From 9657819e1d3de16e43196584fb7e30fbdc18e581 Mon Sep 17 00:00:00 2001 From: teo_sarca Date: Mon, 5 Nov 2007 19:19:09 +0000 Subject: [PATCH] BF [ 1826279 ] MPackageExpCommon.afterSave: bad implementation * javadoc fixes, initial author is Rob Klein and not Jorg Janke --- .../org/compiere/model/MPackageExpCommon.java | 46 +++++++++---------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/base/src/org/compiere/model/MPackageExpCommon.java b/base/src/org/compiere/model/MPackageExpCommon.java index 56bb9b6ade..02c2352222 100644 --- a/base/src/org/compiere/model/MPackageExpCommon.java +++ b/base/src/org/compiere/model/MPackageExpCommon.java @@ -17,15 +17,17 @@ *****************************************************************************/ package org.compiere.model; -import java.sql.*; -import java.util.*; -import org.compiere.util.*; +import java.sql.ResultSet; +import java.util.Properties; + +import org.compiere.util.DB; /** - * Menu Model + * Package Export Commons * - * @author Jorg Janke - * @version $Id: MMenu.java,v 1.5 2005/05/14 05:32:16 jjanke Exp $ + * @author Rob Klein + * @author Teo Sarca, SC ARHIPAC SERVICE SRL + *
  • BF [ 1826279 ] MPackageExpCommon.afterSave: bad implementation */ public class MPackageExpCommon extends X_AD_Package_Exp_Common { @@ -53,24 +55,18 @@ public class MPackageExpCommon extends X_AD_Package_Exp_Common } // 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_Common PackCommon =new X_AD_Package_Exp_Common(Env.getCtx(), getAD_Package_Exp_Common_ID(), null); - String sql = "SELECT max(Line) FROM AD_Package_Exp_Common"; - int lineNo = DB.getSQLValue(null, sql); - - if(PackCommon.getLine()==0){ - PackCommon.setLine(lineNo+10); - PackCommon.save();} - + @Override + protected boolean beforeSave(boolean newRecord) { + if (getLine() == 0) { + String sql = "SELECT max(Line) FROM AD_Package_Exp_Common" + + " WHERE AD_Package_Exp_Common_ID<>?"; + int lineNo = DB.getSQLValue(get_TrxName(), sql, getAD_Package_Exp_Common_ID()); + if (lineNo >= 0) + setLine(lineNo+10); + } return true; - } // afterSave - -} // MMenu + } +} // MPackageExpCommon