Merge
8325, hengsin, 04 February 2009 [ 2566493 ] Material receipt create instance with empty description - Use M_AttributeSetInstance_ID as description when description is null or empty.
This commit is contained in:
parent
ae4ed21cae
commit
4de3321f32
|
@ -347,4 +347,33 @@ public class MAttributeSetInstance extends X_M_AttributeSetInstance
|
|||
return false;
|
||||
} // isExcludeSerNo
|
||||
|
||||
@Override
|
||||
protected boolean afterSave(boolean newRecord, boolean success)
|
||||
{
|
||||
if (super.afterSave(newRecord, success))
|
||||
{
|
||||
if (newRecord && success)
|
||||
{
|
||||
//use id as description when description is empty
|
||||
String desc = this.getDescription();
|
||||
if (desc == null || desc.trim().length() == 0)
|
||||
{
|
||||
this.set_ValueNoCheck("Description", Integer.toString(getM_AttributeSetInstance_ID()));
|
||||
String sql = "UPDATE M_AttributeSetInstance SET Description = ? WHERE M_AttributeSetInstance_ID = ?";
|
||||
int no = DB.executeUpdate(sql,
|
||||
new Object[]{Integer.toString(getM_AttributeSetInstance_ID()), getM_AttributeSetInstance_ID()},
|
||||
false, get_TrxName());
|
||||
if (no <= 0)
|
||||
{
|
||||
log.log(Level.SEVERE, "Failed to update description.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // MAttributeSetInstance
|
||||
|
|
Loading…
Reference in New Issue