diff --git a/migration/iD11/oracle/202405131534_IDEMPIERE-6040.sql b/migration/iD11/oracle/202405131534_IDEMPIERE-6040.sql new file mode 100644 index 0000000000..57a9109402 --- /dev/null +++ b/migration/iD11/oracle/202405131534_IDEMPIERE-6040.sql @@ -0,0 +1,25 @@ +-- IDEMPIERE-6040 Improvements for CSV import template +SELECT register_migration_script('202405131534_IDEMPIERE-6040.sql') FROM dual; + +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- May 13, 2024, 3:34:49 PM CEST +UPDATE AD_Ref_List SET Name='Comma-separated values (CSV)',Updated=TO_TIMESTAMP('2024-05-13 15:34:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200704 +; + +-- May 13, 2024, 3:35:58 PM CEST +UPDATE AD_Ref_List SET Name='Excel (XLS/XLSX)',Updated=TO_TIMESTAMP('2024-05-13 15:35:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200706 +; + +-- May 13, 2024, 3:36:02 PM CEST +UPDATE AD_Ref_List SET IsActive='N',Updated=TO_TIMESTAMP('2024-05-13 15:36:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200705 +; + +UPDATE AD_ImportTemplate SET ImportTemplateType='XLSX' WHERE ImportTemplateType='XLS' +; + +-- May 13, 2024, 3:59:49 PM CEST +UPDATE AD_Field SET SeqNo=120, ColumnSpan=2,Updated=TO_TIMESTAMP('2024-05-13 15:59:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=208476 +; + diff --git a/migration/iD11/postgresql/202405131534_IDEMPIERE-6040.sql b/migration/iD11/postgresql/202405131534_IDEMPIERE-6040.sql new file mode 100644 index 0000000000..962d64dfb4 --- /dev/null +++ b/migration/iD11/postgresql/202405131534_IDEMPIERE-6040.sql @@ -0,0 +1,22 @@ +-- IDEMPIERE-6040 Improvements for CSV import template +SELECT register_migration_script('202405131534_IDEMPIERE-6040.sql') FROM dual; + +-- May 13, 2024, 3:34:49 PM CEST +UPDATE AD_Ref_List SET Name='Comma-separated values (CSV)',Updated=TO_TIMESTAMP('2024-05-13 15:34:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200704 +; + +-- May 13, 2024, 3:35:58 PM CEST +UPDATE AD_Ref_List SET Name='Excel (XLS/XLSX)',Updated=TO_TIMESTAMP('2024-05-13 15:35:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200706 +; + +-- May 13, 2024, 3:36:02 PM CEST +UPDATE AD_Ref_List SET IsActive='N',Updated=TO_TIMESTAMP('2024-05-13 15:36:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=200705 +; + +UPDATE AD_ImportTemplate SET ImportTemplateType='XLSX' WHERE ImportTemplateType='XLS' +; + +-- May 13, 2024, 3:59:49 PM CEST +UPDATE AD_Field SET SeqNo=120, ColumnSpan=2,Updated=TO_TIMESTAMP('2024-05-13 15:59:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=208476 +; + diff --git a/org.adempiere.base-feature/feature.xml b/org.adempiere.base-feature/feature.xml index 839e7dd653..ad1ffdab44 100644 --- a/org.adempiere.base-feature/feature.xml +++ b/org.adempiere.base-feature/feature.xml @@ -273,6 +273,10 @@ id="org.apache.commons.commons-compress" version="0.0.0"/> + + diff --git a/org.adempiere.base-feature/model.generator.launch b/org.adempiere.base-feature/model.generator.launch index 0ddcb8cdd0..6c4e31f52e 100644 --- a/org.adempiere.base-feature/model.generator.launch +++ b/org.adempiere.base-feature/model.generator.launch @@ -60,6 +60,7 @@ + diff --git a/org.adempiere.base-feature/packinfolder.app.launch b/org.adempiere.base-feature/packinfolder.app.launch index 3a3c509882..e04ab163ee 100644 --- a/org.adempiere.base-feature/packinfolder.app.launch +++ b/org.adempiere.base-feature/packinfolder.app.launch @@ -68,6 +68,7 @@ + diff --git a/org.adempiere.base-feature/sign.database.build.launch b/org.adempiere.base-feature/sign.database.build.launch index e84c656caf..b3efd9a7a6 100644 --- a/org.adempiere.base-feature/sign.database.build.launch +++ b/org.adempiere.base-feature/sign.database.build.launch @@ -69,6 +69,7 @@ + diff --git a/org.adempiere.base-feature/synchronize-terminology.app.launch b/org.adempiere.base-feature/synchronize-terminology.app.launch index bf30922042..d907243845 100644 --- a/org.adempiere.base-feature/synchronize-terminology.app.launch +++ b/org.adempiere.base-feature/synchronize-terminology.app.launch @@ -69,6 +69,7 @@ + diff --git a/org.adempiere.base-feature/translation.app.launch b/org.adempiere.base-feature/translation.app.launch index e7d3cc10d8..e42b430b8b 100644 --- a/org.adempiere.base-feature/translation.app.launch +++ b/org.adempiere.base-feature/translation.app.launch @@ -69,6 +69,7 @@ + diff --git a/org.adempiere.base/src/org/adempiere/base/BaseActivator.java b/org.adempiere.base/src/org/adempiere/base/BaseActivator.java index d042c7c473..c10fc3534a 100644 --- a/org.adempiere.base/src/org/adempiere/base/BaseActivator.java +++ b/org.adempiere.base/src/org/adempiere/base/BaseActivator.java @@ -28,6 +28,14 @@ import java.util.Map; import java.util.Properties; import org.adempiere.base.equinox.StackTraceCommand; +import org.apache.poi.extractor.ExtractorFactory; +import org.apache.poi.extractor.MainExtractorFactory; +import org.apache.poi.hssf.usermodel.HSSFWorkbookFactory; +import org.apache.poi.ooxml.extractor.POIXMLExtractorFactory; +import org.apache.poi.sl.usermodel.SlideShowFactory; +import org.apache.poi.ss.usermodel.WorkbookFactory; +import org.apache.poi.xssf.usermodel.XSSFWorkbookFactory; +import org.apache.poi.xslf.usermodel.XSLFSlideShowFactory; import org.compiere.Adempiere; import org.eclipse.osgi.framework.console.CommandProvider; import org.osgi.framework.BundleActivator; @@ -61,6 +69,13 @@ public class BaseActivator implements BundleActivator { context.registerService(CommandProvider.class.getName(), new StackTraceCommand(), null); blacklistService = new ComponentBlackListService(context); + + //setup poi factory + WorkbookFactory.addProvider(new HSSFWorkbookFactory()); + WorkbookFactory.addProvider(new XSSFWorkbookFactory()); + SlideShowFactory.addProvider(new XSLFSlideShowFactory()); + ExtractorFactory.addProvider(new POIXMLExtractorFactory()); + ExtractorFactory.addProvider(new MainExtractorFactory()); } /* @@ -120,6 +135,14 @@ public class BaseActivator implements BundleActivator { blacklistService.stop(context); blacklistService = null; } + + //remove poi factory + WorkbookFactory.removeProvider(HSSFWorkbookFactory.class); + WorkbookFactory.removeProvider(XSSFWorkbookFactory.class); + SlideShowFactory.removeProvider(XSLFSlideShowFactory.class); + ExtractorFactory.removeProvider(POIXMLExtractorFactory.class); + ExtractorFactory.removeProvider(MainExtractorFactory.class); + Adempiere.stop(); } diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_ImportTemplate.java b/org.adempiere.base/src/org/compiere/model/I_AD_ImportTemplate.java index daa56bd6f7..54420f4dc5 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_ImportTemplate.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_ImportTemplate.java @@ -22,7 +22,7 @@ import org.compiere.util.KeyNamePair; /** Generated Interface for AD_ImportTemplate * @author iDempiere (generated) - * @version Release 11 + * @version Release 12 */ public interface I_AD_ImportTemplate { diff --git a/org.adempiere.base/src/org/compiere/model/MImportTemplate.java b/org.adempiere.base/src/org/compiere/model/MImportTemplate.java index d0579c5f4a..bb19a22df1 100644 --- a/org.adempiere.base/src/org/compiere/model/MImportTemplate.java +++ b/org.adempiere.base/src/org/compiere/model/MImportTemplate.java @@ -34,13 +34,12 @@ import java.util.Properties; import java.util.logging.Level; import org.adempiere.exceptions.AdempiereException; -import org.apache.poi.hssf.usermodel.HSSFWorkbookFactory; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.xssf.usermodel.XSSFWorkbookFactory; +import org.apache.poi.ss.usermodel.WorkbookFactory; import org.compiere.util.CCache; import org.compiere.util.CLogger; import org.compiere.util.DB; @@ -238,8 +237,7 @@ public class MImportTemplate extends X_AD_ImportTemplate implements ImmutablePOS */ public InputStream validateFile(InputStream in) { - if ( MImportTemplate.IMPORTTEMPLATETYPE_XLS.equals(getImportTemplateType()) - || MImportTemplate.IMPORTTEMPLATETYPE_XLSX.equals(getImportTemplateType())) { + if (MImportTemplate.IMPORTTEMPLATETYPE_ExcelXLSXLSX.equals(getImportTemplateType())) { try { in = convertExcelToCSV(in); } catch (Exception e) { @@ -308,17 +306,7 @@ public class MImportTemplate extends X_AD_ImportTemplate implements ImmutablePOS */ public InputStream convertExcelToCSV(InputStream excelIs) throws IOException { - Workbook workbook = null; - if (MImportTemplate.IMPORTTEMPLATETYPE_XLS.equals(getImportTemplateType())) { - HSSFWorkbookFactory xlsWbf = new HSSFWorkbookFactory(); - workbook = xlsWbf.create(excelIs); - } else if (MImportTemplate.IMPORTTEMPLATETYPE_XLSX.equals(getImportTemplateType())) { - XSSFWorkbookFactory xlsxWbf = new XSSFWorkbookFactory(); - workbook = xlsxWbf.create(excelIs); - } else { - // unexpected error - throw new AdempiereException("Wrong template type -> " + getImportTemplateType()); - } + Workbook workbook = WorkbookFactory.create(excelIs); List colTypes = calculateAndValidateColumnTypes(); diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_ImportTemplate.java b/org.adempiere.base/src/org/compiere/model/X_AD_ImportTemplate.java index 5cc228ef54..f114b05a72 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_ImportTemplate.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_ImportTemplate.java @@ -23,7 +23,7 @@ import org.compiere.util.KeyNamePair; /** Generated Model for AD_ImportTemplate * @author iDempiere (generated) - * @version Release 11 - $Id$ */ + * @version Release 12 - $Id$ */ @org.adempiere.base.Model(table="AD_ImportTemplate") public class X_AD_ImportTemplate extends PO implements I_AD_ImportTemplate, I_Persistent { @@ -31,7 +31,7 @@ public class X_AD_ImportTemplate extends PO implements I_AD_ImportTemplate, I_Pe /** * */ - private static final long serialVersionUID = 20240327L; + private static final long serialVersionUID = 20240513L; /** Standard Constructor */ public X_AD_ImportTemplate (Properties ctx, int AD_ImportTemplate_ID, String trxName) @@ -300,12 +300,12 @@ public class X_AD_ImportTemplate extends PO implements I_AD_ImportTemplate, I_Pe /** ImportTemplateType AD_Reference_ID=200268 */ public static final int IMPORTTEMPLATETYPE_AD_Reference_ID=200268; - /** CSV = CSV */ - public static final String IMPORTTEMPLATETYPE_CSV = "CSV"; + /** Comma-separated values (CSV) = CSV */ + public static final String IMPORTTEMPLATETYPE_Comma_SeparatedValuesCSV = "CSV"; /** XLS = XLS */ public static final String IMPORTTEMPLATETYPE_XLS = "XLS"; - /** XLSX = XLSX */ - public static final String IMPORTTEMPLATETYPE_XLSX = "XLSX"; + /** Excel (XLS/XLSX) = XLSX */ + public static final String IMPORTTEMPLATETYPE_ExcelXLSXLSX = "XLSX"; /** Set Import Template Type. @param ImportTemplateType Import Template Type */ diff --git a/org.adempiere.install/install.app.launch b/org.adempiere.install/install.app.launch index f3dd7b73b3..cf69899ccc 100644 --- a/org.adempiere.install/install.app.launch +++ b/org.adempiere.install/install.app.launch @@ -58,6 +58,7 @@ + diff --git a/org.adempiere.install/install.console.app.launch b/org.adempiere.install/install.console.app.launch index 1527c6d139..4e6ab62e21 100644 --- a/org.adempiere.install/install.console.app.launch +++ b/org.adempiere.install/install.console.app.launch @@ -58,6 +58,7 @@ + diff --git a/org.adempiere.install/install.silent.app.launch b/org.adempiere.install/install.silent.app.launch index cad6279072..d8435d2c56 100644 --- a/org.adempiere.install/install.silent.app.launch +++ b/org.adempiere.install/install.silent.app.launch @@ -58,6 +58,7 @@ + diff --git a/org.adempiere.server-feature/setup/configuration/config.ini b/org.adempiere.server-feature/setup/configuration/config.ini index 9dfa2bb61a..15ed10c22c 100644 --- a/org.adempiere.server-feature/setup/configuration/config.ini +++ b/org.adempiere.server-feature/setup/configuration/config.ini @@ -30,6 +30,7 @@ osgi.bundles=org.apache.felix.scr@1:start,\ wrapped.org.apache.poi.poi-ooxml,\ wrapped.org.apache.poi.poi-ooxml-lite,\ org.apache.commons.commons-compress,\ + org.apache.commons.commons-io,\ wrapped.org.apache.xmlbeans.xmlbeans,\ org.eclipse.core.jobs,\ org.eclipse.equinox.preferences,\ diff --git a/org.idempiere.test/pom.xml b/org.idempiere.test/pom.xml index 40f3818142..c447127b41 100644 --- a/org.idempiere.test/pom.xml +++ b/org.idempiere.test/pom.xml @@ -126,9 +126,14 @@ eclipse-plugin - org.idempiere.tablepartition - 0.0.0 - + org.idempiere.tablepartition + 0.0.0 + + + eclipse-plugin + wrapped.org.apache.xmlbeans.xmlbeans + 0.0.0 +