IDEMPIERE-5849 MRole.getDefault make phantom role on cache (#2149)

- Make SysConfigurable to return System role for backward compatibility
This commit is contained in:
Carlos Ruiz 2023-12-21 14:26:20 +01:00 committed by GitHub
parent 03ceb5f88f
commit 4f52a4efcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -87,8 +87,10 @@ public final class MRole extends X_AD_Role implements ImmutablePOSupport
*/ */
public static MRole getDefault (Properties ctx, boolean reload) public static MRole getDefault (Properties ctx, boolean reload)
{ {
if (Util.isEmpty(Env.getContext(ctx, Env.AD_ROLE_ID)) || Util.isEmpty(Env.getContext(ctx, Env.AD_USER_ID))) if (MSysConfig.getBooleanValue(MSysConfig.MROLE_GETDEFAULT_RETURNS_NULL_WHEN_NO_CONTEXT, true)) {
return null; if (Util.isEmpty(Env.getContext(ctx, Env.AD_ROLE_ID)) || Util.isEmpty(Env.getContext(ctx, Env.AD_USER_ID)))
return null;
}
int AD_Role_ID = Env.getContextAsInt(ctx, Env.AD_ROLE_ID); int AD_Role_ID = Env.getContextAsInt(ctx, Env.AD_ROLE_ID);
int AD_User_ID = Env.getContextAsInt(ctx, Env.AD_USER_ID); int AD_User_ID = Env.getContextAsInt(ctx, Env.AD_USER_ID);

View File

@ -42,9 +42,9 @@ import org.compiere.util.Util;
public class MSysConfig extends X_AD_SysConfig public class MSysConfig extends X_AD_SysConfig
{ {
/** /**
* generated serial id *
*/ */
private static final long serialVersionUID = -8121703411463724745L; private static final long serialVersionUID = 1548573102245466450L;
/** Constant for Predefine System Configuration Names (in alphabetical order) */ /** Constant for Predefine System Configuration Names (in alphabetical order) */
@ -155,6 +155,7 @@ public class MSysConfig extends X_AD_SysConfig
public static final String MFG_ValidateCostsOnCreate = "MFG_ValidateCostsOnCreate"; public static final String MFG_ValidateCostsOnCreate = "MFG_ValidateCostsOnCreate";
public static final String MONITOR_INITIAL_WAIT_FOR_CLUSTER_IN_SECONDS = "MONITOR_INITIAL_WAIT_FOR_CLUSTER_IN_SECONDS"; public static final String MONITOR_INITIAL_WAIT_FOR_CLUSTER_IN_SECONDS = "MONITOR_INITIAL_WAIT_FOR_CLUSTER_IN_SECONDS";
public static final String MONITOR_MAX_WAIT_FOR_CLUSTER_IN_SECONDS = "MONITOR_MAX_WAIT_FOR_CLUSTER_IN_SECONDS"; public static final String MONITOR_MAX_WAIT_FOR_CLUSTER_IN_SECONDS = "MONITOR_MAX_WAIT_FOR_CLUSTER_IN_SECONDS";
public static final String MROLE_GETDEFAULT_RETURNS_NULL_WHEN_NO_CONTEXT = "MROLE_GETDEFAULT_RETURNS_NULL_WHEN_NO_CONTEXT";
public static final String MSEQUENCE_GETNEXT_TIMEOUT = "MSEQUENCE_GETNEXT_TIMEOUT"; public static final String MSEQUENCE_GETNEXT_TIMEOUT = "MSEQUENCE_GETNEXT_TIMEOUT";
public static final String ORDER_COLUMNS_TO_COPY_TO_NOT_COMPLETED_INVOICES = "ORDER_COLUMNS_TO_COPY_TO_NOT_COMPLETED_INVOICES"; public static final String ORDER_COLUMNS_TO_COPY_TO_NOT_COMPLETED_INVOICES = "ORDER_COLUMNS_TO_COPY_TO_NOT_COMPLETED_INVOICES";
public static final String PAYMENT_OVERWRITE_DOCUMENTNO_WITH_CHECK_ON_PAYMENT = "PAYMENT_OVERWRITE_DOCUMENTNO_WITH_CHECK_ON_PAYMENT"; public static final String PAYMENT_OVERWRITE_DOCUMENTNO_WITH_CHECK_ON_PAYMENT = "PAYMENT_OVERWRITE_DOCUMENTNO_WITH_CHECK_ON_PAYMENT";