IDEMPIERE-2706 bug fix when create record from quick entry with default value (#1924)
This commit is contained in:
parent
9f55c76573
commit
e477dad1c0
|
@ -399,15 +399,7 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
|
||||||
log.config("");
|
log.config("");
|
||||||
boolean anyChange = false;
|
boolean anyChange = false;
|
||||||
for (int idxf = 0; idxf < quickEditors.size(); idxf++) {
|
for (int idxf = 0; idxf < quickEditors.size(); idxf++) {
|
||||||
WEditor editor = quickEditors.get(idxf);
|
if (isChanged(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 (changed) {
|
|
||||||
anyChange = true;
|
anyChange = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -444,11 +436,7 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
|
||||||
|
|
||||||
WEditor editor = quickEditors.get(idxf);
|
WEditor editor = quickEditors.get(idxf);
|
||||||
Object value = editor.getValue();
|
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));
|
|
||||||
boolean thisMandatoryError = false;
|
boolean thisMandatoryError = false;
|
||||||
if (field.isMandatory(true)) {
|
if (field.isMandatory(true)) {
|
||||||
if (value == null || value.toString().length() == 0) {
|
if (value == null || value.toString().length() == 0) {
|
||||||
|
@ -461,7 +449,7 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
|
||||||
}
|
}
|
||||||
|
|
||||||
po.set_ValueOfColumn(field.getColumnName(), value);
|
po.set_ValueOfColumn(field.getColumnName(), value);
|
||||||
if (changed && ! thisMandatoryError) {
|
if (isChanged(idxf) && ! thisMandatoryError) {
|
||||||
savePO = true;
|
savePO = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -502,6 +490,22 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
|
||||||
return true;
|
return true;
|
||||||
} // actionSave
|
} // actionSave
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param index of field
|
||||||
|
* @return true if changed
|
||||||
|
*/
|
||||||
|
private boolean isChanged(int index)
|
||||||
|
{
|
||||||
|
WEditor editor = quickEditors.get(index);
|
||||||
|
Object value = editor.getValue();
|
||||||
|
Object initialValue = initialValues.get(index);
|
||||||
|
|
||||||
|
return (value != null && initialValue == null)
|
||||||
|
|| (value == null && initialValue != null)
|
||||||
|
|| (value != null && initialValue != null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns Record_ID
|
* Returns Record_ID
|
||||||
* @return Record_ID (0 = not saved)
|
* @return Record_ID (0 = not saved)
|
||||||
|
|
Loading…
Reference in New Issue