IDEMPIERE-3799 Avoid users re-running a process that is already being processed
This commit is contained in:
parent
9c88349bb7
commit
0619c3d452
|
@ -0,0 +1,124 @@
|
|||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- Oct 2, 2018 6:52:02 PM CEST
|
||||
-- IDEMPIERE-3799 Avoid users re-running a report that is already being processed
|
||||
INSERT INTO AD_Element (AD_Element_ID,ColumnName,Help,Updated,Name,Description,PrintName,AD_Element_UU,IsActive,Created,CreatedBy,UpdatedBy,AD_Client_ID,EntityType,AD_Org_ID) VALUES (203269,'AllowMultipleExecution','1. Disallow multiple executions: Never allow to execute a process that is already running.
|
||||
2. Disallow multiple executions with the same parameters: Allow to execute a process multiple times with different parameters.
|
||||
3. When blank: Always allow to execute a process multiple times.',TO_DATE('2018-10-02 18:52:01','YYYY-MM-DD HH24:MI:SS'),'Multiple Execution','Allow or disallow executing a process/report multiple times.','Multiple Execution','f8a79725-bf46-4682-aba8-4c1191ba9ddc','Y',TO_DATE('2018-10-02 18:52:01','YYYY-MM-DD HH24:MI:SS'),100,100,0,'D',0)
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 6:53:12 PM CEST
|
||||
INSERT INTO AD_Reference (AD_Reference_ID,Name,AD_Reference_UU,IsOrderByValue,Description,ValidationType,VFormat,Updated,IsActive,CreatedBy,UpdatedBy,AD_Client_ID,Created,EntityType,AD_Org_ID) VALUES (200158,'AD_Process Multiple Execution','e08cde11-cfd5-45e8-9813-0e3005269c97','N','Multiple execution rule list','L',NULL,TO_DATE('2018-10-02 18:53:11','YYYY-MM-DD HH24:MI:SS'),'Y',100,100,0,TO_DATE('2018-10-02 18:53:11','YYYY-MM-DD HH24:MI:SS'),'D',0)
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 6:53:40 PM CEST
|
||||
INSERT INTO AD_Ref_List (AD_Ref_List_ID,Description,AD_Ref_List_UU,Name,IsActive,CreatedBy,UpdatedBy,AD_Client_ID,Created,Updated,EntityType,AD_Reference_ID,Value,AD_Org_ID) VALUES (200440,'Never allow to execute a process that is already running','cd374cc2-e928-4e76-a376-9021ec5f31e7','Disallow multiple executions','Y',100,100,0,TO_DATE('2018-10-02 18:53:39','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-10-02 18:53:39','YYYY-MM-DD HH24:MI:SS'),'D',200158,'N',0)
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 6:53:58 PM CEST
|
||||
INSERT INTO AD_Ref_List (AD_Ref_List_ID,Description,AD_Ref_List_UU,Name,IsActive,CreatedBy,UpdatedBy,AD_Client_ID,Created,Updated,EntityType,AD_Reference_ID,Value,AD_Org_ID) VALUES (200441,'Allow to execute a process multiple times with different parameters.','1dcb3178-d9f5-449e-9592-5e6e29453cf1','Disallow multiple executions with the same parameters','Y',100,100,0,TO_DATE('2018-10-02 18:53:57','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-10-02 18:53:57','YYYY-MM-DD HH24:MI:SS'),'D',200158,'P',0)
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 6:58:23 PM CEST
|
||||
INSERT INTO AD_Column (AD_Column_ID,IsSyncDatabase,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,Updated,IsUpdateable,ColumnName,Description,DefaultValue,Help,Name,IsAllowCopy,IsActive,CreatedBy,UpdatedBy,IsAlwaysUpdateable,AD_Client_ID,Created,IsSecure,EntityType,IsEncrypted,AD_Element_ID,AD_Reference_Value_ID,AD_Table_ID,AD_Reference_ID,IsToolbarButton,AD_Org_ID) VALUES (213699,'N',0,'N','N','N',0,'N',1,'N','N','N','Y','2996d521-d5f3-4b8f-b93d-fab92a71b406',TO_DATE('2018-10-02 18:58:23','YYYY-MM-DD HH24:MI:SS'),'Y','AllowMultipleExecution','Allow or disallow executing a process/report multiple times.','P','1. Disallow multiple executions: Never allow to execute a process that is already running.
|
||||
2. Disallow multiple executions with the same parameters: Allow to execute a process multiple times with different parameters.
|
||||
3. When blank: Always allow to execute a process multiple times.','Multiple Execution','Y','Y',100,100,'Y',0,TO_DATE('2018-10-02 18:58:23','YYYY-MM-DD HH24:MI:SS'),'N','D','N',203269,200158,284,17,'N',0)
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 6:58:37 PM CEST
|
||||
ALTER TABLE AD_Process ADD AllowMultipleExecution CHAR(1) DEFAULT 'P'
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:00:24 PM CEST
|
||||
INSERT INTO AD_Field (SortNo,AD_Field_ID,IsEncrypted,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,IsReadOnly,Help,Updated,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,CreatedBy,UpdatedBy,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,Created,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,AD_Column_ID,EntityType,AD_Tab_ID,AD_Org_ID) VALUES (0,205837,'N',0,'N','N',270,'Y','N','1. Disallow multiple executions: Never allow to execute a process that is already running.
|
||||
2. Disallow multiple executions with the same parameters: Allow to execute a process multiple times with different parameters.
|
||||
3. When blank: Always allow to execute a process multiple times.',TO_DATE('2018-10-02 19:00:23','YYYY-MM-DD HH24:MI:SS'),'Allow or disallow executing a process/report multiple times.','Multiple Execution','f4a81a10-57ca-459f-bb21-a17812a75381','Y','N',100,100,'Y','Y',240,1,'N',0,TO_DATE('2018-10-02 19:00:23','YYYY-MM-DD HH24:MI:SS'),1,1,'N','N',213699,'D',245,0)
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=100, AD_Val_Rule_ID=NULL, IsDisplayed='Y', XPosition=4, ColumnSpan=2, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205837
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=110, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4540
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=120, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205836
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=130, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2571
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=140, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12100
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=150, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3703
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=160, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2534
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=170, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10235
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=180, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=56497
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=190, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3278
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=200, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3219
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=210, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5849
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=220, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50155
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=230, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5850
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=240, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5851
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=250, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50156
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=260, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201809
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=270, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57342
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:05:07 PM CEST
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,AD_Message_UU,Updated,IsActive,CreatedBy,AD_Client_ID,Created,UpdatedBy,EntityType,Value,AD_Org_ID) VALUES ('I','Another instance of this process is already running, please wait until it finishes to run it again.',200483,'db33903f-5eb2-4585-be6f-9a6bcae3940e',TO_DATE('2018-10-02 19:05:06','YYYY-MM-DD HH24:MI:SS'),'Y',100,0,TO_DATE('2018-10-02 19:05:06','YYYY-MM-DD HH24:MI:SS'),100,'D','ProcessAlreadyRunning',0)
|
||||
;
|
||||
|
||||
-- Oct 4, 2018 4:52:16 PM CEST
|
||||
UPDATE AD_Process SET allowMultipleExecution = NULL WHERE isReport ='N'
|
||||
;
|
||||
|
||||
-- Oct 4, 2018 4:52:16 PM CEST
|
||||
UPDATE AD_Process SET allowMultipleExecution = 'P' WHERE isReport ='Y'
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201810041316_IDEMPIERE-3799.sql') FROM dual
|
||||
;
|
|
@ -0,0 +1,121 @@
|
|||
-- Oct 2, 2018 6:52:02 PM CEST
|
||||
-- IDEMPIERE-3799 Avoid users re-running a report that is already being processed
|
||||
INSERT INTO AD_Element (AD_Element_ID,ColumnName,Help,Updated,Name,Description,PrintName,AD_Element_UU,IsActive,Created,CreatedBy,UpdatedBy,AD_Client_ID,EntityType,AD_Org_ID) VALUES (203269,'AllowMultipleExecution','1. Disallow multiple executions: Never allow to execute a process that is already running.
|
||||
2. Disallow multiple executions with the same parameters: Allow to execute a process multiple times with different parameters.
|
||||
3. When blank: Always allow to execute a process multiple times.',TO_TIMESTAMP('2018-10-02 18:52:01','YYYY-MM-DD HH24:MI:SS'),'Multiple Execution','Allow or disallow executing a process/report multiple times.','Multiple Execution','f8a79725-bf46-4682-aba8-4c1191ba9ddc','Y',TO_TIMESTAMP('2018-10-02 18:52:01','YYYY-MM-DD HH24:MI:SS'),100,100,0,'D',0)
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 6:53:12 PM CEST
|
||||
INSERT INTO AD_Reference (AD_Reference_ID,Name,AD_Reference_UU,IsOrderByValue,Description,ValidationType,VFormat,Updated,IsActive,CreatedBy,UpdatedBy,AD_Client_ID,Created,EntityType,AD_Org_ID) VALUES (200158,'AD_Process Multiple Execution','e08cde11-cfd5-45e8-9813-0e3005269c97','N','Multiple execution rule list','L',NULL,TO_TIMESTAMP('2018-10-02 18:53:11','YYYY-MM-DD HH24:MI:SS'),'Y',100,100,0,TO_TIMESTAMP('2018-10-02 18:53:11','YYYY-MM-DD HH24:MI:SS'),'D',0)
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 6:53:40 PM CEST
|
||||
INSERT INTO AD_Ref_List (AD_Ref_List_ID,Description,AD_Ref_List_UU,Name,IsActive,CreatedBy,UpdatedBy,AD_Client_ID,Created,Updated,EntityType,AD_Reference_ID,Value,AD_Org_ID) VALUES (200440,'Never allow to execute a process that is already running','cd374cc2-e928-4e76-a376-9021ec5f31e7','Disallow multiple executions','Y',100,100,0,TO_TIMESTAMP('2018-10-02 18:53:39','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-10-02 18:53:39','YYYY-MM-DD HH24:MI:SS'),'D',200158,'N',0)
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 6:53:58 PM CEST
|
||||
INSERT INTO AD_Ref_List (AD_Ref_List_ID,Description,AD_Ref_List_UU,Name,IsActive,CreatedBy,UpdatedBy,AD_Client_ID,Created,Updated,EntityType,AD_Reference_ID,Value,AD_Org_ID) VALUES (200441,'Allow to execute a process multiple times with different parameters.','1dcb3178-d9f5-449e-9592-5e6e29453cf1','Disallow multiple executions with the same parameters','Y',100,100,0,TO_TIMESTAMP('2018-10-02 18:53:57','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-10-02 18:53:57','YYYY-MM-DD HH24:MI:SS'),'D',200158,'P',0)
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 6:58:23 PM CEST
|
||||
INSERT INTO AD_Column (AD_Column_ID,IsSyncDatabase,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,Updated,IsUpdateable,ColumnName,Description,DefaultValue,Help,Name,IsAllowCopy,IsActive,CreatedBy,UpdatedBy,IsAlwaysUpdateable,AD_Client_ID,Created,IsSecure,EntityType,IsEncrypted,AD_Element_ID,AD_Reference_Value_ID,AD_Table_ID,AD_Reference_ID,IsToolbarButton,AD_Org_ID) VALUES (213699,'N',0,'N','N','N',0,'N',1,'N','N','N','Y','2996d521-d5f3-4b8f-b93d-fab92a71b406',TO_TIMESTAMP('2018-10-02 18:58:23','YYYY-MM-DD HH24:MI:SS'),'Y','AllowMultipleExecution','Allow or disallow executing a process/report multiple times.','P','1. Disallow multiple executions: Never allow to execute a process that is already running.
|
||||
2. Disallow multiple executions with the same parameters: Allow to execute a process multiple times with different parameters.
|
||||
3. When blank: Always allow to execute a process multiple times.','Multiple Execution','Y','Y',100,100,'Y',0,TO_TIMESTAMP('2018-10-02 18:58:23','YYYY-MM-DD HH24:MI:SS'),'N','D','N',203269,200158,284,17,'N',0)
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 6:58:37 PM CEST
|
||||
ALTER TABLE AD_Process ADD COLUMN AllowMultipleExecution CHAR(1) DEFAULT 'P'
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:00:24 PM CEST
|
||||
INSERT INTO AD_Field (SortNo,AD_Field_ID,IsEncrypted,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,IsReadOnly,Help,Updated,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,CreatedBy,UpdatedBy,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,Created,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,AD_Column_ID,EntityType,AD_Tab_ID,AD_Org_ID) VALUES (0,205837,'N',0,'N','N',270,'Y','N','1. Disallow multiple executions: Never allow to execute a process that is already running.
|
||||
2. Disallow multiple executions with the same parameters: Allow to execute a process multiple times with different parameters.
|
||||
3. When blank: Always allow to execute a process multiple times.',TO_TIMESTAMP('2018-10-02 19:00:23','YYYY-MM-DD HH24:MI:SS'),'Allow or disallow executing a process/report multiple times.','Multiple Execution','f4a81a10-57ca-459f-bb21-a17812a75381','Y','N',100,100,'Y','Y',240,1,'N',0,TO_TIMESTAMP('2018-10-02 19:00:23','YYYY-MM-DD HH24:MI:SS'),1,1,'N','N',213699,'D',245,0)
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=100, AD_Val_Rule_ID=NULL, IsDisplayed='Y', XPosition=4, ColumnSpan=2, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205837
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=110, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4540
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=120, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205836
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=130, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2571
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=140, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12100
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=150, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3703
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=160, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2534
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=170, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10235
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=180, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=56497
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=190, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3278
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=200, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3219
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=210, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5849
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=220, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50155
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=230, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5850
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=240, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5851
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=250, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50156
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=260, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201809
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:03:16 PM CEST
|
||||
UPDATE AD_Field SET SeqNo=270, AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-02 19:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57342
|
||||
;
|
||||
|
||||
-- Oct 2, 2018 7:05:07 PM CEST
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,AD_Message_UU,Updated,IsActive,CreatedBy,AD_Client_ID,Created,UpdatedBy,EntityType,Value,AD_Org_ID) VALUES ('I','Another instance of this process is already running, please wait until it finishes to run it again.',200483,'db33903f-5eb2-4585-be6f-9a6bcae3940e',TO_TIMESTAMP('2018-10-02 19:05:06','YYYY-MM-DD HH24:MI:SS'),'Y',100,0,TO_TIMESTAMP('2018-10-02 19:05:06','YYYY-MM-DD HH24:MI:SS'),100,'D','ProcessAlreadyRunning',0)
|
||||
;
|
||||
|
||||
-- Oct 4, 2018 4:52:16 PM CEST
|
||||
UPDATE AD_Process SET allowMultipleExecution = NULL WHERE isReport ='N'
|
||||
;
|
||||
|
||||
-- Oct 4, 2018 4:52:16 PM CEST
|
||||
UPDATE AD_Process SET allowMultipleExecution = 'P' WHERE isReport ='Y'
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201810041316_IDEMPIERE-3799.sql') FROM dual
|
||||
;
|
|
@ -167,6 +167,19 @@ public interface I_AD_Process
|
|||
public int getAD_Workflow_ID();
|
||||
|
||||
public org.compiere.model.I_AD_Workflow getAD_Workflow() throws RuntimeException;
|
||||
|
||||
/** Column name AllowMultipleExecution */
|
||||
public static final String COLUMNNAME_AllowMultipleExecution = "AllowMultipleExecution";
|
||||
|
||||
/** Set Multiple Execution.
|
||||
* Allow or disallow executing a process/report multiple times.
|
||||
*/
|
||||
public void setAllowMultipleExecution (String AllowMultipleExecution);
|
||||
|
||||
/** Get Multiple Execution.
|
||||
* Allow or disallow executing a process/report multiple times.
|
||||
*/
|
||||
public String getAllowMultipleExecution();
|
||||
|
||||
/** Column name Classname */
|
||||
public static final String COLUMNNAME_Classname = "Classname";
|
||||
|
|
|
@ -151,7 +151,37 @@ public class MPInstance extends X_AD_PInstance
|
|||
list.toArray(m_parameters);
|
||||
return m_parameters;
|
||||
} // getParameters
|
||||
|
||||
|
||||
/**
|
||||
* Validate that a set of process instance parameters are equal or not
|
||||
* to the current instance parameter
|
||||
* @param param array of parameters to compare
|
||||
* @return true if the process instance parameters are the same as the array ones
|
||||
*/
|
||||
public boolean equalParameters(MPInstancePara[] params) {
|
||||
|
||||
//No parameters
|
||||
if ((getParameters() == null || getParameters().length == 0) && (params == null || params.length == 0))
|
||||
return true;
|
||||
|
||||
//Different number of parameters
|
||||
if (getParameters().length != params.length)
|
||||
return false;
|
||||
|
||||
int comparedParams = 0;
|
||||
for (MPInstancePara instanceParameter : getParameters()) {
|
||||
for (MPInstancePara para : params) {
|
||||
if (instanceParameter.getParameterName().equals(para.getParameterName())) {
|
||||
comparedParams++;
|
||||
if (!instanceParameter.equalParameter(para)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return comparedParams == getParameters().length; //all the compared parameters have the same name and value
|
||||
}
|
||||
|
||||
/** Log Entries */
|
||||
private ArrayList<MPInstanceLog> m_log = new ArrayList<MPInstanceLog>();
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.compiere.model;
|
|||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
|
@ -233,6 +234,27 @@ public class MPInstancePara extends X_AD_PInstance_Para
|
|||
return -1;
|
||||
}
|
||||
|
||||
public boolean equalParameter(MPInstancePara param) {
|
||||
|
||||
if (param == null)
|
||||
return false;
|
||||
|
||||
if (!Objects.equals(getP_String(),param.getP_String()) && !Objects.equals(getP_String_To(),param.getP_String_To()))
|
||||
return false;
|
||||
|
||||
BigDecimal bd = (BigDecimal)get_Value("P_Number");
|
||||
BigDecimal bdParam = (BigDecimal)param.get_Value("P_Number");
|
||||
BigDecimal bd2 = (BigDecimal)get_Value("P_Number_To");
|
||||
BigDecimal bd2Param = (BigDecimal)param.get_Value("P_Number_To");
|
||||
if (!Objects.equals(bd,bdParam) && !Objects.equals(bd2,bd2Param))
|
||||
return false;
|
||||
|
||||
if (!Objects.equals(getP_Date(),param.getP_Date()) && !Objects.equals(getP_Date_To(),param.getP_Date_To()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get existing AD_PInstance_Para record or create a new one if not found
|
||||
* @param ctx
|
||||
|
|
|
@ -283,6 +283,30 @@ public class X_AD_Process extends PO implements I_AD_Process, I_Persistent
|
|||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** AllowMultipleExecution AD_Reference_ID=200158 */
|
||||
public static final int ALLOWMULTIPLEEXECUTION_AD_Reference_ID=200158;
|
||||
/** Disallow multiple executions = N */
|
||||
public static final String ALLOWMULTIPLEEXECUTION_DisallowMultipleExecutions = "N";
|
||||
/** Disallow multiple executions with the same parameters = P */
|
||||
public static final String ALLOWMULTIPLEEXECUTION_DisallowMultipleExecutionsWithTheSameParameters = "P";
|
||||
/** Set Multiple Execution.
|
||||
@param AllowMultipleExecution
|
||||
Allow or disallow executing a process/report multiple times.
|
||||
*/
|
||||
public void setAllowMultipleExecution (String AllowMultipleExecution)
|
||||
{
|
||||
|
||||
set_Value (COLUMNNAME_AllowMultipleExecution, AllowMultipleExecution);
|
||||
}
|
||||
|
||||
/** Get Multiple Execution.
|
||||
@return Allow or disallow executing a process/report multiple times.
|
||||
*/
|
||||
public String getAllowMultipleExecution ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_AllowMultipleExecution);
|
||||
}
|
||||
|
||||
/** Set Classname.
|
||||
@param Classname
|
||||
|
|
|
@ -22,8 +22,14 @@ import java.math.BigDecimal;
|
|||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.compiere.model.MPInstance;
|
||||
import org.compiere.model.MPInstancePara;
|
||||
import org.compiere.model.MProcess;
|
||||
import org.compiere.model.MSession;
|
||||
import org.compiere.model.PO;
|
||||
import org.compiere.model.Query;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Ini;
|
||||
|
@ -859,5 +865,58 @@ public class ProcessInfo implements Serializable
|
|||
public void setPDFFileName(String fileName) {
|
||||
this.m_PDFfileName = fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates to inform a user running again a process that is already in execution.
|
||||
* @return true if the same process is already running
|
||||
*/
|
||||
public boolean isProcessRunning(MPInstancePara[] params) {
|
||||
MProcess process = MProcess.get(Env.getCtx(), getAD_Process_ID());
|
||||
|
||||
String multipleExecutions = process.getAllowMultipleExecution();
|
||||
if (multipleExecutions == null || multipleExecutions.isEmpty())
|
||||
return false;
|
||||
|
||||
Timestamp lastRebootDate = getLastServerRebootDate();
|
||||
if (lastRebootDate == null)
|
||||
return false;
|
||||
|
||||
List<MPInstance> processInstanceList = new Query(Env.getCtx(), MPInstance.Table_Name, " AD_Process_ID=? AND AD_User_ID=? AND IsProcessing='Y' AND record_ID = ? AND Created > ? ", null)
|
||||
.setParameters(getAD_Process_ID(), getAD_User_ID(), getRecord_ID(), lastRebootDate)
|
||||
.setClient_ID()
|
||||
.setOnlyActiveRecords(true)
|
||||
.list();
|
||||
|
||||
if (processInstanceList == null || processInstanceList.isEmpty())
|
||||
return false;
|
||||
|
||||
//Never allow multiple executions
|
||||
if (multipleExecutions.equals(MProcess.ALLOWMULTIPLEEXECUTION_DisallowMultipleExecutions))
|
||||
return true;
|
||||
|
||||
//Disallow multiple executions with the same params
|
||||
if (multipleExecutions.equals(MProcess.ALLOWMULTIPLEEXECUTION_DisallowMultipleExecutionsWithTheSameParameters)) {
|
||||
for (MPInstance instance : processInstanceList) {
|
||||
if (instance.equalParameters(params))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private Timestamp getLastServerRebootDate() {
|
||||
MSession currentSession = MSession.get(Env.getCtx(), false);
|
||||
if (currentSession == null)
|
||||
return null;
|
||||
|
||||
MSession lastServerSession = new Query(Env.getCtx(), MSession.Table_Name, " serverName=? AND websession=?", null)
|
||||
.setParameters(currentSession.getServerName(), "Server")
|
||||
.setOrderBy("AD_Session_ID desc")
|
||||
.setOnlyActiveRecords(true)
|
||||
.first();
|
||||
|
||||
return lastServerSession.getCreated();
|
||||
}
|
||||
|
||||
} // ProcessInfo
|
||||
|
|
|
@ -780,6 +780,12 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
|
||||
protected void startProcess()
|
||||
{
|
||||
if (m_pi.isProcessRunning(parameterPanel.getParameters())) {
|
||||
FDialog.error(getWindowNo(), "ProcessAlreadyRunning");
|
||||
log.log(Level.WARNING, "Abort process " + m_AD_Process_ID + " because it is already running");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!parameterPanel.validateParameters())
|
||||
return;
|
||||
|
||||
|
|
Loading…
Reference in New Issue