IDEMPIERE-5261 Workflow EMail notification enhancement (#1299)

* IDEMPIERE-5261 Workflow EMail notification enhancement

* Update 202204190945_IDEMPIERE-5261.sql

Co-authored-by: Carlos Ruiz <carg67@gmail.com>
This commit is contained in:
hengsin 2022-05-06 00:51:11 +08:00 committed by GitHub
parent e91aa9d0d3
commit a8958bf29d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 743 additions and 118 deletions

View File

@ -0,0 +1,209 @@
SELECT register_migration_script('202204190945_IDEMPIERE-5261.sql') FROM dual
;
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Apr 18, 2022 11:12:39 PM MYT
INSERT INTO AD_Element (AD_Element_ID,Updated,Created,AD_Client_ID,Description,Name,PrintName,ColumnName,AD_Element_UU,AD_Org_ID,CreatedBy,UpdatedBy,IsActive,EntityType) VALUES (203035,TO_DATE('2022-04-18 23:12:27','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2022-04-18 23:12:27','YYYY-MM-DD HH24:MI:SS'),0,'Attached document to Email','Attached Document','Attached Document','IsAttachedDocumentToEmail','67946e6c-ccc9-41e2-be03-45a66d8fca20',0,100,100,'Y','D')
;
-- Apr 18, 2022 11:49:44 PM MYT
INSERT INTO AD_Column (SeqNoSelection,AD_Column_ID,IsAlwaysUpdateable,IsSyncDatabase,AD_Client_ID,AD_Org_ID,Updated,EntityType,IsSecure,IsEncrypted,IsParent,IsMandatory,IsIdentifier,SeqNo,Version,FieldLength,IsKey,IsTranslated,Created,IsUpdateable,IsAutocomplete,IsAllowLogging,CreatedBy,IsAllowCopy,Description,ColumnName,Name,DefaultValue,IsSelectionColumn,AD_Column_UU,UpdatedBy,IsActive,IsToolbarButton,FKConstraintType,AD_Element_ID,AD_Reference_ID,AD_Table_ID) VALUES (0,212827,'N','N',0,0,TO_DATE('2022-04-18 23:49:43','YYYY-MM-DD HH24:MI:SS'),'D','N','N','N','Y','N',0,0,1,'N','N',TO_DATE('2022-04-18 23:49:43','YYYY-MM-DD HH24:MI:SS'),'Y','N','Y',100,'Y','Attached document to Email','IsAttachedDocumentToEmail','Attached Document','Y','N','d629a293-9361-4879-b0eb-061b5f54297c',100,'Y','N','N',203035,20,129)
;
-- Apr 18, 2022 11:49:55 PM MYT
ALTER TABLE AD_WF_Node ADD IsAttachedDocumentToEmail CHAR(1 CHAR) DEFAULT 'Y' CHECK (IsAttachedDocumentToEmail IN ('Y','N')) NOT NULL
;
-- Apr 19, 2022 12:22:31 AM MYT
INSERT INTO AD_Field (ColumnSpan,NumLines,AD_Field_ID,IsQuickEntry,AD_Client_ID,AD_Org_ID,Updated,IsHeading,IsDisplayed,IsFieldOnly,IsSameLine,IsDisplayedGrid,SeqNoGrid,SeqNo,IsReadOnly,IsCentrallyMaintained,Created,EntityType,CreatedBy,UpdatedBy,Name,Description,SortNo,IsEncrypted,DisplayLength,DisplayLogic,AD_Field_UU,IsActive,XPosition,IsAdvancedField,IsDefaultFocus,AD_Column_ID,AD_Tab_ID) VALUES (2,1,204268,'N',0,0,TO_DATE('2022-04-19 00:22:20','YYYY-MM-DD HH24:MI:SS'),'N','Y','N','N','Y',410,420,'N','Y',TO_DATE('2022-04-19 00:22:20','YYYY-MM-DD HH24:MI:SS'),'D',100,100,'Attached Document','Attached document to Email',0,'N',0,'@Action@=''M''','72c63d51-d8d3-4a17-af66-ed5d27c4b32e','Y',1,'N','N',212827,122)
;
-- Apr 19, 2022 12:23:52 AM MYT
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=270, XPosition=5,Updated=TO_DATE('2022-04-19 00:23:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204268
;
-- Apr 19, 2022 12:23:52 AM MYT
UPDATE AD_Field SET SeqNo=280,Updated=TO_DATE('2022-04-19 00:23:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8761
;
-- Apr 19, 2022 12:23:52 AM MYT
UPDATE AD_Field SET SeqNo=290,Updated=TO_DATE('2022-04-19 00:23:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1269
;
-- Apr 19, 2022 12:23:52 AM MYT
UPDATE AD_Field SET SeqNo=300,Updated=TO_DATE('2022-04-19 00:23:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1268
;
-- Apr 19, 2022 12:23:53 AM MYT
UPDATE AD_Field SET SeqNo=310,Updated=TO_DATE('2022-04-19 00:23:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8766
;
-- Apr 19, 2022 12:23:53 AM MYT
UPDATE AD_Field SET SeqNo=320,Updated=TO_DATE('2022-04-19 00:23:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2578
;
-- Apr 19, 2022 12:24:27 AM MYT
UPDATE AD_Field SET SeqNoGrid=20,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=2005
;
-- Apr 19, 2022 12:24:27 AM MYT
UPDATE AD_Field SET SeqNoGrid=30,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=386
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=10195
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=387
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=60,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=388
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=389
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=390
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=4572
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=5821
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=8764
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=8772
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=130,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=8763
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=140,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=8773
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=150,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=8882
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=160,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=8883
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=170,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=1263
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=180,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=8881
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=190,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=1264
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=200,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=3666
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=210,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=10088
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=220,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=10091
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=230,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=10090
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=240,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=12615
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=250,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=12614
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=260,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=12616
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=270,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=204268
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=280,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=8761
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=290,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=1269
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=300,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=1268
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=310,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=8766
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=320,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=2578
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=330,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=8771
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=340,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=10180
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=350,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=10089
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=360,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=10920
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=370,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=10921
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=380,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=8765
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=390,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=8767
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=400,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=8769
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=410,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=8768
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=420,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=201875
;

View File

@ -0,0 +1,207 @@
SELECT register_migration_script('202204190945_IDEMPIERE-5261.sql') FROM dual
;
-- Apr 18, 2022 11:12:39 PM MYT
INSERT INTO AD_Element (AD_Element_ID,Updated,Created,AD_Client_ID,Description,Name,PrintName,ColumnName,AD_Element_UU,AD_Org_ID,CreatedBy,UpdatedBy,IsActive,EntityType) VALUES (203035,TO_TIMESTAMP('2022-04-18 23:12:27','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2022-04-18 23:12:27','YYYY-MM-DD HH24:MI:SS'),0,'Attached document to Email','Attached Document','Attached Document','IsAttachedDocumentToEmail','67946e6c-ccc9-41e2-be03-45a66d8fca20',0,100,100,'Y','D')
;
-- Apr 18, 2022 11:49:44 PM MYT
INSERT INTO AD_Column (SeqNoSelection,AD_Column_ID,IsAlwaysUpdateable,IsSyncDatabase,AD_Client_ID,AD_Org_ID,Updated,EntityType,IsSecure,IsEncrypted,IsParent,IsMandatory,IsIdentifier,SeqNo,Version,FieldLength,IsKey,IsTranslated,Created,IsUpdateable,IsAutocomplete,IsAllowLogging,CreatedBy,IsAllowCopy,Description,ColumnName,Name,DefaultValue,IsSelectionColumn,AD_Column_UU,UpdatedBy,IsActive,IsToolbarButton,FKConstraintType,AD_Element_ID,AD_Reference_ID,AD_Table_ID) VALUES (0,212827,'N','N',0,0,TO_TIMESTAMP('2022-04-18 23:49:43','YYYY-MM-DD HH24:MI:SS'),'D','N','N','N','Y','N',0,0,1,'N','N',TO_TIMESTAMP('2022-04-18 23:49:43','YYYY-MM-DD HH24:MI:SS'),'Y','N','Y',100,'Y','Attached document to Email','IsAttachedDocumentToEmail','Attached Document','Y','N','d629a293-9361-4879-b0eb-061b5f54297c',100,'Y','N','N',203035,20,129)
;
-- Apr 18, 2022 11:49:55 PM MYT
ALTER TABLE AD_WF_Node ADD COLUMN IsAttachedDocumentToEmail CHAR(1) DEFAULT 'Y' CHECK (IsAttachedDocumentToEmail IN ('Y','N')) NOT NULL
;
-- Apr 19, 2022 12:22:31 AM MYT
INSERT INTO AD_Field (ColumnSpan,NumLines,AD_Field_ID,IsQuickEntry,AD_Client_ID,AD_Org_ID,Updated,IsHeading,IsDisplayed,IsFieldOnly,IsSameLine,IsDisplayedGrid,SeqNoGrid,SeqNo,IsReadOnly,IsCentrallyMaintained,Created,EntityType,CreatedBy,UpdatedBy,Name,Description,SortNo,IsEncrypted,DisplayLength,DisplayLogic,AD_Field_UU,IsActive,XPosition,IsAdvancedField,IsDefaultFocus,AD_Column_ID,AD_Tab_ID) VALUES (2,1,204268,'N',0,0,TO_TIMESTAMP('2022-04-19 00:22:20','YYYY-MM-DD HH24:MI:SS'),'N','Y','N','N','Y',410,420,'N','Y',TO_TIMESTAMP('2022-04-19 00:22:20','YYYY-MM-DD HH24:MI:SS'),'D',100,100,'Attached Document','Attached document to Email',0,'N',0,'@Action@=''M''','72c63d51-d8d3-4a17-af66-ed5d27c4b32e','Y',1,'N','N',212827,122)
;
-- Apr 19, 2022 12:23:52 AM MYT
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=270, XPosition=5,Updated=TO_TIMESTAMP('2022-04-19 00:23:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204268
;
-- Apr 19, 2022 12:23:52 AM MYT
UPDATE AD_Field SET SeqNo=280,Updated=TO_TIMESTAMP('2022-04-19 00:23:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8761
;
-- Apr 19, 2022 12:23:52 AM MYT
UPDATE AD_Field SET SeqNo=290,Updated=TO_TIMESTAMP('2022-04-19 00:23:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1269
;
-- Apr 19, 2022 12:23:52 AM MYT
UPDATE AD_Field SET SeqNo=300,Updated=TO_TIMESTAMP('2022-04-19 00:23:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1268
;
-- Apr 19, 2022 12:23:53 AM MYT
UPDATE AD_Field SET SeqNo=310,Updated=TO_TIMESTAMP('2022-04-19 00:23:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8766
;
-- Apr 19, 2022 12:23:53 AM MYT
UPDATE AD_Field SET SeqNo=320,Updated=TO_TIMESTAMP('2022-04-19 00:23:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2578
;
-- Apr 19, 2022 12:24:27 AM MYT
UPDATE AD_Field SET SeqNoGrid=20,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=2005
;
-- Apr 19, 2022 12:24:27 AM MYT
UPDATE AD_Field SET SeqNoGrid=30,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=386
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=10195
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=387
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=60,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=388
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=389
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=390
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=4572
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=5821
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=8764
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=8772
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=130,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=8763
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=140,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=8773
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=150,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=8882
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=160,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=8883
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=170,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=1263
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=180,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=8881
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=190,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=1264
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=200,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=3666
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=210,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=10088
;
-- Apr 19, 2022 12:24:28 AM MYT
UPDATE AD_Field SET SeqNoGrid=220,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=10091
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=230,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=10090
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=240,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=12615
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=250,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=12614
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=260,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=12616
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=270,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=204268
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=280,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=8761
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=290,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=1269
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=300,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=1268
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=310,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=8766
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=320,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=2578
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=330,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=8771
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=340,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=10180
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=350,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=10089
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=360,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=10920
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=370,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=10921
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=380,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=8765
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=390,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=8767
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=400,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=8769
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=410,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=8768
;
-- Apr 19, 2022 12:24:29 AM MYT
UPDATE AD_Field SET SeqNoGrid=420,IsDisplayedGrid='Y', Updated=Now(), UpdatedBy=100 WHERE AD_Field_ID=201875
;

View File

@ -22,7 +22,7 @@ import org.compiere.util.KeyNamePair;
/** Generated Interface for AD_WF_Node
* @author iDempiere (generated)
* @version Release 9
* @version Release 10
*/
public interface I_AD_WF_Node
{
@ -57,8 +57,8 @@ public interface I_AD_WF_Node
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
/** Get Tenant.
* Tenant for this installation.
*/
public int getAD_Client_ID();
@ -137,12 +137,12 @@ public interface I_AD_WF_Node
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
* Organizational entity within tenant
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
* Organizational entity within tenant
*/
public int getAD_Org_ID();
@ -473,6 +473,19 @@ public interface I_AD_WF_Node
*/
public boolean isActive();
/** Column name IsAttachedDocumentToEmail */
public static final String COLUMNNAME_IsAttachedDocumentToEmail = "IsAttachedDocumentToEmail";
/** Set Attached Document.
* Attached document to Email
*/
public void setIsAttachedDocumentToEmail (boolean IsAttachedDocumentToEmail);
/** Get Attached Document.
* Attached document to Email
*/
public boolean isAttachedDocumentToEmail();
/** Column name IsCentrallyMaintained */
public static final String COLUMNNAME_IsCentrallyMaintained = "IsCentrallyMaintained";

View File

@ -18,15 +18,12 @@ package org.compiere.model;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.Properties;
import java.util.logging.Level;
import org.compiere.util.CCache;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Util;
/**
@ -84,14 +81,25 @@ public class MMailText extends X_R_MailText
/**
* Get parsed/translated Mail Text
* @param all concatinate all
* @param all concatenate all
* @return parsed/translated text
*/
public String getMailText(boolean all)
{
return getMailText(all, true);
}
/**
* Get parsed/translated Mail Text
* @param all concatenate all
* @param parsed
* @return parsed/translated text
*/
public String getMailText(boolean all, boolean parsed)
{
translate();
if (!all)
return parse(m_MailText);
return parsed ? parse(m_MailText) : m_MailText;
//
StringBuilder sb = new StringBuilder();
sb.append(m_MailText);
@ -102,7 +110,7 @@ public class MMailText extends X_R_MailText
if (s != null && s.length() > 0)
sb.append("\n").append(s);
//
return parse(sb.toString());
return parsed ? parse(sb.toString()) : sb.toString();
} // getMailText
/**
@ -140,9 +148,19 @@ public class MMailText extends X_R_MailText
* @return parsed/translated text
*/
public String getMailHeader()
{
return getMailHeader(true);
}
/**
* Get parsed/translated Mail Header
* @param parsed
* @return parsed/translated text
*/
public String getMailHeader(boolean parsed)
{
translate();
return parse(m_MailHeader);
return parsed ? parse(m_MailHeader) : m_MailHeader;
} // getMailHeader
/**************************************************************************
@ -211,41 +229,7 @@ public class MMailText extends X_R_MailText
*/
protected String parseVariable (String variable, PO po)
{
if (variable.contains("<") && variable.contains(">")) { // IDEMPIERE-3096
return Env.parseVariable("@"+variable+"@", po, get_TrxName(), true);
}
String defaultValue = "";
if (variable.contains(":")) {
defaultValue = variable.substring(variable.indexOf(":") + 1, variable.length());
variable = variable.substring(0, variable.indexOf(":"));
}
// special default formatting cases for dates/times/boolean in mail text not covered by Env.parseVariable
int index = po.get_ColumnIndex(variable);
if (index == -1){
StringBuilder msgreturn = new StringBuilder("@").append(variable).append("@");
return msgreturn.toString(); // keep for next
}
//
MColumn col = MColumn.get(Env.getCtx(), po.get_TableName(), variable);
Object value = null;
if (col != null && col.isSecure()) {
value = "********";
} else if (col.getAD_Reference_ID() == DisplayType.Date || col.getAD_Reference_ID() == DisplayType.DateTime || col.getAD_Reference_ID() == DisplayType.Time) {
SimpleDateFormat sdf = DisplayType.getDateFormat(col.getAD_Reference_ID());
value = sdf.format (po.get_Value(index));
} else if (col.getAD_Reference_ID() == DisplayType.YesNo) {
if (po.get_ValueAsBoolean(variable))
value = Msg.getMsg(Env.getCtx(), "Yes");
else
value = Msg.getMsg(Env.getCtx(), "No");
} else {
value = po.get_Value(index);
}
if (value == null)
return defaultValue;
return value.toString();
return Env.parseVariable("@"+variable+"@", po, get_TrxName(), true, true, true);
} // translate
/**

View File

@ -26,7 +26,7 @@ import org.compiere.util.KeyNamePair;
/** Generated Model for AD_WF_Node
* @author iDempiere (generated)
* @version Release 9 - $Id$ */
* @version Release 10 - $Id$ */
@org.adempiere.base.Model(table="AD_WF_Node")
public class X_AD_WF_Node extends PO implements I_AD_WF_Node, I_Persistent
{
@ -34,7 +34,7 @@ public class X_AD_WF_Node extends PO implements I_AD_WF_Node, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20220116L;
private static final long serialVersionUID = 20220420L;
/** Standard Constructor */
public X_AD_WF_Node (Properties ctx, int AD_WF_Node_ID, String trxName)
@ -50,6 +50,8 @@ public class X_AD_WF_Node extends PO implements I_AD_WF_Node, I_Persistent
setDuration (0);
setEntityType (null);
// @SQL=SELECT CASE WHEN '@P|AdempiereSys:N@'='Y' THEN 'D' ELSE get_sysconfig('DEFAULT_ENTITYTYPE','U',0,0) END FROM Dual
setIsAttachedDocumentToEmail (true);
// Y
setIsCentrallyMaintained (true);
// Y
setJoinElement (null);
@ -79,6 +81,8 @@ public class X_AD_WF_Node extends PO implements I_AD_WF_Node, I_Persistent
setDuration (0);
setEntityType (null);
// @SQL=SELECT CASE WHEN '@P|AdempiereSys:N@'='Y' THEN 'D' ELSE get_sysconfig('DEFAULT_ENTITYTYPE','U',0,0) END FROM Dual
setIsAttachedDocumentToEmail (true);
// Y
setIsCentrallyMaintained (true);
// Y
setJoinElement (null);
@ -815,6 +819,29 @@ public class X_AD_WF_Node extends PO implements I_AD_WF_Node, I_Persistent
return (String)get_Value(COLUMNNAME_Help);
}
/** Set Attached Document.
@param IsAttachedDocumentToEmail Attached document to Email
*/
public void setIsAttachedDocumentToEmail (boolean IsAttachedDocumentToEmail)
{
set_Value (COLUMNNAME_IsAttachedDocumentToEmail, Boolean.valueOf(IsAttachedDocumentToEmail));
}
/** Get Attached Document.
@return Attached document to Email
*/
public boolean isAttachedDocumentToEmail()
{
Object oo = get_Value(COLUMNNAME_IsAttachedDocumentToEmail);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Centrally maintained.
@param IsCentrallyMaintained Information maintained in System Element table
*/

View File

@ -16,7 +16,9 @@
*****************************************************************************/
package org.compiere.util;
import java.beans.Expression;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URL;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@ -1656,9 +1658,25 @@ public final class Env
* @param expression
* @param po
* @param trxName
* @param keepUnparseable
* @return String
*/
public static String parseVariable(String expression, PO po, String trxName, boolean keepUnparseable) {
return parseVariable(expression, po, trxName, false, false, keepUnparseable);
}
/**
* Parse expression, replaces global or PO properties @tag@ with actual value.
* @param expression
* @param po
* @param useColumnDateFormat
* @param useMsgForBoolean
* @param trxName
* @param keepUnparseable
* @return String
*/
public static String parseVariable(String expression, PO po, String trxName, boolean useColumnDateFormat,
boolean useMsgForBoolean, boolean keepUnparseable) {
if (expression == null || expression.length() == 0)
return "";
@ -1700,79 +1718,43 @@ public final class Env
if (token.startsWith("#") || token.startsWith("$")) {
//take from context
String v = Env.getContext(ctx, token);
if (v != null && v.length() > 0)
outStr.append(v);
else if (keepUnparseable) {
if (v != null && v.length() > 0) {
appendValue(ctx, po, trxName, useColumnDateFormat, useMsgForBoolean, token, format, null, v, outStr);
} else if (keepUnparseable) {
outStr.append("@").append(token);
if (!Util.isEmpty(format))
outStr.append("<").append(format).append(">");
outStr.append("@");
}
} else if (po != null && token.startsWith("=")) {
String property = token.substring(1);
char startChar = property.charAt(0);
if (startChar != Character.toUpperCase(startChar)) {
property = Character.toUpperCase(startChar) + property.substring(1);
}
String methodName = "get" + property;
Expression methodExpression = new Expression(po, methodName, null);
Object v = null;
try {
v = methodExpression.getValue();
if (v == null)
v = "";
appendValue(ctx, po, trxName, useColumnDateFormat, useMsgForBoolean, token, format, null, v, outStr);
} catch (Exception e) {
if (keepUnparseable) {
outStr.append("@").append(token);
if (!Util.isEmpty(format))
outStr.append("<").append(format).append(">");
outStr.append("@");
}
}
} else if (po != null) {
//take from po
if (po.get_ColumnIndex(token) >= 0) {
Object v = po.get_Value(token);
MColumn colToken = MColumn.get(ctx, po.get_TableName(), token);
String foreignTable = colToken.getReferenceTableName();
if (v != null) {
if (format != null && format.length() > 0) {
if (v instanceof Integer && (Integer) v >= 0 && (!Util.isEmpty(foreignTable) || token.equalsIgnoreCase(po.get_TableName()+"_ID"))){
int tblIndex = format.indexOf(".");
String tableName = null;
if (tblIndex > 0)
tableName = format.substring(0, tblIndex);
else
tableName = foreignTable;
MTable table = MTable.get(ctx, tableName);
String keyCol = tableName + "_ID";
boolean isSubTypeTable = false;
if (! Util.isEmpty(foreignTable) && ! tableName.equalsIgnoreCase(foreignTable)) {
// verify if is a subtype table
if ( table.getKeyColumns() != null
&& table.getKeyColumns().length == 1
&& table.getKeyColumns()[0].equals(foreignTable + "_ID")) {
isSubTypeTable = true;
keyCol = foreignTable + "_ID";
}
}
if (table != null && (isSubTypeTable || tableName.equalsIgnoreCase(foreignTable) || tableName.equalsIgnoreCase(po.get_TableName()))) {
String columnName = tblIndex > 0 ? format.substring(tblIndex + 1) : format;
MColumn column = table.getColumn(columnName);
if (column != null) {
if (column.isSecure()) {
outStr.append("********");
} else {
String value = DB.getSQLValueString(trxName,"SELECT " + columnName + " FROM " + tableName + " WHERE " + keyCol + "=?", (Integer)v);
if (value != null)
outStr.append(value);
}
}
}
} else if (v instanceof String && !Util.isEmpty((String) v) && !Util.isEmpty(foreignTable) && foreignTable.equals(MRefList.Table_Name) && !Util.isEmpty(format)) {
int refID = colToken.getAD_Reference_Value_ID();
if (format.equals("Name"))
outStr.append(MRefList.getListName(getCtx(), refID, (String) v));
else if (format.equals("Description"))
outStr.append(MRefList.getListDescription(getCtx(), DB.getSQLValueStringEx(null, "SELECT Name FROM AD_Reference WHERE AD_Reference_ID = ?", refID), (String) v));
} else if (v instanceof Date) {
SimpleDateFormat df = new SimpleDateFormat(format);
outStr.append(df.format((Date)v));
} else if (v instanceof Number) {
DecimalFormat df = new DecimalFormat(format);
outStr.append(df.format(((Number)v).doubleValue()));
} else {
MessageFormat mf = new MessageFormat(format);
outStr.append(mf.format(v));
}
} else {
if (colToken != null && colToken.isSecure()) {
v = "********";
} else if (colToken != null && colToken.getAD_Reference_ID() == DisplayType.YesNo && v instanceof Boolean) {
v = ((Boolean)v).booleanValue() ? "Y" : "N";
}
outStr.append(v.toString());
}
appendValue(ctx, po, trxName, useColumnDateFormat, useMsgForBoolean, token, format, colToken, v, outStr);
}
else if (!Util.isEmpty(defaultValue))
outStr.append(defaultValue);
@ -1799,6 +1781,92 @@ public final class Env
return outStr.toString();
}
private static void appendValue(Properties ctx, PO po, String trxName, boolean useColumnDateFormat, boolean useMsgForBoolean,
String token, String format, MColumn colToken, Object value, StringBuilder outStr) {
if (format != null && format.length() > 0) {
String foreignTable = colToken != null ? colToken.getReferenceTableName() : null;
if (value instanceof String && token.endsWith("_ID") && (token.startsWith("#") || token.startsWith("$"))) {
try {
int id = Integer.parseInt((String)value);
value = id;
foreignTable = token.substring(1);
foreignTable = foreignTable.substring(0, foreignTable.length()-3);
if (MTable.get(Env.getCtx(), foreignTable) == null)
foreignTable = null;
} catch (Exception ex) {}
}
if (value instanceof Integer && (Integer) value >= 0 && (!Util.isEmpty(foreignTable) || token.equalsIgnoreCase(po.get_TableName()+"_ID"))) {
int tblIndex = format.indexOf(".");
String tableName = null;
if (tblIndex > 0)
tableName = format.substring(0, tblIndex);
else
tableName = foreignTable;
MTable table = MTable.get(ctx, tableName);
String keyCol = tableName + "_ID";
boolean isSubTypeTable = false;
if (! Util.isEmpty(foreignTable) && ! tableName.equalsIgnoreCase(foreignTable)) {
// verify if is a subtype table
if ( table.getKeyColumns() != null
&& table.getKeyColumns().length == 1
&& table.getKeyColumns()[0].equals(foreignTable + "_ID")) {
isSubTypeTable = true;
keyCol = foreignTable + "_ID";
}
}
if (table != null && (isSubTypeTable || tableName.equalsIgnoreCase(foreignTable) || tableName.equalsIgnoreCase(po.get_TableName()))) {
String columnName = tblIndex > 0 ? format.substring(tblIndex + 1) : format;
MColumn column = table.getColumn(columnName);
if (column != null) {
if (column.isSecure()) {
outStr.append("********");
} else {
String strValue = DB.getSQLValueString(trxName,"SELECT " + columnName + " FROM " + tableName + " WHERE " + keyCol + "=?", (Integer)value);
if (strValue != null)
outStr.append(strValue);
}
}
}
} else if (value instanceof String && !Util.isEmpty((String) value) && !Util.isEmpty(foreignTable) && foreignTable.equals(MRefList.Table_Name) && !Util.isEmpty(format)) {
int refID = colToken.getAD_Reference_Value_ID();
if (format.equals("Name"))
outStr.append(MRefList.getListName(getCtx(), refID, (String) value));
else if (format.equals("Description"))
outStr.append(MRefList.getListDescription(getCtx(), DB.getSQLValueStringEx(null, "SELECT Name FROM AD_Reference WHERE AD_Reference_ID = ?", refID), (String) value));
} else if (value instanceof Date) {
SimpleDateFormat df = new SimpleDateFormat(format);
outStr.append(df.format((Date)value));
} else if (value instanceof Number) {
DecimalFormat df = new DecimalFormat(format);
outStr.append(df.format(((Number)value).doubleValue()));
} else {
MessageFormat mf = new MessageFormat(format);
outStr.append(mf.format(value));
}
} else {
if (colToken != null && colToken.isSecure()) {
value = "********";
} else if (colToken != null && colToken.getAD_Reference_ID() == DisplayType.YesNo && value instanceof Boolean) {
if (useMsgForBoolean) {
if (((Boolean)value).booleanValue())
value = Msg.getMsg(Env.getCtx(), "Yes");
else
value = Msg.getMsg(Env.getCtx(), "No");
} else {
value = ((Boolean)value).booleanValue() ? "Y" : "N";
}
} else if (colToken != null && DisplayType.isDate(colToken.getAD_Reference_ID()) && value instanceof Date && useColumnDateFormat) {
SimpleDateFormat sdf = DisplayType.getDateFormat(colToken.getAD_Reference_ID());
value = sdf.format (value);
} else if (value instanceof BigDecimal) {
int precision = MClient.get(Env.getCtx()).getAcctSchema().getStdPrecision();
value = ((BigDecimal)value).setScale(precision, RoundingMode.HALF_UP).toPlainString();
}
outStr.append(value.toString());
}
}
/*************************************************************************/
/**

View File

@ -1781,12 +1781,23 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
MMailText text = new MMailText (getCtx(), m_node.getR_MailText_ID(), null);
text.setPO(m_po, true);
//
String subject = doc.getDocumentInfo()
+ ": " + text.getMailHeader();
String message = text.getMailText(true)
+ "\n-----\n" + doc.getDocumentInfo()
+ "\n" + doc.getSummary();
File pdf = doc.createPDF();
String subject = null;
String raw = text.getMailHeader(false);
int first = raw != null ? raw.indexOf("@") : -1;
if (raw != null && first >= 0 && raw.indexOf("@", first) > first)
subject = text.getMailHeader();
else
subject = doc.getDocumentInfo() + ": " + text.getMailHeader();
String message = null;
raw = text.getMailText(true, false);
if (raw != null && (raw.contains("@=DocumentInfo") || raw.contains("@=documentInfo")
|| raw.contains("@=Summary") || raw.contains("@=summary")))
message = text.getMailText(true);
else
message = text.getMailText(true)
+ "\n-----\n" + doc.getDocumentInfo()
+ "\n" + doc.getSummary();
File pdf = doc != null && m_node.isAttachedDocumentToEmail() ? doc.createPDF() : null;
//
MClient client = MClient.get(doc.getCtx(), doc.getAD_Client_ID());

View File

@ -0,0 +1,106 @@
/***********************************************************************
* 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: *
* - hengsin *
**********************************************************************/
package org.idempiere.test.base;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.text.SimpleDateFormat;
import org.compiere.model.MBPartner;
import org.compiere.model.MClient;
import org.compiere.model.MOrder;
import org.compiere.model.MTable;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.idempiere.test.AbstractTestCase;
import org.junit.jupiter.api.Test;
/**
* @author hengsin
*
*/
public class EnvTest extends AbstractTestCase {
/**
* default constructor
*/
public EnvTest() {
// TODO Auto-generated constructor stub
}
@Test
public void testParseVariable() {
//test bean property, i.e order.getSummary()
MOrder order = new MOrder(Env.getCtx(), 100, getTrxName());
String summary = order.getSummary();
String expr = "@=Summary@";
String parsedText = Env.parseVariable(expr, order, getTrxName(), true, true, true);
assertEquals(summary, parsedText, "Unexpected parsed text for "+expr);
expr = "@=summary@";
parsedText = Env.parseVariable(expr, order, getTrxName(), true, true, true);
assertEquals(summary, parsedText, "Unexpected parsed text for "+expr);
//test po column access
String docNo = order.getDocumentNo();
expr = "@DocumentNo@";
parsedText = Env.parseVariable(expr, order, getTrxName(), true, true, true);
assertEquals(docNo, parsedText, "Unexpected parsed text for "+expr);
//test formatting of date
String dateOrdered = DisplayType.getDateFormat(MTable.get(MOrder.Table_ID).getColumn(MOrder.COLUMNNAME_DateOrdered).getAD_Reference_ID())
.format(order.getDateOrdered());
expr = "@DateOrdered@";
parsedText = Env.parseVariable(expr, order, getTrxName(), true, true, true);
assertEquals(dateOrdered, parsedText, "Unexpected parsed text for "+expr);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
dateOrdered = sdf.format(order.getDateOrdered());
expr = "@DateOrdered<"+sdf.toPattern()+">@";
parsedText = Env.parseVariable(expr, order, getTrxName(), true, true, true);
assertEquals(dateOrdered, parsedText, "Unexpected parsed text for "+expr);
//test foreign table access
String clientId = Env.getContext(Env.getCtx(), Env.AD_CLIENT_ID);
expr = "@#AD_Client_ID@";
parsedText = Env.parseVariable(expr, order, getTrxName(), true, true, true);
assertEquals(clientId, parsedText, "Unexpected parsed text for "+expr);
String clientName = MClient.get(getAD_Client_ID()).getName();
expr = "@#AD_Client_ID<Name>@";
parsedText = Env.parseVariable(expr, order, getTrxName(), true, true, true);
assertEquals(clientName, parsedText, "Unexpected parsed text for "+expr);
String bpartnerValue = MBPartner.get(Env.getCtx(), order.getC_BPartner_ID()).getValue();
expr = "@C_BPartner_ID<Value>@";
parsedText = Env.parseVariable(expr, order, getTrxName(), true, true, true);
assertEquals(bpartnerValue, parsedText, "Unexpected parsed text for "+expr);
//test list expression
String docStatusName = order.getDocStatusName();
expr = "@DocStatus<Name>@";
parsedText = Env.parseVariable(expr, order, getTrxName(), true, true, true);
assertEquals(docStatusName, parsedText, "Unexpected parsed text for "+expr);
}
}