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