From 210bb251c434a3d1cfa1e60224cb0e290eec604a Mon Sep 17 00:00:00 2001 From: Carlos Augusto Sanchez Date: Wed, 12 Jun 2013 17:30:28 -0500 Subject: [PATCH] IDEMPIERE-974 Issue with Quick Entry editor when a checkbox is added and a new record is created --- .../oracle/20130612122145_IDEMPIERE-974.sql | 12 ++++++++ .../20130612122145_IDEMPIERE-974.sql | 13 ++++++++ .../org/adempiere/webui/grid/WQuickEntry.java | 30 ++++++++++++++++--- 3 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 migration/i1.0b-release/oracle/20130612122145_IDEMPIERE-974.sql create mode 100644 migration/i1.0b-release/postgresql/20130612122145_IDEMPIERE-974.sql diff --git a/migration/i1.0b-release/oracle/20130612122145_IDEMPIERE-974.sql b/migration/i1.0b-release/oracle/20130612122145_IDEMPIERE-974.sql new file mode 100644 index 0000000000..14addc1020 --- /dev/null +++ b/migration/i1.0b-release/oracle/20130612122145_IDEMPIERE-974.sql @@ -0,0 +1,12 @@ +-- Jun 12, 2013 12:21:45 PM COT +-- IDEMPIERE-974 Issue with Quick Entry editor when a checkbox is added and a new record is created +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('I','Fill Minimum Information of:',200180,'D','03c360e6-3cdb-4058-818f-260e3aeff485','FillMinimumlInfo','Y',TO_DATE('2013-06-12 12:21:42','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_DATE('2013-06-12 12:21:42','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jun 12, 2013 12:21:45 PM COT +-- IDEMPIERE-974 Issue with Quick Entry editor when a checkbox is added and a new record is created +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200180 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +SELECT register_migration_script('20130612122145_IDEMPIERE-974.sql') FROM dual +; diff --git a/migration/i1.0b-release/postgresql/20130612122145_IDEMPIERE-974.sql b/migration/i1.0b-release/postgresql/20130612122145_IDEMPIERE-974.sql new file mode 100644 index 0000000000..1f08c4a2fd --- /dev/null +++ b/migration/i1.0b-release/postgresql/20130612122145_IDEMPIERE-974.sql @@ -0,0 +1,13 @@ +-- Jun 12, 2013 12:21:45 PM COT +-- IDEMPIERE-974 Issue with Quick Entry editor when a checkbox is added and a new record is created +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('I','Fill Minimum Information of:',200180,'D','03c360e6-3cdb-4058-818f-260e3aeff485','FillMinimumlInfo','Y',TO_TIMESTAMP('2013-06-12 12:21:42','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_TIMESTAMP('2013-06-12 12:21:42','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jun 12, 2013 12:21:45 PM COT +-- IDEMPIERE-974 Issue with Quick Entry editor when a checkbox is added and a new record is created +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200180 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +SELECT register_migration_script('20130612122145_IDEMPIERE-974.sql') FROM dual +; + diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java index 3d2ad55fd4..7e3cad6941 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java @@ -298,8 +298,10 @@ public class WQuickEntry extends Window implements EventListener, ValueCh { log.config(""); boolean anyChange = false; + List specialQuickEditors = new ArrayList(); + WEditor editor=null; for (int idxf = 0; idxf < quickEditors.size(); idxf++) { - WEditor editor = quickEditors.get(idxf); + editor = quickEditors.get(idxf); Object value = editor.getValue(); Object initialValue = initialValues.get(idxf); @@ -324,11 +326,14 @@ public class WQuickEntry extends Window implements EventListener, ValueCh int parentID = 0; String parentColumn = null; + String tabZeroName=null; + boolean isParentSave=false; for (int idxt = 0; idxt < quickTabs.size(); idxt++) { GridTab gridtab = quickTabs.get(idxt); PO po = quickPOs.get(idxt); if (idxt == 0) { parentColumn = gridtab.getTableName() + "_ID"; + tabZeroName=gridtab.getName(); } boolean savePO = false; @@ -339,14 +344,20 @@ public class WQuickEntry extends Window implements EventListener, ValueCh if (field.getGridTab() != gridtab) continue; - WEditor editor = quickEditors.get(idxf); + editor = quickEditors.get(idxf); Object value = editor.getValue(); Object initialValue = initialValues.get(idxf); boolean changed = (value != null && initialValue == null) || (value == null && initialValue != null) || (value != null && initialValue != null && !value.equals(initialValue)); - + if(field.getColumnName().equals("Value") + ||field.getColumnName().equals("DocumentNo") + ||field.getColumnName().equals("M_AttributeSetInstance_ID")){ + if(!specialQuickEditors.contains(field)){ + specialQuickEditors.add(editor); + } + } boolean thisMandatoryError = false; if (field.isMandatory(true)) { if (value == null || value.toString().length() == 0) { @@ -374,8 +385,19 @@ public class WQuickEntry extends Window implements EventListener, ValueCh po.set_ValueOfColumn(parentColumn, parentID); } } - + if(gridtab.getTabLevel()>0 && !isParentSave){ + FDialog.error(m_WindowNo, this, "FillMinimumInfo",tabZeroName); + return false; + } po.saveEx(); + if(gridtab.getTabLevel()==0){ + isParentSave=true; + } + for(WEditor we:specialQuickEditors){ + if(po.get_Value(we.getColumnName())!=null){ + we.setValue(po.get_Value(we.getColumnName())); + } + } } if (idxt == 0) { parentID = po.get_ID();