Fix [1722226] - Usability - Record_ID = 0 on 9 tables can't be modified

Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=1722226
This commit is contained in:
Carlos Ruiz 2010-03-25 04:34:27 +00:00
parent a88e1efec3
commit daea95abbf
1 changed files with 21 additions and 1 deletions

View File

@ -1374,6 +1374,26 @@ private Object[] getDataAtRow(int row)
// get updated row data // get updated row data
Object[] rowData = getDataAtRow(m_rowChanged); Object[] rowData = getDataAtRow(m_rowChanged);
// CarlosRuiz - globalqss - fix [1722226] - Usability - Record_ID = 0 on 9 tables can't be modified
boolean specialZeroUpdate = false;
if (!m_inserting // not inserting, updating a record
&& manualCmd // in a manual way (pushing the save button)
&& (Env.getAD_User_ID(m_ctx) == 0 || Env.getAD_User_ID(m_ctx) == 100) // user must know what is doing -> just allowed to System or SuperUser (Hardcoded)
&& getKeyID(m_rowChanged) == 0) { // the record being changed has ID = 0
String tablename = getTableName(); // just the allowed tables (HardCoded)
if (tablename.equals("AD_Org") ||
tablename.equals("AD_ReportView") ||
tablename.equals("AD_Role") ||
tablename.equals("AD_System") ||
tablename.equals("AD_User") ||
tablename.equals("C_DocType") ||
tablename.equals("GL_Category") ||
tablename.equals("M_AttributeSet") ||
tablename.equals("M_AttributeSetInstance")) {
specialZeroUpdate = true;
}
}
// Check Mandatory // Check Mandatory
String missingColumns = getMandatory(rowData); String missingColumns = getMandatory(rowData);
if (missingColumns.length() != 0) if (missingColumns.length() != 0)
@ -1391,7 +1411,7 @@ private Object[] getDataAtRow(int row)
Record_ID = getKeyID(m_rowChanged); Record_ID = getKeyID(m_rowChanged);
try try
{ {
if (!m_tableName.endsWith("_Trl")) // translation tables have no model if (!m_tableName.endsWith("_Trl") && !specialZeroUpdate) // translation tables have no model
return dataSavePO (Record_ID); return dataSavePO (Record_ID);
} }
catch (Throwable e) catch (Throwable e)