From a7ab3a8345efc92d36d36d684e416f0e13dfb338 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud <58596990+nmicoud@users.noreply.github.com> Date: Fri, 18 Mar 2022 07:42:12 +0100 Subject: [PATCH] IDEMPIERE-5235 : Usage of MOrg.getOfClient without PO (#1255) * IDEMPIERE-5235 : Usage of MOrg.getOfClient without PO * IDEMPIERE-5235 : Usage of MOrg.getOfClient without PO changes suggested by @hengsin --- .../src/org/compiere/model/MOrg.java | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MOrg.java b/org.adempiere.base/src/org/compiere/model/MOrg.java index c14abbab3e..818ce42958 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrg.java +++ b/org.adempiere.base/src/org/compiere/model/MOrg.java @@ -39,7 +39,7 @@ public class MOrg extends X_AD_Org implements ImmutablePOSupport /** * */ - private static final long serialVersionUID = -696173265471741122L; + private static final long serialVersionUID = -8501438599288536080L; /** * Get Active Organizations Of Client @@ -48,10 +48,30 @@ public class MOrg extends X_AD_Org implements ImmutablePOSupport */ public static MOrg[] getOfClient (PO po) { - List list = new Query(po.getCtx(), Table_Name, "AD_Client_ID=?", null) + return getOfClient(po.getAD_Client_ID()); + } // getOfClient + + /** + * Get Active Organizations Of current Client + * @return array of orgs + */ + public static MOrg[] getOfClient () + { + return getOfClient(Env.getAD_Client_ID(Env.getCtx())); + } + + /** + * Get Active Organizations Of Client + * @param ctx context + * @param int clientID + * @return array of orgs + */ + public static MOrg[] getOfClient (int clientID) + { + List list = new Query(Env.getCtx(), Table_Name, "AD_Client_ID=?", null) .setOrderBy(COLUMNNAME_Value) .setOnlyActiveRecords(true) - .setParameters(po.getAD_Client_ID()) + .setParameters(clientID) .list(); for (MOrg org : list) { @@ -59,7 +79,7 @@ public class MOrg extends X_AD_Org implements ImmutablePOSupport } return list.toArray(new MOrg[list.size()]); } // getOfClient - + /** * Get Org from Cache (immutable) * @param AD_Org_ID id