From 291a4df19ec2f5fa8068edf2db3aa6b9f96bdee6 Mon Sep 17 00:00:00 2001 From: Diego Ruiz <12065321+d-ruiz@users.noreply.github.com> Date: Fri, 3 Feb 2023 03:13:33 +0100 Subject: [PATCH] IDEMPIERE-5664 - Improve the message thrown by Import CSV Process when a field does not exist in the tab (#1660) --- migration/iD11/oracle/202302021805_IDEMPIERE-5564.sql | 10 ++++++++++ .../iD11/postgresql/202302021805_IDEMPIERE-5564.sql | 7 +++++++ .../src/org/adempiere/impexp/GridTabCSVImporter.java | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 migration/iD11/oracle/202302021805_IDEMPIERE-5564.sql create mode 100644 migration/iD11/postgresql/202302021805_IDEMPIERE-5564.sql diff --git a/migration/iD11/oracle/202302021805_IDEMPIERE-5564.sql b/migration/iD11/oracle/202302021805_IDEMPIERE-5564.sql new file mode 100644 index 0000000000..71996459da --- /dev/null +++ b/migration/iD11/oracle/202302021805_IDEMPIERE-5564.sql @@ -0,0 +1,10 @@ +-- IDEMPIERE-5564 - Improve the message thrown by Import CSV Process when a field does not exist in the tab +SELECT register_migration_script('202302021805_IDEMPIERE-5564.sql') FROM dual; + +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Feb 2, 2023, 6:05:41 PM CET +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Field {0} not found in tab {1}',0,0,'Y',TO_TIMESTAMP('2023-02-02 18:05:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-02 18:05:40','YYYY-MM-DD HH24:MI:SS'),100,200820,'FieldNotFoundInTab','D','a57c6e74-95bc-4196-9738-9a9b332dca19') +; + diff --git a/migration/iD11/postgresql/202302021805_IDEMPIERE-5564.sql b/migration/iD11/postgresql/202302021805_IDEMPIERE-5564.sql new file mode 100644 index 0000000000..e2cadaa848 --- /dev/null +++ b/migration/iD11/postgresql/202302021805_IDEMPIERE-5564.sql @@ -0,0 +1,7 @@ +-- IDEMPIERE-5564 - Improve the message thrown by Import CSV Process when a field does not exist in the tab +SELECT register_migration_script('202302021805_IDEMPIERE-5564.sql') FROM dual; + +-- Feb 2, 2023, 6:05:41 PM CET +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Field {0} not found in tab {1}',0,0,'Y',TO_TIMESTAMP('2023-02-02 18:05:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-02 18:05:40','YYYY-MM-DD HH24:MI:SS'),100,200820,'FieldNotFoundInTab','D','a57c6e74-95bc-4196-9738-9a9b332dca19') +; + diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java index 47a16e94bb..9ac38aa740 100644 --- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java +++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java @@ -374,7 +374,7 @@ public class GridTabCSVImporter implements IGridTabImporter GridField field = gridTab.getField(columnName); if (field == null) - throwAdempiereException(Msg.getMsg(Env.getCtx(), "FieldNotFound" , new Object[] {columnName}) ); + throwAdempiereException(Msg.getMsg(Env.getCtx(), "FieldNotFoundInTab" , new Object[] {columnName, gridTab.getName()}) ); else if(isKeyColumn && !isThereKey) isThereKey =true; else if (!isThereDocAction &&