From 6b59db69ede6239e74417dbcfc83cec8a9f0a307 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 3 Mar 2010 19:47:16 +0000 Subject: [PATCH] peer review for 11535 -> getBPartnerCashTrx refactored with junit test applied FR: [ 2214883 ] Remove SQL code and Replace for Query Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2214883 --- base/src/org/compiere/model/MBPartner.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/base/src/org/compiere/model/MBPartner.java b/base/src/org/compiere/model/MBPartner.java index b7bb871dde..1e0fb8064d 100644 --- a/base/src/org/compiere/model/MBPartner.java +++ b/base/src/org/compiere/model/MBPartner.java @@ -49,7 +49,6 @@ public class MBPartner extends X_C_BPartner */ private static final long serialVersionUID = -3669895599574182217L; - /** * Get Empty Template Business Partner * @param ctx context @@ -97,11 +96,7 @@ public class MBPartner extends X_C_BPartner */ public static MBPartner getBPartnerCashTrx (Properties ctx, int AD_Client_ID) { - MBPartner retValue = null; - final String whereClause = "C_BPartner_ID IN (SELECT C_BPartnerCashTrx_ID FROM AD_ClientInfo WHERE AD_Client_ID=?)"; - retValue = new Query(ctx, I_C_BPartner.Table_Name, whereClause, null) - .setParameters(AD_Client_ID) - .first(); + MBPartner retValue = (MBPartner) MClientInfo.get(ctx, AD_Client_ID).getC_BPartnerCashTrx(); if (retValue == null) s_log.log(Level.SEVERE, "Not found for AD_Client_ID=" + AD_Client_ID); @@ -119,7 +114,7 @@ public class MBPartner extends X_C_BPartner if (Value == null || Value.length() == 0) return null; final String whereClause = "Value=? AND AD_Client_ID=?"; - MBPartner retValue = new Query(ctx, I_C_BPartner.Table_Name, whereClause.toString(), null) + MBPartner retValue = new Query(ctx, I_C_BPartner.Table_Name, whereClause, null) .setParameters(Value,Env.getAD_Client_ID(ctx)) .firstOnly(); return retValue; @@ -134,7 +129,7 @@ public class MBPartner extends X_C_BPartner public static MBPartner get (Properties ctx, int C_BPartner_ID) { final String whereClause = "C_BPartner_ID=? AND AD_Client_ID=?"; - MBPartner retValue = new Query(ctx,I_C_BPartner.Table_Name,whereClause.toString(),null) + MBPartner retValue = new Query(ctx,I_C_BPartner.Table_Name,whereClause,null) .setParameters(C_BPartner_ID,Env.getAD_Client_ID(ctx)) .firstOnly(); return retValue;