diff --git a/migration/iD10/oracle/202301062010_IDEMPIERE-5534.sql b/migration/iD10/oracle/202301062010_IDEMPIERE-5534.sql new file mode 100644 index 0000000000..1d81bbac79 --- /dev/null +++ b/migration/iD10/oracle/202301062010_IDEMPIERE-5534.sql @@ -0,0 +1,10 @@ +-- IDEMPIERE-5534 Make configurable the maximum records in lists +SELECT register_migration_script('202301062010_IDEMPIERE-5534.sql') FROM dual; + +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Jan 6, 2023, 8:10:55 PM CET +INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200215,0,0,TO_TIMESTAMP('2023-01-06 20:10:55','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2023-01-06 20:10:55','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','MAX_ROWS_IN_TABLE_COMBOLIST','10000','Maximum number of records in lists (records in Table/TableDirect). WARNING: increasing this value affects heavily performance and memory, use it wisely. Max possible value is 50,000','D','C','051dafef-b66e-40ec-8a88-215aeb6c0355') +; + diff --git a/migration/iD10/postgresql/202301062010_IDEMPIERE-5534.sql b/migration/iD10/postgresql/202301062010_IDEMPIERE-5534.sql new file mode 100644 index 0000000000..7aa7f1278f --- /dev/null +++ b/migration/iD10/postgresql/202301062010_IDEMPIERE-5534.sql @@ -0,0 +1,7 @@ +-- IDEMPIERE-5534 Make configurable the maximum records in lists +SELECT register_migration_script('202301062010_IDEMPIERE-5534.sql') FROM dual; + +-- Jan 6, 2023, 8:10:55 PM CET +INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200215,0,0,TO_TIMESTAMP('2023-01-06 20:10:55','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2023-01-06 20:10:55','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','MAX_ROWS_IN_TABLE_COMBOLIST','10000','Maximum number of records in lists (records in Table/TableDirect). WARNING: increasing this value affects heavily performance and memory, use it wisely. Max possible value is 50,000','D','C','051dafef-b66e-40ec-8a88-215aeb6c0355') +; + diff --git a/org.adempiere.base/src/org/compiere/model/MLookup.java b/org.adempiere.base/src/org/compiere/model/MLookup.java index 89faaae5f5..1359366391 100644 --- a/org.adempiere.base/src/org/compiere/model/MLookup.java +++ b/org.adempiere.base/src/org/compiere/model/MLookup.java @@ -98,8 +98,6 @@ public final class MLookup extends Lookup implements Serializable public static final String INACTIVE_S = "~"; /** Inactive Marker End */ public static final String INACTIVE_E = "~"; - /** Number of max rows to load */ - private static final int MAX_ROWS = 5000; /** Indicator for Null */ private static Integer MINUS_ONE = Integer.valueOf(-1); @@ -997,6 +995,12 @@ public final class MLookup extends Lookup implements Serializable */ protected void doRun() { + /** Number of max rows to load */ + int MAX_ROWS = MSysConfig.getIntValue(MSysConfig.MAX_ROWS_IN_TABLE_COMBOLIST, 10000, Env.getAD_Client_ID(Env.getCtx())); + if (MAX_ROWS > 50000) { + log.warning("SysConfig MAX_ROWS_IN_TABLE_COMBOLIST set back to maximum allowed value of 50.000"); + MAX_ROWS = 50000; // impose hardcoded limit of 50.000 + } long startTime = System.currentTimeMillis(); StringBuilder sql = new StringBuilder().append(m_info.Query); diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index 5ee2b1903c..3d22456832 100644 --- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java +++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java @@ -44,7 +44,7 @@ public class MSysConfig extends X_AD_SysConfig /** * */ - private static final long serialVersionUID = 6202541582080272987L; + private static final long serialVersionUID = -1169550637760344445L; public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION"; public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS"; @@ -137,6 +137,7 @@ public class MSysConfig extends X_AD_SysConfig public static final String MAIL_SEND_CREDENTIALS = "MAIL_SEND_CREDENTIALS"; public static final String MAX_ACTIVITIES_IN_LIST = "MAX_ACTIVITIES_IN_LIST"; public static final String MAX_RESULTS_PER_SEARCH_IN_DOCUMENT_CONTROLLER = "MAX_RESULTS_PER_SEARCH_IN_DOCUMENT_CONTROLLER"; + public static final String MAX_ROWS_IN_TABLE_COMBOLIST = "MAX_ROWS_IN_TABLE_COMBOLIST"; public static final String MAX_TEXT_LENGTH_ON_GRID_VIEW = "MAX_TEXT_LENGTH_ON_GRID_VIEW"; public static final String MENU_INFOUPDATER_SLEEP_MS = "MENU_INFOUPDATER_SLEEP_MS"; public static final String MESSAGES_AT_TENANT_LEVEL = "MESSAGES_AT_TENANT_LEVEL";