From 2fe6f5bba5c731c5c6b11dbdbc42da3b367cbe49 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud <58596990+nmicoud@users.noreply.github.com> Date: Wed, 5 Jan 2022 11:34:20 +0100 Subject: [PATCH] IDEMPIERE-5136 : Set Messages at tenant level (#1113) * IDEMPIERE-5136 : Set Messages at tenant level * IDEMPIERE-5136 : Set Messages at tenant level : remove loop of clients to load messages * IDEMPIERE-5136 : Set Messages at tenant level : fix migration scripts + fix imports * IDEMPIERE-5136 : Set Messages at tenant level - callout to fill fields * IDEMPIERE-5136 : Set Messages at tenant level - language field must be mandatory * IDEMPIERE-5136 : Set Messages at tenant level - callout to fill fields (used at tenant level only) * IDEMPIERE-5136 : Set Messages at tenant level - add IsActive check + close pstmt * IDEMPIERE-5136 : Set Messages at tenant level - patch from Carlos Co-Authored-By: Carlos Ruiz * IDEMPIERE-5136 : Set Messages at tenant level - check for active records on Trl table Co-authored-by: Carlos Ruiz --- .../i9/oracle/202201041130_IDEMPIERE-5136.sql | 213 ++++++++++++++++++ .../202201041130_IDEMPIERE-5136.sql | 210 +++++++++++++++++ .../adempiere/base/callout/MessageTrl.java | 66 ++++++ .../src/org/compiere/model/MMessage.java | 24 +- .../src/org/compiere/model/MSysConfig.java | 3 +- .../src/org/compiere/util/Msg.java | 56 +++-- 6 files changed, 556 insertions(+), 16 deletions(-) create mode 100644 migration/i9/oracle/202201041130_IDEMPIERE-5136.sql create mode 100644 migration/i9/postgresql/202201041130_IDEMPIERE-5136.sql create mode 100644 org.adempiere.base.callout/src/org/adempiere/base/callout/MessageTrl.java diff --git a/migration/i9/oracle/202201041130_IDEMPIERE-5136.sql b/migration/i9/oracle/202201041130_IDEMPIERE-5136.sql new file mode 100644 index 0000000000..01725e1abb --- /dev/null +++ b/migration/i9/oracle/202201041130_IDEMPIERE-5136.sql @@ -0,0 +1,213 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-5136 +-- Jan 4, 2022, 11:02:53 AM CET +INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200191,0,0,TO_DATE('2022-01-04 11:02:53','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2022-01-04 11:02:53','YYYY-MM-DD HH24:MI:SS'),0,0,'Y','MESSAGES_AT_TENANT_LEVEL','N','Turn it to Y to allow loading of tenant level messages (see IDEMPIERE-5136)','D','C','6e180e21-59a8-45c0-83c1-35582ae631c5') +; + +-- Jan 4, 2022, 11:03:15 AM CET +UPDATE AD_Table SET AccessLevel='6',Updated=TO_DATE('2022-01-04 11:03:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Table_ID=119 +; + +-- Jan 4, 2022, 11:03:31 AM CET +INSERT INTO AD_TableIndex (AD_Client_ID,AD_Org_ID,AD_TableIndex_ID,AD_TableIndex_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Table_ID,IsCreateConstraint,IsUnique,Processing,TableIndexDrop,IsKey) VALUES (0,0,201099,'53b63823-b226-48ff-b99f-8a0f6f948526',TO_DATE('2022-01-04 11:03:30','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','ad_message_trl_pkey',TO_DATE('2022-01-04 11:03:30','YYYY-MM-DD HH24:MI:SS'),0,119,'Y','Y','N','N','Y') +; + +-- Jan 4, 2022, 11:03:36 AM CET +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201447,'867b99df-c3fe-4643-951d-1a057138905a',TO_DATE('2022-01-04 11:03:36','YYYY-MM-DD HH24:MI:SS'),0,'D','Y',TO_DATE('2022-01-04 11:03:36','YYYY-MM-DD HH24:MI:SS'),0,6767,201099,10) +; + +-- Jan 4, 2022, 11:03:39 AM CET +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201448,'d0730eae-18e9-46db-a38f-0992e919139b',TO_DATE('2022-01-04 11:03:38','YYYY-MM-DD HH24:MI:SS'),0,'D','Y',TO_DATE('2022-01-04 11:03:38','YYYY-MM-DD HH24:MI:SS'),0,341,201099,20) +; + +-- Jan 4, 2022, 11:03:40 AM CET +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201449,'b0a1cb37-ff82-4e10-a1e7-0492e69f9b83',TO_DATE('2022-01-04 11:03:40','YYYY-MM-DD HH24:MI:SS'),0,'D','Y',TO_DATE('2022-01-04 11:03:40','YYYY-MM-DD HH24:MI:SS'),0,1192,201099,30) +; + +-- Jan 4, 2022, 11:03:44 AM CET +ALTER TABLE AD_Message_Trl DROP CONSTRAINT ad_message_trl_key CASCADE +; + +-- Jan 4, 2022, 11:03:44 AM CET +ALTER TABLE AD_Message_Trl ADD CONSTRAINT ad_message_trl_pkey PRIMARY KEY (AD_Message_ID,AD_Language,AD_Client_ID) +; + +-- Jan 4, 2022, 11:04:20 AM CET +INSERT INTO AD_Window (AD_Window_ID,Name,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,WindowType,Processing,EntityType,IsSOTrx,IsDefault,WinHeight,WinWidth,IsBetaFunctionality,AD_Window_UU) VALUES (200120,'Tenant level messages',0,0,'Y',TO_DATE('2022-01-04 11:04:19','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2022-01-04 11:04:19','YYYY-MM-DD HH24:MI:SS'),0,'M','N','D','Y','N',0,0,'N','c58c9213-2d4e-4b9d-ad1f-735c1cc8d3ae') +; + +-- Jan 4, 2022, 11:04:50 AM CET +INSERT INTO AD_Tab (AD_Tab_ID,Name,AD_Window_ID,SeqNo,IsSingleRow,AD_Table_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,HasTree,IsInfoTab,IsTranslationTab,IsReadOnly,WhereClause,Processing,ImportFields,TabLevel,IsSortTab,EntityType,IsInsertRecord,IsAdvancedTab,AD_Tab_UU,TreeDisplayedOn,IsLookupOnlySelection,IsAllowAdvancedLookup,MaxQueryRecords) VALUES (200302,'Tenant level messages',200120,10,'N',119,0,0,'Y',TO_DATE('2022-01-04 11:04:50','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2022-01-04 11:04:50','YYYY-MM-DD HH24:MI:SS'),0,'N','N','N','N','AD_Message_Trl.AD_Client_ID = @#AD_Client_ID@','N','N',0,'N','D','Y','N','64d37a62-cc02-4beb-b3e1-ab7bf6c6f2b7','B','N','Y',0) +; + +-- Jan 4, 2022, 11:04:55 AM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (206823,'Client','Client/Tenant for this installation.','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.',200302,1192,'Y',22,10,'N','N','N','N',0,0,'Y',TO_DATE('2022-01-04 11:04:55','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2022-01-04 11:04:55','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','9fc4aabb-4b36-4690-a361-8a7a1ba4ddd2','Y',10,2) +; + +-- Jan 4, 2022, 11:04:56 AM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsAllowCopy,IsDisplayedGrid,XPosition,ColumnSpan) VALUES (206824,'Organization','Organizational entity within client','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.',200302,1193,'Y',22,20,'N','N','N','N',0,0,'Y',TO_DATE('2022-01-04 11:04:55','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2022-01-04 11:04:55','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','17836fb6-baba-4eac-b652-bb5cf2329781','Y','N',4,2) +; + +-- Jan 4, 2022, 11:04:56 AM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (206825,'Language','Language for this entity','The Language identifies the language to use for display and formatting',200302,341,'Y',6,30,'N','N','N','N',0,0,'Y',TO_DATE('2022-01-04 11:04:56','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2022-01-04 11:04:56','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','bf20379e-ae47-472b-8e18-7a58a7876a2f','Y',20,2) +; + +-- Jan 4, 2022, 11:04:56 AM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (206826,'Message','System Message','Information and Error messages',200302,6767,'Y',22,40,'N','N','N','N',0,0,'Y',TO_DATE('2022-01-04 11:04:56','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2022-01-04 11:04:56','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','4caa0815-bc2c-40ee-a547-c462ebb12d9f','Y',30,2) +; + +-- Jan 4, 2022, 11:04:57 AM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan,NumLines) VALUES (206827,'Message Text','Textual Informational, Menu or Error Message','The Message Text indicates the message that will display ',200302,342,'Y',2000,50,'N','N','N','N',0,0,'Y',TO_DATE('2022-01-04 11:04:56','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2022-01-04 11:04:56','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','87664b81-2842-4499-bae2-fe72ed13341f','Y',40,5,3) +; + +-- Jan 4, 2022, 11:04:57 AM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan,NumLines) VALUES (206828,'Message Tip','Additional tip or help for this message','The Message Tip defines additional help or information about this message.',200302,343,'Y',2000,60,'N','N','N','N',0,0,'Y',TO_DATE('2022-01-04 11:04:57','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2022-01-04 11:04:57','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','00df9659-25af-48d7-918a-3bedf7d05a89','Y',50,5,3) +; + +-- Jan 4, 2022, 11:04:57 AM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (206829,'Translated','This column is translated','The Translated checkbox indicates if this column is translated.',200302,344,'Y',1,70,'N','N','N','N',0,0,'Y',TO_DATE('2022-01-04 11:04:57','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2022-01-04 11:04:57','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','c198c571-4669-4695-9e8a-f3b76e651b07','Y',60,2,2) +; + +-- Jan 4, 2022, 11:04:57 AM CET +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,ColumnSpan) VALUES (206830,'AD_Message_Trl_UU',200302,60435,'N',36,'N','N','N','N',0,0,'Y',TO_DATE('2022-01-04 11:04:57','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2022-01-04 11:04:57','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','db7d3fc0-25e1-4803-9fbf-294c9b99aa44','N',2) +; + +-- Jan 4, 2022, 11:04:58 AM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (206831,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200302,608,'Y',1,80,'N','N','N','N',0,0,'Y',TO_DATE('2022-01-04 11:04:57','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2022-01-04 11:04:57','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','aa09d719-0562-435e-810f-6fd5cc433c7f','Y',70,2,2) +; + +-- Jan 4, 2022, 11:05:27 AM CET +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=30, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2022-01-04 11:05:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206826 +; + +-- Jan 4, 2022, 11:05:27 AM CET +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=40, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2022-01-04 11:05:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206831 +; + +-- Jan 4, 2022, 11:05:27 AM CET +UPDATE AD_Field SET SeqNo=50, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2022-01-04 11:05:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206825 +; + +-- Jan 4, 2022, 11:05:27 AM CET +UPDATE AD_Field SET SeqNo=60, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2022-01-04 11:05:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206827 +; + +-- Jan 4, 2022, 11:05:27 AM CET +UPDATE AD_Field SET SeqNo=70, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2022-01-04 11:05:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206828 +; + +-- Jan 4, 2022, 11:05:27 AM CET +UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2022-01-04 11:05:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206830 +; + +-- Jan 4, 2022, 11:05:27 AM CET +UPDATE AD_Field SET IsDisplayed='N', SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2022-01-04 11:05:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206829 +; + +-- Jan 4, 2022, 11:05:44 AM CET +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=getDate(), UpdatedBy=0 WHERE AD_Field_ID=206829 +; + +-- Jan 4, 2022, 11:05:44 AM CET +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=getDate(), UpdatedBy=0 WHERE AD_Field_ID=206823 +; + +-- Jan 4, 2022, 11:05:44 AM CET +UPDATE AD_Field SET SeqNoGrid=10,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=0 WHERE AD_Field_ID=206826 +; + +-- Jan 4, 2022, 11:05:44 AM CET +UPDATE AD_Field SET SeqNoGrid=30,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=0 WHERE AD_Field_ID=206827 +; + +-- Jan 4, 2022, 11:05:44 AM CET +UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=0 WHERE AD_Field_ID=206828 +; + +-- Jan 4, 2022, 11:05:44 AM CET +UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=0 WHERE AD_Field_ID=206831 +; + +-- Jan 4, 2022, 11:06:08 AM CET +INSERT INTO AD_Menu (AD_Menu_ID,Name,Action,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSummary,IsSOTrx,IsReadOnly,EntityType,IsCentrallyMaintained,AD_Menu_UU) VALUES (200198,'Tenant level messages','W',0,0,'Y',TO_DATE('2022-01-04 11:06:08','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2022-01-04 11:06:08','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','N','D','Y','6a3754ed-8a1b-44b8-8585-1da3d6d5e494') +; + +-- Jan 4, 2022, 11:06:08 AM CET +INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNodeMM_UU) SELECT t.AD_Client_ID, 0, 'Y', getDate(), 0, getDate(), 0,t.AD_Tree_ID, 200198, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='MM' AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200198) +; + +-- Jan 4, 2022, 11:06:31 AM CET +UPDATE AD_TreeNodeMM SET Parent_ID=153, SeqNo=25,Updated=TO_DATE('2022-01-04 11:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tree_ID=10 AND Node_ID=517 +; + +-- Jan 4, 2022, 11:06:31 AM CET +UPDATE AD_TreeNodeMM SET Parent_ID=153, SeqNo=26,Updated=TO_DATE('2022-01-04 11:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tree_ID=10 AND Node_ID=499 +; + +-- Jan 4, 2022, 11:06:31 AM CET +UPDATE AD_TreeNodeMM SET Parent_ID=153, SeqNo=27,Updated=TO_DATE('2022-01-04 11:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tree_ID=10 AND Node_ID=200150 +; + +-- Jan 4, 2022, 11:06:31 AM CET +UPDATE AD_TreeNodeMM SET Parent_ID=153, SeqNo=28,Updated=TO_DATE('2022-01-04 11:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tree_ID=10 AND Node_ID=200174 +; + +-- Jan 4, 2022, 11:06:31 AM CET +UPDATE AD_TreeNodeMM SET Parent_ID=153, SeqNo=29,Updated=TO_DATE('2022-01-04 11:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tree_ID=10 AND Node_ID=53089 +; + +-- Jan 4, 2022, 11:06:31 AM CET +UPDATE AD_TreeNodeMM SET Parent_ID=153, SeqNo=30,Updated=TO_DATE('2022-01-04 11:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tree_ID=10 AND Node_ID=53090 +; + +-- Jan 4, 2022, 11:06:31 AM CET +UPDATE AD_TreeNodeMM SET Parent_ID=153, SeqNo=31,Updated=TO_DATE('2022-01-04 11:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tree_ID=10 AND Node_ID=200038 +; + +-- Jan 4, 2022, 11:06:31 AM CET +UPDATE AD_TreeNodeMM SET Parent_ID=153, SeqNo=32,Updated=TO_DATE('2022-01-04 11:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tree_ID=10 AND Node_ID=200143 +; + +-- Jan 4, 2022, 11:06:31 AM CET +UPDATE AD_TreeNodeMM SET Parent_ID=153, SeqNo=33,Updated=TO_DATE('2022-01-04 11:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tree_ID=10 AND Node_ID=200141 +; + +-- Jan 4, 2022, 11:06:31 AM CET +UPDATE AD_TreeNodeMM SET Parent_ID=153, SeqNo=34,Updated=TO_DATE('2022-01-04 11:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tree_ID=10 AND Node_ID=200198 +; + +-- Jan 4, 2022, 11:20:28 AM CET +UPDATE AD_Menu SET AD_Window_ID=200120,Updated=TO_DATE('2022-01-04 11:20:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=200198 +; + +-- Jan 4, 2022, 11:24:44 AM CET +UPDATE AD_Field SET AD_Reference_ID=18, AD_Reference_Value_ID=327,Updated=TO_DATE('2022-01-04 11:24:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206825 +; + +-- Jan 4, 2022, 4:14:20 PM CET +UPDATE AD_Column SET IsParent='Y', IsUpdateable='N',Updated=TO_DATE('2022-01-04 16:14:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=1192 +; + +-- Jan 4, 2022, 4:14:40 PM CET +UPDATE AD_Tab SET Name='Client level messages', IsSingleRow='Y',Updated=TO_DATE('2022-01-04 16:14:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tab_ID=200302 +; + +-- Jan 4, 2022, 4:14:45 PM CET +UPDATE AD_Window SET Name='Client level messages',Updated=TO_DATE('2022-01-04 16:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=200120 +; + +-- Jan 4, 2022, 4:14:45 PM CET +UPDATE AD_Menu SET Name='Client level messages', Description=NULL, IsActive='Y',Updated=TO_DATE('2022-01-04 16:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=200198 +; + +-- Jan 4, 2022, 4:38:38 PM CET +UPDATE AD_Field SET IsMandatory='Y',Updated=TO_DATE('2022-01-04 16:38:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206825 +; + +SELECT register_migration_script('202201041130_IDEMPIERE-5136.sql') FROM dual +; diff --git a/migration/i9/postgresql/202201041130_IDEMPIERE-5136.sql b/migration/i9/postgresql/202201041130_IDEMPIERE-5136.sql new file mode 100644 index 0000000000..59b369db8d --- /dev/null +++ b/migration/i9/postgresql/202201041130_IDEMPIERE-5136.sql @@ -0,0 +1,210 @@ +-- IDEMPIERE-5136 +-- Jan 4, 2022, 11:02:53 AM CET +INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200191,0,0,TO_TIMESTAMP('2022-01-04 11:02:53','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2022-01-04 11:02:53','YYYY-MM-DD HH24:MI:SS'),0,0,'Y','MESSAGES_AT_TENANT_LEVEL','N','Turn it to Y to allow loading of tenant level messages (see IDEMPIERE-5136)','D','C','6e180e21-59a8-45c0-83c1-35582ae631c5') +; + +-- Jan 4, 2022, 11:03:15 AM CET +UPDATE AD_Table SET AccessLevel='6',Updated=TO_TIMESTAMP('2022-01-04 11:03:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Table_ID=119 +; + +-- Jan 4, 2022, 11:03:31 AM CET +INSERT INTO AD_TableIndex (AD_Client_ID,AD_Org_ID,AD_TableIndex_ID,AD_TableIndex_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Table_ID,IsCreateConstraint,IsUnique,Processing,TableIndexDrop,IsKey) VALUES (0,0,201099,'53b63823-b226-48ff-b99f-8a0f6f948526',TO_TIMESTAMP('2022-01-04 11:03:30','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','ad_message_trl_pkey',TO_TIMESTAMP('2022-01-04 11:03:30','YYYY-MM-DD HH24:MI:SS'),0,119,'Y','Y','N','N','Y') +; + +-- Jan 4, 2022, 11:03:36 AM CET +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201447,'867b99df-c3fe-4643-951d-1a057138905a',TO_TIMESTAMP('2022-01-04 11:03:36','YYYY-MM-DD HH24:MI:SS'),0,'D','Y',TO_TIMESTAMP('2022-01-04 11:03:36','YYYY-MM-DD HH24:MI:SS'),0,6767,201099,10) +; + +-- Jan 4, 2022, 11:03:39 AM CET +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201448,'d0730eae-18e9-46db-a38f-0992e919139b',TO_TIMESTAMP('2022-01-04 11:03:38','YYYY-MM-DD HH24:MI:SS'),0,'D','Y',TO_TIMESTAMP('2022-01-04 11:03:38','YYYY-MM-DD HH24:MI:SS'),0,341,201099,20) +; + +-- Jan 4, 2022, 11:03:40 AM CET +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201449,'b0a1cb37-ff82-4e10-a1e7-0492e69f9b83',TO_TIMESTAMP('2022-01-04 11:03:40','YYYY-MM-DD HH24:MI:SS'),0,'D','Y',TO_TIMESTAMP('2022-01-04 11:03:40','YYYY-MM-DD HH24:MI:SS'),0,1192,201099,30) +; + +-- Jan 4, 2022, 11:03:44 AM CET +ALTER TABLE AD_Message_Trl DROP CONSTRAINT ad_message_trl_pkey CASCADE +; + +-- Jan 4, 2022, 11:03:44 AM CET +ALTER TABLE AD_Message_Trl ADD CONSTRAINT ad_message_trl_pkey PRIMARY KEY (AD_Message_ID,AD_Language,AD_Client_ID) +; + +-- Jan 4, 2022, 11:04:20 AM CET +INSERT INTO AD_Window (AD_Window_ID,Name,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,WindowType,Processing,EntityType,IsSOTrx,IsDefault,WinHeight,WinWidth,IsBetaFunctionality,AD_Window_UU) VALUES (200120,'Tenant level messages',0,0,'Y',TO_TIMESTAMP('2022-01-04 11:04:19','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-01-04 11:04:19','YYYY-MM-DD HH24:MI:SS'),0,'M','N','D','Y','N',0,0,'N','c58c9213-2d4e-4b9d-ad1f-735c1cc8d3ae') +; + +-- Jan 4, 2022, 11:04:50 AM CET +INSERT INTO AD_Tab (AD_Tab_ID,Name,AD_Window_ID,SeqNo,IsSingleRow,AD_Table_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,HasTree,IsInfoTab,IsTranslationTab,IsReadOnly,WhereClause,Processing,ImportFields,TabLevel,IsSortTab,EntityType,IsInsertRecord,IsAdvancedTab,AD_Tab_UU,TreeDisplayedOn,IsLookupOnlySelection,IsAllowAdvancedLookup,MaxQueryRecords) VALUES (200302,'Tenant level messages',200120,10,'N',119,0,0,'Y',TO_TIMESTAMP('2022-01-04 11:04:50','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-01-04 11:04:50','YYYY-MM-DD HH24:MI:SS'),0,'N','N','N','N','AD_Message_Trl.AD_Client_ID = @#AD_Client_ID@','N','N',0,'N','D','Y','N','64d37a62-cc02-4beb-b3e1-ab7bf6c6f2b7','B','N','Y',0) +; + +-- Jan 4, 2022, 11:04:55 AM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (206823,'Client','Client/Tenant for this installation.','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.',200302,1192,'Y',22,10,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-01-04 11:04:55','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-01-04 11:04:55','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','9fc4aabb-4b36-4690-a361-8a7a1ba4ddd2','Y',10,2) +; + +-- Jan 4, 2022, 11:04:56 AM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsAllowCopy,IsDisplayedGrid,XPosition,ColumnSpan) VALUES (206824,'Organization','Organizational entity within client','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.',200302,1193,'Y',22,20,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-01-04 11:04:55','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-01-04 11:04:55','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','17836fb6-baba-4eac-b652-bb5cf2329781','Y','N',4,2) +; + +-- Jan 4, 2022, 11:04:56 AM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (206825,'Language','Language for this entity','The Language identifies the language to use for display and formatting',200302,341,'Y',6,30,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-01-04 11:04:56','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-01-04 11:04:56','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','bf20379e-ae47-472b-8e18-7a58a7876a2f','Y',20,2) +; + +-- Jan 4, 2022, 11:04:56 AM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (206826,'Message','System Message','Information and Error messages',200302,6767,'Y',22,40,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-01-04 11:04:56','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-01-04 11:04:56','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','4caa0815-bc2c-40ee-a547-c462ebb12d9f','Y',30,2) +; + +-- Jan 4, 2022, 11:04:57 AM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan,NumLines) VALUES (206827,'Message Text','Textual Informational, Menu or Error Message','The Message Text indicates the message that will display ',200302,342,'Y',2000,50,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-01-04 11:04:56','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-01-04 11:04:56','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','87664b81-2842-4499-bae2-fe72ed13341f','Y',40,5,3) +; + +-- Jan 4, 2022, 11:04:57 AM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan,NumLines) VALUES (206828,'Message Tip','Additional tip or help for this message','The Message Tip defines additional help or information about this message.',200302,343,'Y',2000,60,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-01-04 11:04:57','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-01-04 11:04:57','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','00df9659-25af-48d7-918a-3bedf7d05a89','Y',50,5,3) +; + +-- Jan 4, 2022, 11:04:57 AM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (206829,'Translated','This column is translated','The Translated checkbox indicates if this column is translated.',200302,344,'Y',1,70,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-01-04 11:04:57','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-01-04 11:04:57','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','c198c571-4669-4695-9e8a-f3b76e651b07','Y',60,2,2) +; + +-- Jan 4, 2022, 11:04:57 AM CET +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,ColumnSpan) VALUES (206830,'AD_Message_Trl_UU',200302,60435,'N',36,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-01-04 11:04:57','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-01-04 11:04:57','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','db7d3fc0-25e1-4803-9fbf-294c9b99aa44','N',2) +; + +-- Jan 4, 2022, 11:04:58 AM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (206831,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200302,608,'Y',1,80,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-01-04 11:04:57','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-01-04 11:04:57','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','aa09d719-0562-435e-810f-6fd5cc433c7f','Y',70,2,2) +; + +-- Jan 4, 2022, 11:05:27 AM CET +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=30, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-01-04 11:05:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206826 +; + +-- Jan 4, 2022, 11:05:27 AM CET +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=40, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-01-04 11:05:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206831 +; + +-- Jan 4, 2022, 11:05:27 AM CET +UPDATE AD_Field SET SeqNo=50, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-01-04 11:05:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206825 +; + +-- Jan 4, 2022, 11:05:27 AM CET +UPDATE AD_Field SET SeqNo=60, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-01-04 11:05:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206827 +; + +-- Jan 4, 2022, 11:05:27 AM CET +UPDATE AD_Field SET SeqNo=70, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-01-04 11:05:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206828 +; + +-- Jan 4, 2022, 11:05:27 AM CET +UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-01-04 11:05:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206830 +; + +-- Jan 4, 2022, 11:05:27 AM CET +UPDATE AD_Field SET IsDisplayed='N', SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-01-04 11:05:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206829 +; + +-- Jan 4, 2022, 11:05:44 AM CET +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=statement_timestamp(), UpdatedBy=0 WHERE AD_Field_ID=206829 +; + +-- Jan 4, 2022, 11:05:44 AM CET +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=statement_timestamp(), UpdatedBy=0 WHERE AD_Field_ID=206823 +; + +-- Jan 4, 2022, 11:05:44 AM CET +UPDATE AD_Field SET SeqNoGrid=10,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=0 WHERE AD_Field_ID=206826 +; + +-- Jan 4, 2022, 11:05:44 AM CET +UPDATE AD_Field SET SeqNoGrid=30,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=0 WHERE AD_Field_ID=206827 +; + +-- Jan 4, 2022, 11:05:44 AM CET +UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=0 WHERE AD_Field_ID=206828 +; + +-- Jan 4, 2022, 11:05:44 AM CET +UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=0 WHERE AD_Field_ID=206831 +; + +-- Jan 4, 2022, 11:06:08 AM CET +INSERT INTO AD_Menu (AD_Menu_ID,Name,"action",AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSummary,IsSOTrx,IsReadOnly,EntityType,IsCentrallyMaintained,AD_Menu_UU) VALUES (200198,'Tenant level messages','W',0,0,'Y',TO_TIMESTAMP('2022-01-04 11:06:08','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-01-04 11:06:08','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','N','D','Y','6a3754ed-8a1b-44b8-8585-1da3d6d5e494') +; + +-- Jan 4, 2022, 11:06:08 AM CET +INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNodeMM_UU) SELECT t.AD_Client_ID, 0, 'Y', statement_timestamp(), 0, statement_timestamp(), 0,t.AD_Tree_ID, 200198, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='MM' AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200198) +; + +-- Jan 4, 2022, 11:06:31 AM CET +UPDATE AD_TreeNodeMM SET Parent_ID=153, SeqNo=25,Updated=TO_TIMESTAMP('2022-01-04 11:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tree_ID=10 AND Node_ID=517 +; + +-- Jan 4, 2022, 11:06:31 AM CET +UPDATE AD_TreeNodeMM SET Parent_ID=153, SeqNo=26,Updated=TO_TIMESTAMP('2022-01-04 11:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tree_ID=10 AND Node_ID=499 +; + +-- Jan 4, 2022, 11:06:31 AM CET +UPDATE AD_TreeNodeMM SET Parent_ID=153, SeqNo=27,Updated=TO_TIMESTAMP('2022-01-04 11:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tree_ID=10 AND Node_ID=200150 +; + +-- Jan 4, 2022, 11:06:31 AM CET +UPDATE AD_TreeNodeMM SET Parent_ID=153, SeqNo=28,Updated=TO_TIMESTAMP('2022-01-04 11:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tree_ID=10 AND Node_ID=200174 +; + +-- Jan 4, 2022, 11:06:31 AM CET +UPDATE AD_TreeNodeMM SET Parent_ID=153, SeqNo=29,Updated=TO_TIMESTAMP('2022-01-04 11:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tree_ID=10 AND Node_ID=53089 +; + +-- Jan 4, 2022, 11:06:31 AM CET +UPDATE AD_TreeNodeMM SET Parent_ID=153, SeqNo=30,Updated=TO_TIMESTAMP('2022-01-04 11:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tree_ID=10 AND Node_ID=53090 +; + +-- Jan 4, 2022, 11:06:31 AM CET +UPDATE AD_TreeNodeMM SET Parent_ID=153, SeqNo=31,Updated=TO_TIMESTAMP('2022-01-04 11:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tree_ID=10 AND Node_ID=200038 +; + +-- Jan 4, 2022, 11:06:31 AM CET +UPDATE AD_TreeNodeMM SET Parent_ID=153, SeqNo=32,Updated=TO_TIMESTAMP('2022-01-04 11:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tree_ID=10 AND Node_ID=200143 +; + +-- Jan 4, 2022, 11:06:31 AM CET +UPDATE AD_TreeNodeMM SET Parent_ID=153, SeqNo=33,Updated=TO_TIMESTAMP('2022-01-04 11:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tree_ID=10 AND Node_ID=200141 +; + +-- Jan 4, 2022, 11:06:31 AM CET +UPDATE AD_TreeNodeMM SET Parent_ID=153, SeqNo=34,Updated=TO_TIMESTAMP('2022-01-04 11:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tree_ID=10 AND Node_ID=200198 +; + +-- Jan 4, 2022, 11:20:28 AM CET +UPDATE AD_Menu SET AD_Window_ID=200120,Updated=TO_TIMESTAMP('2022-01-04 11:20:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=200198 +; + +-- Jan 4, 2022, 11:24:44 AM CET +UPDATE AD_Field SET AD_Reference_ID=18, AD_Reference_Value_ID=327,Updated=TO_TIMESTAMP('2022-01-04 11:24:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206825 +; + +-- Jan 4, 2022, 4:14:20 PM CET +UPDATE AD_Column SET IsParent='Y', IsUpdateable='N',Updated=TO_TIMESTAMP('2022-01-04 16:14:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=1192 +; + +-- Jan 4, 2022, 4:14:40 PM CET +UPDATE AD_Tab SET Name='Client level messages', IsSingleRow='Y',Updated=TO_TIMESTAMP('2022-01-04 16:14:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tab_ID=200302 +; + +-- Jan 4, 2022, 4:14:45 PM CET +UPDATE AD_Window SET Name='Client level messages',Updated=TO_TIMESTAMP('2022-01-04 16:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=200120 +; + +-- Jan 4, 2022, 4:14:45 PM CET +UPDATE AD_Menu SET Name='Client level messages', Description=NULL, IsActive='Y',Updated=TO_TIMESTAMP('2022-01-04 16:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=200198 +; + +-- Jan 4, 2022, 4:38:38 PM CET +UPDATE AD_Field SET IsMandatory='Y',Updated=TO_TIMESTAMP('2022-01-04 16:38:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206825 +; + +SELECT register_migration_script('202201041130_IDEMPIERE-5136.sql') FROM dual +; diff --git a/org.adempiere.base.callout/src/org/adempiere/base/callout/MessageTrl.java b/org.adempiere.base.callout/src/org/adempiere/base/callout/MessageTrl.java new file mode 100644 index 0000000000..26208fc47a --- /dev/null +++ b/org.adempiere.base.callout/src/org/adempiere/base/callout/MessageTrl.java @@ -0,0 +1,66 @@ +/*********************************************************************** + * This file is part of iDempiere ERP Open Source * + * http://www.idempiere.org * + * * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Nicolas Micoud (TGI) * + **********************************************************************/ +package org.adempiere.base.callout; + +import java.util.Properties; + +import org.adempiere.base.IColumnCallout; +import org.adempiere.base.annotation.Callout; +import org.compiere.model.GridField; +import org.compiere.model.GridTab; +import org.compiere.model.MMessage; +import org.compiere.util.Env; +import org.compiere.util.Msg; + +/** + * + * @author Nicolas Micoud (TGI) + * + */ +@Callout(tableName = "AD_Message_Trl", columnName = {"AD_Message_ID", "AD_Language"}) +public class MessageTrl implements IColumnCallout { + @Override + public String start(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value, Object oldValue) { + + if (Env.getAD_Client_ID(ctx) > 0 && value != null) { // only use to fill fields from System to tenant + + int messageID = 0; + String lang = ""; + + if (mField.getColumnName().equals("AD_Message_ID")) { + messageID = (Integer) value; + lang = mTab.get_ValueAsString("AD_Language"); + } + else if (mField.getColumnName().equals("AD_Language")) { + messageID = mTab.getValue("AD_Message_ID") != null ? (Integer) mTab.getValue("AD_Message_ID") : 0; + lang = (String) value; + } + + mTab.setValue("MsgText", Msg.getMsg(lang, MMessage.get(ctx, messageID).getValue(), true)); + mTab.setValue("MsgTip", Msg.getMsg(lang, MMessage.get(ctx, messageID).getValue(), false)); + } + return null; + } +} \ No newline at end of file diff --git a/org.adempiere.base/src/org/compiere/model/MMessage.java b/org.adempiere.base/src/org/compiere/model/MMessage.java index 13984a0124..6501aa167a 100644 --- a/org.adempiere.base/src/org/compiere/model/MMessage.java +++ b/org.adempiere.base/src/org/compiere/model/MMessage.java @@ -24,8 +24,8 @@ import java.util.logging.Level; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; -import org.idempiere.cache.ImmutablePOSupport; import org.idempiere.cache.ImmutablePOCache; +import org.idempiere.cache.ImmutablePOSupport; /** * Message Model @@ -38,7 +38,7 @@ public class MMessage extends X_AD_Message implements ImmutablePOSupport /** * */ - private static final long serialVersionUID = -7983736322524189608L; + private static final long serialVersionUID = 3305457539918386807L; /** * Get Message (cached) (immutable) @@ -207,4 +207,24 @@ public class MMessage extends X_AD_Message implements ImmutablePOSupport return this; } + /* + * Before Save + * @param newRecord + * @return true if save + */ + protected boolean beforeSave(boolean newRecord) { + + // To avoid conflicts with tenant level messages, the value cannot start with numeric and | + if (getValue().contains("|")) { + + String prefix = getValue().substring(0, getValue().indexOf("|")); + + if (prefix.matches("[0-9]+")) { + log.saveError("Error", "A message cannot have a value starting with numeric and |"); + return false; + } + } + + return true; + } } // MMessage diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index bef8eb5128..408683bf0d 100644 --- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java +++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java @@ -44,7 +44,7 @@ public class MSysConfig extends X_AD_SysConfig /** * */ - private static final long serialVersionUID = 4071371201535378277L; + private static final long serialVersionUID = 7257949078651339908L; public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION"; public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS"; @@ -126,6 +126,7 @@ public class MSysConfig extends X_AD_SysConfig public static final String MAX_RESULTS_PER_SEARCH_IN_DOCUMENT_CONTROLLER = "MAX_RESULTS_PER_SEARCH_IN_DOCUMENT_CONTROLLER"; public static final String MAX_TEXT_LENGTH_ON_GRID_VIEW = "MAX_TEXT_LENGTH_ON_GRID_VIEW"; public static final String MENU_INFOUPDATER_SLEEP_MS = "MENU_INFOUPDATER_SLEEP_MS"; + public static final String MESSAGES_AT_TENANT_LEVEL = "MESSAGES_AT_TENANT_LEVEL"; public static final String MFA_NTP_TIMEOUT_IN_MILLISECONDS = "MFA_NTP_TIMEOUT_IN_MILLISECONDS"; public static final String MFA_REGISTERED_DEVICE_EXPIRATION_DAYS = "MFA_REGISTERED_DEVICE_EXPIRATION_DAYS"; public static final String MONITOR_INITIAL_WAIT_FOR_CLUSTER_IN_SECONDS = "MONITOR_INITIAL_WAIT_FOR_CLUSTER_IN_SECONDS"; diff --git a/org.adempiere.base/src/org/compiere/util/Msg.java b/org.adempiere.base/src/org/compiere/util/Msg.java index 4e406a52b7..4105df5584 100644 --- a/org.adempiere.base/src/org/compiere/util/Msg.java +++ b/org.adempiere.base/src/org/compiere/util/Msg.java @@ -30,6 +30,7 @@ import java.util.logging.Level; import org.compiere.Adempiere; import org.compiere.model.I_AD_Element; import org.compiere.model.I_AD_Message; +import org.compiere.model.MSysConfig; /** * Reads all Messages and stores them in a HashMap @@ -144,29 +145,31 @@ public final class Msg try { if (AD_Language == null || AD_Language.length() == 0 || Env.isBaseLanguage(AD_Language, "AD_Language")) - pstmt = DB.prepareStatement("SELECT Value, MsgText, MsgTip FROM AD_Message", null); + pstmt = DB.prepareStatement("SELECT Value, MsgText, MsgTip FROM AD_Message WHERE IsActive ='Y'", null); else { pstmt = DB.prepareStatement("SELECT m.Value, t.MsgText, t.MsgTip " + "FROM AD_Message_Trl t, AD_Message m " + "WHERE m.AD_Message_ID=t.AD_Message_ID" + + " AND t.AD_Client_ID = 0" // load only translated messages at System level (using Value as key) + + " AND m.IsActive ='Y' AND t.IsActive ='Y'" + " AND t.AD_Language=?", null); pstmt.setString(1, AD_Language); } rs = pstmt.executeQuery(); + addMessagesInCache(rs, msg); + DB.close(rs, pstmt); - // get values - while (rs.next()) - { - String AD_Message = rs.getString(1); - StringBuilder MsgText = new StringBuilder(); - MsgText.append(rs.getString(2)); - String MsgTip = rs.getString(3); - // - if (MsgTip != null) // messageTip on next line, if exists - MsgText.append(" ").append(SEPARATOR).append(MsgTip); - msg.put(AD_Message, MsgText.toString()); - } + // load translated messages at tenant level (using AD_Client_ID|Value as key) + pstmt = DB.prepareStatement("SELECT t.AD_Client_ID || '|' || m.Value, t.MsgText, t.MsgTip" + + " FROM AD_Message_Trl t, AD_Message m" + + " WHERE m.AD_Message_ID=t.AD_Message_ID" + + " AND t.AD_Client_ID != 0" + + " AND m.IsActive ='Y' AND t.IsActive ='Y'" + + " AND t.AD_Language=?", null); + pstmt.setString(1, AD_Language); + rs = pstmt.executeQuery(); + addMessagesInCache(rs, msg); } catch (SQLException e) { @@ -188,6 +191,26 @@ public final class Msg return msg; } // initMsg + /** + * @param rs + * @param msg + * @throws SQLException + */ + private void addMessagesInCache(ResultSet rs, CCache msg) throws SQLException { + // get values + while (rs.next()) + { + String AD_Message = rs.getString(1); + StringBuilder MsgText = new StringBuilder(); + MsgText.append(rs.getString(2)); + String MsgTip = rs.getString(3); + // + if (MsgTip != null) // messageTip on next line, if exists + MsgText.append(" ").append(SEPARATOR).append(MsgTip); + msg.put(AD_Message, MsgText.toString()); + } + } + /** * Reset Message cache */ @@ -261,6 +284,13 @@ public final class Msg CCache langMap = getMsgMap(AD_Language); if (langMap == null) return null; + + if (MSysConfig.getBooleanValue(MSysConfig.MESSAGES_AT_TENANT_LEVEL, false, Env.getAD_Client_ID(Env.getCtx()))) { + String msg = (String) langMap.get(Env.getAD_Client_ID(Env.getCtx()) + "|" + text); + if (!Util.isEmpty(msg)) + return msg; + } + return (String)langMap.get(text); } // lookup