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:
Heng Sin Low 2009-02-06 09:13:50 +00:00
parent ae4ed21cae
commit 4de3321f32
1 changed files with 30 additions and 1 deletions

View File

@ -346,5 +346,34 @@ public class MAttributeSetInstance extends X_M_AttributeSetInstance
return m_mas.isExcludeSerNo (AD_Column_ID, isSOTrx);
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