IDEMPIERE-843 Negative values are not evaluated in Tab Editor
This commit is contained in:
parent
01a9897cc1
commit
8ec9d58deb
|
@ -0,0 +1,16 @@
|
||||||
|
-- Apr 9, 2013 8:52:09 PM COT
|
||||||
|
-- IDEMPIERE-843 Negative values are not evaluated in Tab Editor
|
||||||
|
UPDATE AD_Column SET ValueMin='1',Updated=TO_DATE('2013-04-09 20:52:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200351
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Apr 9, 2013 8:52:37 PM COT
|
||||||
|
UPDATE AD_Column SET ValueMin='1',Updated=TO_DATE('2013-04-09 20:52:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200352
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Apr 9, 2013 8:53:07 PM COT
|
||||||
|
UPDATE AD_Column SET ValueMin='1',Updated=TO_DATE('2013-04-09 20:53:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200354
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201304092105_IDEMPIERE-843.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
-- Apr 9, 2013 8:52:09 PM COT
|
||||||
|
-- IDEMPIERE-843 Negative values are not evaluated in Tab Editor
|
||||||
|
UPDATE AD_Column SET ValueMin='1',Updated=TO_TIMESTAMP('2013-04-09 20:52:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200351
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Apr 9, 2013 8:52:37 PM COT
|
||||||
|
UPDATE AD_Column SET ValueMin='1',Updated=TO_TIMESTAMP('2013-04-09 20:52:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200352
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Apr 9, 2013 8:53:07 PM COT
|
||||||
|
UPDATE AD_Column SET ValueMin='1',Updated=TO_TIMESTAMP('2013-04-09 20:53:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200354
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201304092105_IDEMPIERE-843.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -102,12 +102,12 @@ import org.w3c.dom.Element;
|
||||||
public abstract class PO
|
public abstract class PO
|
||||||
implements Serializable, Comparator<Object>, Evaluatee, Cloneable
|
implements Serializable, Comparator<Object>, Evaluatee, Cloneable
|
||||||
{
|
{
|
||||||
public static final String LOCAL_TRX_PREFIX = "POSave";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 6604764467216189092L;
|
private static final long serialVersionUID = 8742545079591136114L;
|
||||||
|
|
||||||
|
public static final String LOCAL_TRX_PREFIX = "POSave";
|
||||||
|
|
||||||
private static final String USE_TIMEOUT_FOR_UPDATE = "org.adempiere.po.useTimeoutForUpdate";
|
private static final String USE_TIMEOUT_FOR_UPDATE = "org.adempiere.po.useTimeoutForUpdate";
|
||||||
|
|
||||||
|
@ -196,6 +196,7 @@ public abstract class PO
|
||||||
int size = p_info.getColumnCount();
|
int size = p_info.getColumnCount();
|
||||||
m_oldValues = new Object[size];
|
m_oldValues = new Object[size];
|
||||||
m_newValues = new Object[size];
|
m_newValues = new Object[size];
|
||||||
|
m_setErrors = new ValueNamePair[size];
|
||||||
|
|
||||||
if (rs != null)
|
if (rs != null)
|
||||||
load(rs); // will not have virtual columns
|
load(rs); // will not have virtual columns
|
||||||
|
@ -235,6 +236,8 @@ public abstract class PO
|
||||||
private Object[] m_oldValues = null;
|
private Object[] m_oldValues = null;
|
||||||
/** New Values */
|
/** New Values */
|
||||||
private Object[] m_newValues = null;
|
private Object[] m_newValues = null;
|
||||||
|
/** Errors when setting */
|
||||||
|
private ValueNamePair[] m_setErrors = null;
|
||||||
|
|
||||||
/** Record_IDs */
|
/** Record_IDs */
|
||||||
private Object[] m_IDs = new Object[] {I_ZERO};
|
private Object[] m_IDs = new Object[] {I_ZERO};
|
||||||
|
@ -763,12 +766,14 @@ public abstract class PO
|
||||||
String ColumnName = p_info.getColumnName(index);
|
String ColumnName = p_info.getColumnName(index);
|
||||||
String colInfo = " - " + ColumnName;
|
String colInfo = " - " + ColumnName;
|
||||||
//
|
//
|
||||||
|
m_setErrors[index] = null;
|
||||||
if (checkWritable)
|
if (checkWritable)
|
||||||
{
|
{
|
||||||
if (p_info.isVirtualColumn(index))
|
if (p_info.isVirtualColumn(index))
|
||||||
{
|
{
|
||||||
log.log(Level.WARNING, "Virtual Column" + colInfo);
|
log.log(Level.WARNING, "Virtual Column" + colInfo);
|
||||||
log.saveError("VirtualColumn", "Virtual Column" + colInfo);
|
log.saveError("VirtualColumn", "Virtual Column" + colInfo);
|
||||||
|
m_setErrors[index] = new ValueNamePair("VirtualColumn", "Virtual Column" + colInfo);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -780,6 +785,7 @@ public abstract class PO
|
||||||
colInfo += " - NewValue=" + value + " - OldValue=" + get_Value(index);
|
colInfo += " - NewValue=" + value + " - OldValue=" + get_Value(index);
|
||||||
log.log(Level.WARNING, "Column not updateable" + colInfo);
|
log.log(Level.WARNING, "Column not updateable" + colInfo);
|
||||||
log.saveError("ColumnReadonly", "Column not updateable" + colInfo);
|
log.saveError("ColumnReadonly", "Column not updateable" + colInfo);
|
||||||
|
m_setErrors[index] = new ValueNamePair("ColumnReadonly", "Column not updateable" + colInfo);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -789,7 +795,8 @@ public abstract class PO
|
||||||
if (checkWritable && p_info.isColumnMandatory(index))
|
if (checkWritable && p_info.isColumnMandatory(index))
|
||||||
{
|
{
|
||||||
log.saveError("FillMandatory", ColumnName + " is mandatory.");
|
log.saveError("FillMandatory", ColumnName + " is mandatory.");
|
||||||
throw new IllegalArgumentException (ColumnName + " is mandatory.");
|
m_setErrors[index] = new ValueNamePair("FillMandatory", ColumnName + " is mandatory.");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
m_newValues[index] = Null.NULL; // correct
|
m_newValues[index] = Null.NULL; // correct
|
||||||
if (log.isLoggable(Level.FINER)) log.finer(ColumnName + " = null");
|
if (log.isLoggable(Level.FINER)) log.finer(ColumnName + " = null");
|
||||||
|
@ -823,22 +830,22 @@ public abstract class PO
|
||||||
}
|
}
|
||||||
catch (NumberFormatException e)
|
catch (NumberFormatException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, ColumnName
|
String errmsg = ColumnName
|
||||||
+ " - Class invalid: " + value.getClass().toString()
|
+ " - Class invalid: " + value.getClass().toString()
|
||||||
+ ", Should be " + p_info.getColumnClass(index).toString() + ": " + value);
|
+ ", Should be " + p_info.getColumnClass(index).toString() + ": " + value;
|
||||||
log.saveError("WrongDataType", ColumnName
|
log.log(Level.SEVERE, errmsg);
|
||||||
+ " - Class invalid: " + value.getClass().toString()
|
log.saveError("WrongDataType", errmsg);
|
||||||
+ ", Should be " + p_info.getColumnClass(index).toString() + ": " + value);
|
m_setErrors[index] = new ValueNamePair("WrongDataType", errmsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, ColumnName
|
String errmsg = ColumnName
|
||||||
+ " - Class invalid: " + value.getClass().toString()
|
+ " - Class invalid: " + value.getClass().toString()
|
||||||
+ ", Should be " + p_info.getColumnClass(index).toString() + ": " + value);
|
+ ", Should be " + p_info.getColumnClass(index).toString() + ": " + value;
|
||||||
log.saveError("WrongDataType", ColumnName
|
log.log(Level.SEVERE, errmsg);
|
||||||
+ " - Class invalid: " + value.getClass().toString()
|
log.saveError("WrongDataType", errmsg);
|
||||||
+ ", Should be " + p_info.getColumnClass(index).toString() + ": " + value);
|
m_setErrors[index] = new ValueNamePair("WrongDataType", errmsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Validate (Min/Max)
|
// Validate (Min/Max)
|
||||||
|
@ -849,8 +856,10 @@ public abstract class PO
|
||||||
int separatorIndex = error.indexOf(";");
|
int separatorIndex = error.indexOf(";");
|
||||||
if (separatorIndex > 0) {
|
if (separatorIndex > 0) {
|
||||||
log.saveError(error.substring(0,separatorIndex), error.substring(separatorIndex+1));
|
log.saveError(error.substring(0,separatorIndex), error.substring(separatorIndex+1));
|
||||||
|
m_setErrors[index] = new ValueNamePair(error.substring(0,separatorIndex), error.substring(separatorIndex+1));
|
||||||
} else {
|
} else {
|
||||||
log.saveError(error, ColumnName);
|
log.saveError(error, ColumnName);
|
||||||
|
m_setErrors[index] = new ValueNamePair(error, ColumnName);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -876,10 +885,11 @@ public abstract class PO
|
||||||
StringBuilder validValues = new StringBuilder();
|
StringBuilder validValues = new StringBuilder();
|
||||||
for (ValueNamePair vp : MRefList.getList(getCtx(), p_info.getColumn(index).AD_Reference_Value_ID, false))
|
for (ValueNamePair vp : MRefList.getList(getCtx(), p_info.getColumn(index).AD_Reference_Value_ID, false))
|
||||||
validValues.append(" - ").append(vp.getValue());
|
validValues.append(" - ").append(vp.getValue());
|
||||||
log.saveError("Validate", ColumnName + " Invalid value - "
|
String errmsg = ColumnName + " Invalid value - "
|
||||||
+ value + " - Reference_ID=" + p_info.getColumn(index).AD_Reference_Value_ID + validValues.toString());
|
+ value + " - Reference_ID=" + p_info.getColumn(index).AD_Reference_Value_ID + validValues.toString();
|
||||||
throw new IllegalArgumentException(ColumnName + " Invalid value - "
|
log.saveError("Validate", errmsg);
|
||||||
+ value + " - Reference_ID=" + p_info.getColumn(index).AD_Reference_Value_ID + validValues.toString());
|
m_setErrors[index] = new ValueNamePair("Validate", errmsg);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (log.isLoggable(Level.FINEST)) log.finest(ColumnName + " = " + m_newValues[index] + " (OldValue="+m_oldValues[index]+")");
|
if (log.isLoggable(Level.FINEST)) log.finest(ColumnName + " = " + m_newValues[index] + " (OldValue="+m_oldValues[index]+")");
|
||||||
|
@ -1953,6 +1963,14 @@ public abstract class PO
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < m_setErrors.length; i++) {
|
||||||
|
ValueNamePair setError = m_setErrors[i];
|
||||||
|
if (setError != null) {
|
||||||
|
log.saveError(setError.getValue(), Msg.getElement(getCtx(), p_info.getColumnName(i)) + " - " + setError.getName());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Organization Check
|
// Organization Check
|
||||||
if (getAD_Org_ID() == 0
|
if (getAD_Org_ID() == 0
|
||||||
&& (get_AccessLevel() == ACCESSLEVEL_ORG
|
&& (get_AccessLevel() == ACCESSLEVEL_ORG
|
||||||
|
@ -2156,8 +2174,9 @@ public abstract class PO
|
||||||
if (!save()) {
|
if (!save()) {
|
||||||
String msg = null;
|
String msg = null;
|
||||||
ValueNamePair err = CLogger.retrieveError();
|
ValueNamePair err = CLogger.retrieveError();
|
||||||
|
String val = Msg.translate(getCtx(), err.getValue());
|
||||||
if (err != null)
|
if (err != null)
|
||||||
msg = err.getName();
|
msg = (val != null ? val + ": " : "") + err.getName();
|
||||||
if (msg == null || msg.length() == 0)
|
if (msg == null || msg.length() == 0)
|
||||||
msg = "SaveError";
|
msg = "SaveError";
|
||||||
throw new AdempiereException(msg);
|
throw new AdempiereException(msg);
|
||||||
|
|
|
@ -810,7 +810,9 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
} else if (MField.COLUMNNAME_XPosition.equals(propertyName)) {
|
} else if (MField.COLUMNNAME_XPosition.equals(propertyName)) {
|
||||||
field.setXPosition(intvalue);
|
field.setXPosition(intvalue);
|
||||||
} else if (MField.COLUMNNAME_ColumnSpan.equals(propertyName)) {
|
} else if (MField.COLUMNNAME_ColumnSpan.equals(propertyName)) {
|
||||||
field.setColumnSpan(intvalue);
|
int prevcolspan = field.getColumnSpan();
|
||||||
|
if (!field.set_ValueOfColumnReturningBoolean(MField.COLUMNNAME_ColumnSpan, intvalue))
|
||||||
|
field.setColumnSpan(prevcolspan);
|
||||||
} else if (MField.COLUMNNAME_NumLines.equals(propertyName)) {
|
} else if (MField.COLUMNNAME_NumLines.equals(propertyName)) {
|
||||||
field.setNumLines(intvalue);
|
field.setNumLines(intvalue);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue