BF [ 1808552 ] Adempiere freeze when we try to save a packout line

This commit is contained in:
teo_sarca 2007-10-06 10:44:06 +00:00
parent 81fa88f9f1
commit f6b5458305
1 changed files with 18 additions and 20 deletions

View File

@ -54,24 +54,22 @@ public class MPackageExpDetail extends X_AD_Package_Exp_Detail
} // MPackageExp
/**
* After Save
* @param newRecord new
* @param success success
* @return success
/* (non-Javadoc)
* @see org.compiere.model.PO#beforeSave(boolean)
*/
protected boolean afterSave (boolean newRecord, boolean success)
{
X_AD_Package_Exp_Detail PackDetail =new X_AD_Package_Exp_Detail(Env.getCtx(), getAD_Package_Exp_Detail_ID(), null);
String sql = "SELECT max(Line) FROM AD_Package_Exp_Detail WHERE AD_Package_Exp_ID = ?";
int lineNo = DB.getSQLValue(null, sql,getAD_Package_Exp_ID());
if(PackDetail.getLine()==0){
PackDetail.setLine(lineNo+10);
PackDetail.save();}
@Override
protected boolean beforeSave(boolean newRecord) {
if (getLine() == 0) {
final String sql = "SELECT max("+COLUMNNAME_Line+")"
+ "FROM "+Table_Name
+ " WHERE "+COLUMNNAME_AD_Package_Exp_ID+"=?"
+" AND "+COLUMNNAME_AD_Package_Exp_Detail_ID+"<>?";
int lineNo = DB.getSQLValue(get_TrxName(), sql, getAD_Package_Exp_ID(), getAD_Package_Exp_Detail_ID());
if (lineNo >= 0)
setLine(lineNo+10);
}
//
return true;
} // afterSave
}
} // MMenu