diff --git a/migration/i5.1z/oracle/201411190748_IDEMPIERE-2319.sql b/migration/i5.1z/oracle/201411190748_IDEMPIERE-2319.sql index 5f11966a8c..0fc7fde97f 100644 --- a/migration/i5.1z/oracle/201411190748_IDEMPIERE-2319.sql +++ b/migration/i5.1z/oracle/201411190748_IDEMPIERE-2319.sql @@ -38,5 +38,5 @@ INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,S UPDATE AD_Field SET DisplayLogic='@AttributeValueType@=''D''', MandatoryLogic='@AttributeValueType@=''D''',Updated=TO_DATE('2014-11-18 15:43:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203472 ; -SELECT register_migration_script('201411140854_IDEMPIERE-2315.sql') FROM dual +SELECT register_migration_script('201411190748_IDEMPIERE-2319.sql') FROM dual ; diff --git a/org.adempiere.base/src/org/compiere/model/MAttributeInstance.java b/org.adempiere.base/src/org/compiere/model/MAttributeInstance.java index 9b3298d605..73b24e8e96 100644 --- a/org.adempiere.base/src/org/compiere/model/MAttributeInstance.java +++ b/org.adempiere.base/src/org/compiere/model/MAttributeInstance.java @@ -174,6 +174,10 @@ public class MAttributeInstance extends X_M_AttributeInstance new MAttribute(getCtx(), getM_Attribute_ID(), get_TrxName()).getDateFormat()); setValue(sdf.format(valueDate)); } + else + { + setValue(null); + } } /** diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeDialog.java index 2c89f0a874..eeb220be64 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeDialog.java @@ -642,9 +642,7 @@ public class WPAttributeDialog extends Window implements EventListener if(instance != null) editor.setValue(instance.getValueDate()); else - editor.setValue(Env.getContextAsDate(Env.getCtx(), "#Date")); - - + editor.setValue(null); } private void setListAttribute(MAttribute attribute, Listbox editor) { @@ -988,13 +986,17 @@ public class WPAttributeDialog extends Window implements EventListener { return true; } - String trxName = Trx.createTrxName("WPAttributeDialog_SaveSelection"); + Trx trx = null; + String mandatory = ""; + try { + String trxName = Trx.createTrxName("WPAD"); + trx = Trx.get(trxName, false); + trx.setDisplayName(getClass().getName()+"_saveSelection"); m_masi.set_TrxName(trxName); as.set_TrxName(trxName); // m_changed = false; - String mandatory = ""; if (!m_productWindow && as.isLot()) { if (log.isLoggable(Level.FINE)) log.fine("Lot=" + fieldLotString.getText ()); @@ -1084,18 +1086,6 @@ public class WPAttributeDialog extends Window implements EventListener } // for all attributes m_M_AttributeSetInstance_ID = m_masi.getM_AttributeSetInstance_ID (); m_M_AttributeSetInstanceName = m_masi.getDescription(); - - if (!m_changed || mandatory.length() > 0) - { - // Rollback - Trx.get(trxName, false).rollback(); - } - else - { - // Commit - Trx.get(trxName, false).commit(); - } - Trx.get(trxName, false).close(); // if (mandatory.length() > 0) { @@ -1108,6 +1098,23 @@ public class WPAttributeDialog extends Window implements EventListener m_masi.setDescription (); m_masi.saveEx(); } + } + finally { + if (trx != null) { + if (!m_changed || mandatory.length() > 0) + { + // Rollback + trx.rollback(); + } + else + { + // Commit + trx.commit(); + } + trx.close(); + trx = null; + } + } return true; } // saveSelection