[ 1955264 ] Changing columns is updating fields needlessly
This commit is contained in:
parent
aa7dfe359b
commit
a6345d0702
|
@ -273,61 +273,82 @@ public class M_Element extends X_AD_Element
|
||||||
// Update Columns, Fields, Parameters, Print Info
|
// Update Columns, Fields, Parameters, Print Info
|
||||||
if (!newRecord)
|
if (!newRecord)
|
||||||
{
|
{
|
||||||
// Column
|
StringBuffer sql = new StringBuffer();
|
||||||
StringBuffer sql = new StringBuffer("UPDATE AD_Column SET ColumnName=")
|
int no = 0;
|
||||||
.append(DB.TO_STRING(getColumnName()))
|
|
||||||
.append(", Name=").append(DB.TO_STRING(getName()))
|
|
||||||
.append(", Description=").append(DB.TO_STRING(getDescription()))
|
|
||||||
.append(", Help=").append(DB.TO_STRING(getHelp()))
|
|
||||||
.append(" WHERE AD_Element_ID=").append(get_ID());
|
|
||||||
int no = DB.executeUpdate(sql.toString(), get_TrxName());
|
|
||||||
log.fine("afterSave - Columns updated #" + no);
|
|
||||||
|
|
||||||
// Field
|
if ( is_ValueChanged(M_Element.COLUMNNAME_Name)
|
||||||
sql = new StringBuffer("UPDATE AD_Field SET Name=")
|
|| is_ValueChanged(M_Element.COLUMNNAME_Description)
|
||||||
.append(DB.TO_STRING(getName()))
|
|| is_ValueChanged(M_Element.COLUMNNAME_Help)
|
||||||
.append(", Description=").append(DB.TO_STRING(getDescription()))
|
|| is_ValueChanged(M_Element.COLUMNNAME_ColumnName)
|
||||||
.append(", Help=").append(DB.TO_STRING(getHelp()))
|
) {
|
||||||
.append(" WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=")
|
// Column
|
||||||
.append(get_ID())
|
sql = new StringBuffer("UPDATE AD_Column SET ColumnName=")
|
||||||
.append(") AND IsCentrallyMaintained='Y'");
|
.append(DB.TO_STRING(getColumnName()))
|
||||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
.append(", Name=").append(DB.TO_STRING(getName()))
|
||||||
log.fine("Fields updated #" + no);
|
.append(", Description=").append(DB.TO_STRING(getDescription()))
|
||||||
|
.append(", Help=").append(DB.TO_STRING(getHelp()))
|
||||||
|
.append(" WHERE AD_Element_ID=").append(get_ID());
|
||||||
|
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||||
|
log.fine("afterSave - Columns updated #" + no);
|
||||||
|
|
||||||
// Parameter
|
// Parameter
|
||||||
sql = new StringBuffer("UPDATE AD_Process_Para SET ColumnName=")
|
sql = new StringBuffer("UPDATE AD_Process_Para SET ColumnName=")
|
||||||
.append(DB.TO_STRING(getColumnName()))
|
.append(DB.TO_STRING(getColumnName()))
|
||||||
.append(", Name=").append(DB.TO_STRING(getName()))
|
.append(", Name=").append(DB.TO_STRING(getName()))
|
||||||
.append(", Description=").append(DB.TO_STRING(getDescription()))
|
.append(", Description=").append(DB.TO_STRING(getDescription()))
|
||||||
.append(", Help=").append(DB.TO_STRING(getHelp()))
|
.append(", Help=").append(DB.TO_STRING(getHelp()))
|
||||||
.append(", AD_Element_ID=").append(get_ID())
|
.append(", AD_Element_ID=").append(get_ID())
|
||||||
.append(" WHERE UPPER(ColumnName)=")
|
.append(" WHERE UPPER(ColumnName)=")
|
||||||
.append(DB.TO_STRING(getColumnName().toUpperCase()))
|
.append(DB.TO_STRING(getColumnName().toUpperCase()))
|
||||||
.append(" AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL");
|
.append(" AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL");
|
||||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||||
sql = new StringBuffer("UPDATE AD_Process_Para SET ColumnName=")
|
|
||||||
.append(DB.TO_STRING(getColumnName()))
|
|
||||||
.append(", Name=").append(DB.TO_STRING(getName()))
|
|
||||||
.append(", Description=").append(DB.TO_STRING(getDescription()))
|
|
||||||
.append(", Help=").append(DB.TO_STRING(getHelp()))
|
|
||||||
.append(" WHERE AD_Element_ID=").append(get_ID())
|
|
||||||
.append(" AND IsCentrallyMaintained='Y'");
|
|
||||||
no += DB.executeUpdate(sql.toString(), get_TrxName());
|
|
||||||
log.fine("Parameters updated #" + no);
|
|
||||||
|
|
||||||
// Print Info
|
sql = new StringBuffer("UPDATE AD_Process_Para SET ColumnName=")
|
||||||
sql = new StringBuffer("UPDATE AD_PrintFormatItem pi SET PrintName=")
|
.append(DB.TO_STRING(getColumnName()))
|
||||||
.append(DB.TO_STRING(getPrintName()))
|
.append(", Name=").append(DB.TO_STRING(getName()))
|
||||||
.append(", Name=").append(DB.TO_STRING(getName()))
|
.append(", Description=").append(DB.TO_STRING(getDescription()))
|
||||||
.append(" WHERE IsCentrallyMaintained='Y'")
|
.append(", Help=").append(DB.TO_STRING(getHelp()))
|
||||||
.append(" AND EXISTS (SELECT * FROM AD_Column c ")
|
.append(" WHERE AD_Element_ID=").append(get_ID())
|
||||||
.append("WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=")
|
.append(" AND IsCentrallyMaintained='Y'");
|
||||||
.append(get_ID()).append(")");
|
no += DB.executeUpdate(sql.toString(), get_TrxName());
|
||||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
log.fine("Parameters updated #" + no);
|
||||||
log.fine("PrintFormatItem updated #" + no);
|
}
|
||||||
|
|
||||||
|
if ( is_ValueChanged(M_Element.COLUMNNAME_Name)
|
||||||
|
|| is_ValueChanged(M_Element.COLUMNNAME_Description)
|
||||||
|
|| is_ValueChanged(M_Element.COLUMNNAME_Help)
|
||||||
|
) {
|
||||||
|
// Field
|
||||||
|
sql = new StringBuffer("UPDATE AD_Field SET Name=")
|
||||||
|
.append(DB.TO_STRING(getName()))
|
||||||
|
.append(", Description=").append(DB.TO_STRING(getDescription()))
|
||||||
|
.append(", Help=").append(DB.TO_STRING(getHelp()))
|
||||||
|
.append(" WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=")
|
||||||
|
.append(get_ID())
|
||||||
|
.append(") AND IsCentrallyMaintained='Y'");
|
||||||
|
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||||
|
log.fine("Fields updated #" + no);
|
||||||
|
|
||||||
|
// Info Column - update Name, Description, Help - doesn't have IsCentrallyMaintained currently
|
||||||
|
// no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||||
|
// log.fine("InfoColumn updated #" + no);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( is_ValueChanged(M_Element.COLUMNNAME_PrintName)
|
||||||
|
|| is_ValueChanged(M_Element.COLUMNNAME_Name)
|
||||||
|
) {
|
||||||
|
// Print Info
|
||||||
|
sql = new StringBuffer("UPDATE AD_PrintFormatItem pi SET PrintName=")
|
||||||
|
.append(DB.TO_STRING(getPrintName()))
|
||||||
|
.append(", Name=").append(DB.TO_STRING(getName()))
|
||||||
|
.append(" WHERE IsCentrallyMaintained='Y'")
|
||||||
|
.append(" AND EXISTS (SELECT * FROM AD_Column c ")
|
||||||
|
.append("WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=")
|
||||||
|
.append(get_ID()).append(")");
|
||||||
|
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||||
|
log.fine("PrintFormatItem updated #" + no);
|
||||||
|
}
|
||||||
|
|
||||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
|
||||||
log.fine("InfoWindow updated #" + no);
|
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
} // afterSave
|
} // afterSave
|
||||||
|
|
Loading…
Reference in New Issue