From 4f3c18730dfe2939bb99fef2351f02778bf06d7d Mon Sep 17 00:00:00 2001 From: hieplq Date: Tue, 27 Feb 2024 21:57:40 +0700 Subject: [PATCH] IDEMPIERE-4677: get client id from MRole instead of from context (#2250) Calling Env.getAD_Client_ID(getCtx()) within the loadOrgAccessUser function can cause issues if the context is not yet logged in. To avoid this, it's recommended to use getAD_Client_ID() directly instead. --- org.adempiere.base/src/org/compiere/model/MRole.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MRole.java b/org.adempiere.base/src/org/compiere/model/MRole.java index 69432e17b4..ef59a77fc8 100644 --- a/org.adempiere.base/src/org/compiere/model/MRole.java +++ b/org.adempiere.base/src/org/compiere/model/MRole.java @@ -856,7 +856,7 @@ public final class MRole extends X_AD_Role implements ImmutablePOSupport { pstmt = DB.prepareStatement(sql, get_TrxName()); pstmt.setInt(1, getAD_User_ID()); - pstmt.setInt(2, Env.getAD_Client_ID(getCtx())); + pstmt.setInt(2, getAD_Client_ID()); rs = pstmt.executeQuery(); while (rs.next()) { @@ -888,7 +888,7 @@ public final class MRole extends X_AD_Role implements ImmutablePOSupport { pstmt = DB.prepareStatement(sql, get_TrxName()); pstmt.setInt(1, getAD_Role_ID()); - pstmt.setInt(2, Env.getAD_Client_ID(getCtx())); + pstmt.setInt(2, getAD_Client_ID()); rs = pstmt.executeQuery(); while (rs.next()) {