From f4c50410dc21de04f9ed0759ce29767ad41cc420 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 12 Jun 2013 18:06:37 -0500 Subject: [PATCH] IDEMPIERE-974 Issue with Quick Entry editor when a checkbox is added and a new record is created / peer review --- .../src/org/compiere/model/GridField.java | 2 +- .../org/adempiere/webui/grid/WQuickEntry.java | 26 ++++++++----------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/GridField.java b/org.adempiere.base/src/org/compiere/model/GridField.java index b4b281a41e..0795655642 100644 --- a/org.adempiere.base/src/org/compiere/model/GridField.java +++ b/org.adempiere.base/src/org/compiere/model/GridField.java @@ -348,7 +348,7 @@ public class GridField return false; // Numeric Keys and Created/Updated as well as - // DocumentNo/Value/ASI ars not mandatory (persistency layer manages them) + // DocumentNo/Value/ASI are not mandatory (persistence layer manages them) if (m_gridTab != null && // if gridtab doesn't exist then it's not a window field (probably a process parameter field) ( (m_vo.IsKey && m_vo.ColumnName.endsWith("_ID")) || m_vo.ColumnName.startsWith("Created") || m_vo.ColumnName.startsWith("Updated") 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 7e3cad6941..0017192e8b 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,10 +298,8 @@ 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++) { - editor = quickEditors.get(idxf); + WEditor editor = quickEditors.get(idxf); Object value = editor.getValue(); Object initialValue = initialValues.get(idxf); @@ -327,7 +325,7 @@ public class WQuickEntry extends Window implements EventListener, ValueCh int parentID = 0; String parentColumn = null; String tabZeroName=null; - boolean isParentSave=false; + boolean isParentSave = (getRecord_ID() > 0); for (int idxt = 0; idxt < quickTabs.size(); idxt++) { GridTab gridtab = quickTabs.get(idxt); PO po = quickPOs.get(idxt); @@ -344,20 +342,13 @@ public class WQuickEntry extends Window implements EventListener, ValueCh if (field.getGridTab() != gridtab) continue; - editor = quickEditors.get(idxf); + WEditor 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) { @@ -387,14 +378,19 @@ public class WQuickEntry extends Window implements EventListener, ValueCh } if(gridtab.getTabLevel()>0 && !isParentSave){ FDialog.error(m_WindowNo, this, "FillMinimumInfo",tabZeroName); - return false; + return false; } po.saveEx(); if(gridtab.getTabLevel()==0){ isParentSave=true; } - for(WEditor we:specialQuickEditors){ - if(po.get_Value(we.getColumnName())!=null){ + for (int idxf = 0; idxf < quickFields.size(); idxf++) { + GridField field = quickFields.get(idxf); + if (field.getGridTab() != gridtab) + continue; + + WEditor we = quickEditors.get(idxf); + if (po.get_Value(we.getColumnName()) != null) { we.setValue(po.get_Value(we.getColumnName())); } }