From 3041228c45ca83c5c37277d3233c1ef0995bccbf Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 18 Dec 2019 23:07:01 +0100 Subject: [PATCH] IDEMPIERE-4130 MaxQueryRecords by Tab (FHCA-1115) --- db/ddlutils/oracle/views/AD_TAB_V.sql | 5 +- db/ddlutils/oracle/views/AD_TAB_VT.sql | 5 +- db/ddlutils/postgresql/views/AD_TAB_V.sql | 5 +- db/ddlutils/postgresql/views/AD_TAB_VT.sql | 5 +- .../oracle/201912182232_IDEMPIERE-4130.sql | 122 ++++++++++++++++++ .../201912182232_IDEMPIERE-4130.sql | 119 +++++++++++++++++ .../src/org/compiere/model/GridTab.java | 42 +++++- .../src/org/compiere/model/GridTabVO.java | 7 +- .../src/org/compiere/model/I_AD_Tab.java | 13 ++ .../src/org/compiere/model/X_AD_Tab.java | 22 +++- .../adwindow/AbstractADWindowContent.java | 6 +- .../webui/panel/action/CSVImportAction.java | 5 +- .../adempiere/webui/window/FindWindow.java | 21 +-- 13 files changed, 350 insertions(+), 27 deletions(-) create mode 100644 migration/i7.1/oracle/201912182232_IDEMPIERE-4130.sql create mode 100644 migration/i7.1/postgresql/201912182232_IDEMPIERE-4130.sql diff --git a/db/ddlutils/oracle/views/AD_TAB_V.sql b/db/ddlutils/oracle/views/AD_TAB_V.sql index fae4a4ae4e..1f023c8c2b 100644 --- a/db/ddlutils/oracle/views/AD_TAB_V.sql +++ b/db/ddlutils/oracle/views/AD_TAB_V.sql @@ -6,7 +6,8 @@ CREATE OR REPLACE VIEW AD_TAB_V AD_IMAGE_ID, TABLEVEL, WHERECLAUSE, ORDERBYCLAUSE, COMMITWARNING, READONLYLOGIC, DISPLAYLOGIC, AD_COLUMN_ID, AD_PROCESS_ID, ISSORTTAB, ISINSERTRECORD, ISADVANCEDTAB, AD_COLUMNSORTORDER_ID, AD_COLUMNSORTYESNO_ID, - INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON) + INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON, + MAXQUERYRECORDS) AS SELECT t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, t.Name, t.Description, t.Help, t.SeqNo, t.IsSingleRow, t.HasTree, t.IsInfoTab, tbl.ReplicationType, @@ -16,7 +17,7 @@ SELECT t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, t.Name, t.Description, t.WhereClause, t.OrderByClause, t.CommitWarning, t.ReadOnlyLogic, t.DisplayLogic, t.AD_Column_ID, t.AD_Process_ID, t.IsSortTab, t.IsInsertRecord, t.IsAdvancedTab, t.AD_ColumnSortOrder_ID, t.AD_ColumnSortYesNo_ID, t.Included_Tab_ID, t.Parent_Column_ID, - t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn + t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn, t.MaxQueryRecords FROM AD_Tab t INNER JOIN AD_Table tbl ON (t.AD_Table_ID = tbl.AD_Table_ID) WHERE t.IsActive='Y' diff --git a/db/ddlutils/oracle/views/AD_TAB_VT.sql b/db/ddlutils/oracle/views/AD_TAB_VT.sql index bd05795bb3..0d9163e692 100644 --- a/db/ddlutils/oracle/views/AD_TAB_VT.sql +++ b/db/ddlutils/oracle/views/AD_TAB_VT.sql @@ -6,7 +6,8 @@ CREATE OR REPLACE VIEW AD_TAB_VT ISREADONLY, AD_IMAGE_ID, TABLEVEL, WHERECLAUSE, ORDERBYCLAUSE, COMMITWARNING, READONLYLOGIC, DISPLAYLOGIC, AD_COLUMN_ID, AD_PROCESS_ID, ISSORTTAB, ISINSERTRECORD, ISADVANCEDTAB, AD_COLUMNSORTORDER_ID, AD_COLUMNSORTYESNO_ID, - INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON) + INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON, + MAXQUERYRECORDS) AS SELECT trl.AD_Language, t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, trl.Name, trl.Description, trl.Help, t.SeqNo, t.IsSingleRow, t.HasTree, t.IsInfoTab, tbl.ReplicationType, @@ -16,7 +17,7 @@ SELECT trl.AD_Language, t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, trl.Name, tr t.WhereClause, t.OrderByClause, trl.CommitWarning, t.ReadOnlyLogic, t.DisplayLogic, t.AD_Column_ID, t.AD_Process_ID, t.IsSortTab, t.IsInsertRecord, t.IsAdvancedTab, t.AD_ColumnSortOrder_ID, t.AD_ColumnSortYesNo_ID, t.Included_Tab_ID, t.Parent_Column_ID, - t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn + t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn, t.MaxQueryRecords FROM AD_Tab t INNER JOIN AD_Table tbl ON (t.AD_Table_ID = tbl.AD_Table_ID) INNER JOIN AD_Tab_Trl trl ON (t.AD_Tab_ID = trl.AD_Tab_ID) diff --git a/db/ddlutils/postgresql/views/AD_TAB_V.sql b/db/ddlutils/postgresql/views/AD_TAB_V.sql index bc691b9291..142593968d 100644 --- a/db/ddlutils/postgresql/views/AD_TAB_V.sql +++ b/db/ddlutils/postgresql/views/AD_TAB_V.sql @@ -6,7 +6,8 @@ CREATE OR REPLACE VIEW AD_TAB_V AD_IMAGE_ID, TABLEVEL, WHERECLAUSE, ORDERBYCLAUSE, COMMITWARNING, READONLYLOGIC, DISPLAYLOGIC, AD_COLUMN_ID, AD_PROCESS_ID, ISSORTTAB, ISINSERTRECORD, ISADVANCEDTAB, AD_COLUMNSORTORDER_ID, AD_COLUMNSORTYESNO_ID, - INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON) + INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON, + MAXQUERYRECORDS) AS SELECT t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, t.Name, t.Description, t.Help, t.SeqNo, t.IsSingleRow, t.HasTree, t.IsInfoTab, tbl.ReplicationType, @@ -16,7 +17,7 @@ SELECT t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, t.Name, t.Description, t.WhereClause, t.OrderByClause, t.CommitWarning, t.ReadOnlyLogic, t.DisplayLogic, t.AD_Column_ID, t.AD_Process_ID, t.IsSortTab, t.IsInsertRecord, t.IsAdvancedTab, t.AD_ColumnSortOrder_ID, t.AD_ColumnSortYesNo_ID, t.Included_Tab_ID, t.Parent_Column_ID, - t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn + t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn, t.MaxQueryRecords FROM AD_Tab t INNER JOIN AD_Table tbl ON (t.AD_Table_ID = tbl.AD_Table_ID) WHERE t.IsActive='Y' diff --git a/db/ddlutils/postgresql/views/AD_TAB_VT.sql b/db/ddlutils/postgresql/views/AD_TAB_VT.sql index bd05795bb3..0d9163e692 100644 --- a/db/ddlutils/postgresql/views/AD_TAB_VT.sql +++ b/db/ddlutils/postgresql/views/AD_TAB_VT.sql @@ -6,7 +6,8 @@ CREATE OR REPLACE VIEW AD_TAB_VT ISREADONLY, AD_IMAGE_ID, TABLEVEL, WHERECLAUSE, ORDERBYCLAUSE, COMMITWARNING, READONLYLOGIC, DISPLAYLOGIC, AD_COLUMN_ID, AD_PROCESS_ID, ISSORTTAB, ISINSERTRECORD, ISADVANCEDTAB, AD_COLUMNSORTORDER_ID, AD_COLUMNSORTYESNO_ID, - INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON) + INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON, + MAXQUERYRECORDS) AS SELECT trl.AD_Language, t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, trl.Name, trl.Description, trl.Help, t.SeqNo, t.IsSingleRow, t.HasTree, t.IsInfoTab, tbl.ReplicationType, @@ -16,7 +17,7 @@ SELECT trl.AD_Language, t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, trl.Name, tr t.WhereClause, t.OrderByClause, trl.CommitWarning, t.ReadOnlyLogic, t.DisplayLogic, t.AD_Column_ID, t.AD_Process_ID, t.IsSortTab, t.IsInsertRecord, t.IsAdvancedTab, t.AD_ColumnSortOrder_ID, t.AD_ColumnSortYesNo_ID, t.Included_Tab_ID, t.Parent_Column_ID, - t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn + t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn, t.MaxQueryRecords FROM AD_Tab t INNER JOIN AD_Table tbl ON (t.AD_Table_ID = tbl.AD_Table_ID) INNER JOIN AD_Tab_Trl trl ON (t.AD_Tab_ID = trl.AD_Tab_ID) diff --git a/migration/i7.1/oracle/201912182232_IDEMPIERE-4130.sql b/migration/i7.1/oracle/201912182232_IDEMPIERE-4130.sql new file mode 100644 index 0000000000..a22e7e3e42 --- /dev/null +++ b/migration/i7.1/oracle/201912182232_IDEMPIERE-4130.sql @@ -0,0 +1,122 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-4130 MaxQueryRecords by Tab (FHCA-1115) +-- Dec 18, 2019, 10:20:27 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (214163,0,'Max Query Records','If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records','Enter the number of records a user will be able to query to avoid unnecessary system load. If 0, no restrictions are imposed.',106,'MaxQueryRecords','0',10,'N','N','N','N','N',0,'N',11,0,0,'Y',TO_DATE('2019-12-18 22:20:26','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-12-18 22:20:26','YYYY-MM-DD HH24:MI:SS'),100,2854,'Y','N','D','N','N','N','Y','33a4790c-3b91-474d-9c36-0cc85af4b700','Y',0,'N','N','N','N') +; + +-- Dec 18, 2019, 10:20:44 PM CET +ALTER TABLE AD_Tab ADD MaxQueryRecords NUMBER(10) DEFAULT 0 +; + +-- Dec 18, 2019, 10:21:56 PM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (206373,'Max Query Records','If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records','Enter the number of records a user will be able to query to avoid unnecessary system load. If 0, no restrictions are imposed.',106,214163,'Y',10,350,'N','N','N','N',0,0,'Y',TO_DATE('2019-12-18 22:21:56','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-12-18 22:21:56','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','27fb6d6a-0562-4de7-a9a8-7772daca44a0','Y',330,2) +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=230, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206373 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=240, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11265 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=250, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=929 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=260, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11998 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=270, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=271 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=280, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11266 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=290, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1548 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=300, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1550 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=310, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1549 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=320, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4956 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=330, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201811 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=340, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5131 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=350, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3205 +; + +CREATE OR REPLACE VIEW AD_TAB_V +(AD_TAB_ID, AD_WINDOW_ID, AD_TABLE_ID, NAME, DESCRIPTION, + HELP, SEQNO, ISSINGLEROW, HASTREE, ISINFOTAB, + REPLICATIONTYPE, TABLENAME, ACCESSLEVEL, ISSECURITYENABLED, ISDELETEABLE, + ISHIGHVOLUME, ISVIEW, HASASSOCIATION, ISTRANSLATIONTAB, ISREADONLY, + AD_IMAGE_ID, TABLEVEL, WHERECLAUSE, ORDERBYCLAUSE, COMMITWARNING, + READONLYLOGIC, DISPLAYLOGIC, AD_COLUMN_ID, AD_PROCESS_ID, ISSORTTAB, + ISINSERTRECORD, ISADVANCEDTAB, AD_COLUMNSORTORDER_ID, AD_COLUMNSORTYESNO_ID, + INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON, + MAXQUERYRECORDS) +AS +SELECT t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, t.Name, t.Description, + t.Help, t.SeqNo, t.IsSingleRow, t.HasTree, t.IsInfoTab, tbl.ReplicationType, + tbl.TableName, tbl.AccessLevel, tbl.IsSecurityEnabled, tbl.IsDeleteable, + tbl.IsHighVolume, tbl.IsView, cast('N' as char) AS HasAssociation, -- compatibility + t.IsTranslationTab, t.IsReadOnly, t.AD_Image_ID, t.TabLevel, + t.WhereClause, t.OrderByClause, t.CommitWarning, t.ReadOnlyLogic, t.DisplayLogic, + t.AD_Column_ID, t.AD_Process_ID, t.IsSortTab, t.IsInsertRecord, t.IsAdvancedTab, + t.AD_ColumnSortOrder_ID, t.AD_ColumnSortYesNo_ID, t.Included_Tab_ID, t.Parent_Column_ID, + t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn, t.MaxQueryRecords +FROM AD_Tab t + INNER JOIN AD_Table tbl ON (t.AD_Table_ID = tbl.AD_Table_ID) +WHERE t.IsActive='Y' + AND tbl.IsActive='Y'; + +CREATE OR REPLACE VIEW AD_TAB_VT +(AD_LANGUAGE, AD_TAB_ID, AD_WINDOW_ID, AD_TABLE_ID, NAME, + DESCRIPTION, HELP, SEQNO, ISSINGLEROW, HASTREE, + ISINFOTAB, REPLICATIONTYPE, TABLENAME, ACCESSLEVEL, ISSECURITYENABLED, + ISDELETEABLE, ISHIGHVOLUME, ISVIEW, HASASSOCIATION, ISTRANSLATIONTAB, + ISREADONLY, AD_IMAGE_ID, TABLEVEL, WHERECLAUSE, ORDERBYCLAUSE, + COMMITWARNING, READONLYLOGIC, DISPLAYLOGIC, AD_COLUMN_ID, AD_PROCESS_ID, + ISSORTTAB, ISINSERTRECORD, ISADVANCEDTAB, AD_COLUMNSORTORDER_ID, AD_COLUMNSORTYESNO_ID, + INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON, + MAXQUERYRECORDS) +AS +SELECT trl.AD_Language, t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, trl.Name, trl.Description, + trl.Help, t.SeqNo, t.IsSingleRow, t.HasTree, t.IsInfoTab, tbl.ReplicationType, + tbl.TableName, tbl.AccessLevel, tbl.IsSecurityEnabled, tbl.IsDeleteable, + tbl.IsHighVolume, tbl.IsView, cast('N' as char) AS HasAssociation, -- compatibility + t.IsTranslationTab, t.IsReadOnly, t.AD_Image_ID, t.TabLevel, + t.WhereClause, t.OrderByClause, trl.CommitWarning, t.ReadOnlyLogic, t.DisplayLogic, + t.AD_Column_ID, t.AD_Process_ID, t.IsSortTab, t.IsInsertRecord, t.IsAdvancedTab, + t.AD_ColumnSortOrder_ID, t.AD_ColumnSortYesNo_ID, t.Included_Tab_ID, t.Parent_Column_ID, + t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn, t.MaxQueryRecords +FROM AD_Tab t + INNER JOIN AD_Table tbl ON (t.AD_Table_ID = tbl.AD_Table_ID) + INNER JOIN AD_Tab_Trl trl ON (t.AD_Tab_ID = trl.AD_Tab_ID) +WHERE t.IsActive='Y' + AND tbl.IsActive='Y'; + +SELECT register_migration_script('201912182232_IDEMPIERE-4130.sql') FROM dual +; + diff --git a/migration/i7.1/postgresql/201912182232_IDEMPIERE-4130.sql b/migration/i7.1/postgresql/201912182232_IDEMPIERE-4130.sql new file mode 100644 index 0000000000..83b0f45646 --- /dev/null +++ b/migration/i7.1/postgresql/201912182232_IDEMPIERE-4130.sql @@ -0,0 +1,119 @@ +-- IDEMPIERE-4130 MaxQueryRecords by Tab (FHCA-1115) +-- Dec 18, 2019, 10:20:27 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (214163,0,'Max Query Records','If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records','Enter the number of records a user will be able to query to avoid unnecessary system load. If 0, no restrictions are imposed.',106,'MaxQueryRecords','0',10,'N','N','N','N','N',0,'N',11,0,0,'Y',TO_TIMESTAMP('2019-12-18 22:20:26','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-12-18 22:20:26','YYYY-MM-DD HH24:MI:SS'),100,2854,'Y','N','D','N','N','N','Y','33a4790c-3b91-474d-9c36-0cc85af4b700','Y',0,'N','N','N','N') +; + +-- Dec 18, 2019, 10:20:44 PM CET +ALTER TABLE AD_Tab ADD COLUMN MaxQueryRecords NUMERIC(10) DEFAULT '0' +; + +-- Dec 18, 2019, 10:21:56 PM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (206373,'Max Query Records','If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records','Enter the number of records a user will be able to query to avoid unnecessary system load. If 0, no restrictions are imposed.',106,214163,'Y',10,350,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2019-12-18 22:21:56','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-12-18 22:21:56','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','27fb6d6a-0562-4de7-a9a8-7772daca44a0','Y',330,2) +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=230, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206373 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=240, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11265 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=250, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=929 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=260, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11998 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=270, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=271 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=280, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11266 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=290, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1548 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=300, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1550 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=310, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1549 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=320, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4956 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=330, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201811 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=340, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5131 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=350, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3205 +; + +CREATE OR REPLACE VIEW AD_TAB_V +(AD_TAB_ID, AD_WINDOW_ID, AD_TABLE_ID, NAME, DESCRIPTION, + HELP, SEQNO, ISSINGLEROW, HASTREE, ISINFOTAB, + REPLICATIONTYPE, TABLENAME, ACCESSLEVEL, ISSECURITYENABLED, ISDELETEABLE, + ISHIGHVOLUME, ISVIEW, HASASSOCIATION, ISTRANSLATIONTAB, ISREADONLY, + AD_IMAGE_ID, TABLEVEL, WHERECLAUSE, ORDERBYCLAUSE, COMMITWARNING, + READONLYLOGIC, DISPLAYLOGIC, AD_COLUMN_ID, AD_PROCESS_ID, ISSORTTAB, + ISINSERTRECORD, ISADVANCEDTAB, AD_COLUMNSORTORDER_ID, AD_COLUMNSORTYESNO_ID, + INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON, + MAXQUERYRECORDS) +AS +SELECT t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, t.Name, t.Description, + t.Help, t.SeqNo, t.IsSingleRow, t.HasTree, t.IsInfoTab, tbl.ReplicationType, + tbl.TableName, tbl.AccessLevel, tbl.IsSecurityEnabled, tbl.IsDeleteable, + tbl.IsHighVolume, tbl.IsView, cast('N' as char) AS HasAssociation, -- compatibility + t.IsTranslationTab, t.IsReadOnly, t.AD_Image_ID, t.TabLevel, + t.WhereClause, t.OrderByClause, t.CommitWarning, t.ReadOnlyLogic, t.DisplayLogic, + t.AD_Column_ID, t.AD_Process_ID, t.IsSortTab, t.IsInsertRecord, t.IsAdvancedTab, + t.AD_ColumnSortOrder_ID, t.AD_ColumnSortYesNo_ID, t.Included_Tab_ID, t.Parent_Column_ID, + t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn, t.MaxQueryRecords +FROM AD_Tab t + INNER JOIN AD_Table tbl ON (t.AD_Table_ID = tbl.AD_Table_ID) +WHERE t.IsActive='Y' + AND tbl.IsActive='Y'; + +CREATE OR REPLACE VIEW AD_TAB_VT +(AD_LANGUAGE, AD_TAB_ID, AD_WINDOW_ID, AD_TABLE_ID, NAME, + DESCRIPTION, HELP, SEQNO, ISSINGLEROW, HASTREE, + ISINFOTAB, REPLICATIONTYPE, TABLENAME, ACCESSLEVEL, ISSECURITYENABLED, + ISDELETEABLE, ISHIGHVOLUME, ISVIEW, HASASSOCIATION, ISTRANSLATIONTAB, + ISREADONLY, AD_IMAGE_ID, TABLEVEL, WHERECLAUSE, ORDERBYCLAUSE, + COMMITWARNING, READONLYLOGIC, DISPLAYLOGIC, AD_COLUMN_ID, AD_PROCESS_ID, + ISSORTTAB, ISINSERTRECORD, ISADVANCEDTAB, AD_COLUMNSORTORDER_ID, AD_COLUMNSORTYESNO_ID, + INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON, + MAXQUERYRECORDS) +AS +SELECT trl.AD_Language, t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, trl.Name, trl.Description, + trl.Help, t.SeqNo, t.IsSingleRow, t.HasTree, t.IsInfoTab, tbl.ReplicationType, + tbl.TableName, tbl.AccessLevel, tbl.IsSecurityEnabled, tbl.IsDeleteable, + tbl.IsHighVolume, tbl.IsView, cast('N' as char) AS HasAssociation, -- compatibility + t.IsTranslationTab, t.IsReadOnly, t.AD_Image_ID, t.TabLevel, + t.WhereClause, t.OrderByClause, trl.CommitWarning, t.ReadOnlyLogic, t.DisplayLogic, + t.AD_Column_ID, t.AD_Process_ID, t.IsSortTab, t.IsInsertRecord, t.IsAdvancedTab, + t.AD_ColumnSortOrder_ID, t.AD_ColumnSortYesNo_ID, t.Included_Tab_ID, t.Parent_Column_ID, + t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn, t.MaxQueryRecords +FROM AD_Tab t + INNER JOIN AD_Table tbl ON (t.AD_Table_ID = tbl.AD_Table_ID) + INNER JOIN AD_Tab_Trl trl ON (t.AD_Tab_ID = trl.AD_Tab_ID) +WHERE t.IsActive='Y' + AND tbl.IsActive='Y'; + +SELECT register_migration_script('201912182232_IDEMPIERE-4130.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/model/GridTab.java b/org.adempiere.base/src/org/compiere/model/GridTab.java index cb5df676a3..507b26de23 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTab.java +++ b/org.adempiere.base/src/org/compiere/model/GridTab.java @@ -112,7 +112,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable /** * */ - private static final long serialVersionUID = -3115353522698098211L; + private static final long serialVersionUID = 5057703093968124177L; public static final String DEFAULT_STATUS_MESSAGE = "NavigateOrUpdate"; @@ -3392,4 +3392,44 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable public void setCalloutUI(ICalloutUI calloutUI) { this.calloutUI = calloutUI; } + + /** Get Max Query Records. + * @return If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records + */ + public int getMaxQueryRecords() { + // minimum between AD_Tab.MaxQueryRecords and AD_Role.MaxQueryRecords + int roleMaxQueryRecords = MRole.getDefault().getMaxQueryRecords(); + int tabMaxQueryRecords = m_vo.MaxQueryRecords; + if (roleMaxQueryRecords > 0 && roleMaxQueryRecords < tabMaxQueryRecords) + tabMaxQueryRecords = roleMaxQueryRecords; + return tabMaxQueryRecords; + } + + /** + * Require Query + * @param noRecords records + * @return true if query required + */ + public boolean isQueryRequire (int noRecords) + { + if (noRecords < 2) + return false; + int max = getMaxQueryRecords(); + if (max > 0 && noRecords > max) + return true; + int qu = MRole.getDefault().getConfirmQueryRecords(); + return (noRecords > qu); + } // isQueryRequire + + /** + * Over max Query + * @param noRecords records + * @return true if over max query + */ + public boolean isQueryMax (int noRecords) + { + int max = getMaxQueryRecords(); + return max > 0 && noRecords > max; + } // isQueryMax + } // GridTab diff --git a/org.adempiere.base/src/org/compiere/model/GridTabVO.java b/org.adempiere.base/src/org/compiere/model/GridTabVO.java index fae6f358d1..e2e354f020 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTabVO.java +++ b/org.adempiere.base/src/org/compiere/model/GridTabVO.java @@ -41,7 +41,7 @@ public class GridTabVO implements Evaluatee, Serializable /** * */ - private static final long serialVersionUID = -1353087123788176368L; + private static final long serialVersionUID = 9091214632840854495L; /************************************************************************** * Create MTab VO @@ -206,6 +206,8 @@ public class GridTabVO implements Evaluatee, Serializable vo.TreeDisplayedOn = rs.getString("TreeDisplayedOn"); + vo.MaxQueryRecords = rs.getInt("MaxQueryRecords"); + vo.AD_Table_ID = rs.getInt("AD_Table_ID"); vo.TableName = rs.getString("TableName"); if (rs.getString("IsView").equals("Y")) @@ -436,6 +438,8 @@ public class GridTabVO implements Evaluatee, Serializable public boolean HasTree = false; /** Tree displayed on */ public String TreeDisplayedOn = ""; + /** Max Query Records */ + public int MaxQueryRecords = 0; /** Table */ public int AD_Table_ID; /** Table UUID */ @@ -553,6 +557,7 @@ public class GridTabVO implements Evaluatee, Serializable clone.IsInsertRecord = IsInsertRecord; clone.HasTree = HasTree; clone.TreeDisplayedOn = TreeDisplayedOn; + clone.MaxQueryRecords = MaxQueryRecords; clone.AD_Table_ID = AD_Table_ID; clone.AD_Column_ID = AD_Column_ID; clone.Parent_Column_ID = Parent_Column_ID; diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_Tab.java b/org.adempiere.base/src/org/compiere/model/I_AD_Tab.java index 3ae74c404a..7667f99fed 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_Tab.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_Tab.java @@ -428,6 +428,19 @@ public interface I_AD_Tab */ public boolean isTranslationTab(); + /** Column name MaxQueryRecords */ + public static final String COLUMNNAME_MaxQueryRecords = "MaxQueryRecords"; + + /** Set Max Query Records. + * If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records + */ + public void setMaxQueryRecords (int MaxQueryRecords); + + /** Get Max Query Records. + * If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records + */ + public int getMaxQueryRecords(); + /** Column name Name */ public static final String COLUMNNAME_Name = "Name"; diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_Tab.java b/org.adempiere.base/src/org/compiere/model/X_AD_Tab.java index c2966aa6c6..f2b826c04f 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_Tab.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_Tab.java @@ -30,7 +30,7 @@ public class X_AD_Tab extends PO implements I_AD_Tab, I_Persistent /** * */ - private static final long serialVersionUID = 20191121L; + private static final long serialVersionUID = 20191218L; /** Standard Constructor */ public X_AD_Tab (Properties ctx, int AD_Tab_ID, String trxName) @@ -674,6 +674,26 @@ public class X_AD_Tab extends PO implements I_AD_Tab, I_Persistent return false; } + /** Set Max Query Records. + @param MaxQueryRecords + If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records + */ + public void setMaxQueryRecords (int MaxQueryRecords) + { + set_Value (COLUMNNAME_MaxQueryRecords, Integer.valueOf(MaxQueryRecords)); + } + + /** Get Max Query Records. + @return If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records + */ + public int getMaxQueryRecords () + { + Integer ii = (Integer)get_Value(COLUMNNAME_MaxQueryRecords); + if (ii == null) + return 0; + return ii.intValue(); + } + /** Set Name. @param Name Alphanumeric identifier of the entity diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java index 649dff6613..a12634a3e5 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java @@ -657,7 +657,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements } private void initFirstTabpanel() { - adTabbox.getSelectedTabpanel().query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); + adTabbox.getSelectedTabpanel().query(m_onlyCurrentRows, m_onlyCurrentDays, adTabbox.getSelectedGridTab().getMaxQueryRecords()); adTabbox.getSelectedTabpanel().activate(true); Events.echoEvent(new Event(ADTabpanel.ON_POST_INIT_EVENT, adTabbox.getSelectedTabpanel())); } @@ -705,7 +705,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements mTab.getTableName(), MRole.SQL_NOTQUALIFIED, MRole.SQL_RO); int no = DB.getSQLValue(null, finalSQL.toString()); // - require = MRole.getDefault().isQueryRequire(no); + require = mTab.isQueryRequire(no); } // Show Query if (require) @@ -2060,7 +2060,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements { m_onlyCurrentRows = false; // search history too adTabbox.getSelectedGridTab().setQuery(query); - adTabbox.getSelectedTabpanel().query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); // autoSize + adTabbox.getSelectedTabpanel().query(m_onlyCurrentRows, m_onlyCurrentDays, adTabbox.getSelectedGridTab().getMaxQueryRecords()); // autoSize } if (findWindow.isCreateNew()) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/CSVImportAction.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/CSVImportAction.java index 4aeb7723bd..66eedf00a6 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/CSVImportAction.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/CSVImportAction.java @@ -58,7 +58,6 @@ import org.adempiere.webui.util.ZKUpdateUtil; import org.compiere.model.GridTab; import org.compiere.model.MImportTemplate; import org.compiere.model.MQuery; -import org.compiere.model.MRole; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; @@ -345,14 +344,14 @@ public class CSVImportAction implements EventListener if (query != null) { query.addRestriction("1=1"); panel.getActiveGridTab().setQuery(query); - panel.getADTab().getSelectedTabpanel().query(false, 0, MRole.getDefault().getMaxQueryRecords()); + panel.getADTab().getSelectedTabpanel().query(false, 0, panel.getActiveGridTab().getMaxQueryRecords()); } panel.getActiveGridTab().dataRefresh(false); if (detailQuery != null){ detailQuery.addRestriction("1=1"); panel.getADTab().getSelectedDetailADTabpanel().getGridTab().setQuery(detailQuery); - panel.getADTab().getSelectedDetailADTabpanel().query(false, 0, MRole.getDefault().getMaxQueryRecords()); + panel.getADTab().getSelectedDetailADTabpanel().query(false, 0, panel.getActiveGridTab().getMaxQueryRecords()); panel.getADTab().getSelectedDetailADTabpanel().getGridTab().dataRefresh(false); } } catch (Exception e) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java index ddf269e5f8..451b0a3221 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java @@ -127,16 +127,15 @@ import org.zkoss.zul.Vlayout; */ public class FindWindow extends Window implements EventListener, ValueChangeListener, DialogEvents { + /** + * + */ + private static final long serialVersionUID = 2958810511464597943L; private static final String FIND_ROW_EDITOR = "find.row.editor"; private static final String FIND_ROW_EDITOR_TO = "find.row.editor.to"; - /** - * - */ - private static final long serialVersionUID = -7374857601424061640L; - // values and label for history combo private static final String HISTORY_DAY_ALL = "All"; private static final String HISTORY_DAY_YEAR = "Year"; @@ -174,6 +173,8 @@ public class FindWindow extends Window implements EventListener, ValueCha private String m_whereExtended; /** Search Fields */ private GridField[] m_findFields; + /** The Tab */ + private GridTab m_gridTab = null; /** Resulting query */ private MQuery m_query = null; /** Is cancel ? */ @@ -268,6 +269,8 @@ public class FindWindow extends Window implements EventListener, ValueCha m_tableName = tableName; m_whereExtended = whereExtended; m_findFields = findFields; + if (findFields != null && findFields.length > 0) + m_gridTab = findFields[0].getGridTab(); m_sNew = "** ".concat(Msg.getMsg(Env.getCtx(), "New Query")).concat(" **"); m_AD_Tab_ID = adTabId; m_minRecords = minRecords; @@ -2357,15 +2360,14 @@ public class FindWindow extends Window implements EventListener, ValueCha rs = null; stmt = null; } - MRole role = MRole.getDefault(); // No Records /* if (m_total == 0 && alertZeroRecords) FDialog.warn(m_targetWindowNo, this, "FindZeroRecords");*/ // More then allowed - if (query != null && role.isQueryMax(m_total)) + if (m_gridTab != null && query != null && m_gridTab.isQueryMax(m_total)) { FDialog.error(m_targetWindowNo, this, "FindOverMax", - m_total + " > " + role.getMaxQueryRecords()); + m_total + " > " + m_gridTab.getMaxQueryRecords()); m_total = 0; // return 0 if more then allowed - teo_sarca [ 1708717 ] } else @@ -2553,8 +2555,7 @@ public class FindWindow extends Window implements EventListener, ValueCha */ public MQuery getQuery() { - MRole role = MRole.getDefault(); - if (role.isQueryMax(getTotalRecords()) && !m_isCancel) + if (m_gridTab != null && m_gridTab.isQueryMax(getTotalRecords()) && !m_isCancel) { m_query = MQuery.getNoRecordQuery (m_tableName, false); m_total = 0;