From 6e8d32a3111c46f31a6339be49162c3ffc066611 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 26 Mar 2010 18:42:14 +0000 Subject: [PATCH] Peer review for 11751 - FR: [ 2214883 ] Remove SQL code and Replace for Query minor refactoring Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2214883 --- base/src/org/compiere/model/MCostDetail.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/base/src/org/compiere/model/MCostDetail.java b/base/src/org/compiere/model/MCostDetail.java index 156130bdb3..033c1bf48b 100644 --- a/base/src/org/compiere/model/MCostDetail.java +++ b/base/src/org/compiere/model/MCostDetail.java @@ -48,8 +48,7 @@ public class MCostDetail extends X_M_CostDetail /** * */ - private static final long serialVersionUID = 5452006110417178583L; - + private static final long serialVersionUID = -7882724307127281675L; /** * Create New Order Cost Detail for Purchase Orders. @@ -524,13 +523,13 @@ public class MCostDetail extends X_M_CostDetail * @param trxName trx * @return cost detail */ - public static MCostDetail get (Properties ctx, String passedClause, + public static MCostDetail get (Properties ctx, String whereClause, int ID, int M_AttributeSetInstance_ID, int C_AcctSchema_ID, String trxName) { - final String whereClause = passedClause + final String localWhereClause = whereClause + " AND M_AttributeSetInstance_ID=?" + " AND C_AcctSchema_ID=?"; - MCostDetail retValue = new Query(ctx,I_M_CostDetail.Table_Name,whereClause,trxName) + MCostDetail retValue = new Query(ctx,I_M_CostDetail.Table_Name,localWhereClause,trxName) .setParameters(ID,M_AttributeSetInstance_ID,C_AcctSchema_ID) .first(); return retValue; @@ -552,12 +551,12 @@ public class MCostDetail extends X_M_CostDetail .setParameters(product.getM_Product_ID(),false) .setOrderBy("C_AcctSchema_ID, M_CostElement_ID, AD_Org_ID, M_AttributeSetInstance_ID, Created") .list(); - for (MCostDetail cd:list){ + for (MCostDetail cd : list) { if (cd.process()) // saves - counterOK++; - else - counterError++; - } + counterOK++; + else + counterError++; + } s_log.config("OK=" + counterOK + ", Errors=" + counterError); return counterError == 0; } // processProduct