IDEMPIERE-481 Order field cleared at Shipment window. Add control to avoid clearing of lookup field value that just have been set. Fixed shipment callout always modify the IsSoTrx field's value due to wrong datatype comparision ( comparing 'Y'/'N' with boolean true/false ).

This commit is contained in:
Heng Sin Low 2013-07-22 20:13:00 +08:00
parent 0f04122f5b
commit 0cead2d7f9
5 changed files with 86 additions and 36 deletions

View File

@ -193,7 +193,17 @@ public class CalloutInOut extends CalloutEngine
String DocBaseType = rs.getString("DocBaseType"); String DocBaseType = rs.getString("DocBaseType");
// BF [2708789] Read IsSOTrx from C_DocType // BF [2708789] Read IsSOTrx from C_DocType
String trxFlag = rs.getString("IsSOTrx"); String trxFlag = rs.getString("IsSOTrx");
if (!(trxFlag.equals(mTab.getValue("IsSOTrx")))) Object isSOTrxValue = mTab.getValue("IsSOTrx");
String isSOTrxValueStr = null;
if (isSOTrxValue != null)
{
if (isSOTrxValue instanceof Boolean)
isSOTrxValueStr = (Boolean)isSOTrxValue ? "Y" : "N";
else
isSOTrxValueStr = (String)isSOTrxValue;
}
if (!(trxFlag.equals(isSOTrxValueStr)))
mTab.setValue("IsSOTrx", trxFlag); mTab.setValue("IsSOTrx", trxFlag);
if (DocBaseType.equals("MMS")) // Material Shipments if (DocBaseType.equals("MMS")) // Material Shipments
/**solve 1648131 bug vpj-cd e-evolution */ /**solve 1648131 bug vpj-cd e-evolution */

View File

@ -102,6 +102,12 @@ public class GridField
private GridTab m_gridTab; private GridTab m_gridTab;
/**
* Use by lookup editor to indicate setting of new value is in progress.
* GridTab.processDependentFields will check this flag to avoid clearing of lookup field value that just have been set.
**/
private boolean m_lookupEditorSettingValue = false;
/** /**
* Dispose * Dispose
*/ */
@ -2052,4 +2058,20 @@ public class GridField
} }
/**
* @param b
*/
public void setLookupEditorSettingValue(boolean b)
{
m_lookupEditorSettingValue = b;
}
/**
* @return true if the setting value of this field by UI is in progress
*/
public boolean isLookupEditorSettingValue()
{
return m_lookupEditorSettingValue;
}
} // GridField } // GridField

View File

@ -2676,8 +2676,10 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
// Get dependent MFields (may be because of display or dynamic lookup) // Get dependent MFields (may be because of display or dynamic lookup)
for (GridField dependentField : getDependantFields(columnName)) for (GridField dependentField : getDependantFields(columnName))
{ {
if (dependentField == null || dependentField.isLookupEditorSettingValue()) continue;
// if the field has a lookup // if the field has a lookup
if (dependentField != null && dependentField.getLookup() instanceof MLookup) if (dependentField.getLookup() instanceof MLookup)
{ {
MLookup mLookup = (MLookup)dependentField.getLookup(); MLookup mLookup = (MLookup)dependentField.getLookup();
// if the lookup is dynamic (i.e. contains this columnName as variable) // if the lookup is dynamic (i.e. contains this columnName as variable)

View File

@ -450,33 +450,35 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
if (log.isLoggable(Level.FINE)) if (log.isLoggable(Level.FINE))
log.fine("Value=" + value); log.fine("Value=" + value);
ValueChangeEvent evt = new ValueChangeEvent(this, this.getColumnName(), getValue(), value); try
// -> ADTabpanel - valuechange
fireValueChange(evt);
// is the value updated ?
boolean updated = false;
if (value instanceof Object[] && ((Object[])value).length > 0)
{ {
value = ((Object[])value)[0]; if (gridField != null)
} gridField.setLookupEditorSettingValue(true);
if (value == null && getValue() == null) ValueChangeEvent evt = new ValueChangeEvent(this, this.getColumnName(), getValue(), value);
updated = true; // -> ADTabpanel - valuechange
else if (value != null && value.equals(getValue())) fireValueChange(evt);
updated = true;
if (!updated) // is the value updated ?
{ boolean updated = false;
setValue(value); if (value instanceof Object[] && ((Object[])value).length > 0)
if (gridTab != null && gridField != null) { {
if (value == null && gridField.getValue() != null) { value = ((Object[])value)[0];
gridTab.setValue(gridField, value);
} else if (value != null && gridField.getValue() == null) {
gridTab.setValue(gridField, value);
} else if (value != null && !value.equals(gridField.getValue())) {
gridTab.setValue(gridField, value);
}
} }
if (value == null && getValue() == null)
updated = true;
else if (value != null && value.equals(getValue()))
updated = true;
if (!updated)
{
setValue(value);
}
}
finally
{
if (gridField != null)
gridField.setLookupEditorSettingValue(false);
} }
} // actionCombo } // actionCombo

View File

@ -399,10 +399,17 @@ ContextMenuListener, IZoomableEditor
onselecting = true; onselecting = true;
Object newValue = getValue(); Object newValue = getValue();
if (isValueChange(newValue)) { if (isValueChange(newValue)) {
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue); try {
super.fireValueChange(changeEvent); if (gridField != null)
oldValue = newValue; gridField.setLookupEditorSettingValue(true);
getComponent().setValue(newValue); ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
super.fireValueChange(changeEvent);
oldValue = newValue;
getComponent().setValue(newValue);
} finally {
if (gridField != null)
gridField.setLookupEditorSettingValue(false);
}
} }
} finally { } finally {
onselecting = false; onselecting = false;
@ -422,9 +429,16 @@ ContextMenuListener, IZoomableEditor
{ {
Object newValue = getValue(); Object newValue = getValue();
if (isValueChange(newValue)) { if (isValueChange(newValue)) {
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue); try {
super.fireValueChange(changeEvent); if (gridField != null)
oldValue = newValue; gridField.setLookupEditorSettingValue(true);
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
super.fireValueChange(changeEvent);
oldValue = newValue;
} finally {
if (gridField != null)
gridField.setLookupEditorSettingValue(false);
}
} }
} }
} }