OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Compare Revisions

Ignore whitespace Rev 163 → Rev 164

/trunk/Modules/Module Exchange Rates/src/org/openconcerto/modules/finance/accounting/exchangerates/Module.java
1,7 → 1,6
package org.openconcerto.modules.finance.accounting.exchangerates;
 
import java.awt.GraphicsEnvironment;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.sql.ResultSet;
19,26 → 18,19
 
import org.apache.commons.dbutils.ResultSetHandler;
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.config.Gestion;
import org.openconcerto.erp.core.finance.accounting.model.CurrencyConverter;
import org.openconcerto.erp.modules.AbstractModule;
import org.openconcerto.erp.modules.DBContext;
import org.openconcerto.erp.modules.ModuleFactory;
import org.openconcerto.erp.modules.ModuleManager;
import org.openconcerto.erp.modules.ModulePackager;
import org.openconcerto.erp.modules.ModulePreferencePanel;
import org.openconcerto.erp.modules.ModulePreferencePanelDesc;
import org.openconcerto.erp.modules.ModuleVersion;
import org.openconcerto.erp.modules.RuntimeModuleFactory;
import org.openconcerto.sql.model.DBRoot;
import org.openconcerto.sql.model.SQLBase;
import org.openconcerto.sql.model.SQLRequestLog;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowListRSH;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.ui.ConnexionPanel;
import org.openconcerto.sql.utils.SQLUtils;
import org.openconcerto.utils.PrefType;
 
47,7 → 39,6
public static final String TABLE_EXPENSE = "EXPENSE";
public static final String TABLE_EXPENSE_STATE = "EXPENSE_STATE";
public static final String EXPENSE_RATE_NOT_DOWNLOAD_PREF = "EXPENSE_RATE_NOT_DOWNLOAD_PREF";
public static ModuleVersion MODULE_VERSION = new ModuleVersion(1, 0);
private CurrencyConverter commercialConverter = null;
 
public Module(ModuleFactory f) throws IOException {
66,8 → 57,7
@Override
protected void start() {
final DBRoot root = ComptaPropsConfiguration.getInstanceCompta().getRootSociete();
Boolean b = ModuleManager.getInstance().getFactories().get("org.openconcerto.modules.finance.accounting.exchangerates").get(Module.MODULE_VERSION).getSQLPreferences(root)
.getBoolean(EXPENSE_RATE_NOT_DOWNLOAD_PREF, false);
Boolean b = getFactory().getSQLPreferences(root).getBoolean(EXPENSE_RATE_NOT_DOWNLOAD_PREF, false);
if (!b) {
final Thread t = new Thread() {
public void run() {
138,14 → 128,13
}
 
@Override
public List<ModulePreferencePanelDesc> getPrefDescriptors() {
public List<ModulePreferencePanelDesc> getPrefDescriptors(final DBRoot root) {
return Arrays.<ModulePreferencePanelDesc> asList(new ModulePreferencePanelDesc("Gestion des devises") {
@Override
protected ModulePreferencePanel createPanel() {
return new ModulePreferencePanel("Gestion des devises") {
return new ModulePreferencePanel(root, "Gestion des devises") {
@Override
protected void addViews() {
 
final SQLPrefView<Boolean> view = new SQLPrefView<Boolean>(PrefType.BOOLEAN_TYPE, "Ne pas télécharger les nouveaux taux au lancement du logiciel",
EXPENSE_RATE_NOT_DOWNLOAD_PREF);
this.addView(view);
267,20 → 256,4
protected void stop() {
}
 
public static void main(String[] args) throws IOException {
System.setProperty(ConnexionPanel.QUICK_LOGIN, "true");
final File propsFile = new File("module.properties");
System.out.println(propsFile.getAbsolutePath());
final ModuleFactory factory = new RuntimeModuleFactory(propsFile);
SQLRequestLog.setEnabled(true);
SQLRequestLog.showFrame();
// uncomment to create and use the jar
final ModulePackager modulePackager = new ModulePackager(propsFile, new File("bin/"));
modulePackager.writeToDir(new File("../OpenConcerto/Modules"));
// final ModuleFactory factory = new JarModuleFactory(jar);
ModuleManager.getInstance().addFactories(new File("../OpenConcerto/Modules"));
ModuleManager.getInstance().addFactoryAndStart(factory, false);
Gestion.main(args);
}
 
}