# HG changeset patch # User Antonio Moreno # Date 1329390682 -3600 # Node ID 459c8c6700f5df8b4cc1385f5c854f7303c297fe # Parent eb48f353d1d3ee2df696d828b9cf0553d672446f Fixed issue 13438. Now the import of reference data and translations can be forced with -DforceRefData=true diff -r eb48f353d1d3 -r 459c8c6700f5 build.xml --- a/build.xml Thu Feb 16 10:46:50 2012 +0100 +++ b/build.xml Thu Feb 16 12:11:22 2012 +0100 @@ -777,7 +777,7 @@ - + @@ -794,7 +794,7 @@ --> - + diff -r eb48f353d1d3 -r 459c8c6700f5 src/org/openbravo/erpCommon/modules/ApplyModule.java --- a/src/org/openbravo/erpCommon/modules/ApplyModule.java Thu Feb 16 10:46:50 2012 +0100 +++ b/src/org/openbravo/erpCommon/modules/ApplyModule.java Thu Feb 16 12:11:22 2012 +0100 @@ -54,6 +54,7 @@ private static ConnectionProvider pool; static Logger log4j = Logger.getLogger(ApplyModule.class); private String obDir; + private boolean forceRefData = false; public ApplyModule(ConnectionProvider cp, String dir) { pool = cp; @@ -62,6 +63,14 @@ log4j = Logger.getLogger(ApplyModule.class); } + public ApplyModule(ConnectionProvider cp, String dir, boolean forceRefData) { + pool = cp; + obDir = dir; + PropertyConfigurator.configure(obDir + "/src/log4j.lcf"); + log4j = Logger.getLogger(ApplyModule.class); + this.forceRefData = forceRefData; + } + /** * Process the Installed but not applied modules, the treatement for these modules is: Translation * modules In case the module contains translations the process will:
@@ -84,7 +93,12 @@ // **************** Translation modules ************************ // Check whether modules to install are translations log4j.info("Looking for translation modules"); - final ApplyModuleData[] data = ApplyModuleData.selectTranslationModules(pool); + final ApplyModuleData[] data; + if (!forceRefData) { + data = ApplyModuleData.selectTranslationModules(pool); + } else { + data = ApplyModuleData.selectAllTranslationModules(pool); + } if (data != null && data.length > 0) { log4j.info(data.length + " translation modules found"); @@ -123,7 +137,12 @@ log4j.info("Looking for reference data modules"); - final ApplyModuleData[] ds = ApplyModuleData.selectClientReferenceModules(pool); + final ApplyModuleData[] ds; + if (!forceRefData) { + ds = ApplyModuleData.selectClientReferenceModules(pool); + } else { + ds = ApplyModuleData.selectAllClientReferenceModules(pool); + } if (ds != null && ds.length > 0) { ModuleUtility.orderModuleByDependency(ds); diff -r eb48f353d1d3 -r 459c8c6700f5 src/org/openbravo/erpCommon/modules/ApplyModuleTask.java --- a/src/org/openbravo/erpCommon/modules/ApplyModuleTask.java Thu Feb 16 10:46:50 2012 +0100 +++ b/src/org/openbravo/erpCommon/modules/ApplyModuleTask.java Thu Feb 16 12:11:22 2012 +0100 @@ -37,18 +37,22 @@ // private String propertiesFile; private String obDir; private static final Logger log4j = Logger.getLogger(ApplyModuleTask.class); + private Boolean forceRefData = false; public static void main(String[] args) { + Boolean lforceRefData = false; final String srcPath = args[0]; String friendlyWarnings = "false"; if (args.length >= 2) { friendlyWarnings = args[1]; + lforceRefData = args[2].equalsIgnoreCase("true") || args[2].equalsIgnoreCase("yes"); } final File srcDir = new File(srcPath); final File baseDir = srcDir.getParentFile(); try { final AntExecutor antExecutor = new AntExecutor(baseDir.getAbsolutePath()); antExecutor.setProperty("friendlyWarnings", friendlyWarnings); + antExecutor.setProperty("forceRefData", lforceRefData.toString()); antExecutor.runTask("apply.module.forked"); } catch (final Exception e) { throw new OBException(e); @@ -65,7 +69,11 @@ CPStandAlone pool = new CPStandAlone(propertiesFile); ApplyModuleData[] ds = null; try { - ds = ApplyModuleData.selectClientReferenceModules(pool); + if (!forceRefData) { + ds = ApplyModuleData.selectClientReferenceModules(pool); + } else { + ds = ApplyModuleData.selectAllClientReferenceModules(pool); + } } catch (Exception e) { log4j.error("Error checking modules with reference data", e); } @@ -74,7 +82,11 @@ super.execute(); } else { try { - ds = ApplyModuleData.selectTranslationModules(pool); + if (!forceRefData) { + ds = ApplyModuleData.selectTranslationModules(pool); + } else { + ds = ApplyModuleData.selectAllTranslationModules(pool); + } } catch (Exception e) { log4j.error("Error checking modules with translation data", e); } @@ -101,7 +113,7 @@ obDir = getProject().getBaseDir().toString(); if (propertiesFile == null || propertiesFile.equals("")) propertiesFile = obDir + "/config/Openbravo.properties"; - final ApplyModule am = new ApplyModule(new CPStandAlone(propertiesFile), obDir); + final ApplyModule am = new ApplyModule(new CPStandAlone(propertiesFile), obDir, forceRefData); am.execute(); } catch (final Exception e) { throw new BuildException(e); @@ -114,4 +126,8 @@ public void setObDir(String obDir) { this.obDir = obDir; } + + public void setForceRefData(boolean forceRefData) { + this.forceRefData = forceRefData; + } } diff -r eb48f353d1d3 -r 459c8c6700f5 src/org/openbravo/erpCommon/modules/ApplyModule_data.xsql --- a/src/org/openbravo/erpCommon/modules/ApplyModule_data.xsql Thu Feb 16 10:46:50 2012 +0100 +++ b/src/org/openbravo/erpCommon/modules/ApplyModule_data.xsql Thu Feb 16 12:11:22 2012 +0100 @@ -31,6 +31,16 @@ AND ISTRANSLATIONMODULE = 'Y' ]]> + + + + + @@ -45,6 +55,18 @@ ]]> + + + + + +