IDEMPIERE-2319 Adding date value type support in Attribute set / peer review

This commit is contained in:
Carlos Ruiz 2018-09-11 15:45:59 +02:00
parent 9a0b9fb317
commit 49016d35ed
3 changed files with 29 additions and 18 deletions

View File

@ -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 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
; ;

View File

@ -174,6 +174,10 @@ public class MAttributeInstance extends X_M_AttributeInstance
new MAttribute(getCtx(), getM_Attribute_ID(), get_TrxName()).getDateFormat()); new MAttribute(getCtx(), getM_Attribute_ID(), get_TrxName()).getDateFormat());
setValue(sdf.format(valueDate)); setValue(sdf.format(valueDate));
} }
else
{
setValue(null);
}
} }
/** /**

View File

@ -642,9 +642,7 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
if(instance != null) if(instance != null)
editor.setValue(instance.getValueDate()); editor.setValue(instance.getValueDate());
else else
editor.setValue(Env.getContextAsDate(Env.getCtx(), "#Date")); editor.setValue(null);
} }
private void setListAttribute(MAttribute attribute, Listbox editor) { private void setListAttribute(MAttribute attribute, Listbox editor) {
@ -988,13 +986,17 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
{ {
return true; 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); m_masi.set_TrxName(trxName);
as.set_TrxName(trxName); as.set_TrxName(trxName);
// //
m_changed = false; m_changed = false;
String mandatory = "";
if (!m_productWindow && as.isLot()) if (!m_productWindow && as.isLot())
{ {
if (log.isLoggable(Level.FINE)) log.fine("Lot=" + fieldLotString.getText ()); if (log.isLoggable(Level.FINE)) log.fine("Lot=" + fieldLotString.getText ());
@ -1084,18 +1086,6 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
} // for all attributes } // for all attributes
m_M_AttributeSetInstance_ID = m_masi.getM_AttributeSetInstance_ID (); m_M_AttributeSetInstance_ID = m_masi.getM_AttributeSetInstance_ID ();
m_M_AttributeSetInstanceName = m_masi.getDescription(); 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) if (mandatory.length() > 0)
{ {
@ -1108,6 +1098,23 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
m_masi.setDescription (); m_masi.setDescription ();
m_masi.saveEx(); 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; return true;
} // saveSelection } // saveSelection