diff --git a/migration/i6.2/oracle/201903181955_IDEMPIERE-3528.sql b/migration/i6.2/oracle/201903181955_IDEMPIERE-3528.sql new file mode 100644 index 0000000000..87daf6396f --- /dev/null +++ b/migration/i6.2/oracle/201903181955_IDEMPIERE-3528.sql @@ -0,0 +1,8 @@ +UPDATE ad_treebar SET ad_client_id=(SELECT ad_client_id FROM ad_user WHERE ad_user.ad_user_id=ad_treebar.ad_user_id) +WHERE ad_client_id!=(SELECT ad_client_id FROM ad_user WHERE ad_user.ad_user_id=ad_treebar.ad_user_id); + +UPDATE ad_treebar SET ad_org_id=0 WHERE ad_org_id!=0; + +SELECT register_migration_script('201903181955_IDEMPIERE-3528.sql') FROM dual +; + diff --git a/migration/i6.2/oracle/201903191017_IDEMPIERE-2395.sql b/migration/i6.2/oracle/201903191017_IDEMPIERE-2395.sql new file mode 100644 index 0000000000..b1b18da596 --- /dev/null +++ b/migration/i6.2/oracle/201903191017_IDEMPIERE-2395.sql @@ -0,0 +1,10 @@ +-- IDEMPIERE-2395 - clean orphan ad_note in seed +DELETE FROM ad_note WHERE ad_table_id=53043 AND record_id NOT IN (SELECT PP_MRP_ID FROM PP_MRP); + +DELETE FROM ad_attachment WHERE ad_table_id=389 AND record_id NOT IN (SELECT ad_note_id FROM ad_note); + +DELETE FROM ad_treenodecmt WHERE node_id>0 AND node_id NOT IN (SELECT cm_template_id FROM cm_template); + +SELECT register_migration_script('201903191017_IDEMPIERE-2395.sql') FROM dual +; + diff --git a/migration/i6.2/oracle/201903191533_IDEMPIERE-2395.sql b/migration/i6.2/oracle/201903191533_IDEMPIERE-2395.sql new file mode 100644 index 0000000000..76b5c80058 --- /dev/null +++ b/migration/i6.2/oracle/201903191533_IDEMPIERE-2395.sql @@ -0,0 +1,15 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-2395 +-- Mar 19, 2019, 3:24:55 PM BRT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203300,0,0,'Y',TO_DATE('2019-03-19 15:24:31','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-19 15:24:31','YYYY-MM-DD HH24:MI:SS'),100,'IsCleanChangeLog','Clean Change Log',NULL,NULL,'Clean Change Log','D','c6e68794-2989-4a46-9151-a94a3254cf93') +; + +-- Mar 19, 2019, 3:25:19 PM BRT +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200269,0,0,'Y',TO_DATE('2019-03-19 15:25:18','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-19 15:25:18','YYYY-MM-DD HH24:MI:SS'),100,'Clean Change Log',200102,10,20,'N',1,'Y','N','IsCleanChangeLog','Y','D',203300,'459a7f88-ec79-47cf-9c7b-7429ac565f55','N') +; + +SELECT register_migration_script('201903191533_IDEMPIERE-2395.sql') FROM dual +; + diff --git a/migration/i6.2/oracle/201903191614_IDEMPIERE-3916_CopyClient.sql b/migration/i6.2/oracle/201903191614_IDEMPIERE-3916_CopyClient.sql new file mode 100644 index 0000000000..784d639f8e --- /dev/null +++ b/migration/i6.2/oracle/201903191614_IDEMPIERE-3916_CopyClient.sql @@ -0,0 +1,115 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3916 Copy Template +-- Mar 19, 2019, 3:57:52 PM BRT +UPDATE AD_Process SET Name='Copy Client', Description='Process to copy a client', Help='This process can be used to copy a client from an external database to the current database, or to duplicate a template client within the current database.',Updated=TO_DATE('2019-03-19 15:57:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=200110 +; + +-- Mar 19, 2019, 3:57:52 PM BRT +UPDATE AD_Menu SET Name='Copy Client', Description='Process to copy a client', IsActive='Y',Updated=TO_DATE('2019-03-19 15:57:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=200168 +; + +-- Mar 19, 2019, 3:59:09 PM BRT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203301,0,0,'Y',TO_DATE('2019-03-19 15:58:39','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-19 15:58:39','YYYY-MM-DD HH24:MI:SS'),100,'IsCopyClient','Copy Template Client',NULL,NULL,'Copy Template Client','D','a5e530c4-15aa-4e5e-9d43-afb7b7528ce1') +; + +-- Mar 19, 2019, 3:59:42 PM BRT +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200270,0,0,'Y',TO_DATE('2019-03-19 15:59:42','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-19 15:59:42','YYYY-MM-DD HH24:MI:SS'),100,'Copy Template Client',200110,5,20,'N',1,'Y','N','IsCopyClient','Y','D',203301,'c7f81809-5948-47fd-8a37-a6614266c104','N') +; + +-- Mar 19, 2019, 4:00:55 PM BRT +UPDATE AD_Process_Para SET IsMandatory='N', DisplayLogic='IsCopyClient=N', MandatoryLogic='IsCopyClient=N',Updated=TO_DATE('2019-03-19 16:00:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200256 +; + +-- Mar 19, 2019, 4:01:02 PM BRT +UPDATE AD_Process_Para SET DisplayLogic='IsCopyClient=N',Updated=TO_DATE('2019-03-19 16:01:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200257 +; + +-- Mar 19, 2019, 4:01:04 PM BRT +UPDATE AD_Process_Para SET DisplayLogic='IsCopyClient=N',Updated=TO_DATE('2019-03-19 16:01:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200258 +; + +-- Mar 19, 2019, 4:01:29 PM BRT +UPDATE AD_Process_Para SET DisplayLogic='IsCopyClient=N',Updated=TO_DATE('2019-03-19 16:01:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200261 +; + +-- Mar 19, 2019, 4:01:43 PM BRT +UPDATE AD_Process_Para SET DisplayLogic='IsCopyClient=N',Updated=TO_DATE('2019-03-19 16:01:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200263 +; + +-- Mar 19, 2019, 4:03:09 PM BRT +UPDATE AD_Process_Para SET SeqNo=110,Updated=TO_DATE('2019-03-19 16:03:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200263 +; + +-- Mar 19, 2019, 4:03:17 PM BRT +UPDATE AD_Process_Para SET SeqNo=100,Updated=TO_DATE('2019-03-19 16:03:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200262 +; + +-- Mar 19, 2019, 4:03:21 PM BRT +UPDATE AD_Process_Para SET SeqNo=90,Updated=TO_DATE('2019-03-19 16:03:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200261 +; + +-- Mar 19, 2019, 4:03:28 PM BRT +UPDATE AD_Process_Para SET SeqNo=80,Updated=TO_DATE('2019-03-19 16:03:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200260 +; + +-- Mar 19, 2019, 4:03:32 PM BRT +UPDATE AD_Process_Para SET SeqNo=70,Updated=TO_DATE('2019-03-19 16:03:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200259 +; + +-- Mar 19, 2019, 4:03:41 PM BRT +UPDATE AD_Process_Para SET SeqNo=40,Updated=TO_DATE('2019-03-19 16:03:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200258 +; + +-- Mar 19, 2019, 4:03:45 PM BRT +UPDATE AD_Process_Para SET SeqNo=30,Updated=TO_DATE('2019-03-19 16:03:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200257 +; + +-- Mar 19, 2019, 4:03:48 PM BRT +UPDATE AD_Process_Para SET SeqNo=20,Updated=TO_DATE('2019-03-19 16:03:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200256 +; + +-- Mar 19, 2019, 4:03:53 PM BRT +UPDATE AD_Process_Para SET SeqNo=10,Updated=TO_DATE('2019-03-19 16:03:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200270 +; + +-- Mar 19, 2019, 4:06:44 PM BRT +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,DisplayLogic,AD_Process_Para_UU,IsEncrypted,MandatoryLogic) VALUES (200271,0,0,'Y',TO_DATE('2019-03-19 16:06:44','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-19 16:06:44','YYYY-MM-DD HH24:MI:SS'),100,'Client Name','Client in which current session user logged in',200110,50,10,'N',60,'N','ClientName','Y','D',200186,'@IsCopyClient@=Y','edbacdb3-9a07-490a-ba53-33d0cab63c47','N','@IsCopyClient@=Y') +; + +-- Mar 19, 2019, 4:07:17 PM BRT +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,DisplayLogic,AD_Process_Para_UU,IsEncrypted,MandatoryLogic) VALUES (200272,0,0,'Y',TO_DATE('2019-03-19 16:07:16','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-19 16:07:16','YYYY-MM-DD HH24:MI:SS'),100,'Client Key','Key of the Client',200110,60,10,'N',40,'N','ClientValue','Y','D',2097,'@IsCopyClient@=Y','55b77a95-1564-41d2-9177-97fbcf264e66','N','@IsCopyClient@=Y') +; + +-- Mar 19, 2019, 4:07:45 PM BRT +UPDATE AD_Process_Para SET DisplayLogic='@IsCopyClient@=N', MandatoryLogic='@IsCopyClient@=N',Updated=TO_DATE('2019-03-19 16:07:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200256 +; + +-- Mar 19, 2019, 4:07:51 PM BRT +UPDATE AD_Process_Para SET DisplayLogic='@IsCopyClient@=N',Updated=TO_DATE('2019-03-19 16:07:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200257 +; + +-- Mar 19, 2019, 4:07:56 PM BRT +UPDATE AD_Process_Para SET DisplayLogic='@IsCopyClient@=N',Updated=TO_DATE('2019-03-19 16:07:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200258 +; + +-- Mar 19, 2019, 4:08:11 PM BRT +UPDATE AD_Process_Para SET DisplayLogic='@IsCopyClient@=N',Updated=TO_DATE('2019-03-19 16:08:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200261 +; + +-- Mar 19, 2019, 4:08:21 PM BRT +UPDATE AD_Process_Para SET DisplayLogic='@IsCopyClient@=N',Updated=TO_DATE('2019-03-19 16:08:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200263 +; + +-- Mar 19, 2019, 4:09:44 PM BRT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203302,0,0,'Y',TO_DATE('2019-03-19 16:09:00','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-19 16:09:00','YYYY-MM-DD HH24:MI:SS'),100,'IsSkipSomeValidations','Skip Some Validations',NULL,NULL,'Skip Some Validations','D','b061fb74-6d5f-49dd-a7ff-2e94eeca9fe4') +; + +-- Mar 19, 2019, 4:10:39 PM BRT +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,DisplayLogic,AD_Process_Para_UU,IsEncrypted) VALUES (200273,0,0,'Y',TO_DATE('2019-03-19 16:10:38','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-19 16:10:38','YYYY-MM-DD HH24:MI:SS'),100,'Skip Some Validations',200110,120,20,'N',1,'Y','N','IsSkipSomeValidations','Y','D',203302,'@IsCopyClient@=Y','976f2e77-2354-4724-89a8-d13176211649','N') +; + +SELECT register_migration_script('201903191614_IDEMPIERE-3916_CopyClient.sql') FROM dual +; + diff --git a/migration/i6.2/oracle/201903211444_IDEMPIERE-3926.sql b/migration/i6.2/oracle/201903211444_IDEMPIERE-3926.sql new file mode 100644 index 0000000000..45bb4c1061 --- /dev/null +++ b/migration/i6.2/oracle/201903211444_IDEMPIERE-3926.sql @@ -0,0 +1,222 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3926 Restrict roles in login by type +-- Mar 21, 2019, 2:17:02 PM BRT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203303,0,0,'Y',TO_DATE('2019-03-21 14:16:45','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:16:45','YYYY-MM-DD HH24:MI:SS'),100,'RoleType','Role Type',NULL,NULL,'Role Type','D','d5790909-7831-4e65-ae23-2621d6916933') +; + +-- Mar 21, 2019, 2:17:50 PM BRT +INSERT INTO AD_Reference (AD_Reference_ID,Name,ValidationType,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,IsOrderByValue,AD_Reference_UU) VALUES (200166,'AD_Role RoleType','L',0,0,'Y',TO_DATE('2019-03-21 14:17:49','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:17:49','YYYY-MM-DD HH24:MI:SS'),100,'D','N','88b0c074-0f6f-4a8b-b76e-e230e340f670') +; + +-- Mar 21, 2019, 2:18:17 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Reference_Value_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,IsHtml) VALUES (213856,0,'Role Type',156,'RoleType',2,'N','N','N','N','N',0,'N',17,200166,0,0,'Y',TO_DATE('2019-03-21 14:18:16','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:18:16','YYYY-MM-DD HH24:MI:SS'),100,203303,'Y','N','D','N','N','N','Y','ab062f58-46e1-4a1a-9245-bfa6dd7f42bb','Y',0,'N','N','N') +; + +-- Mar 21, 2019, 2:18:20 PM BRT +ALTER TABLE AD_Role ADD RoleType VARCHAR2(2) DEFAULT NULL +; + +-- Mar 21, 2019, 2:21:49 PM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,AD_FieldGroup_ID,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205947,'Role Type',119,213856,'Y',0,450,0,'N','N','N','N',0,0,'Y',TO_DATE('2019-03-21 14:21:48','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:21:48','YYYY-MM-DD HH24:MI:SS'),100,'N','Y',135,'D','69560ba0-28c5-481b-b06f-ba1fb8cf468f','Y',440,1,1,1,'N','N','N') +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET SeqNo=50, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=364 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET SeqNo=60, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=7833 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=70, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=363 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200071 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11002 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=930 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=931 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59591 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59592 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=150, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10126 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205947 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11003 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5227 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=2, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202366 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=200, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10813 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=210, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11257 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=220, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8312 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=230, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8310 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET SeqNo=240, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8313 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=250, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8314 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=260, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8311 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=270, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11006 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=280, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12367 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=290, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12368 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=300, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11256 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=310, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50168 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=320, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50178 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=330, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50176 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=340, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50170 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=350, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50174 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=360, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50173 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=370, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50172 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=380, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=2, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50175 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=390, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50169 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=400, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50177 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204590 +; + +-- Mar 21, 2019, 2:35:20 PM BRT +UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:35:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205947 +; + +-- Mar 21, 2019, 2:37:34 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200457,'WebUI',200166,'ZK',0,0,'Y',TO_DATE('2019-03-21 14:37:33','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:37:33','YYYY-MM-DD HH24:MI:SS'),100,'D','af5be523-6318-4b6c-bc8b-f51ecd0de2d0') +; + +-- Mar 21, 2019, 2:37:43 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200458,'WebService',200166,'WS',0,0,'Y',TO_DATE('2019-03-21 14:37:43','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:37:43','YYYY-MM-DD HH24:MI:SS'),100,'D','ff7ae569-ea86-4c21-9aff-6a9073f4b677') +; + +-- Mar 21, 2019, 2:37:53 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200459,'System Support',200166,'SS',0,0,'Y',TO_DATE('2019-03-21 14:37:53','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:37:53','YYYY-MM-DD HH24:MI:SS'),100,'D','3b6ad66c-e962-46a5-a3ec-b8787ee4c754') +; + +-- Mar 21, 2019, 2:38:04 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200460,'Mobile',200166,'MO',0,0,'Y',TO_DATE('2019-03-21 14:38:03','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:38:03','YYYY-MM-DD HH24:MI:SS'),100,'D','78962d5b-b6bb-4798-8f9d-fd36381b58ed') +; + +-- Mar 21, 2019, 2:38:13 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200461,'Swing',200166,'SW',0,0,'Y',TO_DATE('2019-03-21 14:38:12','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:38:12','YYYY-MM-DD HH24:MI:SS'),100,'D','b6d02ebf-6845-47d9-b91e-b956084333e8') +; + +-- Mar 21, 2019, 2:38:27 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200462,'External App 1',200166,'E1',0,0,'Y',TO_DATE('2019-03-21 14:38:27','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:38:27','YYYY-MM-DD HH24:MI:SS'),100,'D','d6bc8c6d-d5bf-458c-81f7-4d3f11303d6d') +; + +-- Mar 21, 2019, 2:38:41 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200463,'External App 2',200166,'E2',0,0,'Y',TO_DATE('2019-03-21 14:38:40','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:38:40','YYYY-MM-DD HH24:MI:SS'),100,'D','79a2e44a-dfd6-4114-b835-5392c4736eb9') +; + +-- Mar 21, 2019, 2:38:46 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200464,'External App 3',200166,'E3',0,0,'Y',TO_DATE('2019-03-21 14:38:46','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:38:46','YYYY-MM-DD HH24:MI:SS'),100,'D','f158da0d-6ad6-4f2e-aa65-099417d6217b') +; + +-- Mar 21, 2019, 2:38:54 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200465,'External App 4',200166,'E4',0,0,'Y',TO_DATE('2019-03-21 14:38:53','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:38:53','YYYY-MM-DD HH24:MI:SS'),100,'D','d136b0f9-658a-4e79-b22f-3cf995da34ff') +; + +-- Mar 21, 2019, 2:39:00 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200466,'External App 5',200166,'E5',0,0,'Y',TO_DATE('2019-03-21 14:38:59','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:38:59','YYYY-MM-DD HH24:MI:SS'),100,'D','b06729fb-ce8e-4bff-b6da-0f38bdefa55e') +; + +-- Mar 21, 2019, 2:43:43 PM BRT +UPDATE AD_Role SET RoleType='WS',Updated=TO_DATE('2019-03-21 14:43:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Role_ID=50004 +; + +UPDATE AD_Role SET RoleType='SS',Updated=TO_DATE('2019-03-21 14:43:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Role_ID=0 +; + +SELECT register_migration_script('201903211444_IDEMPIERE-3926.sql') FROM dual +; + diff --git a/migration/i6.2/oracle/201903211743_IDEMPIERE-3439_IsSupportUser.sql b/migration/i6.2/oracle/201903211743_IDEMPIERE-3439_IsSupportUser.sql new file mode 100644 index 0000000000..c18e545d2b --- /dev/null +++ b/migration/i6.2/oracle/201903211743_IDEMPIERE-3439_IsSupportUser.sql @@ -0,0 +1,291 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3352 Enhancement of Batch Level Costing +-- Mar 21, 2019, 5:27:07 PM BRT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203304,0,0,'Y',TO_DATE('2019-03-21 17:25:13','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 17:25:13','YYYY-MM-DD HH24:MI:SS'),100,'IsSupportUser','Support User',NULL,NULL,'Support User','D','d25abb34-0978-4475-b27f-c9141985b1db') +; + +-- Mar 21, 2019, 5:27:36 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,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,IsHtml) VALUES (213857,0,'Support User',114,'IsSupportUser','N',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_DATE('2019-03-21 17:27:36','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 17:27:36','YYYY-MM-DD HH24:MI:SS'),100,203304,'Y','N','D','N','N','N','Y','fe4fbe00-ff30-4810-bc60-9608ac6fc885','Y',0,'N','N','N') +; + +-- Mar 21, 2019, 5:27:38 PM BRT +ALTER TABLE AD_User ADD IsSupportUser CHAR(1) DEFAULT 'N' CHECK (IsSupportUser IN ('Y','N')) NOT NULL +; + +-- Mar 21, 2019, 5:30:34 PM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205948,'Support User',118,213857,'Y',0,430,0,'N','N','N','N',0,0,'Y',TO_DATE('2019-03-21 17:30:34','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 17:30:34','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','01a94208-4db0-4b76-81ff-273561203926','Y',430,1,1,1,'N','N','N') +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=204217 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=5884 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=12640 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=52010 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=302 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=10,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=309 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=20,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=300 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=6521 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=6515 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=130,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=6517 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=140,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=6514 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=150,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=6518 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=160,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=11679 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=170,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=12324 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=180,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=12323 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=190,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=5883 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=200,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=4261 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=210,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=10491 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=220,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=6511 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=230,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=200072 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=240,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=202876 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=250,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=202875 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=260,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=6513 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=270,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=11525 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=280,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=6520 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=290,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=8342 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=300,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=6519 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=310,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=200405 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=320,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=200400 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=330,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=200403 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=340,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=200401 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=350,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=200406 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=360,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=200402 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=370,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=200474 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=380,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=200475 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=390,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=200473 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=400,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=205948 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=410,IsDisplayedGrid='Y', Updated=sysdate, UpdatedBy=100 WHERE AD_Field_ID=205827 +; + +-- Mar 21, 2019, 5:37:45 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6515 +; + +-- Mar 21, 2019, 5:37:45 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=150, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12323 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6517 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6514 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6518 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11679 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=200, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12324 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=210, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=52010 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET SeqNo=250, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10491 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=260, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205948 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=270, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6511 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=280, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200072 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET SeqNo=290, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6513 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET SeqNo=300, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11525 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=310, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202876 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=320, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202875 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET SeqNo=330, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6520 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET SeqNo=340, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8342 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET SeqNo=350, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6519 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=360, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200400 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=370, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200405 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=380, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200406 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=390, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200474 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=400, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205827 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET SeqNo=410, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200403 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET SeqNo=420, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200401 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET SeqNo=430, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200402 +; + +-- Mar 21, 2019, 5:38:17 PM BRT +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL, IsAdvancedField='Y',Updated=TO_DATE('2019-03-21 17:38:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205948 +; + +-- Mar 21, 2019, 5:41:32 PM BRT +UPDATE AD_User SET IsSupportUser='Y',Updated=TO_DATE('2019-03-21 17:41:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_User_ID=100 +; + +SELECT register_migration_script('201903211743_IDEMPIERE-3439_IsSupportUser.sql') FROM dual +; + diff --git a/migration/i6.2/postgresql/201903181955_IDEMPIERE-3528.sql b/migration/i6.2/postgresql/201903181955_IDEMPIERE-3528.sql new file mode 100644 index 0000000000..87daf6396f --- /dev/null +++ b/migration/i6.2/postgresql/201903181955_IDEMPIERE-3528.sql @@ -0,0 +1,8 @@ +UPDATE ad_treebar SET ad_client_id=(SELECT ad_client_id FROM ad_user WHERE ad_user.ad_user_id=ad_treebar.ad_user_id) +WHERE ad_client_id!=(SELECT ad_client_id FROM ad_user WHERE ad_user.ad_user_id=ad_treebar.ad_user_id); + +UPDATE ad_treebar SET ad_org_id=0 WHERE ad_org_id!=0; + +SELECT register_migration_script('201903181955_IDEMPIERE-3528.sql') FROM dual +; + diff --git a/migration/i6.2/postgresql/201903191017_IDEMPIERE-2395.sql b/migration/i6.2/postgresql/201903191017_IDEMPIERE-2395.sql new file mode 100644 index 0000000000..b1b18da596 --- /dev/null +++ b/migration/i6.2/postgresql/201903191017_IDEMPIERE-2395.sql @@ -0,0 +1,10 @@ +-- IDEMPIERE-2395 - clean orphan ad_note in seed +DELETE FROM ad_note WHERE ad_table_id=53043 AND record_id NOT IN (SELECT PP_MRP_ID FROM PP_MRP); + +DELETE FROM ad_attachment WHERE ad_table_id=389 AND record_id NOT IN (SELECT ad_note_id FROM ad_note); + +DELETE FROM ad_treenodecmt WHERE node_id>0 AND node_id NOT IN (SELECT cm_template_id FROM cm_template); + +SELECT register_migration_script('201903191017_IDEMPIERE-2395.sql') FROM dual +; + diff --git a/migration/i6.2/postgresql/201903191533_IDEMPIERE-2395.sql b/migration/i6.2/postgresql/201903191533_IDEMPIERE-2395.sql new file mode 100644 index 0000000000..ab473a8697 --- /dev/null +++ b/migration/i6.2/postgresql/201903191533_IDEMPIERE-2395.sql @@ -0,0 +1,12 @@ +-- IDEMPIERE-2395 +-- Mar 19, 2019, 3:24:55 PM BRT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203300,0,0,'Y',TO_TIMESTAMP('2019-03-19 15:24:31','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-19 15:24:31','YYYY-MM-DD HH24:MI:SS'),100,'IsCleanChangeLog','Clean Change Log',NULL,NULL,'Clean Change Log','D','c6e68794-2989-4a46-9151-a94a3254cf93') +; + +-- Mar 19, 2019, 3:25:19 PM BRT +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200269,0,0,'Y',TO_TIMESTAMP('2019-03-19 15:25:18','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-19 15:25:18','YYYY-MM-DD HH24:MI:SS'),100,'Clean Change Log',200102,10,20,'N',1,'Y','N','IsCleanChangeLog','Y','D',203300,'459a7f88-ec79-47cf-9c7b-7429ac565f55','N') +; + +SELECT register_migration_script('201903191533_IDEMPIERE-2395.sql') FROM dual +; + diff --git a/migration/i6.2/postgresql/201903191614_IDEMPIERE-3916_CopyClient.sql b/migration/i6.2/postgresql/201903191614_IDEMPIERE-3916_CopyClient.sql new file mode 100644 index 0000000000..8ef235c142 --- /dev/null +++ b/migration/i6.2/postgresql/201903191614_IDEMPIERE-3916_CopyClient.sql @@ -0,0 +1,112 @@ +-- IDEMPIERE-3916 Copy Template +-- Mar 19, 2019, 3:57:52 PM BRT +UPDATE AD_Process SET Name='Copy Client', Description='Process to copy a client', Help='This process can be used to copy a client from an external database to the current database, or to duplicate a template client within the current database.',Updated=TO_TIMESTAMP('2019-03-19 15:57:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=200110 +; + +-- Mar 19, 2019, 3:57:52 PM BRT +UPDATE AD_Menu SET Name='Copy Client', Description='Process to copy a client', IsActive='Y',Updated=TO_TIMESTAMP('2019-03-19 15:57:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=200168 +; + +-- Mar 19, 2019, 3:59:09 PM BRT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203301,0,0,'Y',TO_TIMESTAMP('2019-03-19 15:58:39','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-19 15:58:39','YYYY-MM-DD HH24:MI:SS'),100,'IsCopyClient','Copy Template Client',NULL,NULL,'Copy Template Client','D','a5e530c4-15aa-4e5e-9d43-afb7b7528ce1') +; + +-- Mar 19, 2019, 3:59:42 PM BRT +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200270,0,0,'Y',TO_TIMESTAMP('2019-03-19 15:59:42','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-19 15:59:42','YYYY-MM-DD HH24:MI:SS'),100,'Copy Template Client',200110,5,20,'N',1,'Y','N','IsCopyClient','Y','D',203301,'c7f81809-5948-47fd-8a37-a6614266c104','N') +; + +-- Mar 19, 2019, 4:00:55 PM BRT +UPDATE AD_Process_Para SET IsMandatory='N', DisplayLogic='IsCopyClient=N', MandatoryLogic='IsCopyClient=N',Updated=TO_TIMESTAMP('2019-03-19 16:00:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200256 +; + +-- Mar 19, 2019, 4:01:02 PM BRT +UPDATE AD_Process_Para SET DisplayLogic='IsCopyClient=N',Updated=TO_TIMESTAMP('2019-03-19 16:01:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200257 +; + +-- Mar 19, 2019, 4:01:04 PM BRT +UPDATE AD_Process_Para SET DisplayLogic='IsCopyClient=N',Updated=TO_TIMESTAMP('2019-03-19 16:01:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200258 +; + +-- Mar 19, 2019, 4:01:29 PM BRT +UPDATE AD_Process_Para SET DisplayLogic='IsCopyClient=N',Updated=TO_TIMESTAMP('2019-03-19 16:01:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200261 +; + +-- Mar 19, 2019, 4:01:43 PM BRT +UPDATE AD_Process_Para SET DisplayLogic='IsCopyClient=N',Updated=TO_TIMESTAMP('2019-03-19 16:01:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200263 +; + +-- Mar 19, 2019, 4:03:09 PM BRT +UPDATE AD_Process_Para SET SeqNo=110,Updated=TO_TIMESTAMP('2019-03-19 16:03:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200263 +; + +-- Mar 19, 2019, 4:03:17 PM BRT +UPDATE AD_Process_Para SET SeqNo=100,Updated=TO_TIMESTAMP('2019-03-19 16:03:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200262 +; + +-- Mar 19, 2019, 4:03:21 PM BRT +UPDATE AD_Process_Para SET SeqNo=90,Updated=TO_TIMESTAMP('2019-03-19 16:03:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200261 +; + +-- Mar 19, 2019, 4:03:28 PM BRT +UPDATE AD_Process_Para SET SeqNo=80,Updated=TO_TIMESTAMP('2019-03-19 16:03:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200260 +; + +-- Mar 19, 2019, 4:03:32 PM BRT +UPDATE AD_Process_Para SET SeqNo=70,Updated=TO_TIMESTAMP('2019-03-19 16:03:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200259 +; + +-- Mar 19, 2019, 4:03:41 PM BRT +UPDATE AD_Process_Para SET SeqNo=40,Updated=TO_TIMESTAMP('2019-03-19 16:03:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200258 +; + +-- Mar 19, 2019, 4:03:45 PM BRT +UPDATE AD_Process_Para SET SeqNo=30,Updated=TO_TIMESTAMP('2019-03-19 16:03:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200257 +; + +-- Mar 19, 2019, 4:03:48 PM BRT +UPDATE AD_Process_Para SET SeqNo=20,Updated=TO_TIMESTAMP('2019-03-19 16:03:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200256 +; + +-- Mar 19, 2019, 4:03:53 PM BRT +UPDATE AD_Process_Para SET SeqNo=10,Updated=TO_TIMESTAMP('2019-03-19 16:03:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200270 +; + +-- Mar 19, 2019, 4:06:44 PM BRT +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,DisplayLogic,AD_Process_Para_UU,IsEncrypted,MandatoryLogic) VALUES (200271,0,0,'Y',TO_TIMESTAMP('2019-03-19 16:06:44','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-19 16:06:44','YYYY-MM-DD HH24:MI:SS'),100,'Client Name','Client in which current session user logged in',200110,50,10,'N',60,'N','ClientName','Y','D',200186,'@IsCopyClient@=Y','edbacdb3-9a07-490a-ba53-33d0cab63c47','N','@IsCopyClient@=Y') +; + +-- Mar 19, 2019, 4:07:17 PM BRT +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,DisplayLogic,AD_Process_Para_UU,IsEncrypted,MandatoryLogic) VALUES (200272,0,0,'Y',TO_TIMESTAMP('2019-03-19 16:07:16','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-19 16:07:16','YYYY-MM-DD HH24:MI:SS'),100,'Client Key','Key of the Client',200110,60,10,'N',40,'N','ClientValue','Y','D',2097,'@IsCopyClient@=Y','55b77a95-1564-41d2-9177-97fbcf264e66','N','@IsCopyClient@=Y') +; + +-- Mar 19, 2019, 4:07:45 PM BRT +UPDATE AD_Process_Para SET DisplayLogic='@IsCopyClient@=N', MandatoryLogic='@IsCopyClient@=N',Updated=TO_TIMESTAMP('2019-03-19 16:07:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200256 +; + +-- Mar 19, 2019, 4:07:51 PM BRT +UPDATE AD_Process_Para SET DisplayLogic='@IsCopyClient@=N',Updated=TO_TIMESTAMP('2019-03-19 16:07:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200257 +; + +-- Mar 19, 2019, 4:07:56 PM BRT +UPDATE AD_Process_Para SET DisplayLogic='@IsCopyClient@=N',Updated=TO_TIMESTAMP('2019-03-19 16:07:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200258 +; + +-- Mar 19, 2019, 4:08:11 PM BRT +UPDATE AD_Process_Para SET DisplayLogic='@IsCopyClient@=N',Updated=TO_TIMESTAMP('2019-03-19 16:08:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200261 +; + +-- Mar 19, 2019, 4:08:21 PM BRT +UPDATE AD_Process_Para SET DisplayLogic='@IsCopyClient@=N',Updated=TO_TIMESTAMP('2019-03-19 16:08:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200263 +; + +-- Mar 19, 2019, 4:09:44 PM BRT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203302,0,0,'Y',TO_TIMESTAMP('2019-03-19 16:09:00','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-19 16:09:00','YYYY-MM-DD HH24:MI:SS'),100,'IsSkipSomeValidations','Skip Some Validations',NULL,NULL,'Skip Some Validations','D','b061fb74-6d5f-49dd-a7ff-2e94eeca9fe4') +; + +-- Mar 19, 2019, 4:10:39 PM BRT +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,DisplayLogic,AD_Process_Para_UU,IsEncrypted) VALUES (200273,0,0,'Y',TO_TIMESTAMP('2019-03-19 16:10:38','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-19 16:10:38','YYYY-MM-DD HH24:MI:SS'),100,'Skip Some Validations',200110,120,20,'N',1,'Y','N','IsSkipSomeValidations','Y','D',203302,'@IsCopyClient@=Y','976f2e77-2354-4724-89a8-d13176211649','N') +; + +SELECT register_migration_script('201903191614_IDEMPIERE-3916_CopyClient.sql') FROM dual +; + diff --git a/migration/i6.2/postgresql/201903211444_IDEMPIERE-3926.sql b/migration/i6.2/postgresql/201903211444_IDEMPIERE-3926.sql new file mode 100644 index 0000000000..6f5002734f --- /dev/null +++ b/migration/i6.2/postgresql/201903211444_IDEMPIERE-3926.sql @@ -0,0 +1,219 @@ +-- IDEMPIERE-3926 Restrict roles in login by type +-- Mar 21, 2019, 2:17:02 PM BRT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203303,0,0,'Y',TO_TIMESTAMP('2019-03-21 14:16:45','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:16:45','YYYY-MM-DD HH24:MI:SS'),100,'RoleType','Role Type',NULL,NULL,'Role Type','D','d5790909-7831-4e65-ae23-2621d6916933') +; + +-- Mar 21, 2019, 2:17:50 PM BRT +INSERT INTO AD_Reference (AD_Reference_ID,Name,ValidationType,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,IsOrderByValue,AD_Reference_UU) VALUES (200166,'AD_Role RoleType','L',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:17:49','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:17:49','YYYY-MM-DD HH24:MI:SS'),100,'D','N','88b0c074-0f6f-4a8b-b76e-e230e340f670') +; + +-- Mar 21, 2019, 2:18:17 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Reference_Value_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,IsHtml) VALUES (213856,0,'Role Type',156,'RoleType',2,'N','N','N','N','N',0,'N',17,200166,0,0,'Y',TO_TIMESTAMP('2019-03-21 14:18:16','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:18:16','YYYY-MM-DD HH24:MI:SS'),100,203303,'Y','N','D','N','N','N','Y','ab062f58-46e1-4a1a-9245-bfa6dd7f42bb','Y',0,'N','N','N') +; + +-- Mar 21, 2019, 2:18:20 PM BRT +ALTER TABLE AD_Role ADD COLUMN RoleType VARCHAR(2) DEFAULT NULL +; + +-- Mar 21, 2019, 2:21:49 PM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,AD_FieldGroup_ID,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205947,'Role Type',119,213856,'Y',0,450,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:21:48','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:21:48','YYYY-MM-DD HH24:MI:SS'),100,'N','Y',135,'D','69560ba0-28c5-481b-b06f-ba1fb8cf468f','Y',440,1,1,1,'N','N','N') +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET SeqNo=50, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=364 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET SeqNo=60, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=7833 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=70, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=363 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200071 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11002 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=930 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=931 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59591 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59592 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=150, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10126 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205947 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11003 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5227 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=2, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202366 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=200, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10813 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=210, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11257 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=220, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8312 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=230, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8310 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET SeqNo=240, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8313 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=250, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8314 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=260, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8311 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=270, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11006 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=280, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12367 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=290, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12368 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=300, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11256 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=310, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50168 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=320, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50178 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=330, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50176 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=340, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50170 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=350, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50174 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=360, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50173 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=370, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50172 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=380, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=2, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50175 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=390, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50169 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=400, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50177 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204590 +; + +-- Mar 21, 2019, 2:35:20 PM BRT +UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:35:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205947 +; + +-- Mar 21, 2019, 2:37:34 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200457,'WebUI',200166,'ZK',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:37:33','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:37:33','YYYY-MM-DD HH24:MI:SS'),100,'D','af5be523-6318-4b6c-bc8b-f51ecd0de2d0') +; + +-- Mar 21, 2019, 2:37:43 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200458,'WebService',200166,'WS',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:37:43','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:37:43','YYYY-MM-DD HH24:MI:SS'),100,'D','ff7ae569-ea86-4c21-9aff-6a9073f4b677') +; + +-- Mar 21, 2019, 2:37:53 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200459,'System Support',200166,'SS',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:37:53','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:37:53','YYYY-MM-DD HH24:MI:SS'),100,'D','3b6ad66c-e962-46a5-a3ec-b8787ee4c754') +; + +-- Mar 21, 2019, 2:38:04 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200460,'Mobile',200166,'MO',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:38:03','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:38:03','YYYY-MM-DD HH24:MI:SS'),100,'D','78962d5b-b6bb-4798-8f9d-fd36381b58ed') +; + +-- Mar 21, 2019, 2:38:13 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200461,'Swing',200166,'SW',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:38:12','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:38:12','YYYY-MM-DD HH24:MI:SS'),100,'D','b6d02ebf-6845-47d9-b91e-b956084333e8') +; + +-- Mar 21, 2019, 2:38:27 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200462,'External App 1',200166,'E1',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:38:27','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:38:27','YYYY-MM-DD HH24:MI:SS'),100,'D','d6bc8c6d-d5bf-458c-81f7-4d3f11303d6d') +; + +-- Mar 21, 2019, 2:38:41 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200463,'External App 2',200166,'E2',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:38:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:38:40','YYYY-MM-DD HH24:MI:SS'),100,'D','79a2e44a-dfd6-4114-b835-5392c4736eb9') +; + +-- Mar 21, 2019, 2:38:46 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200464,'External App 3',200166,'E3',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:38:46','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:38:46','YYYY-MM-DD HH24:MI:SS'),100,'D','f158da0d-6ad6-4f2e-aa65-099417d6217b') +; + +-- Mar 21, 2019, 2:38:54 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200465,'External App 4',200166,'E4',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:38:53','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:38:53','YYYY-MM-DD HH24:MI:SS'),100,'D','d136b0f9-658a-4e79-b22f-3cf995da34ff') +; + +-- Mar 21, 2019, 2:39:00 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200466,'External App 5',200166,'E5',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:38:59','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:38:59','YYYY-MM-DD HH24:MI:SS'),100,'D','b06729fb-ce8e-4bff-b6da-0f38bdefa55e') +; + +-- Mar 21, 2019, 2:43:43 PM BRT +UPDATE AD_Role SET RoleType='WS',Updated=TO_TIMESTAMP('2019-03-21 14:43:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Role_ID=50004 +; + +UPDATE AD_Role SET RoleType='SS',Updated=TO_TIMESTAMP('2019-03-21 14:43:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Role_ID=0 +; + +SELECT register_migration_script('201903211444_IDEMPIERE-3926.sql') FROM dual +; + diff --git a/migration/i6.2/postgresql/201903211743_IDEMPIERE-3439_IsSupportUser.sql b/migration/i6.2/postgresql/201903211743_IDEMPIERE-3439_IsSupportUser.sql new file mode 100644 index 0000000000..36d7f3884f --- /dev/null +++ b/migration/i6.2/postgresql/201903211743_IDEMPIERE-3439_IsSupportUser.sql @@ -0,0 +1,288 @@ +-- IDEMPIERE-3352 Enhancement of Batch Level Costing +-- Mar 21, 2019, 5:27:07 PM BRT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203304,0,0,'Y',TO_TIMESTAMP('2019-03-21 17:25:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 17:25:13','YYYY-MM-DD HH24:MI:SS'),100,'IsSupportUser','Support User',NULL,NULL,'Support User','D','d25abb34-0978-4475-b27f-c9141985b1db') +; + +-- Mar 21, 2019, 5:27:36 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,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,IsHtml) VALUES (213857,0,'Support User',114,'IsSupportUser','N',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2019-03-21 17:27:36','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 17:27:36','YYYY-MM-DD HH24:MI:SS'),100,203304,'Y','N','D','N','N','N','Y','fe4fbe00-ff30-4810-bc60-9608ac6fc885','Y',0,'N','N','N') +; + +-- Mar 21, 2019, 5:27:38 PM BRT +ALTER TABLE AD_User ADD COLUMN IsSupportUser CHAR(1) DEFAULT 'N' CHECK (IsSupportUser IN ('Y','N')) NOT NULL +; + +-- Mar 21, 2019, 5:30:34 PM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205948,'Support User',118,213857,'Y',0,430,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2019-03-21 17:30:34','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 17:30:34','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','01a94208-4db0-4b76-81ff-273561203926','Y',430,1,1,1,'N','N','N') +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=204217 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=5884 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=12640 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=52010 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=302 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=10,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=309 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=20,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=300 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=6521 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=6515 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=130,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=6517 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=140,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=6514 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=150,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=6518 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=160,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=11679 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=170,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=12324 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=180,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=12323 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=190,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=5883 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=200,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=4261 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=210,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=10491 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=220,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=6511 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=230,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=200072 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=240,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=202876 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=250,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=202875 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=260,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=6513 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=270,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=11525 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=280,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=6520 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=290,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=8342 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=300,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=6519 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=310,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=200405 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=320,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=200400 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=330,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=200403 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=340,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=200401 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=350,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=200406 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=360,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=200402 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=370,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=200474 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=380,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=200475 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=390,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=200473 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=400,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=205948 +; + +-- Mar 21, 2019, 5:31:23 PM BRT +UPDATE AD_Field SET SeqNoGrid=410,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=205827 +; + +-- Mar 21, 2019, 5:37:45 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6515 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=150, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12323 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6517 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6514 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6518 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11679 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=200, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12324 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=210, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=52010 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET SeqNo=250, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10491 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=260, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205948 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=270, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6511 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=280, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200072 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET SeqNo=290, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6513 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET SeqNo=300, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11525 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=310, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202876 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=320, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202875 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET SeqNo=330, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6520 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET SeqNo=340, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8342 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET SeqNo=350, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6519 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=360, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200400 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=370, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200405 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=380, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200406 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=390, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200474 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=400, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205827 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET SeqNo=410, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200403 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET SeqNo=420, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200401 +; + +-- Mar 21, 2019, 5:37:46 PM BRT +UPDATE AD_Field SET SeqNo=430, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 17:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200402 +; + +-- Mar 21, 2019, 5:38:17 PM BRT +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL, IsAdvancedField='Y',Updated=TO_TIMESTAMP('2019-03-21 17:38:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205948 +; + +-- Mar 21, 2019, 5:41:32 PM BRT +UPDATE AD_User SET IsSupportUser='Y',Updated=TO_TIMESTAMP('2019-03-21 17:41:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_User_ID=100 +; + +SELECT register_migration_script('201903211743_IDEMPIERE-3439_IsSupportUser.sql') FROM dual +; + diff --git a/org.adempiere.base.process/src/org/idempiere/process/CleanOrphanCascade.java b/org.adempiere.base.process/src/org/idempiere/process/CleanOrphanCascade.java index bec999a7c3..1980795867 100644 --- a/org.adempiere.base.process/src/org/idempiere/process/CleanOrphanCascade.java +++ b/org.adempiere.base.process/src/org/idempiere/process/CleanOrphanCascade.java @@ -31,11 +31,14 @@ import java.util.logging.Level; import org.compiere.model.MArchive; import org.compiere.model.MAttachment; import org.compiere.model.MTable; +import org.compiere.model.MTree_Base; import org.compiere.model.Query; +import org.compiere.model.X_AD_Package_UUID_Map; import org.compiere.process.ProcessInfoParameter; import org.compiere.process.SvrProcess; import org.compiere.util.DB; import org.compiere.util.Msg; +import org.compiere.util.ValueNamePair; /** * IDEMPIERE-2395 @@ -44,6 +47,8 @@ import org.compiere.util.Msg; public class CleanOrphanCascade extends SvrProcess { + private boolean p_IsCleanChangeLog; + /** * Prepare - e.g., get Parameters. */ @@ -52,7 +57,11 @@ public class CleanOrphanCascade extends SvrProcess for (ProcessInfoParameter para : getParameter()) { String name = para.getParameterName(); - log.log(Level.SEVERE, "Unknown Parameter: " + name); + if ("IsCleanChangeLog".equals(name)) { + p_IsCleanChangeLog = para.getParameterAsBoolean(); + } else { + log.log(Level.SEVERE, "Unknown Parameter: " + name); + } } } // prepare @@ -65,9 +74,38 @@ public class CleanOrphanCascade extends SvrProcess { if (log.isLoggable(Level.INFO)) log.info(""); + ValueNamePair[] treeTables = new ValueNamePair[] { + new ValueNamePair("AD_TreeBar", "AD_Menu"), + new ValueNamePair("AD_TreeNodeBP", "C_BPartner"), + new ValueNamePair("AD_TreeNodeCMC", "CM_Container"), + new ValueNamePair("AD_TreeNodeCMM", "CM_Media"), + new ValueNamePair("AD_TreeNodeCMS", "CM_CStage"), + new ValueNamePair("AD_TreeNodeCMT", "CM_Template"), + new ValueNamePair("AD_TreeNodeMM", "AD_Menu"), + new ValueNamePair("AD_TreeNodePR", "M_Product"), + new ValueNamePair("AD_TreeNodeU1", "C_ElementValue"), + new ValueNamePair("AD_TreeNodeU2", "C_ElementValue"), + new ValueNamePair("AD_TreeNodeU3", "C_ElementValue"), + new ValueNamePair("AD_TreeNodeU4", "C_ElementValue") + }; + for (ValueNamePair vnp : treeTables) { + String treeTable = vnp.getValue(); + String foreignTable = vnp.getName(); + delTree(treeTable,foreignTable, "Node_ID", 0); + if (! "AD_TreeBar".equalsIgnoreCase(treeTable)) { + delTree(treeTable,foreignTable, "Parent_ID", 0); + } + } + + List trees = new Query(getCtx(), MTree_Base.Table_Name, null, get_TrxName()).list(); + String treeTable = "AD_TreeNode"; + for (MTree_Base tree : trees) { + String foreignTable = tree.getSourceTableName(true); + delTree(treeTable,foreignTable, "Parent_ID", tree.getAD_Tree_ID()); + } + String whereTables = "" + " IsView = 'N' " - + "AND TableName != 'AD_ChangeLog' " + "AND EXISTS (SELECT 1 " + " FROM AD_Column ct " + " WHERE ct.IsActive='Y' AND ct.AD_Table_ID = AD_Table.AD_Table_ID " @@ -80,13 +118,18 @@ public class CleanOrphanCascade extends SvrProcess + " FROM AD_Column ck " + " WHERE ck.IsActive='Y' AND ck.AD_Table_ID = AD_Table.AD_Table_ID " + " AND ck.ColumnName = AD_Table.TableName || '_ID')"; + if (! p_IsCleanChangeLog) { + whereTables += " AND TableName != 'AD_ChangeLog'"; + } List tables = new Query(getCtx(), "AD_Table", whereTables, get_TrxName()) .setOnlyActiveRecords(true) .setOrderBy("TableName") .list(); + tables.add(MTable.get(getCtx(), X_AD_Package_UUID_Map.Table_Name)); for (MTable table : tables) { String tableName = table.getTableName(); + boolean isUUIDMap = X_AD_Package_UUID_Map.Table_Name.equals(tableName); StringBuilder sqlRef = new StringBuilder(); sqlRef.append("SELECT DISTINCT t.AD_Table_ID, "); @@ -101,17 +144,26 @@ public class CleanOrphanCascade extends SvrProcess String refTableName = row.get(1).toString(); MTable refTable = MTable.get(getCtx(), refTableID); - if (refTable.getKeyColumns().length != 1) { - log.warning("Wrong reference for table " + tableName + " -> " + refTableName); - continue; - } - String colRef = refTable.getKeyColumns()[0]; - StringBuilder whereClause = new StringBuilder(); whereClause.append("AD_Table_ID = ").append(refTableID); - whereClause.append(" AND NOT EXISTS (SELECT ").append(colRef); - whereClause.append(" FROM ").append(refTableName).append(" "); - whereClause.append(" WHERE ").append(refTableName).append(".").append(colRef).append(" = ").append(tableName).append(".Record_ID)"); + if (refTable.getKeyColumns().length != 1 && !isUUIDMap) { + log.warning("Wrong reference for table " + tableName + " -> " + refTableName); + whereClause.append(" AND Record_ID>0"); + } else { + String colRef = refTable.getKeyColumns()[0]; + if (isUUIDMap) { + colRef = MTable.getUUIDColumnName(refTable.getTableName()); + } + + whereClause.append(" AND NOT EXISTS (SELECT ").append(colRef); + whereClause.append(" FROM ").append(refTableName).append(" "); + whereClause.append(" WHERE ").append(refTableName).append(".").append(colRef).append(" = ").append(tableName); + if (isUUIDMap) { + whereClause.append(".Target_UUID)"); + } else { + whereClause.append(".Record_ID)"); + } + } int noDel = 0; if (MAttachment.Table_Name.equals(tableName)) { @@ -144,4 +196,19 @@ public class CleanOrphanCascade extends SvrProcess return "@OK@"; } // doIt + private void delTree(String treeTable, String foreignTable, String columnName, int treeId) { + StringBuilder sqlDelete = new StringBuilder() + .append("DELETE FROM ").append(treeTable) + .append(" WHERE ").append(columnName).append(">0 AND ") + .append(columnName).append(" NOT IN (SELECT ").append(foreignTable).append("_ID FROM ").append(foreignTable).append(")"); + if (treeId > 0) { + sqlDelete.append(" AND AD_Tree_ID=").append(treeId); + } + int noDel = DB.executeUpdateEx(sqlDelete.toString(), get_TrxName()); + if (noDel > 0) { + addLog(Msg.parseTranslation(getCtx(), noDel + " " + treeTable + " " + "@Deleted@ -> " + foreignTable + + (treeId > 0 ? " Tree=" + treeId: "" ))); + } + } // delTree + } // CleanOrphanCascade diff --git a/org.adempiere.base/src/org/adempiere/base/PackInFolderApplication.java b/org.adempiere.base/src/org/adempiere/base/PackInFolderApplication.java index 04f278051f..90418fbc5a 100644 --- a/org.adempiere.base/src/org/adempiere/base/PackInFolderApplication.java +++ b/org.adempiere.base/src/org/adempiere/base/PackInFolderApplication.java @@ -85,11 +85,11 @@ public class PackInFolderApplication implements IApplication { .append("\n Logs=\n").append(pi.getLogInfo(false).replaceAll("
", "\n")); System.out.println(msgout.toString()); if (!success) - return new Integer(1); + return Integer.valueOf(1); } else { System.out.println("Apply PackIn from Folder usage:"); System.out.println("RUN_ApplyPackInFromFolder.sh folder"); - return new Integer(1); + return Integer.valueOf(1); } diff --git a/org.adempiere.base/src/org/adempiere/base/event/AbstractEventHandler.java b/org.adempiere.base/src/org/adempiere/base/event/AbstractEventHandler.java index 8af7a945ed..955acc9f8e 100644 --- a/org.adempiere.base/src/org/adempiere/base/event/AbstractEventHandler.java +++ b/org.adempiere.base/src/org/adempiere/base/event/AbstractEventHandler.java @@ -14,8 +14,10 @@ package org.adempiere.base.event; import java.util.List; +import java.util.UUID; import org.compiere.model.PO; +import org.compiere.process.ProcessInfo; import org.osgi.service.event.Event; import org.osgi.service.event.EventHandler; @@ -105,6 +107,21 @@ public abstract class AbstractEventHandler implements EventHandler { registerEvent(topic, filter); } + /** + * @param topic + * @param classOrUUID className or ProcessUUID + */ + protected void registerProcessEvent(String topic, String classOrUUID) { + String prop = "processUUID"; + try { + UUID.fromString(classOrUUID); + } catch (Exception e) { + prop = "className"; + } + String filter = "("+prop+"="+classOrUUID+")"; + registerEvent(topic, filter); + } + /** * @param event * @return PO @@ -113,6 +130,14 @@ public abstract class AbstractEventHandler implements EventHandler { return getEventProperty(event, IEventManager.EVENT_DATA); } + /** + * @param event + * @return ProcessInfo + */ + protected ProcessInfo getProcessInfo(Event event) { + return getEventProperty(event, IEventManager.EVENT_DATA); + } + /** * * @param diff --git a/org.adempiere.base/src/org/adempiere/base/event/IEventTopics.java b/org.adempiere.base/src/org/adempiere/base/event/IEventTopics.java index 7a2287c8f2..8661a7af37 100644 --- a/org.adempiere.base/src/org/adempiere/base/event/IEventTopics.java +++ b/org.adempiere.base/src/org/adempiere/base/event/IEventTopics.java @@ -97,5 +97,12 @@ public interface IEventTopics { public static final String BROADCAST_MESSAGE = "idempiere/broadcastMsg"; public static final String REQUEST_SEND_EMAIL = "idempiere/requestSendEMail"; -} + /** Called before starting a process, after prepared */ + public static final String BEFORE_PROCESS = "idempiere/beforeProcess"; + /** Called after a process finishes, before commit */ + public static final String AFTER_PROCESS = "idempiere/afterProcess"; + /** Called after a process is committed */ + public static final String POST_PROCESS = "idempiere/postProcess"; + +} diff --git a/org.adempiere.base/src/org/adempiere/process/UUIDGenerator.java b/org.adempiere.base/src/org/adempiere/process/UUIDGenerator.java index adcd3f5940..1844da0b5b 100644 --- a/org.adempiere.base/src/org/adempiere/process/UUIDGenerator.java +++ b/org.adempiere.base/src/org/adempiere/process/UUIDGenerator.java @@ -38,6 +38,7 @@ import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.Trx; +import org.compiere.util.Util; import org.compiere.util.ValueNamePair; /** @@ -127,13 +128,19 @@ public class UUIDGenerator extends SvrProcess { //update db if (isFillUUID) { // COMMENT NEXT LINE ON RELEASE WORK - updateUUID(mColumn, null); + String msg = updateUUID(mColumn, null); + if (! Util.isEmpty(msg)) { + addBufferLog(0, null, null, msg, 0, 0); + } } } else { if (isFillUUID) { MColumn mColumn = MColumn.get(getCtx(), AD_Column_ID); // COMMENT NEXT LINE ON RELEASE WORK - updateUUID(mColumn, null); + String msg = updateUUID(mColumn, null); + if (! Util.isEmpty(msg)) { + addBufferLog(0, null, null, msg, 0, 0); + } } } @@ -157,11 +164,11 @@ public class UUIDGenerator extends SvrProcess { return msgreturn.toString(); } - public static void updateUUID(MColumn column, String trxName) { + public static String updateUUID(MColumn column, String trxName) { MTable table = (MTable) column.getAD_Table(); if (table.getTableName().startsWith("T_")) { // don't update UUID for temporary tables - return; + return ""; } int AD_Column_ID = 0; StringBuilder sql = new StringBuilder("SELECT "); @@ -175,7 +182,7 @@ public class UUIDGenerator extends SvrProcess { if ((compositeKeys == null || compositeKeys.length == 0) && keyColumn == null) { // TODO: Update using rowid for oracle or ctid for postgresql log.warning("Cannot update orphan table " + table.getTableName() + " (not ID neither parents)"); - return; + return ""; } if (compositeKeys == null) { sql.append(keyColumn); @@ -211,19 +218,21 @@ public class UUIDGenerator extends SvrProcess { trx.setDisplayName(UUIDGenerator.class.getName()+"_updateUUID"); localTrx = true; } + String msg = ""; try { if (localTrx) trx.start(); stmt = DB.prepareStatement(sql.toString(), trx.getTrxName()); stmt.setFetchSize(100); rs = stmt.executeQuery(); + int no = 0; while (rs.next()) { if (AD_Column_ID > 0) { int recordId = rs.getInt(1); // this line is to avoid users generating official UUIDs - comment it to do official migration script work if (recordId > MTable.MAX_OFFICIAL_ID) { UUID uuid = UUID.randomUUID(); - DB.executeUpdateEx(updateSQL.toString(),new Object[]{uuid.toString(), recordId}, trx.getTrxName()); + no += DB.executeUpdateEx(updateSQL.toString(),new Object[]{uuid.toString(), recordId}, trx.getTrxName()); } } else { UUID uuid = UUID.randomUUID(); @@ -232,9 +241,12 @@ public class UUIDGenerator extends SvrProcess { for (String s : compositeKeys) { params.add(rs.getObject(s)); } - DB.executeUpdateEx(updateSQL.toString(),params.toArray(),trx.getTrxName()); + no += DB.executeUpdateEx(updateSQL.toString(),params.toArray(),trx.getTrxName()); } } + if (no > 0) { + msg = no + " UUID assigned for table " + table.getTableName(); + } if (localTrx) { trx.commit(true); } @@ -249,6 +261,7 @@ public class UUIDGenerator extends SvrProcess { trx.close(); } } + return msg; } private void syncColumn(MColumn column) { diff --git a/org.adempiere.base/src/org/compiere/model/GridField.java b/org.adempiere.base/src/org/compiere/model/GridField.java index 1f26b575df..936a0864b3 100644 --- a/org.adempiere.base/src/org/compiere/model/GridField.java +++ b/org.adempiere.base/src/org/compiere/model/GridField.java @@ -31,10 +31,8 @@ import java.util.Calendar; import java.util.Collections; import java.util.Date; import java.util.List; -import java.util.Map; import java.util.Properties; import java.util.StringTokenizer; -import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.adempiere.base.ILookupFactory; @@ -358,7 +356,7 @@ public class GridField { boolean retValue = false; if (m_vo.MandatoryLogic != null && m_vo.MandatoryLogic.startsWith("@SQL=")) { - retValue = parseSQLLogic(m_vo.MandatoryLogic); + retValue = Evaluator.parseSQLLogic(m_vo.MandatoryLogic, m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, m_vo.ColumnName); } else{ retValue= Evaluator.evaluateLogic(this, m_vo.MandatoryLogic); @@ -390,57 +388,6 @@ public class GridField return isDisplayed (checkContext); } // isMandatory - private boolean parseSQLLogic(String sqlLogic) { - String sql = sqlLogic.substring(5); // remove @SQL= - boolean reverse = false; - if (sql.startsWith("!")) { - reverse = true; - sql = sql.substring(1); //remove ! - } - sql = Env.parseContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, sql, false, false); // replace - - // variables - if (sql.equals("")) { - log.log(Level.WARNING,"(" + m_vo.ColumnName + ") - SQL variable parse failed: " + sqlLogic); - } else { - SQLLogicResult cache = sqlLogicCache.get(sql); - if (cache != null) { - long since = System.currentTimeMillis() - cache.timestamp; - if (since <= 500) { - cache.timestamp = System.currentTimeMillis(); - if (cache.value) - return reverse ? false : true; - else - return reverse ? true : false; - } - } - PreparedStatement stmt = null; - ResultSet rs = null; - try { - stmt = DB.prepareStatement(sql, null); - rs = stmt.executeQuery(); - boolean hasNext = rs.next(); - if (cache == null) { - cache = new SQLLogicResult(); - sqlLogicCache.put(sql, cache); - } - cache.value = hasNext; - cache.timestamp = System.currentTimeMillis(); - if (hasNext) - return reverse ? false : true; - else - return reverse ? true : false; - } catch (SQLException e) { - log.log(Level.WARNING, "(" + m_vo.ColumnName + ") " + sql, e); - } finally { - DB.close(rs, stmt); - rs = null; - stmt = null; - } - } - return false; - } - /** * Is parameter Editable - checks if parameter is Read Only * @param checkContext if true checks Context @@ -451,7 +398,7 @@ public class GridField { if (m_vo.ReadOnlyLogic.startsWith("@SQL=")) { - boolean retValue = !parseSQLLogic(m_vo.ReadOnlyLogic); + boolean retValue = !Evaluator.parseSQLLogic(m_vo.ReadOnlyLogic, m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, m_vo.ColumnName); if (!retValue) return false; } @@ -563,7 +510,7 @@ public class GridField { if (m_vo.ReadOnlyLogic.startsWith("@SQL=")) { - boolean retValue = !parseSQLLogic(m_vo.ReadOnlyLogic); + boolean retValue = !Evaluator.parseSQLLogic(m_vo.ReadOnlyLogic, m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, m_vo.ColumnName); if (!retValue) return false; } @@ -1245,6 +1192,9 @@ public class GridField // ** dynamic content ** if (checkContext) { + if (m_vo.DisplayLogic.startsWith("@SQL=")) { + return Evaluator.parseSQLLogic(m_vo.DisplayLogic, m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, m_vo.ColumnName); + } Evaluatee evaluatee = new Evaluatee() { public String get_ValueAsString(String variableName) { return GridField.this.get_ValueAsString(ctx, variableName); @@ -2605,13 +2555,6 @@ public class GridField return m_lookupEditorSettingValue; } - private static final Map sqlLogicCache = new ConcurrentHashMap<>(); - - private class SQLLogicResult { - long timestamp; - boolean value; - } - public void processUIVirtualColumn() { String sql = m_vo.ColumnSQL.substring(5); sql = Env.parseContext(Env.getCtx(), getWindowNo(), sql, false); diff --git a/org.adempiere.base/src/org/compiere/model/GridTable.java b/org.adempiere.base/src/org/compiere/model/GridTable.java index 46b1314b1f..1570fed909 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTable.java +++ b/org.adempiere.base/src/org/compiere/model/GridTable.java @@ -1026,7 +1026,7 @@ public class GridTable extends AbstractTableModel } } return null; - } // getKeyID + } // getUUID /** * Get Key ColumnName diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_Role.java b/org.adempiere.base/src/org/compiere/model/I_AD_Role.java index fa50ff26ea..fa57444f8d 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_Role.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_Role.java @@ -548,6 +548,15 @@ public interface I_AD_Role */ public String getPreferenceType(); + /** Column name RoleType */ + public static final String COLUMNNAME_RoleType = "RoleType"; + + /** Set Role Type */ + public void setRoleType (String RoleType); + + /** Get Role Type */ + public String getRoleType(); + /** Column name Supervisor_ID */ public static final String COLUMNNAME_Supervisor_ID = "Supervisor_ID"; diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_User.java b/org.adempiere.base/src/org/compiere/model/I_AD_User.java index 6a71706c35..53992bdaba 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_User.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_User.java @@ -516,6 +516,15 @@ public interface I_AD_User */ public boolean isSalesLead(); + /** Column name IsSupportUser */ + public static final String COLUMNNAME_IsSupportUser = "IsSupportUser"; + + /** Set Support User */ + public void setIsSupportUser (boolean IsSupportUser); + + /** Get Support User */ + public boolean isSupportUser(); + /** Column name LastContact */ public static final String COLUMNNAME_LastContact = "LastContact"; diff --git a/org.adempiere.base/src/org/compiere/model/MRole.java b/org.adempiere.base/src/org/compiere/model/MRole.java index fedfe537fa..94c8c41ca1 100644 --- a/org.adempiere.base/src/org/compiere/model/MRole.java +++ b/org.adempiere.base/src/org/compiere/model/MRole.java @@ -44,6 +44,7 @@ import org.compiere.util.Ini; import org.compiere.util.KeyNamePair; import org.compiere.util.Msg; import org.compiere.util.Trace; +import org.compiere.util.Util; /** * Role Model. @@ -61,7 +62,7 @@ public final class MRole extends X_AD_Role /** * */ - private static final long serialVersionUID = 8952907008982481439L; + private static final long serialVersionUID = -4649095180532036099L; /** * Get Default (Client) Role @@ -3198,4 +3199,50 @@ public final class MRole extends X_AD_Role return m_canAccess_Info_Product.booleanValue(); } + /** + * Get where clause for a role types list + * @param roleType - comma separated list of role types, NULL can be used + * @param tableName - if table needs to be qualified + * @return whereClause - return null if roleType is null or empty + */ + public static String getWhereRoleType(String roleType, String tableName) { + if (Util.isEmpty(roleType, true)) { + return null; + } + boolean includeNull = false; + String types[] = roleType.split(","); + StringBuilder whereClause = new StringBuilder("("); + boolean start = true; + for (String type : types) { + if ("null".equalsIgnoreCase(type)) { + includeNull = true; + } else { + if (start) { + if (! Util.isEmpty(tableName)) { + whereClause.append(tableName).append("."); + } + whereClause.append(COLUMNNAME_RoleType).append(" IN ("); + start = false; + } else { + whereClause.append(","); + } + whereClause.append(DB.TO_STRING(type)); + } + } + if (! start) { + whereClause.append(")"); + } + if (includeNull) { + if (! start) { + whereClause.append(" OR "); + } + if (! Util.isEmpty(tableName)) { + whereClause.append(tableName).append("."); + } + whereClause.append(COLUMNNAME_RoleType).append(" IS NULL"); + } + whereClause.append(")"); + return whereClause.toString(); + } + } // MRole diff --git a/org.adempiere.base/src/org/compiere/model/MUser.java b/org.adempiere.base/src/org/compiere/model/MUser.java index cf85f3b2bd..7a32faaddb 100644 --- a/org.adempiere.base/src/org/compiere/model/MUser.java +++ b/org.adempiere.base/src/org/compiere/model/MUser.java @@ -898,12 +898,11 @@ public class MUser extends X_AD_User } } } - - if (getPassword() != null && getPassword().length() > 0 && (newRecord || is_ValueChanged("Password"))) { + + boolean hasPassword = ! Util.isEmpty(getPassword()); + if (hasPassword && (newRecord || is_ValueChanged("Password"))) { // Validate password policies / IDEMPIERE-221 - if (get_ValueOld("Salt") == null && get_Value("Salt") != null) { // being hashed - ; - } else { + if (! (get_ValueOld("Salt") == null && get_Value("Salt") != null)) { // not being hashed MPasswordRule pwdrule = MPasswordRule.getRules(getCtx(), get_TrxName()); if (pwdrule != null){ List passwordHistorys = MPasswordHistory.getPasswordHistoryForCheck(pwdrule.getDays_Reuse_Password(), this.getAD_User_ID()); @@ -911,12 +910,15 @@ public class MUser extends X_AD_User } setDatePasswordChanged(new Timestamp(new Date().getTime())); } + } + boolean hash_password = MSysConfig.getBooleanValue(MSysConfig.USER_PASSWORD_HASH, false); + if ( hasPassword + && is_ValueChanged("Password") + && (!newRecord || (hash_password && getSalt() == null))) { // Hash password - IDEMPIERE-347 - boolean hash_password = MSysConfig.getBooleanValue(MSysConfig.USER_PASSWORD_HASH, false); if (hash_password) setPassword(getPassword()); - } return true; diff --git a/org.adempiere.base/src/org/compiere/model/SystemIDs.java b/org.adempiere.base/src/org/compiere/model/SystemIDs.java index f064122dec..9fd0c43545 100644 --- a/org.adempiere.base/src/org/compiere/model/SystemIDs.java +++ b/org.adempiere.base/src/org/compiere/model/SystemIDs.java @@ -58,6 +58,15 @@ public class SystemIDs public final static int MESSAGE_WORKFLOWRESULT = 753; public final static int PRINTFORMAT_STATEMENTOFACCOUNT = 134; + public final static int PRINTFORMAT_ORDER_HEADER_TEMPLATE = 100; + public final static int PRINTFORMAT_ORDER_LINETAX_TEMPLATE = 101; + public final static int PRINTFORMAT_INVOICE_HEADER_TEMPLATE = 102; + public final static int PRINTFORMAT_INVOICE_LINETAX_TEMPLATE = 103; + public final static int PRINTFORMAT_INOUT_HEADER_TEMPLATE = 104; + public final static int PRINTFORMAT_INOUT_LINE_TEMPLATE = 105; + public final static int PRINTFORMAT_PAYSELECTION_CHECK_TEMPLATE = 106; + public final static int PRINTFORMAT_PAYSELECTION_REMITTANCE_LINES_TEMPLATE = 107; + public final static int PRINTFORMAT_PAYSELECTION_REMITTANCE__TEMPLATE = 108; public final static int PROCESS_AD_WORKFLOW_DOCVALUE = 305; public final static int PROCESS_AD_CHANGELOG_UNDO = 306; diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_Role.java b/org.adempiere.base/src/org/compiere/model/X_AD_Role.java index 3ca5a5cd36..bef5882e54 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_Role.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_Role.java @@ -32,7 +32,7 @@ public class X_AD_Role extends PO implements I_AD_Role, I_Persistent /** * */ - private static final long serialVersionUID = 20190106L; + private static final long serialVersionUID = 20190321L; /** Standard Constructor */ public X_AD_Role (Properties ctx, int AD_Role_ID, String trxName) @@ -1003,6 +1003,43 @@ public class X_AD_Role extends PO implements I_AD_Role, I_Persistent return (String)get_Value(COLUMNNAME_PreferenceType); } + /** RoleType AD_Reference_ID=200166 */ + public static final int ROLETYPE_AD_Reference_ID=200166; + /** WebUI = ZK */ + public static final String ROLETYPE_WebUI = "ZK"; + /** WebService = WS */ + public static final String ROLETYPE_WebService = "WS"; + /** System Support = SS */ + public static final String ROLETYPE_SystemSupport = "SS"; + /** Mobile = MO */ + public static final String ROLETYPE_Mobile = "MO"; + /** Swing = SW */ + public static final String ROLETYPE_Swing = "SW"; + /** External App 1 = E1 */ + public static final String ROLETYPE_ExternalApp1 = "E1"; + /** External App 2 = E2 */ + public static final String ROLETYPE_ExternalApp2 = "E2"; + /** External App 3 = E3 */ + public static final String ROLETYPE_ExternalApp3 = "E3"; + /** External App 4 = E4 */ + public static final String ROLETYPE_ExternalApp4 = "E4"; + /** External App 5 = E5 */ + public static final String ROLETYPE_ExternalApp5 = "E5"; + /** Set Role Type. + @param RoleType Role Type */ + public void setRoleType (String RoleType) + { + + set_Value (COLUMNNAME_RoleType, RoleType); + } + + /** Get Role Type. + @return Role Type */ + public String getRoleType () + { + return (String)get_Value(COLUMNNAME_RoleType); + } + public org.compiere.model.I_AD_User getSupervisor() throws RuntimeException { return (org.compiere.model.I_AD_User)MTable.get(getCtx(), org.compiere.model.I_AD_User.Table_Name) diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_User.java b/org.adempiere.base/src/org/compiere/model/X_AD_User.java index 242c493634..f9f5ca01f3 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_User.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_User.java @@ -31,7 +31,7 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent /** * */ - private static final long serialVersionUID = 20190106L; + private static final long serialVersionUID = 20190321L; /** Standard Constructor */ public X_AD_User (Properties ctx, int AD_User_ID, String trxName) @@ -57,10 +57,12 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent setIsNoPasswordReset (false); // 'N' setIsSalesLead (false); +// N + setIsSupportUser (false); // N setName (null); setNotificationType (null); -// E +// X } */ } @@ -815,6 +817,27 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent return false; } + /** Set Support User. + @param IsSupportUser Support User */ + public void setIsSupportUser (boolean IsSupportUser) + { + set_Value (COLUMNNAME_IsSupportUser, Boolean.valueOf(IsSupportUser)); + } + + /** Get Support User. + @return Support User */ + public boolean isSupportUser () + { + Object oo = get_Value(COLUMNNAME_IsSupportUser); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + /** Set Last Contact. @param LastContact Date this individual was last contacted diff --git a/org.adempiere.base/src/org/compiere/print/PrintUtil.java b/org.adempiere.base/src/org/compiere/print/PrintUtil.java index b77616adc4..61bff30c65 100644 --- a/org.adempiere.base/src/org/compiere/print/PrintUtil.java +++ b/org.adempiere.base/src/org/compiere/print/PrintUtil.java @@ -16,6 +16,16 @@ *****************************************************************************/ package org.compiere.print; +import static org.compiere.model.SystemIDs.PRINTFORMAT_INOUT_HEADER_TEMPLATE; +import static org.compiere.model.SystemIDs.PRINTFORMAT_INOUT_LINE_TEMPLATE; +import static org.compiere.model.SystemIDs.PRINTFORMAT_INVOICE_HEADER_TEMPLATE; +import static org.compiere.model.SystemIDs.PRINTFORMAT_INVOICE_LINETAX_TEMPLATE; +import static org.compiere.model.SystemIDs.PRINTFORMAT_ORDER_HEADER_TEMPLATE; +import static org.compiere.model.SystemIDs.PRINTFORMAT_ORDER_LINETAX_TEMPLATE; +import static org.compiere.model.SystemIDs.PRINTFORMAT_PAYSELECTION_CHECK_TEMPLATE; +import static org.compiere.model.SystemIDs.PRINTFORMAT_PAYSELECTION_REMITTANCE_LINES_TEMPLATE; +import static org.compiere.model.SystemIDs.PRINTFORMAT_PAYSELECTION_REMITTANCE__TEMPLATE; + import java.awt.print.PageFormat; import java.awt.print.Pageable; import java.awt.print.PrinterException; @@ -546,23 +556,23 @@ public class PrintUtil CLogMgt.enable(false); // // Order Template - int Order_PrintFormat_ID = MPrintFormat.copyToClient(ctx, 100, AD_Client_ID).get_ID(); - int OrderLine_PrintFormat_ID = MPrintFormat.copyToClient(ctx, 101, AD_Client_ID).get_ID(); + int Order_PrintFormat_ID = MPrintFormat.copyToClient(ctx, PRINTFORMAT_ORDER_HEADER_TEMPLATE, AD_Client_ID).get_ID(); + int OrderLine_PrintFormat_ID = MPrintFormat.copyToClient(ctx, PRINTFORMAT_ORDER_LINETAX_TEMPLATE, AD_Client_ID).get_ID(); updatePrintFormatHeader(Order_PrintFormat_ID, OrderLine_PrintFormat_ID); // Invoice - int Invoice_PrintFormat_ID = MPrintFormat.copyToClient(ctx, 102, AD_Client_ID).get_ID(); - int InvoiceLine_PrintFormat_ID = MPrintFormat.copyToClient(ctx, 103, AD_Client_ID).get_ID(); + int Invoice_PrintFormat_ID = MPrintFormat.copyToClient(ctx, PRINTFORMAT_INVOICE_HEADER_TEMPLATE, AD_Client_ID).get_ID(); + int InvoiceLine_PrintFormat_ID = MPrintFormat.copyToClient(ctx, PRINTFORMAT_INVOICE_LINETAX_TEMPLATE, AD_Client_ID).get_ID(); updatePrintFormatHeader(Invoice_PrintFormat_ID, InvoiceLine_PrintFormat_ID); // Shipment - int Shipment_PrintFormat_ID = MPrintFormat.copyToClient(ctx, 104, AD_Client_ID).get_ID(); - int ShipmentLine_PrintFormat_ID = MPrintFormat.copyToClient(ctx, 105, AD_Client_ID).get_ID(); + int Shipment_PrintFormat_ID = MPrintFormat.copyToClient(ctx, PRINTFORMAT_INOUT_HEADER_TEMPLATE, AD_Client_ID).get_ID(); + int ShipmentLine_PrintFormat_ID = MPrintFormat.copyToClient(ctx, PRINTFORMAT_INOUT_LINE_TEMPLATE, AD_Client_ID).get_ID(); updatePrintFormatHeader(Shipment_PrintFormat_ID, ShipmentLine_PrintFormat_ID); // Check - int Check_PrintFormat_ID = MPrintFormat.copyToClient(ctx, 106, AD_Client_ID).get_ID(); - int RemittanceLine_PrintFormat_ID = MPrintFormat.copyToClient(ctx, 107, AD_Client_ID).get_ID(); + int Check_PrintFormat_ID = MPrintFormat.copyToClient(ctx, PRINTFORMAT_PAYSELECTION_CHECK_TEMPLATE, AD_Client_ID).get_ID(); + int RemittanceLine_PrintFormat_ID = MPrintFormat.copyToClient(ctx, PRINTFORMAT_PAYSELECTION_REMITTANCE_LINES_TEMPLATE, AD_Client_ID).get_ID(); updatePrintFormatHeader(Check_PrintFormat_ID, RemittanceLine_PrintFormat_ID); // Remittance - int Remittance_PrintFormat_ID = MPrintFormat.copyToClient(ctx, 108, AD_Client_ID).get_ID(); + int Remittance_PrintFormat_ID = MPrintFormat.copyToClient(ctx, PRINTFORMAT_PAYSELECTION_REMITTANCE__TEMPLATE, AD_Client_ID).get_ID(); updatePrintFormatHeader(Remittance_PrintFormat_ID, RemittanceLine_PrintFormat_ID); // TODO: MPrintForm diff --git a/org.adempiere.base/src/org/compiere/process/ProcessInfo.java b/org.adempiere.base/src/org/compiere/process/ProcessInfo.java index a6566a4c32..81760af172 100644 --- a/org.adempiere.base/src/org/compiere/process/ProcessInfo.java +++ b/org.adempiere.base/src/org/compiere/process/ProcessInfo.java @@ -24,6 +24,7 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; +import org.adempiere.util.IProcessUI; import org.compiere.model.MPInstance; import org.compiere.model.MPInstancePara; import org.compiere.model.MProcess; @@ -49,7 +50,7 @@ public class ProcessInfo implements Serializable /** * */ - private static final long serialVersionUID = 2167823616151648814L; + private static final long serialVersionUID = -4600747909096993053L; /** * Constructor @@ -203,6 +204,8 @@ public class ProcessInfo implements Serializable sb.append(",Transient=").append(m_TransientObject); if (m_SerializableObject != null) sb.append(",Serializable=").append(m_SerializableObject); + if (m_transactionName != null) + sb.append(",Trx=").append(m_transactionName); sb.append(",Summary=").append(getSummary()) .append(",Log=").append(m_logs == null ? 0 : m_logs.size()); // .append(getLogInfo(false)); @@ -918,5 +921,15 @@ public class ProcessInfo implements Serializable return lastServerSession.getCreated(); } + + private IProcessUI processUI; + + public void setProcessUI(IProcessUI processUI) { + this.processUI = processUI; + } + + public IProcessUI getProcessUI() { + return processUI; + } } // ProcessInfo diff --git a/org.adempiere.base/src/org/compiere/process/SvrProcess.java b/org.adempiere.base/src/org/compiere/process/SvrProcess.java index e4cb3092c8..ad72f1ba82 100644 --- a/org.adempiere.base/src/org/compiere/process/SvrProcess.java +++ b/org.adempiere.base/src/org/compiere/process/SvrProcess.java @@ -27,6 +27,10 @@ import java.util.List; import java.util.Properties; import java.util.logging.Level; +import org.adempiere.base.event.EventManager; +import org.adempiere.base.event.EventProperty; +import org.adempiere.base.event.IEventManager; +import org.adempiere.base.event.IEventTopics; import org.adempiere.util.IProcessUI; import org.compiere.model.MPInstance; import org.compiere.model.PO; @@ -35,6 +39,7 @@ import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.Trx; +import org.osgi.service.event.Event; /** * Server Process Template @@ -128,6 +133,8 @@ public abstract class SvrProcess implements ProcessCall m_trx = Trx.get(Trx.createTrxName("SvrProcess"), true); m_trx.setDisplayName(getClass().getName()+"_startProcess"); } + m_pi.setTransactionName(m_trx.getTrxName()); + m_pi.setProcessUI(processUI); // ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); ClassLoader processLoader = getClass().getClassLoader(); @@ -168,13 +175,17 @@ public abstract class SvrProcess implements ProcessCall m_trx.rollback(); m_trx.close(); m_trx = null; + m_pi.setTransactionName(null); } unlock(); // outside transaction processing [ teo_sarca, 1646891 ] postProcess(!m_pi.isError()); - + + @SuppressWarnings("unused") + Event eventPP = sendProcessEvent(IEventTopics.POST_PROCESS); + Thread.currentThread().setContextClassLoader(contextLoader); } } finally { @@ -198,7 +209,24 @@ public abstract class SvrProcess implements ProcessCall try { prepare(); - msg = doIt(); + + // event before process + Event eventBP = sendProcessEvent(IEventTopics.BEFORE_PROCESS); + @SuppressWarnings("unchecked") + List errorsBP = (List) eventBP.getProperty(IEventManager.EVENT_ERROR_MESSAGES); + if (errorsBP != null && !errorsBP.isEmpty()) { + msg = "@Error@:" + errorsBP.get(0); + } else { + msg = doIt(); + if (msg != null && ! msg.startsWith("@Error@")) { + Event eventAP = sendProcessEvent(IEventTopics.AFTER_PROCESS); + @SuppressWarnings("unchecked") + List errorsAP = (List) eventAP.getProperty(IEventManager.EVENT_ERROR_MESSAGES); + if (errorsAP != null && !errorsAP.isEmpty()) { + msg = "@Error@:" + errorsAP.get(0); + } + } + } } catch (Throwable e) { @@ -227,6 +255,15 @@ public abstract class SvrProcess implements ProcessCall return success; } // process + private Event sendProcessEvent(String topic) { + Event event = EventManager.newEvent(topic, + new EventProperty(EventManager.EVENT_DATA, m_pi), + new EventProperty("processUUID", m_pi.getAD_Process_UU()), + new EventProperty("className", m_pi.getClassName())); + EventManager.getInstance().sendEvent(event); + return event; + } + /** * Prepare - e.g., get Parameters. * diff --git a/org.adempiere.base/src/org/compiere/util/Evaluator.java b/org.adempiere.base/src/org/compiere/util/Evaluator.java index 9ca826fba5..3dfcea07fb 100644 --- a/org.adempiere.base/src/org/compiere/util/Evaluator.java +++ b/org.adempiere.base/src/org/compiere/util/Evaluator.java @@ -17,8 +17,14 @@ package org.compiere.util; import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; import java.util.ArrayList; +import java.util.Map; +import java.util.Properties; import java.util.StringTokenizer; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; @@ -33,6 +39,13 @@ public class Evaluator /** Static Logger */ private static CLogger s_log = CLogger.getCLogger (Evaluator.class); + private static final Map sqlLogicCache = new ConcurrentHashMap<>(); + + public static class SQLLogicResult { + long timestamp; + boolean value; + } + /** * Check if All Variables are Defined * @param source source @@ -299,4 +312,63 @@ public class Evaluator } } // parseDepends + /** + * evaluator a expression logic base on sql + * @param sqlLogic + * @param ctx + * @param windowNo + * @param tabNo + * @param targetObjectName expression logic is evaluated for, that target object (purpose for logging) can be field name, toolbar button name,.. + * @return + */ + public static boolean parseSQLLogic(String sqlLogic, Properties ctx, int windowNo, int tabNo, String targetObjectName) { + String sql = sqlLogic.substring(5); // remove @SQL= + boolean reverse = false; + if (sql.startsWith("!")) { + reverse = true; + sql = sql.substring(1); //remove ! + } + sql = Env.parseContext(ctx, windowNo, tabNo, sql, false, false); // replace + + // variables + if (sql.equals("")) { + s_log.log(Level.WARNING,"(" + targetObjectName + ") - SQL variable parse failed: " + sqlLogic); + } else { + SQLLogicResult cache = sqlLogicCache.get(sql); + if (cache != null) { + long since = System.currentTimeMillis() - cache.timestamp; + if (since <= 500) { + cache.timestamp = System.currentTimeMillis(); + if (cache.value) + return reverse ? false : true; + else + return reverse ? true : false; + } + } + PreparedStatement stmt = null; + ResultSet rs = null; + try { + stmt = DB.prepareStatement(sql, null); + rs = stmt.executeQuery(); + boolean hasNext = rs.next(); + if (cache == null) { + cache = new SQLLogicResult(); + sqlLogicCache.put(sql, cache); + } + cache.value = hasNext; + cache.timestamp = System.currentTimeMillis(); + if (hasNext) + return reverse ? false : true; + else + return reverse ? true : false; + } catch (SQLException e) { + s_log.log(Level.WARNING, "(" + targetObjectName + ") " + sql, e); + } finally { + DB.close(rs, stmt); + rs = null; + stmt = null; + } + } + return false; + } } // Evaluator diff --git a/org.adempiere.base/src/org/compiere/util/Ini.java b/org.adempiere.base/src/org/compiere/util/Ini.java index ca5307263e..eb86a35569 100644 --- a/org.adempiere.base/src/org/compiere/util/Ini.java +++ b/org.adempiere.base/src/org/compiere/util/Ini.java @@ -420,7 +420,6 @@ public final class Ini implements Serializable { fis = new FileInputStream(filename); s_prop.load(fis); - fis.close(); } catch (FileNotFoundException e) { @@ -437,6 +436,17 @@ public final class Ini implements Serializable log.log(Level.SEVERE, filename + " - " + t.toString()); loadOK = false; } + finally + { + if (fis != null) + { + try + { + fis.close(); + } + catch (Exception e) {} + } + } if (!loadOK || s_prop.getProperty(P_TODAY, "").equals("")) { if (log.isLoggable(Level.CONFIG)) log.config(filename); diff --git a/org.adempiere.base/src/org/compiere/util/Login.java b/org.adempiere.base/src/org/compiere/util/Login.java index a770447150..820bc4dcba 100644 --- a/org.adempiere.base/src/org/compiere/util/Login.java +++ b/org.adempiere.base/src/org/compiere/util/Login.java @@ -1239,14 +1239,19 @@ public class Login return null; } // getPrincipal + public KeyNamePair[] getClients(String app_user, String app_pwd) { + return getClients(app_user, app_pwd, null); + } + /** * Validate Client Login. * Sets Context with login info * @param app_user user id * @param app_pwd password + * @param roleTypes comma separated list of the role types allowed to login (NULL can be added) * @return client array or null if in error. */ - public KeyNamePair[] getClients(String app_user, String app_pwd) { + public KeyNamePair[] getClients(String app_user, String app_pwd, String roleTypes) { if (log.isLoggable(Level.INFO)) log.info("User=" + app_user); if (Util.isEmpty(app_user)) @@ -1287,10 +1292,15 @@ public class Login where.append("EMail=?"); else where.append("COALESCE(LDAPUser,Name)=?"); + String whereRoleType = MRole.getWhereRoleType(roleTypes, "r"); where.append(" AND") .append(" EXISTS (SELECT * FROM AD_User_Roles ur") .append(" INNER JOIN AD_Role r ON (ur.AD_Role_ID=r.AD_Role_ID)") - .append(" WHERE ur.AD_User_ID=AD_User.AD_User_ID AND ur.IsActive='Y' AND r.IsActive='Y') AND ") + .append(" WHERE ur.AD_User_ID=AD_User.AD_User_ID AND ur.IsActive='Y' AND r.IsActive='Y'"); + if (! Util.isEmpty(whereRoleType)) { + where.append(" AND ").append(whereRoleType); + } + where.append(") AND ") .append(" EXISTS (SELECT * FROM AD_Client c") .append(" WHERE c.AD_Client_ID=AD_User.AD_Client_ID") .append(" AND c.IsActive='Y') AND ") @@ -1511,17 +1521,24 @@ public class Login } return retValue; } + + public KeyNamePair[] getRoles(String app_user, KeyNamePair client) { + return getRoles(app_user, client, null); + } + /************************************************************************** * Load Roles. *

* Sets Client info in context and loads its roles * @param client client information + * @param roleTypes comma separated list of the role types allowed to login (NULL can be added) * @return list of valid roles KeyNodePairs or null if in error */ - public KeyNamePair[] getRoles(String app_user, KeyNamePair client) { + public KeyNamePair[] getRoles(String app_user, KeyNamePair client, String roleTypes) { if (client == null) throw new IllegalArgumentException("Client missing"); + String whereRoleType = MRole.getWhereRoleType(roleTypes, "r"); ArrayList rolesList = new ArrayList(); KeyNamePair[] retValue = null; StringBuffer sql = new StringBuffer("SELECT u.AD_User_ID, r.AD_Role_ID,r.Name ") @@ -1535,6 +1552,9 @@ public class Login else sql.append("COALESCE(u.LDAPUser,u.Name)=?"); sql.append(" AND r.IsMasterRole='N'"); + if (! Util.isEmpty(whereRoleType)) { + sql.append(" AND ").append(whereRoleType); + } sql.append(" AND u.IsActive='Y' AND EXISTS (SELECT * FROM AD_Client c WHERE u.AD_Client_ID=c.AD_Client_ID AND c.IsActive='Y')"); // don't show roles without org access sql.append(" AND ("); diff --git a/org.adempiere.base/src/org/idempiere/process/MoveClient.java b/org.adempiere.base/src/org/idempiere/process/MoveClient.java index 42b0ccef6f..5d03f87d3e 100644 --- a/org.adempiere.base/src/org/idempiere/process/MoveClient.java +++ b/org.adempiere.base/src/org/idempiere/process/MoveClient.java @@ -32,6 +32,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; +import java.util.UUID; import java.util.logging.Level; import org.adempiere.exceptions.AdempiereException; @@ -40,6 +41,7 @@ import org.compiere.model.MColumn; import org.compiere.model.MSequence; import org.compiere.model.MTable; import org.compiere.model.Query; +import org.compiere.model.X_AD_Package_UUID_Map; import org.compiere.process.ProcessInfoParameter; import org.compiere.process.SvrProcess; import org.compiere.util.AdempiereUserError; @@ -49,8 +51,9 @@ import org.compiere.util.Util; public class MoveClient extends SvrProcess { - // Process to move a client from a external database to current + // Process to move a client from a external database to current, or copy a template in current database + private boolean p_IsCopyClient; // Define if the process is to copy a template client, or bring from external database private String p_JDBC_URL; // JDBC URL of the external database private String p_UserName; // optional to connect to the JDBC URL, if empty use the same as target private String p_Password; // optional to connect to the JDBC URL, if empty use the same as target @@ -58,7 +61,10 @@ public class MoveClient extends SvrProcess { private String p_ClientsToInclude; // optional, comma separated list, if empty then all clients >= 1000000 will be moved private String p_ClientsToExclude; // optional, comma separated list of clients to exclude private boolean p_IsValidateOnly; // to do just validation and not execute the process - private String p_IsPreserveIDs; // optional, comma separated list of tables that require to preserve IDs + private String p_TablesToPreserveIDs; // optional, comma separated list of tables that require to preserve IDs, * for all + private String p_ClientName; // New client name when copying from template + private String p_ClientValue; // New client value when copying from template + private boolean p_IsSkipSomeValidations; // skip some validations to make the process faster final static String insertConversionId = "INSERT INTO T_MoveClient (AD_PInstance_ID, TableName, Source_ID, Target_ID) VALUES (?, ?, ?, ?)"; @@ -71,6 +77,7 @@ public class MoveClient extends SvrProcess { private List p_tablesToExcludeList = new ArrayList(); private List p_columnsVerifiedList = new ArrayList(); private List p_idSystemConversionList = new ArrayList(); // can consume lot of memory but it helps for performance + private boolean p_isPreserveAll = false; @Override protected void prepare() { @@ -79,12 +86,18 @@ public class MoveClient extends SvrProcess { // for (ProcessInfoParameter para : getParameter()) { String name = para.getParameterName(); - if ("JDBC_URL".equals(name)) { + if ("IsCopyClient".equals(name)) { + p_IsCopyClient = para.getParameterAsBoolean(); + } else if ("JDBC_URL".equals(name)) { p_JDBC_URL = para.getParameterAsString(); } else if ("UserName".equals(name)) { p_UserName = para.getParameterAsString(); } else if ("Password".equals(name)) { p_Password = para.getParameterAsString(); + } else if ("ClientName".equals(name)) { + p_ClientName = para.getParameterAsString(); + } else if ("ClientValue".equals(name)) { + p_ClientValue = para.getParameterAsString(); } else if ("TablesToExclude".equals(name)) { p_TablesToExclude = para.getParameterAsString(); } else if ("ClientsToInclude".equals(name)) { @@ -94,9 +107,11 @@ public class MoveClient extends SvrProcess { } else if ("IsValidateOnly".equals(name)) { p_IsValidateOnly = para.getParameterAsBoolean(); } else if ("IsPreserveIDs".equals(name)) { - p_IsPreserveIDs = para.getParameterAsString(); + p_TablesToPreserveIDs = para.getParameterAsString(); + } else if ("IsSkipSomeValidations".equals(name)) { + p_IsSkipSomeValidations = para.getParameterAsBoolean(); } else { - log.log(Level.SEVERE, "Unknown Parameter: " + name); + if (log.isLoggable(Level.INFO)) log.log(Level.INFO, "Custom Parameter: " + name + "=" + para.getInfo()); } } } @@ -104,17 +119,33 @@ public class MoveClient extends SvrProcess { @Override protected String doIt() throws Exception { // validate parameters - if (Util.isEmpty(p_JDBC_URL, true)) - throw new AdempiereException("Fill mandatory JDBC_URL"); + if (p_IsCopyClient) { + if (! Util.isEmpty(p_ClientsToExclude, true)) + throw new AdempiereException("Clients to exclude must be empty when copying from template"); + if (! Util.isEmpty(p_TablesToPreserveIDs, true)) + throw new AdempiereException("Preserve IDs must be empty when copying from template"); + try { + Integer.parseInt(p_ClientsToInclude); + } catch (NumberFormatException e) { + throw new AdempiereException("Error in parameter Clients to Include, must be just one integer"); + } + } else { + if (Util.isEmpty(p_JDBC_URL, true)) + throw new AdempiereException("Fill mandatory JDBC_URL"); + } if (! Util.isEmpty(p_ClientsToInclude, true) && ! Util.isEmpty(p_ClientsToExclude, true)) throw new AdempiereException("Clients to exclude and include cannot be used at the same time"); if (Util.isEmpty(p_UserName, true)) p_UserName = CConnection.get().getDbUid(); if (Util.isEmpty(p_Password, true)) p_Password = CConnection.get().getDbPwd(); - + // Construct the where clauses p_excludeTablesWhere.append("(UPPER(AD_Table.TableName) NOT LIKE 'T|_%' ESCAPE '|'"); // exclude temporary tables + if (p_IsCopyClient) { + // exclude always AD_ChangeLog when copying from template client + p_excludeTablesWhere.append(" AND UPPER(TableName) != 'AD_CHANGELOG'"); + } if (Util.isEmpty(p_TablesToExclude, true)) { p_excludeTablesWhere.append(")"); } else { @@ -166,9 +197,14 @@ public class MoveClient extends SvrProcess { p_whereClient.append(")"); } - if (! Util.isEmpty(p_IsPreserveIDs, true)) { - for (String tableName : p_IsPreserveIDs.split(",")) { - p_tablesToPreserveIDsList.add(tableName.toUpperCase()); + if (! Util.isEmpty(p_TablesToPreserveIDs, true)) { + if ("*".equals(p_TablesToPreserveIDs)) { + p_isPreserveAll = true; + } else { + p_isPreserveAll = false; + for (String tableName : p_TablesToPreserveIDs.split(",")) { + p_tablesToPreserveIDsList.add(tableName.toUpperCase()); + } } } @@ -176,7 +212,11 @@ public class MoveClient extends SvrProcess { externalConn = null; try { try { - externalConn = DB.getDatabase(p_JDBC_URL).getDriverConnection(p_JDBC_URL, p_UserName, p_Password); + if (p_IsCopyClient) { + externalConn = DB.getConnectionRO(); + } else { + externalConn = DB.getDatabase(p_JDBC_URL).getDriverConnection(p_JDBC_URL, p_UserName, p_Password); + } } catch (Exception e) { throw new AdempiereException("Could not get a connection to " + p_JDBC_URL + ",\nCause: " + e.getLocalizedMessage()); } @@ -203,6 +243,19 @@ public class MoveClient extends SvrProcess { } private void validate() { + if (p_IsCopyClient) { + // Validate that the newtenant value/name doesn't exist + int cntCN = DB.getSQLValueEx(get_TrxName(), "SELECT COUNT(*) FROM AD_Client WHERE Name=?", p_ClientName); + if (cntCN > 0) + throw new AdempiereUserError("Client with name " + p_ClientName + " already exists in database"); + int cntCV = DB.getSQLValueEx(get_TrxName(), "SELECT COUNT(*) FROM AD_Client WHERE Value=?", p_ClientValue); + if (cntCV > 0) + throw new AdempiereUserError("Client with search key " + p_ClientValue + " already exists in database"); + int cntCW = DB.getSQLValueEx(get_TrxName(), "SELECT COUNT(*) FROM W_Store WHERE WebContext=?", p_ClientValue.toLowerCase()); + if (cntCW > 0) + throw new AdempiereUserError("WebStore with context " + p_ClientValue.toLowerCase() + " already exists in database"); + } + // validate there are clients to move, and doesn't exist in target StringBuilder sqlValidClientsSB = new StringBuilder() .append("SELECT AD_Client_ID, Value, Name, AD_Client_UU FROM AD_Client WHERE ") @@ -210,7 +263,7 @@ public class MoveClient extends SvrProcess { .append(" ORDER BY Value"); StringBuilder sqlValidateLocalClient = new StringBuilder() .append("SELECT COUNT(*) FROM AD_Client WHERE Value=? OR Name=? OR AD_Client_UU=?"); - if (p_tablesToPreserveIDsList.contains("AD_CLIENT")) { + if (p_isPreserveAll || p_tablesToPreserveIDsList.contains("AD_CLIENT")) { sqlValidateLocalClient.append(" OR AD_Client_ID=?"); } String sqlValidClients = DB.getDatabase().convertStatement(sqlValidClientsSB.toString()); @@ -226,18 +279,20 @@ public class MoveClient extends SvrProcess { String clientValue = rsVC.getString(2); String clientName = rsVC.getString(3); String clientUUID = rsVC.getString(4); - int cnt = 0; - if (p_tablesToPreserveIDsList.contains("AD_CLIENT")) { - cnt = DB.getSQLValueEx(get_TrxName(), sqlValidateLocalClient.toString(), clientValue, clientName, clientUUID, clientID); - } else { - cnt = DB.getSQLValueEx(get_TrxName(), sqlValidateLocalClient.toString(), clientValue, clientName, clientUUID); - } - if (cnt > 0) { - String msg = "Client " + clientValue + "/" + clientName + " already exists. UUID=" + clientUUID; - if (p_tablesToPreserveIDsList.contains("AD_CLIENT")) { - msg += ", ID=" + clientID; + if (! p_IsCopyClient) { + int cnt = 0; + if (p_isPreserveAll || p_tablesToPreserveIDsList.contains("AD_CLIENT")) { + cnt = DB.getSQLValueEx(get_TrxName(), sqlValidateLocalClient.toString(), clientValue, clientName, clientUUID, clientID); + } else { + cnt = DB.getSQLValueEx(get_TrxName(), sqlValidateLocalClient.toString(), clientValue, clientName, clientUUID); + } + if (cnt > 0) { + String msg = "Client " + clientValue + "/" + clientName + " already exists. UUID=" + clientUUID; + if (p_isPreserveAll || p_tablesToPreserveIDsList.contains("AD_CLIENT")) { + msg += ", ID=" + clientID; + } + p_errorList.add(msg); } - p_errorList.add(msg); } } } catch (SQLException e) { @@ -312,8 +367,10 @@ public class MoveClient extends SvrProcess { DB.close(rsRT, stmtRT); } - for (String tableName : p_tablesVerifiedList) { - validateOrphan(tableName); + if (! p_IsSkipSomeValidations) { + for (String tableName : p_tablesVerifiedList) { + validateOrphan(tableName); + } } } @@ -420,7 +477,7 @@ public class MoveClient extends SvrProcess { throw new AdempiereUserError("There is data in unsupported Multi-ID column " + tableName + "." + columnName); } } - if (refID > MTable.MAX_OFFICIAL_ID) { + if (!p_IsSkipSomeValidations && refID > MTable.MAX_OFFICIAL_ID) { int cntET = countInExternal(sqlDataNotNullInColumn.toString()); if (cntET > 0) { // TODO: Implement support for non-official data types (must implement how to obtain the foreign table with MColumn.getReferenceTableName) @@ -436,6 +493,9 @@ public class MoveClient extends SvrProcess { } else if ("C_BPartner".equalsIgnoreCase(tableName) && "AD_OrgBP_ID".equalsIgnoreCase(columnName)) { // Special case for C_BPartner.AD_OrgBP_ID defined as Button in dictionary foreignTable = "AD_Org"; + } else if ("C_Project".equalsIgnoreCase(tableName) && "C_ProjectType_ID".equalsIgnoreCase(columnName)) { + // Special case for C_Project.C_ProjectType_ID defined as Button in dictionary + foreignTable = "C_ProjectType"; } if (! Util.isEmpty(foreignTable)) { // verify all foreign keys pointing to a different client @@ -476,8 +536,13 @@ public class MoveClient extends SvrProcess { if (! "AD_Client".equalsIgnoreCase(tableName)) { sqlForeignClientSB.append(" JOIN AD_Client ON (").append(tableName).append(".AD_Client_ID=AD_Client.AD_Client_ID)"); } - sqlForeignClientSB.append(" JOIN ").append(foreignTable) - .append(" ON (").append(tableName).append(".").append(columnName).append("=").append(foreignTable).append("."); + if ("AD_Client".equalsIgnoreCase(foreignTable)) { // fix issue with foreign AD_Client_ID like AD_Replication.Remote_Client_ID + sqlForeignClientSB.append(" JOIN ").append(foreignTable) + .append(" c ON (").append(tableName).append(".").append(columnName).append("=c."); + } else { + sqlForeignClientSB.append(" JOIN ").append(foreignTable) + .append(" ON (").append(tableName).append(".").append(columnName).append("=").append(foreignTable).append("."); + } if ("AD_Language".equalsIgnoreCase(foreignTable) && !columnName.equalsIgnoreCase("AD_Language_ID")) { sqlForeignClientSB.append("AD_Language"); } else if ("AD_EntityType".equalsIgnoreCase(foreignTable) && !columnName.equalsIgnoreCase("AD_EntityType_ID")) { @@ -504,7 +569,7 @@ public class MoveClient extends SvrProcess { p_errorList.add("Column " + tableName + "." + columnName + " has invalid cross-client reference to client " + clientID + " on ID=" + foreignID); continue; } - if (foreignID > MTable.MAX_OFFICIAL_ID) { + if (foreignID > 0) { if (! p_idSystemConversionList.contains(foreignTable.toUpperCase() + "." + foreignID)) { int localID = getFromUUID(foreignTable, uuidCol, tableName, columnName, foreignUU, foreignID); if (localID < 0) { @@ -538,6 +603,9 @@ public class MoveClient extends SvrProcess { if ("C_BPartner".equalsIgnoreCase(tableName) && "AD_OrgBP_ID".equalsIgnoreCase(columnName)) { // Special case for C_BPartner.AD_OrgBP_ID defined as Button in dictionary foreignTable = "AD_Org"; + } else if ("C_Project".equalsIgnoreCase(tableName) && "C_ProjectType_ID".equalsIgnoreCase(columnName)) { + // Special case for C_Project.C_ProjectType_ID defined as Button in dictionary + foreignTable = "C_ProjectType"; } if (! Util.isEmpty(foreignTable) && ! "AD_Ref_List".equalsIgnoreCase(foreignTable)) { MTable tableFK = MTable.get(getCtx(), foreignTable); @@ -637,7 +705,7 @@ public class MoveClient extends SvrProcess { while (rsGI.next()) { int sourceID = rsGI.getInt(1); int targetID = -1; - if (p_tablesToPreserveIDsList.contains(tableName.toUpperCase())) { + if (p_isPreserveAll || p_tablesToPreserveIDsList.contains(tableName.toUpperCase())) { int localID = DB.getSQLValueEx(get_TrxName(), selectVerifyIdSB.toString(), sourceID); if (localID < 0) { targetID = sourceID; @@ -645,7 +713,17 @@ public class MoveClient extends SvrProcess { throw new AdempiereException("In " + tableName + "." + tableName + "_ID already exist the ID=" + sourceID); } } else { - targetID = DB.getNextID(getAD_Client_ID(), tableName, get_TrxName()); + if ("AD_ChangeLog".equalsIgnoreCase(tableName)) { + // AD_ChangeLog_ID is not really a unique key - validate if it was already converted before + int clId = DB.getSQLValueEx(get_TrxName(), + "SELECT Target_ID FROM T_MoveClient WHERE AD_PInstance_ID=? AND TableName=? AND Source_ID=?", + getAD_PInstance_ID(), "AD_CHANGELOG", sourceID); + if (clId == -1) { + targetID = DB.getNextID(getAD_Client_ID(), tableName, get_TrxName()); + } + } else { + targetID = DB.getNextID(getAD_Client_ID(), tableName, get_TrxName()); + } } if (targetID >= 0) { DB.executeUpdateEx(insertConversionId, @@ -667,6 +745,22 @@ public class MoveClient extends SvrProcess { throw new AdempiereException(e1); } + int newADClientID = -1; + String oldClientValue = null; + if (p_IsCopyClient) { + int clientInt; + try { + clientInt = Integer.parseInt(p_ClientsToInclude); + } catch (NumberFormatException e) { + throw new AdempiereException("Error in parameter Clients to Include, must be just one integer"); + } + newADClientID = DB.getSQLValueEx(get_TrxName(), + "SELECT Target_ID FROM T_MoveClient WHERE AD_PInstance_ID=? AND TableName=? AND Source_ID=?", + getAD_PInstance_ID(), "AD_CLIENT", clientInt); + oldClientValue = DB.getSQLValueStringEx(get_TrxName(), + "SELECT Value FROM AD_Client WHERE AD_Client_ID=?", clientInt); + } + // get the source data and insert into target converting the IDs for (MTable table : tables) { String tableName = table.getTableName(); @@ -728,6 +822,9 @@ public class MoveClient extends SvrProcess { } else if ("C_BPartner".equalsIgnoreCase(tableName) && "AD_OrgBP_ID".equalsIgnoreCase(columnName)) { // Special case for C_BPartner.AD_OrgBP_ID defined as Button in dictionary convertTable = "AD_Org"; + } else if ("C_Project".equalsIgnoreCase(tableName) && "C_ProjectType_ID".equalsIgnoreCase(columnName)) { + // Special case for C_Project.C_ProjectType_ID defined as Button in dictionary + convertTable = "C_ProjectType"; } else if (convertTable != null && ("AD_Ref_List".equalsIgnoreCase(convertTable) || "AD_Language".equalsIgnoreCase(columnName) @@ -779,7 +876,8 @@ public class MoveClient extends SvrProcess { || "AD_TreeNodeU4".equalsIgnoreCase(tableName))) { // Special case for AD_TreeNodeU*.Node/Parent_ID convertTable = "C_ElementValue"; - } else if (("Node_ID".equalsIgnoreCase(columnName) || "Parent_ID".equalsIgnoreCase(columnName)) && "AD_TreeNode".equalsIgnoreCase(tableName)) { + } else if (("Node_ID".equalsIgnoreCase(columnName) || "Parent_ID".equalsIgnoreCase(columnName)) + && "AD_TreeNode".equalsIgnoreCase(tableName)) { // Special case for AD_TreeNode.Node/Parent_ID - depends on AD_Tree -> TreeType and AD_Table_ID int treeId = rsGD.getInt("AD_Tree_ID"); convertTable = getExternalTableFromTree(treeId); @@ -790,6 +888,11 @@ public class MoveClient extends SvrProcess { convertTable = att.substring(0, att.length()-3); if ("C_DocTypeTarget".equals(convertTable)) { convertTable = "C_DocType"; + } else { + // validate that AD_Preference points to a valid table, ignore otherwise + if (MTable.getTable_ID(convertTable, get_TrxName()) <= 0) { + convertTable = ""; + } } } else { convertTable = ""; @@ -801,7 +904,8 @@ public class MoveClient extends SvrProcess { if (rsGD.wasNull()) { parameters[i] = null; } else { - if (id >= MTable.MAX_OFFICIAL_ID) { + if (! (id == 0 && ("Parent_ID".equalsIgnoreCase(columnName) || "Node_ID".equalsIgnoreCase(columnName))) // Parent_ID/Node_ID=0 is valid + && (id >= MTable.MAX_OFFICIAL_ID || p_IsCopyClient)) { int convertedId = -1; final String query = "SELECT Target_ID FROM T_MoveClient WHERE AD_PInstance_ID=? AND TableName=? AND Source_ID=?"; try { @@ -813,15 +917,34 @@ public class MoveClient extends SvrProcess { } if (convertedId < 0) { // not found in the table - try to get it again - could be missed in first pass - convertedId = getLocalIDFor(convertTable, id); + convertedId = getLocalIDFor(convertTable, id, tableName); if (convertedId < 0) { - if ("Record_ID".equalsIgnoreCase(columnName) && table.getColumnIndex("AD_Table_ID") > 0) { + if (("Record_ID".equalsIgnoreCase(columnName) && table.getColumnIndex("AD_Table_ID") > 0) + || (("Node_ID".equalsIgnoreCase(columnName) || "Parent_ID".equalsIgnoreCase(columnName)) + && ( "AD_TreeNode".equalsIgnoreCase(tableName) + || "AD_TreeNodeMM".equalsIgnoreCase(tableName) + || "AD_TreeNodeBP".equalsIgnoreCase(tableName) + || "AD_TreeNodeCMC".equalsIgnoreCase(tableName) + || "AD_TreeNodeCMM".equalsIgnoreCase(tableName) + || "AD_TreeNodeCMS".equalsIgnoreCase(tableName) + || "AD_TreeNodeCMT".equalsIgnoreCase(tableName) + || "AD_TreeNodePR".equalsIgnoreCase(tableName) + || "AD_TreeNodeU1".equalsIgnoreCase(tableName) + || "AD_TreeNodeU2".equalsIgnoreCase(tableName) + || "AD_TreeNodeU3".equalsIgnoreCase(tableName) + || "AD_TreeNodeU4".equalsIgnoreCase(tableName) + || "AD_TreeBar".equalsIgnoreCase(tableName)))) { if (p_tablesToExcludeList.contains(convertTable.toUpperCase())) { // record is pointing to a table that is not included, ignore it insertRecord = false; break; } } + if ("AD_ChangeLog".equalsIgnoreCase(tableName)) { + // skip orphan records in AD_ChangeLog, can be log of deleted records, skip + insertRecord = false; + break; + } throw new AdempiereException("Found orphan record in " + tableName + "." + columnName + ": " + id + " related to table " + convertTable); } } @@ -838,6 +961,56 @@ public class MoveClient extends SvrProcess { if (rsGD.wasNull()) { parameters[i] = null; } + if (p_IsCopyClient) { + String uuidCol = MTable.getUUIDColumnName(tableName); + if (columnName.equals(uuidCol)) { + String oldUUID = (String) parameters[i]; + String newUUID = UUID.randomUUID().toString(); + parameters[i] = newUUID; + if (! Util.isEmpty(oldUUID)) { + X_AD_Package_UUID_Map map = new X_AD_Package_UUID_Map(getCtx(), 0, get_TrxName()); + map.setAD_Table_ID(table.getAD_Table_ID()); + map.set_ValueNoCheck("AD_Client_ID", newADClientID); + map.setSource_UUID(oldUUID); + map.setTarget_UUID(newUUID); + map.saveEx(); + } + } else if ("AD_Client".equalsIgnoreCase(tableName) && "Value".equalsIgnoreCase(columnName)) { + parameters[i] = p_ClientValue; + } else if ("AD_Client".equalsIgnoreCase(tableName) && "Name".equalsIgnoreCase(columnName)) { + parameters[i] = p_ClientName; + } else if ( + ("W_Store".equalsIgnoreCase(tableName) && "WebContext".equalsIgnoreCase(columnName)) + || ("AD_User".equalsIgnoreCase(tableName) && "Value".equalsIgnoreCase(columnName)) + ) { + parameters[i] = p_ClientValue.toLowerCase(); + } else if ( + ("AD_User".equalsIgnoreCase(tableName) && "Password".equalsIgnoreCase(columnName)) + || ("AD_User".equalsIgnoreCase(tableName) && "Salt".equalsIgnoreCase(columnName)) + ) { + parameters[i] = null; // do not assign passwords to new users, must be managed by SuperUser or plugin + } else if ( + ("AD_Org".equalsIgnoreCase(tableName) && "Value".equalsIgnoreCase(columnName)) + || ("AD_Org".equalsIgnoreCase(tableName) && "Name".equalsIgnoreCase(columnName)) + || ("AD_Role".equalsIgnoreCase(tableName) && "Name".equalsIgnoreCase(columnName)) + || ("AD_Tree".equalsIgnoreCase(tableName) && "Name".equalsIgnoreCase(columnName)) + || ("AD_User".equalsIgnoreCase(tableName) && "Name".equalsIgnoreCase(columnName)) + || ("AD_User".equalsIgnoreCase(tableName) && "Description".equalsIgnoreCase(columnName)) + || ("C_AcctProcessor".equalsIgnoreCase(tableName) && "Name".equalsIgnoreCase(columnName)) + || ("C_AcctSchema".equalsIgnoreCase(tableName) && "Name".equalsIgnoreCase(columnName)) + || ("C_BPartner".equalsIgnoreCase(tableName) && "Value".equalsIgnoreCase(columnName)) + || ("C_BPartner".equalsIgnoreCase(tableName) && "Name".equalsIgnoreCase(columnName)) + || ("C_Calendar".equalsIgnoreCase(tableName) && "Name".equalsIgnoreCase(columnName)) + || ("C_Element".equalsIgnoreCase(tableName) && "Name".equalsIgnoreCase(columnName)) + || ("M_CostType".equalsIgnoreCase(tableName) && "Name".equalsIgnoreCase(columnName)) + || ("R_RequestProcessor".equalsIgnoreCase(tableName) && "Name".equalsIgnoreCase(columnName)) + ) { + if (parameters[i] != null) { + String value = parameters[i].toString(); + parameters[i] = value.replaceFirst(oldClientValue, p_ClientValue); + } + } + } } } if (insertRecord) { @@ -930,15 +1103,24 @@ public class MoveClient extends SvrProcess { } private void checkSequences() { - for (String tableName : p_tablesToPreserveIDsList) { - MSequence seq = MSequence.get(getCtx(), tableName, get_TrxName()); - if (seq != null) { - seq.validateTableIDValue(); // ignore output messages + if (p_isPreserveAll) { + for (String tableName : p_tablesVerifiedList) { + MSequence seq = MSequence.get(getCtx(), tableName, get_TrxName()); + if (seq != null) { + seq.validateTableIDValue(); // ignore output messages + } + } + } else { + for (String tableName : p_tablesToPreserveIDsList) { + MSequence seq = MSequence.get(getCtx(), tableName, get_TrxName()); + if (seq != null) { + seq.validateTableIDValue(); // ignore output messages + } } } } - private int getLocalIDFor(String tableName, int foreignId) { + private int getLocalIDFor(String tableName, int foreignId, String tableNameSource) { String uuidCol = MTable.getUUIDColumnName(tableName); StringBuilder sqlRemoteUUSB = new StringBuilder() .append("SELECT ").append(uuidCol).append(" FROM ").append(tableName) @@ -954,7 +1136,7 @@ public class MoveClient extends SvrProcess { if (rs.next()) remoteUUID = rs.getString(1); } catch (SQLException e) { - throw new AdempiereException("Could not execute external query: " + sqlRemoteUU + "\nCause = " + e.getLocalizedMessage()); + throw new AdempiereException("Could not execute external query for table " + tableNameSource + ": " + sqlRemoteUU + "\nCause = " + e.getLocalizedMessage()); } finally { DB.close(rs, stmtUU); } diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/FormAccessElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/FormAccessElementHandler.java index ffddf51a17..2938bf0c95 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/FormAccessElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/FormAccessElementHandler.java @@ -20,11 +20,12 @@ import java.util.List; import javax.xml.transform.sax.TransformerHandler; +import org.adempiere.exceptions.AdempiereException; import org.adempiere.pipo2.AbstractElementHandler; +import org.adempiere.pipo2.Element; import org.adempiere.pipo2.PIPOContext; import org.adempiere.pipo2.PackOut; import org.adempiere.pipo2.PoExporter; -import org.adempiere.pipo2.Element; import org.adempiere.pipo2.PoFiller; import org.compiere.model.I_AD_Form_Access; import org.compiere.model.MFormAccess; @@ -90,10 +91,28 @@ public class FormAccessElementHandler extends AbstractElementHandler { filler.export(excludes); } + @Override + public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId) + throws Exception { + throw new AdempiereException("AD_Form_Access doesn't have ID, use method with UUID"); + } + @Override public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, - int recordId) throws Exception { + int recordId, String uuid) throws Exception { + MFormAccess po = new Query(packout.getCtx().ctx, MFormAccess.Table_Name, "AD_Form_Access_UU=?", getTrxName(packout.getCtx())) + .setParameters(uuid) + .first(); + if (po != null) { + Env.setContext(packout.getCtx().ctx, X_AD_Form.COLUMNNAME_AD_Form_ID, po.getAD_Form_ID()); + Env.setContext(packout.getCtx().ctx, X_AD_Role.COLUMNNAME_AD_Role_ID, po.getAD_Role_ID()); + this.create(packout.getCtx(), packoutHandler); + packout.getCtx().ctx.remove(X_AD_Form.COLUMNNAME_AD_Form_ID); + packout.getCtx().ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID); + } else { + throw new AdempiereException("AD_Form_Access_UU not found = " + uuid); + } } } diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/InfoWindowAccessElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/InfoWindowAccessElementHandler.java index d03a4dc4c0..fbfe18881b 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/InfoWindowAccessElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/InfoWindowAccessElementHandler.java @@ -29,6 +29,7 @@ import java.util.List; import javax.xml.transform.sax.TransformerHandler; +import org.adempiere.exceptions.AdempiereException; import org.adempiere.pipo2.AbstractElementHandler; import org.adempiere.pipo2.Element; import org.adempiere.pipo2.PIPOContext; @@ -90,7 +91,24 @@ public class InfoWindowAccessElementHandler extends AbstractElementHandler { } @Override - public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId) throws Exception { - create(packout.getCtx(), packoutHandler); + public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId) + throws Exception { + throw new AdempiereException("AD_InfoWindow_Access doesn't have ID, use method with UUID"); + } + + @Override + public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId, String uuid) throws Exception { + X_AD_InfoWindow_Access po = new Query(packout.getCtx().ctx, X_AD_InfoWindow_Access.Table_Name, "AD_InfoWindow_Access_UU=?", getTrxName(packout.getCtx())) + .setParameters(uuid) + .first(); + if (po != null) { + Env.setContext(packout.getCtx().ctx, X_AD_InfoWindow.COLUMNNAME_AD_InfoWindow_ID, po.getAD_InfoWindow_ID()); + Env.setContext(packout.getCtx().ctx, X_AD_Role.COLUMNNAME_AD_Role_ID, po.getAD_Role_ID()); + this.create(packout.getCtx(), packoutHandler); + packout.getCtx().ctx.remove(X_AD_InfoWindow.COLUMNNAME_AD_InfoWindow_ID); + packout.getCtx().ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID); + } else { + throw new AdempiereException("AD_InfoWindow_Access_UU not found = " + uuid); + } } } diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/OrgRoleElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/OrgRoleElementHandler.java index 81255b64c2..17c4b445cb 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/OrgRoleElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/OrgRoleElementHandler.java @@ -20,6 +20,7 @@ import java.util.List; import javax.xml.transform.sax.TransformerHandler; +import org.adempiere.exceptions.AdempiereException; import org.adempiere.pipo2.AbstractElementHandler; import org.adempiere.pipo2.Element; import org.adempiere.pipo2.PIPOContext; @@ -59,7 +60,7 @@ public class OrgRoleElementHandler extends AbstractElementHandler { public void create(PIPOContext ctx, TransformerHandler document) throws SAXException { - int AD_Org_ID = Env.getContextAsInt(ctx.ctx, "AD_Org_ID"); + int AD_Org_ID = Env.getContextAsInt(ctx.ctx, X_AD_Role.COLUMNNAME_AD_Org_ID); int AD_Role_ID = Env.getContextAsInt(ctx.ctx, X_AD_Role.COLUMNNAME_AD_Role_ID); Query query = new Query(ctx.ctx, "AD_Role_OrgAccess", "AD_Role_ID=? and AD_Org_ID=?", getTrxName(ctx)); @@ -86,10 +87,27 @@ public class OrgRoleElementHandler extends AbstractElementHandler { filler.export(excludes); } + @Override + public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId) + throws Exception { + throw new AdempiereException("AD_Role_OrgAccess doesn't have ID, use method with UUID"); + } + @Override public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, - int recordId) throws Exception { - create(packout.getCtx(), packoutHandler); + int recordId, String uuid) throws Exception { + X_AD_Role_OrgAccess po = new Query(packout.getCtx().ctx, X_AD_Role_OrgAccess.Table_Name, "AD_Role_OrgAccess_UU=?", getTrxName(packout.getCtx())) + .setParameters(uuid) + .first(); + if (po != null) { + Env.setContext(packout.getCtx().ctx, X_AD_Role.COLUMNNAME_AD_Org_ID, po.getAD_Org_ID()); + Env.setContext(packout.getCtx().ctx, X_AD_Role.COLUMNNAME_AD_Role_ID, po.getAD_Role_ID()); + this.create(packout.getCtx(), packoutHandler); + packout.getCtx().ctx.remove(X_AD_Role.COLUMNNAME_AD_Org_ID); + packout.getCtx().ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID); + } else { + throw new AdempiereException("AD_Role_OrgAccess_UU not found = " + uuid); + } } } diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ProcessAccessElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ProcessAccessElementHandler.java index 6e62db75d9..07fc631790 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ProcessAccessElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ProcessAccessElementHandler.java @@ -20,13 +20,15 @@ import java.util.List; import javax.xml.transform.sax.TransformerHandler; +import org.adempiere.exceptions.AdempiereException; import org.adempiere.pipo2.AbstractElementHandler; +import org.adempiere.pipo2.Element; import org.adempiere.pipo2.PIPOContext; import org.adempiere.pipo2.PackOut; import org.adempiere.pipo2.PoExporter; -import org.adempiere.pipo2.Element; import org.adempiere.pipo2.PoFiller; import org.compiere.model.I_AD_Process_Access; +import org.compiere.model.MProcessAccess; import org.compiere.model.Query; import org.compiere.model.X_AD_Process; import org.compiere.model.X_AD_Process_Access; @@ -88,10 +90,28 @@ public class ProcessAccessElementHandler extends AbstractElementHandler { filler.export(excludes); } + @Override + public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId) + throws Exception { + throw new AdempiereException("AD_Process_Access doesn't have ID, use method with UUID"); + } + @Override public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, - int recordId) throws Exception { - create(packout.getCtx(), packoutHandler); + int recordId, String uuid) throws Exception { + MProcessAccess po = new Query(packout.getCtx().ctx, MProcessAccess.Table_Name, "AD_Process_Access_UU=?", getTrxName(packout.getCtx())) + .setParameters(uuid) + .first(); + if (po != null) { + Env.setContext(packout.getCtx().ctx, X_AD_Process.COLUMNNAME_AD_Process_ID, po.getAD_Process_ID()); + Env.setContext(packout.getCtx().ctx, X_AD_Role.COLUMNNAME_AD_Role_ID, po.getAD_Role_ID()); + this.create(packout.getCtx(), packoutHandler); + packout.getCtx().ctx.remove(X_AD_Process.COLUMNNAME_AD_Process_ID); + packout.getCtx().ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID); + } else { + throw new AdempiereException("AD_Process_Access_UU not found = " + uuid); + } } + } diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/TaskAccessElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/TaskAccessElementHandler.java index 0f0c9d05fd..92b9120fd6 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/TaskAccessElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/TaskAccessElementHandler.java @@ -20,11 +20,12 @@ import java.util.List; import javax.xml.transform.sax.TransformerHandler; +import org.adempiere.exceptions.AdempiereException; import org.adempiere.pipo2.AbstractElementHandler; +import org.adempiere.pipo2.Element; import org.adempiere.pipo2.PIPOContext; import org.adempiere.pipo2.PackOut; import org.adempiere.pipo2.PoExporter; -import org.adempiere.pipo2.Element; import org.adempiere.pipo2.PoFiller; import org.compiere.model.I_AD_Task_Access; import org.compiere.model.Query; @@ -82,10 +83,28 @@ public class TaskAccessElementHandler extends AbstractElementHandler { filler.export(excludes); } + @Override + public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId) + throws Exception { + throw new AdempiereException("AD_Task_Access doesn't have ID, use method with UUID"); + } + @Override public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, - int recordId) throws Exception { - create(packout.getCtx(), packoutHandler); + int recordId, String uuid) throws Exception { + X_AD_Task_Access po = new Query(packout.getCtx().ctx, X_AD_Task_Access.Table_Name, "AD_Task_Access_UU=?", getTrxName(packout.getCtx())) + .setParameters(uuid) + .first(); + if (po != null) { + Env.setContext(packout.getCtx().ctx, X_AD_Task.COLUMNNAME_AD_Task_ID, po.getAD_Task_ID()); + Env.setContext(packout.getCtx().ctx, X_AD_Role.COLUMNNAME_AD_Role_ID, po.getAD_Role_ID()); + this.create(packout.getCtx(), packoutHandler); + packout.getCtx().ctx.remove(X_AD_Task.COLUMNNAME_AD_Task_ID); + packout.getCtx().ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID); + } else { + throw new AdempiereException("AD_Task_Access_UU not found = " + uuid); + } } + } diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/UserRoleElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/UserRoleElementHandler.java index 2ed746c279..8ca68dc307 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/UserRoleElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/UserRoleElementHandler.java @@ -20,11 +20,12 @@ import java.util.List; import javax.xml.transform.sax.TransformerHandler; +import org.adempiere.exceptions.AdempiereException; import org.adempiere.pipo2.AbstractElementHandler; +import org.adempiere.pipo2.Element; import org.adempiere.pipo2.PIPOContext; import org.adempiere.pipo2.PackOut; import org.adempiere.pipo2.PoExporter; -import org.adempiere.pipo2.Element; import org.adempiere.pipo2.PoFiller; import org.compiere.model.I_AD_User_Roles; import org.compiere.model.Query; @@ -63,11 +64,10 @@ public class UserRoleElementHandler extends AbstractElementHandler { throws SAXException { int AD_User_ID = Env.getContextAsInt(ctx.ctx, X_AD_User.COLUMNNAME_AD_User_ID); int AD_Role_ID = Env.getContextAsInt(ctx.ctx, X_AD_Role.COLUMNNAME_AD_Role_ID); - int AD_Org_ID = Env.getContextAsInt(ctx.ctx, "AD_Org_ID"); Query query = new Query(ctx.ctx, "AD_User_Roles", - "AD_User_ID = ? AND AD_Role_ID = ? AND AD_Org_ID = ?", getTrxName(ctx)); + "AD_User_ID = ? AND AD_Role_ID = ?", getTrxName(ctx)); X_AD_User_Roles po = query.setParameters( - new Object[] { AD_User_ID, AD_Role_ID, AD_Org_ID }).first(); + new Object[] { AD_User_ID, AD_Role_ID}).first(); if (po != null) { if (!isPackOutElement(ctx, po)) return; @@ -90,10 +90,28 @@ public class UserRoleElementHandler extends AbstractElementHandler { filler.export(excludes, true); } + @Override + public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId) + throws Exception { + throw new AdempiereException("AD_User_Roles doesn't have ID, use method with UUID"); + } + @Override public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, - int recordId) throws Exception { - create(packout.getCtx(), packoutHandler); + int recordId, String uuid) throws Exception { + X_AD_User_Roles po = new Query(packout.getCtx().ctx, X_AD_User_Roles.Table_Name, "AD_User_Roles_UU=?", getTrxName(packout.getCtx())) + .setParameters(uuid) + .first(); + if (po != null) { + Env.setContext(packout.getCtx().ctx, X_AD_User.COLUMNNAME_AD_User_ID, po.getAD_User_ID()); + Env.setContext(packout.getCtx().ctx, X_AD_Role.COLUMNNAME_AD_Role_ID, po.getAD_Role_ID()); + this.create(packout.getCtx(), packoutHandler); + packout.getCtx().ctx.remove(X_AD_User.COLUMNNAME_AD_User_ID); + packout.getCtx().ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID); + } else { + throw new AdempiereException("AD_User_Roles_UU not found = " + uuid); + } } + } diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WindowAccessElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WindowAccessElementHandler.java index 02ef45f276..3cc2be26b9 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WindowAccessElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WindowAccessElementHandler.java @@ -20,13 +20,15 @@ import java.util.List; import javax.xml.transform.sax.TransformerHandler; +import org.adempiere.exceptions.AdempiereException; import org.adempiere.pipo2.AbstractElementHandler; +import org.adempiere.pipo2.Element; import org.adempiere.pipo2.PIPOContext; import org.adempiere.pipo2.PackOut; import org.adempiere.pipo2.PoExporter; -import org.adempiere.pipo2.Element; import org.adempiere.pipo2.PoFiller; import org.compiere.model.I_AD_Window_Access; +import org.compiere.model.MWindowAccess; import org.compiere.model.Query; import org.compiere.model.X_AD_Role; import org.compiere.model.X_AD_Window; @@ -83,10 +85,28 @@ public class WindowAccessElementHandler extends AbstractElementHandler { filler.export(excludes); } + @Override + public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId) + throws Exception { + throw new AdempiereException("AD_Window_Access doesn't have ID, use method with UUID"); + } + @Override public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, - int recordId) throws Exception { - create(packout.getCtx(), packoutHandler); + int recordId, String uuid) throws Exception { + MWindowAccess po = new Query(packout.getCtx().ctx, MWindowAccess.Table_Name, "AD_Window_Access_UU=?", getTrxName(packout.getCtx())) + .setParameters(uuid) + .first(); + if (po != null) { + Env.setContext(packout.getCtx().ctx, X_AD_Window.COLUMNNAME_AD_Window_ID, po.getAD_Window_ID()); + Env.setContext(packout.getCtx().ctx, X_AD_Role.COLUMNNAME_AD_Role_ID, po.getAD_Role_ID()); + this.create(packout.getCtx(), packoutHandler); + packout.getCtx().ctx.remove(X_AD_Window.COLUMNNAME_AD_Window_ID); + packout.getCtx().ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID); + } else { + throw new AdempiereException("AD_Window_Access_UU not found = " + uuid); + } } + } diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WorkflowAccessElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WorkflowAccessElementHandler.java index 3a5a9a2c69..f0a69ca34d 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WorkflowAccessElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WorkflowAccessElementHandler.java @@ -20,11 +20,12 @@ import java.util.List; import javax.xml.transform.sax.TransformerHandler; +import org.adempiere.exceptions.AdempiereException; import org.adempiere.pipo2.AbstractElementHandler; +import org.adempiere.pipo2.Element; import org.adempiere.pipo2.PIPOContext; import org.adempiere.pipo2.PackOut; import org.adempiere.pipo2.PoExporter; -import org.adempiere.pipo2.Element; import org.adempiere.pipo2.PoFiller; import org.compiere.model.I_AD_Workflow_Access; import org.compiere.model.Query; @@ -86,10 +87,28 @@ public class WorkflowAccessElementHandler extends AbstractElementHandler { filler.export(excludes); } + @Override + public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId) + throws Exception { + throw new AdempiereException("AD_Workflow_Access doesn't have ID, use method with UUID"); + } + @Override public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, - int recordId) throws Exception { - create(packout.getCtx(), packoutHandler); + int recordId, String uuid) throws Exception { + MWorkflowAccess po = new Query(packout.getCtx().ctx, MWorkflowAccess.Table_Name, "AD_Workflow_Access_UU=?", getTrxName(packout.getCtx())) + .setParameters(uuid) + .first(); + if (po != null) { + Env.setContext(packout.getCtx().ctx, X_AD_Workflow.COLUMNNAME_AD_Workflow_ID, po.getAD_Workflow_ID()); + Env.setContext(packout.getCtx().ctx, X_AD_Role.COLUMNNAME_AD_Role_ID, po.getAD_Role_ID()); + this.create(packout.getCtx(), packoutHandler); + packout.getCtx().ctx.remove(X_AD_Workflow.COLUMNNAME_AD_Workflow_ID); + packout.getCtx().ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID); + } else { + throw new AdempiereException("AD_Workflow_Access_UU not found = " + uuid); + } } + } diff --git a/org.adempiere.pipo/src/org/adempiere/pipo2/ElementHandler.java b/org.adempiere.pipo/src/org/adempiere/pipo2/ElementHandler.java index fe9bab225a..46910e11dc 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo2/ElementHandler.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo2/ElementHandler.java @@ -52,4 +52,18 @@ public interface ElementHandler { * @throws Exception */ public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception; + + /** + * @param packout + * @param packoutHandler + * @param docHandler + * @param recordId + * @param uuid + * @throws Exception + */ + default public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId, String uuid) throws Exception { + // element handlers for tables without ID must implement this method + packOut(packout, packoutHandler, docHandler, recordId); // defaults to calling the method without uuid + } + } diff --git a/org.adempiere.pipo/src/org/adempiere/pipo2/GridTab2PackExporter.java b/org.adempiere.pipo/src/org/adempiere/pipo2/GridTab2PackExporter.java index 9a7cc2704e..2a0d83cb23 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo2/GridTab2PackExporter.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo2/GridTab2PackExporter.java @@ -20,6 +20,7 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.UUID; import org.adempiere.base.IGridTabExporter; import org.adempiere.exceptions.AdempiereException; @@ -87,13 +88,27 @@ public class GridTab2PackExporter implements IGridTabExporter { packoutItems.add(packoutItem); } else { if (currentRowOnly) { - PackoutItem packoutItem = new PackoutItem(tableName, gridTab.getRecord_ID(), - properties); + int recordID = gridTab.getRecord_ID(); + String uuid = null; + if (recordID == -1) { + UUID uuidObj = gridTab.getTableModel().getUUID(gridTab.getCurrentRow()); + if (uuidObj != null) { + uuid = uuidObj.toString(); + } + } + PackoutItem packoutItem = new PackoutItem(tableName, recordID, uuid, properties); packoutItems.add(packoutItem); } else { for(int i = 0; i < gridTab.getRowCount(); i++) { - PackoutItem packoutItem = new PackoutItem(tableName, gridTab.getKeyID(i), - properties); + int recordID = gridTab.getKeyID(i); + String uuid = null; + if (recordID == -1) { + UUID uuidObj = gridTab.getTableModel().getUUID(i); + if (uuidObj != null) { + uuid = uuidObj.toString(); + } + } + PackoutItem packoutItem = new PackoutItem(tableName, recordID, uuid, properties); packoutItems.add(packoutItem); } } diff --git a/org.adempiere.pipo/src/org/adempiere/pipo2/IDFinder.java b/org.adempiere.pipo/src/org/adempiere/pipo2/IDFinder.java index 615548879d..0bf4c20300 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo2/IDFinder.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo2/IDFinder.java @@ -58,10 +58,10 @@ public class IDFinder { * @param trxName */ public static int findIdByColumn (String tableName, String columnName, Object value, int AD_Client_ID, boolean ignorecase, String trxName) { - int id = 0; - if (value == null) - return id; + return 0; + + int id = -1; //construct cache key StringBuilder key = new StringBuilder(); @@ -168,7 +168,7 @@ public class IDFinder { } //update cache - if (id > 0) + if (id >= 0) idCache.put(key.toString(), id); return id; diff --git a/org.adempiere.pipo/src/org/adempiere/pipo2/PackOut.java b/org.adempiere.pipo/src/org/adempiere/pipo2/PackOut.java index c6d3a59ca6..6f6a3b52b0 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo2/PackOut.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo2/PackOut.java @@ -141,7 +141,7 @@ public class PackOut ElementHandler handler = handlerRegistry.getHandler(type); if (handler != null) - handler.packOut(this,packoutHandler,docHandler,packoutItem.getRecordId()); + handler.packOut(this,packoutHandler,docHandler,packoutItem.getRecordId(),packoutItem.getUUID()); else throw new IllegalArgumentException("Packout handler not found for type " + type); diff --git a/org.adempiere.pipo/src/org/adempiere/pipo2/PackoutItem.java b/org.adempiere.pipo/src/org/adempiere/pipo2/PackoutItem.java index 4af45dab38..dcf3b2cdc5 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo2/PackoutItem.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo2/PackoutItem.java @@ -24,6 +24,7 @@ public class PackoutItem { private String type; private int recordId; + private String uuid; private Map properties; /** @@ -31,9 +32,18 @@ public class PackoutItem { * @param recordId */ public PackoutItem(String type, int recordId, Map properties) { + this(type, recordId, null, properties); + } + + /** + * @param type + * @param recordId + */ + public PackoutItem(String type, int recordId, String uuid, Map properties) { super(); this.type = type; this.recordId = recordId; + this.uuid = uuid; this.properties = properties; } @@ -51,6 +61,13 @@ public class PackoutItem { return recordId; } + /** + * @return the uuid + */ + public String getUUID() { + return uuid; + } + /** * * @param key diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/ALogin.java b/org.adempiere.ui.swing/src/org/compiere/apps/ALogin.java index f41fbc0db8..d0a88fddd5 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/ALogin.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/ALogin.java @@ -80,7 +80,7 @@ public final class ALogin extends CDialog /** * */ - private static final long serialVersionUID = -3057525535969948097L; + private static final long serialVersionUID = -4397663968578607998L; /** * Construct the dialog. @@ -109,6 +109,7 @@ public final class ALogin extends CDialog } // ALogin + public static final String ROLE_TYPES_SWING = "NULL,SW,SS"; //swing,support+null protected static final String RESOURCE = "org.compiere.apps.ALoginRes"; private static ResourceBundle res = ResourceBundle.getBundle(RESOURCE); /** Logger */ @@ -871,7 +872,7 @@ public final class ALogin extends CDialog KeyNamePair[] clients = null; try { - clients = m_login.getClients(m_user, new String(m_pwd)); + clients = m_login.getClients(m_user, new String(m_pwd), ROLE_TYPES_SWING); if (clients == null || clients.length == 0) { String loginErrMsg = m_login.getLoginErrMsg(); @@ -976,7 +977,7 @@ public final class ALogin extends CDialog Env.setContext(m_ctx, "#SalesRep_ID", user.getAD_User_ID()); } // - KeyNamePair[] roles = m_login.getRoles(userTextField.getText(), client); + KeyNamePair[] roles = m_login.getRoles(userTextField.getText(), client, ROLE_TYPES_SWING); // Make role Combo visible roleCombo.setVisible(true); roleLabel.setVisible(true); diff --git a/org.adempiere.ui.zk.example/META-INF/MANIFEST.MF b/org.adempiere.ui.zk.example/META-INF/MANIFEST.MF index ee7219077f..69276bc0f5 100644 --- a/org.adempiere.ui.zk.example/META-INF/MANIFEST.MF +++ b/org.adempiere.ui.zk.example/META-INF/MANIFEST.MF @@ -5,7 +5,8 @@ Bundle-SymbolicName: org.adempiere.ui.zk.example Bundle-Version: 1.0.0.qualifier Bundle-Activator: org.adempiere.ui.zk.example.Activator Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Comment: Bundle-RequiredExecutionEnvironment: JavaSE-11 +Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version>=1.11))" Import-Package: org.adempiere.base, org.adempiere.base.equinox, org.adempiere.exceptions, @@ -19,13 +20,15 @@ Import-Package: org.adempiere.base, org.adempiere.webui.window, org.compiere.model, org.compiere.util, - org.osgi.framework;version="1.3.0", - org.zkoss.util.media, - org.zkoss.zk.ui, - org.zkoss.zk.ui.event, - org.zkoss.zul, - org.zkoss.zul.event, - org.zkoss.zul.impl + org.osgi.framework;version="1.3.0" +Require-Bundle: zcommon;bundle-version="0.0.0", + zel;bundle-version="0.0.0", + zhtml;bundle-version="0.0.0", + zk;bundle-version="0.0.0", + zkbind;bundle-version="0.0.0", + zkplus;bundle-version="0.0.0", + zul;bundle-version="0.0.0", + zweb;bundle-version="0.0.0" Service-Component: OSGI-INF/export.xml, OSGI-INF/paymentwindowvalidator.xml Export-Package: action.images diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ToolbarCustomButton.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ToolbarCustomButton.java index e6b65fa6e0..67ff617a1a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ToolbarCustomButton.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ToolbarCustomButton.java @@ -76,8 +76,22 @@ public class ToolbarCustomButton implements EventListener, Evaluatee { String displayLogic = mToolbarButton.getDisplayLogic(); if (displayLogic == null || displayLogic.trim().length() == 0) return; - - boolean visible = Evaluator.evaluateLogic(this, displayLogic); + + boolean visible = true; + if (displayLogic.startsWith("@SQL=")) { + ADWindow adwindow = ADWindow.get(windowNo); + if (adwindow == null) + return; + + IADTabpanel adTabpanel = adwindow.getADWindowContent().getADTab().getSelectedTabpanel(); + if (adTabpanel == null) + return; + + visible = Evaluator.parseSQLLogic(displayLogic, Env.getCtx(), windowNo, adTabpanel.getTabNo(), mToolbarButton.getActionName()); + }else { + visible = Evaluator.evaluateLogic(this, displayLogic); + } + toolbarButton.setVisible(visible); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ToolbarProcessButton.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ToolbarProcessButton.java index 0352765dfa..1614ff0cf9 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ToolbarProcessButton.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ToolbarProcessButton.java @@ -119,7 +119,13 @@ public class ToolbarProcessButton implements IProcessButton, Evaluatee { if (displayLogic == null || displayLogic.trim().length() == 0) return; - boolean visible = Evaluator.evaluateLogic(this, displayLogic); + boolean visible = true; + if (displayLogic.startsWith("@SQL=")) { + visible = Evaluator.parseSQLLogic(displayLogic, Env.getCtx(), windowNo, adTabpanel.getTabNo(), mToolbarButton.getActionName()); + }else { + visible = Evaluator.evaluateLogic(this, displayLogic); + } + button.setVisible(visible); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/FavouriteController.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/FavouriteController.java index 5d48cb8b25..737943e024 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/FavouriteController.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/FavouriteController.java @@ -3,6 +3,8 @@ */ package org.adempiere.webui.desktop; +import static org.compiere.model.SystemIDs.TREE_MENUPRIMARY; + import java.util.ArrayList; import java.util.Enumeration; import java.util.LinkedHashMap; @@ -12,12 +14,11 @@ import java.util.Map; import org.adempiere.util.Callback; import org.compiere.model.MTree; import org.compiere.model.MTreeNode; +import org.compiere.model.MUser; import org.compiere.util.DB; import org.compiere.util.Env; import org.zkoss.zk.ui.Session; -import static org.compiere.model.SystemIDs.TREE_MENUPRIMARY; - /** * @author hengsin * @@ -83,8 +84,8 @@ public class FavouriteController { private boolean barDBupdate(boolean add, int Node_ID) { - int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx()); - int AD_Org_ID = Env.getContextAsInt(Env.getCtx(), "#AD_Org_ID"); + int AD_Client_ID = MUser.get(Env.getCtx()).getAD_Client_ID(); + int AD_Org_ID = 0; int AD_User_ID = Env.getContextAsInt(Env.getCtx(), "#AD_User_ID"); StringBuilder sql = new StringBuilder(); if (add) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java index 76dd2494a6..1e6fe43d54 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java @@ -101,7 +101,9 @@ public class LoginPanel extends Window implements EventListener /** * */ - private static final long serialVersionUID = -3361823499124119753L; + private static final long serialVersionUID = -6130436148212949636L; + + public static final String ROLE_TYPES_WEBUI = "NULL,ZK,SS"; //webui,support+null private static LogAuthFailure logAuthFailure = new LogAuthFailure(); @@ -575,7 +577,7 @@ public class LoginPanel extends Window implements EventListener Session currSess = Executions.getCurrent().getDesktop().getSession(); - KeyNamePair clientsKNPairs[] = login.getClients(userId, userPassword); + KeyNamePair clientsKNPairs[] = login.getClients(userId, userPassword, ROLE_TYPES_WEBUI); if (clientsKNPairs == null || clientsKNPairs.length == 0) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java index f84899ecad..8125b5e67e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java @@ -423,7 +423,7 @@ public class RolePanel extends Window implements EventListener, Deferrabl initDefault=m_userpreference.getProperty( UserPreference.P_ROLE ); } KeyNamePair clientKNPair = new KeyNamePair(Integer.valueOf((String)lstItemClient.getValue()), lstItemClient.getLabel()); - KeyNamePair roleKNPairs[] = login.getRoles(m_userName, clientKNPair); + KeyNamePair roleKNPairs[] = login.getRoles(m_userName, clientKNPair, LoginPanel.ROLE_TYPES_WEBUI); if (roleKNPairs != null && roleKNPairs.length > 0) { for (int i = 0; i < roleKNPairs.length; i++) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/AboutWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/AboutWindow.java index 120cd03d23..93ad881d7b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/AboutWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/AboutWindow.java @@ -14,6 +14,7 @@ package org.adempiere.webui.window; import java.io.File; +import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.Properties; import java.util.Vector; @@ -59,6 +60,7 @@ import org.compiere.util.Env; import org.compiere.util.Ini; import org.compiere.util.KeyNamePair; import org.compiere.util.Msg; +import org.compiere.util.SecureEngine; import org.compiere.util.Util; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; @@ -91,7 +93,7 @@ public class AboutWindow extends Window implements EventListener { /** * */ - private static final long serialVersionUID = 8527444729510721269L; + private static final long serialVersionUID = 7922577248288156723L; private Checkbox bErrorsOnly; private Listbox logTable; @@ -104,6 +106,7 @@ public class AboutWindow extends Window implements EventListener { protected Tab tabPlugins; protected Button btnAdempiereLog; + protected Button btnReloadLogProps; private Listbox levelListBox; @@ -268,14 +271,20 @@ public class AboutWindow extends Window implements EventListener { levelListBox.setEnabled(true); levelListBox.setTooltiptext("Set trace level. Warning: this will effect all session not just the current session"); levelLabel.setTooltiptext("Set trace level. Warning: this will effect all session not just the current session"); + btnAdempiereLog = new Button("iDempiere Log"); btnAdempiereLog.setTooltiptext("Download iDempiere log file from server"); LayoutUtils.addSclass("txt-btn", btnAdempiereLog); btnAdempiereLog.addEventListener(Events.ON_CLICK, this); - hbox.appendChild(new Space()); hbox.appendChild(btnAdempiereLog); + btnReloadLogProps = new Button("Reload Log Props"); + btnReloadLogProps.setTooltiptext("Reload the configuration of log levels from idempiere.properties file"); + LayoutUtils.addSclass("txt-btn", btnReloadLogProps); + btnReloadLogProps.addEventListener(Events.ON_CLICK, this); + hbox.appendChild(new Space()); + hbox.appendChild(btnReloadLogProps); } } @@ -716,6 +725,8 @@ public class AboutWindow extends Window implements EventListener { cmd_errorEMail(); else if (event.getTarget() == btnAdempiereLog) downloadAdempiereLogFile(); + else if (event.getTarget() == btnReloadLogProps) + reloadLogProps(); else if (event.getTarget() == levelListBox) setTraceLevel(); else if (Events.ON_SELECT.equals(event.getName()) && event.getTarget() == pluginsTable) @@ -728,6 +739,53 @@ public class AboutWindow extends Window implements EventListener { } } + private void reloadLogProps() { + Properties props = new Properties(); + String propertyFileName = Ini.getFileName(false); + FileInputStream fis = null; + try { + fis = new FileInputStream(propertyFileName); + props.load(fis); + } catch (Exception e) { + throw new AdempiereException("Could not load properties file, cause: " + e.getLocalizedMessage()); + } finally { + if (fis != null) { + try { + fis.close(); + } catch (Exception e) {} + } + } + String globalLevel = props.getProperty(Ini.P_TRACELEVEL); + if (! Util.isEmpty(globalLevel)) { + globalLevel = SecureEngine.decrypt(globalLevel, 0); + if (! Util.isEmpty(globalLevel)) { + CLogMgt.setLevel(globalLevel); + Level level = CLogMgt.getLevel(); + for (int i = 0; i < CLogMgt.LEVELS.length; i++) { + if (CLogMgt.LEVELS[i].intValue() == level.intValue()) { + levelListBox.setSelectedIndex(i); + break; + } + } + } + } + for(Object key : props.keySet()) { + if (key instanceof String) { + String s = (String)key; + if (s.endsWith("."+Ini.P_TRACELEVEL)) { + String level = props.getProperty(s); + if (! Util.isEmpty(level)) { + level = SecureEngine.decrypt(level, 0); + if (! Util.isEmpty(level)) { + s = s.substring(0, s.length() - ("."+Ini.P_TRACELEVEL).length()); + CLogMgt.setLevel(s, level); + } + } + } + } + } + } + private void setTraceLevel() { Listitem item = levelListBox.getSelectedItem(); if (item != null && item.getValue() != null) { diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java index 35bdf5cea2..14ce7e1ab7 100644 --- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java +++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java @@ -66,6 +66,7 @@ import org.idempiere.webservices.fault.IdempiereServiceFault; */ public class AbstractService { + public static final String ROLE_TYPES_WEBSERVICE = "NULL,WS"; //webservice+null private static final String ROLE_ACCESS_SQL = "SELECT IsActive FROM WS_WebServiceTypeAccess WHERE AD_Role_ID IN (" + "SELECT AD_Role_ID FROM AD_Role WHERE AD_Role_ID=? UNION " + "SELECT Included_Role_ID as AD_Role_ID FROM AD_Role_Included WHERE AD_Role_ID=?) " @@ -110,7 +111,7 @@ public class AbstractService { return ret; Login login = new Login(m_cs.getCtx()); - KeyNamePair[] clients = login.getClients(loginRequest.getUser(), loginRequest.getPass()); + KeyNamePair[] clients = login.getClients(loginRequest.getUser(), loginRequest.getPass(), ROLE_TYPES_WEBSERVICE); if (clients == null) return "Error login - User invalid"; m_cs.setPassword(loginRequest.getPass()); @@ -140,7 +141,7 @@ public class AbstractService { Env.setContext(m_cs.getCtx(), "#UserAgent", userAgent == null ? "Unknown" : userAgent); } - KeyNamePair[] roles = login.getRoles(loginRequest.getUser(), selectedClient); + KeyNamePair[] roles = login.getRoles(loginRequest.getUser(), selectedClient, ROLE_TYPES_WEBSERVICE); if (roles != null) { boolean okrole = false; for (KeyNamePair role : roles) {