IDEMPIERE-5567 Support of UUID as Key (FHCA-4195) - Toolbar (#1865)

* IDEMPIERE-5567 Support of UUID as Key (FHCA-4195) - Toolbar

- add support for AD_Attachment, CM_Chat, AD_PostIt and AD_LabelAssignment for UUID based tables

* - Better deprecated message
- Better deprecated management for constructors

* - Fix non unique exception on ad_changelog
- Fix to save changelog just ID on insert and not the UUID for ID based tables
This commit is contained in:
Carlos Ruiz 2023-05-31 04:39:10 +02:00 committed by GitHub
parent 7336dc967d
commit 013ba190fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 984 additions and 143 deletions

View File

@ -0,0 +1,296 @@
-- IDEMPIERE-5567 Support of UUID as Key (FHCA-4195)
SELECT register_migration_script('202305291332_IDEMPIERE-5567.sql') FROM dual;
SET SQLBLANKLINES ON
SET DEFINE OFF
-- May 29, 2023, 1:32:46 PM CEST
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_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (215842,1,'Record UUID',254,'Record_UU',36,'N','N','N','N','N',0,'N',200240,0,0,'Y',TO_TIMESTAMP('2023-05-29 13:32:46','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-29 13:32:46','YYYY-MM-DD HH24:MI:SS'),100,203804,'N','N','D','N','N','N','Y','82a502a9-7d34-4024-adce-7d4f6537d9e9','Y','N','N','M','N')
;
-- May 29, 2023, 1:33:09 PM CEST
ALTER TABLE AD_Attachment ADD Record_UU VARCHAR2(36 CHAR) DEFAULT NULL
;
-- May 29, 2023, 1:33:42 PM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,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 (207627,'Record UUID',173,215842,'Y',36,90,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-05-29 13:33:42','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-29 13:33:42','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','f61f312c-8b91-4000-8f06-8cf0eb394bfa','Y',110,2)
;
-- May 29, 2023, 1:34:28 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=50, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 13:34:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207627
;
-- May 29, 2023, 1:34:28 PM CEST
UPDATE AD_Field SET SeqNo=60,Updated=TO_TIMESTAMP('2023-05-29 13:34:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3819
;
-- May 29, 2023, 1:34:28 PM CEST
UPDATE AD_Field SET SeqNo=70,Updated=TO_TIMESTAMP('2023-05-29 13:34:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10074
;
-- May 29, 2023, 1:34:28 PM CEST
UPDATE AD_Field SET SeqNo=80,Updated=TO_TIMESTAMP('2023-05-29 13:34:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206604
;
-- May 29, 2023, 1:34:28 PM CEST
UPDATE AD_Field SET SeqNo=90,Updated=TO_TIMESTAMP('2023-05-29 13:34:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=961
;
-- May 29, 2023, 1:35:34 PM CEST
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2023-05-29 13:35:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2097
;
-- May 29, 2023, 1:35:36 PM CEST
ALTER TABLE AD_Attachment MODIFY Record_ID NUMBER(10) DEFAULT NULL
;
-- May 29, 2023, 1:35:36 PM CEST
ALTER TABLE AD_Attachment MODIFY Record_ID NULL
;
-- May 29, 2023, 1:36:50 PM CEST
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,IsKey) VALUES (0,0,201249,'38483bb0-dc89-4202-b098-e600bb71e448',TO_TIMESTAMP('2023-05-29 13:36:50','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','ad_attachment_record_uu',TO_TIMESTAMP('2023-05-29 13:36:50','YYYY-MM-DD HH24:MI:SS'),100,254,'N','N','N','N')
;
-- May 29, 2023, 1:36:58 PM CEST
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,201689,'caebdbe7-e600-49fa-82d6-fc9c952e3f07',TO_TIMESTAMP('2023-05-29 13:36:58','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-05-29 13:36:58','YYYY-MM-DD HH24:MI:SS'),100,215842,201249,10)
;
-- May 29, 2023, 1:37:02 PM CEST
CREATE INDEX ad_attachment_record_uu ON AD_Attachment (Record_UU)
;
-- May 29, 2023, 3:53:58 PM CEST
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_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,IsHtml,FKConstraintType) VALUES (215843,0,'Record UUID',876,'Record_UU',36,'N','N','N','N','N',0,'N',200240,0,0,'Y',TO_TIMESTAMP('2023-05-29 15:53:58','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-29 15:53:58','YYYY-MM-DD HH24:MI:SS'),100,203804,'N','N','D','N','N','N','Y','6ff5f5d7-73e0-40ad-b0fb-24c7fa905bed','Y','N','N','N','O')
;
-- May 29, 2023, 5:14:56 PM CEST
ALTER TABLE CM_Chat ADD Record_UU VARCHAR2(36 CHAR) DEFAULT NULL
;
-- May 29, 2023, 5:14:31 PM CEST
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,IsKey) VALUES (0,0,201250,'79030873-e8df-4b29-bb22-78f8cab89eab',TO_TIMESTAMP('2023-05-29 17:14:30','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','cm_chat_record_uu',TO_TIMESTAMP('2023-05-29 17:14:30','YYYY-MM-DD HH24:MI:SS'),100,876,'N','Y','N','N')
;
-- May 29, 2023, 5:14:36 PM CEST
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,201690,'e1dd3f51-921e-44bb-bada-1f047a4b1629',TO_TIMESTAMP('2023-05-29 17:14:36','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-05-29 17:14:36','YYYY-MM-DD HH24:MI:SS'),100,215843,201250,10)
;
-- May 29, 2023, 5:15:06 PM CEST
CREATE UNIQUE INDEX cm_chat_record_uu ON CM_Chat (Record_UU)
;
-- May 29, 2023, 3:54:59 PM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,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 (207628,'Record UUID',821,215843,'Y',36,100,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-05-29 15:54:59','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-29 15:54:59','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','d5e76de8-7b65-46c3-b168-192f78e30b29','Y',100,2)
;
-- May 29, 2023, 3:55:18 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 15:55:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207628
;
-- May 29, 2023, 3:55:18 PM CEST
UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2023-05-29 15:55:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204751
;
-- May 29, 2023, 3:56:02 PM CEST
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2023-05-29 15:56:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=15514
;
-- May 29, 2023, 3:56:04 PM CEST
ALTER TABLE CM_Chat MODIFY Record_ID NUMBER(10) DEFAULT NULL
;
-- May 29, 2023, 3:56:04 PM CEST
ALTER TABLE CM_Chat MODIFY Record_ID NULL
;
-- May 29, 2023, 5:23:31 PM CEST
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_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (215844,0,'Record UUID',200215,'Record_UU',36,'N','N','N','N','N',0,'N',200240,0,0,'Y',TO_TIMESTAMP('2023-05-29 17:23:31','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-29 17:23:31','YYYY-MM-DD HH24:MI:SS'),100,203804,'Y','N','D','Y','N','N','Y','a3fa71ca-eb2c-47eb-b388-d3da2a6989ee','Y',0,'N','N','M','N')
;
-- May 29, 2023, 5:23:33 PM CEST
ALTER TABLE AD_PostIt ADD Record_UU VARCHAR2(36 CHAR) DEFAULT NULL
;
-- May 29, 2023, 5:23:52 PM CEST
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,201251,'652cadb1-d5dc-4fa8-86d6-a8ff7718551c',TO_TIMESTAMP('2023-05-29 17:23:52','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','AD_PostIt_Record_UU',TO_TIMESTAMP('2023-05-29 17:23:52','YYYY-MM-DD HH24:MI:SS'),100,200215,'N','Y','N','N','N')
;
-- May 29, 2023, 5:23:58 PM CEST
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,201691,'797e1821-2972-47be-a881-bba8f3f993a6',TO_TIMESTAMP('2023-05-29 17:23:58','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-05-29 17:23:58','YYYY-MM-DD HH24:MI:SS'),100,215844,201251,10)
;
-- May 29, 2023, 5:24:01 PM CEST
CREATE UNIQUE INDEX AD_PostIt_Record_UU ON AD_PostIt (Record_UU)
;
-- May 29, 2023, 5:24:27 PM CEST
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 (207629,'AD_PostIt_UU',200220,212933,'N',36,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-05-29 17:24:26','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-29 17:24:26','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','514955cd-1967-403f-baf0-ef2f7ae05d37','N',2)
;
-- May 29, 2023, 5:24:27 PM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,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 (207630,'Record UUID',200220,215844,'Y',36,60,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-05-29 17:24:27','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-29 17:24:27','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','3f4dd6e1-1e7e-47a5-984e-a88c7f9ab349','Y',50,2)
;
-- May 29, 2023, 5:24:54 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=50, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 17:24:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207630
;
-- May 29, 2023, 5:24:54 PM CEST
UPDATE AD_Field SET SeqNo=60,Updated=TO_TIMESTAMP('2023-05-29 17:24:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204349
;
-- May 29, 2023, 5:24:54 PM CEST
UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2023-05-29 17:24:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207629
;
-- May 29, 2023, 5:26:00 PM CEST
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_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (215845,0,'Record UUID',200347,'Record_UU',36,'N','N','N','N','N',0,'N',200240,0,0,'Y',TO_TIMESTAMP('2023-05-29 17:25:59','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-29 17:25:59','YYYY-MM-DD HH24:MI:SS'),100,203804,'N','N','D','N','N','N','Y','8a9d216d-4e90-4c52-aa15-f8beefcb7d84','Y',0,'N','N','M','N')
;
-- May 29, 2023, 5:26:02 PM CEST
ALTER TABLE AD_LabelAssignment ADD Record_UU VARCHAR2(36 CHAR) DEFAULT NULL
;
-- May 29, 2023, 5:26:07 PM CEST
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2023-05-29 17:26:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=214903
;
-- May 29, 2023, 5:26:09 PM CEST
ALTER TABLE AD_LabelAssignment MODIFY Record_ID NUMBER(10) DEFAULT NULL
;
-- May 29, 2023, 5:26:09 PM CEST
ALTER TABLE AD_LabelAssignment MODIFY Record_ID NULL
;
-- May 29, 2023, 5:26:27 PM CEST
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,201252,'7e1b1e58-f2e6-4b2d-be6d-7fcbce5da426',TO_TIMESTAMP('2023-05-29 17:26:26','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','ad_labelassignment_record_uu',TO_TIMESTAMP('2023-05-29 17:26:26','YYYY-MM-DD HH24:MI:SS'),100,200347,'N','N','N','N','N')
;
-- May 29, 2023, 5:26:33 PM CEST
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,201692,'daba3554-2805-465b-afd5-0ad29fe9bd79',TO_TIMESTAMP('2023-05-29 17:26:32','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-05-29 17:26:32','YYYY-MM-DD HH24:MI:SS'),100,215845,201252,10)
;
-- May 29, 2023, 5:26:36 PM CEST
CREATE INDEX ad_labelassignment_record_uu ON AD_LabelAssignment (Record_UU)
;
-- May 29, 2023, 7:20:16 PM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,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 (207631,'Record UUID',200324,215845,'Y',36,80,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-05-29 19:20:16','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-29 19:20:16','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','989dacd0-f98d-410f-a43a-6eb5ff27bea0','Y',80,2)
;
-- May 29, 2023, 7:20:28 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=80, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 19:20:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207631
;
-- May 29, 2023, 7:30:02 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', DisplayLogic='@Record_UU@!''''', SeqNo=70, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 19:30:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207631
;
-- May 29, 2023, 7:30:02 PM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@=''''', SeqNo=80,Updated=TO_TIMESTAMP('2023-05-29 19:30:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207107
;
-- May 29, 2023, 7:33:52 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', DisplayLogic='@Record_UU@!''''', SeqNo=40, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 19:33:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207630
;
-- May 29, 2023, 7:33:52 PM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@=''''', SeqNo=50,Updated=TO_TIMESTAMP('2023-05-29 19:33:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204348
;
-- May 29, 2023, 7:35:06 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', DisplayLogic='@Record_UU@!''''', SeqNo=80, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 19:35:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207628
;
-- May 29, 2023, 7:35:06 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', DisplayLogic='@Record_UU@=''''', SeqNo=100, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 19:35:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13396
;
-- May 29, 2023, 7:35:49 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', DisplayLogic='@Record_UU@!''''', SeqNo=40, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 19:35:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207627
;
-- May 29, 2023, 7:35:49 PM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@=''''', SeqNo=50,Updated=TO_TIMESTAMP('2023-05-29 19:35:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=964
;
-- May 29, 2023, 7:37:52 PM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@=''''', SeqNo=90,Updated=TO_TIMESTAMP('2023-05-29 19:37:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6781
;
-- May 29, 2023, 7:37:52 PM CEST
UPDATE AD_Field SET SeqNo=100,Updated=TO_TIMESTAMP('2023-05-29 19:37:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6779
;
-- May 29, 2023, 7:37:52 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', DisplayLogic='@Record_UU@!''''', SeqNo=110, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 19:37:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207619
;
-- May 29, 2023, 7:38:12 PM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@=''''', SeqNo=90,Updated=TO_TIMESTAMP('2023-05-29 19:38:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6771
;
-- May 29, 2023, 7:38:12 PM CEST
UPDATE AD_Field SET SeqNo=100,Updated=TO_TIMESTAMP('2023-05-29 19:38:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6769
;
-- May 29, 2023, 7:38:12 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', DisplayLogic='@Record_UU@!''''', SeqNo=110, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 19:38:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207620
;
SET SERVEROUTPUT on;
-- Set Record_UU for existing records
DECLARE
cmd varchar2(2000);
v_cnt numeric;
BEGIN
FOR r IN (
SELECT DISTINCT t.TableName, at.AD_Table_ID
FROM AD_Attachment at JOIN AD_Table t ON (at.AD_Table_ID=t.AD_Table_ID)
WHERE at.Record_UU IS NULL AND at.Record_ID IS NOT NULL
) LOOP
cmd := 'UPDATE AD_Attachment SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|| ' WHERE ' || r.TableName || '_ID=AD_Attachment.Record_ID) WHERE AD_Table_ID=' || r.AD_Table_ID
|| ' AND Record_ID IS NOT NULL AND Record_UU IS NULL';
EXECUTE IMMEDIATE cmd;
DBMS_OUTPUT.PUT_LINE(SQL%ROWCOUNT || ' AD_Attachment.Record_UU set in ' || r.TableName);
END LOOP;
FOR r IN (
SELECT DISTINCT t.TableName, ch.AD_Table_ID
FROM CM_Chat ch JOIN AD_Table t ON (ch.AD_Table_ID=t.AD_Table_ID)
WHERE ch.Record_UU IS NULL AND ch.Record_ID IS NOT NULL
) LOOP
cmd := 'UPDATE CM_Chat SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|| ' WHERE ' || r.TableName || '_ID=CM_Chat.Record_ID) WHERE AD_Table_ID=' || r.AD_Table_ID
|| ' AND Record_ID IS NOT NULL AND Record_UU IS NULL';
EXECUTE IMMEDIATE cmd;
DBMS_OUTPUT.PUT_LINE(SQL%ROWCOUNT || ' CM_Chat.Record_UU set in ' || r.TableName);
END LOOP;
FOR r IN (
SELECT DISTINCT t.TableName, po.AD_Table_ID
FROM AD_PostIt po JOIN AD_Table t ON (po.AD_Table_ID=t.AD_Table_ID)
WHERE po.Record_UU IS NULL AND po.Record_ID IS NOT NULL
) LOOP
cmd := 'UPDATE AD_PostIt SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|| ' WHERE ' || r.TableName || '_ID=AD_PostIt.Record_ID) WHERE AD_Table_ID=' || r.AD_Table_ID
|| ' AND Record_ID IS NOT NULL AND Record_UU IS NULL';
EXECUTE IMMEDIATE cmd;
DBMS_OUTPUT.PUT_LINE(SQL%ROWCOUNT || ' AD_PostIt.Record_UU set in ' || r.TableName);
END LOOP;
FOR r IN (
SELECT DISTINCT t.TableName, la.AD_Table_ID
FROM AD_LabelAssignment la JOIN AD_Table t ON (la.AD_Table_ID=t.AD_Table_ID)
WHERE la.Record_UU IS NULL AND la.Record_ID IS NOT NULL
) LOOP
cmd := 'UPDATE AD_LabelAssignment SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|| ' WHERE ' || r.TableName || '_ID=AD_LabelAssignment.Record_ID) WHERE AD_Table_ID=' || r.AD_Table_ID
|| ' AND Record_ID IS NOT NULL AND Record_UU IS NULL';
EXECUTE IMMEDIATE cmd;
DBMS_OUTPUT.PUT_LINE(SQL%ROWCOUNT || ' AD_LabelAssignment.Record_UU set in ' || r.TableName);
END LOOP;
END;
/

View File

@ -0,0 +1,298 @@
-- IDEMPIERE-5567 Support of UUID as Key (FHCA-4195)
SELECT register_migration_script('202305291332_IDEMPIERE-5567.sql') FROM dual;
-- May 29, 2023, 1:32:46 PM CEST
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_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (215842,1,'Record UUID',254,'Record_UU',36,'N','N','N','N','N',0,'N',200240,0,0,'Y',TO_TIMESTAMP('2023-05-29 13:32:46','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-29 13:32:46','YYYY-MM-DD HH24:MI:SS'),100,203804,'N','N','D','N','N','N','Y','82a502a9-7d34-4024-adce-7d4f6537d9e9','Y','N','N','M','N')
;
-- May 29, 2023, 1:33:09 PM CEST
ALTER TABLE AD_Attachment ADD COLUMN Record_UU VARCHAR(36) DEFAULT NULL
;
-- May 29, 2023, 1:33:42 PM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,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 (207627,'Record UUID',173,215842,'Y',36,90,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-05-29 13:33:42','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-29 13:33:42','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','f61f312c-8b91-4000-8f06-8cf0eb394bfa','Y',110,2)
;
-- May 29, 2023, 1:34:28 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=50, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 13:34:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207627
;
-- May 29, 2023, 1:34:28 PM CEST
UPDATE AD_Field SET SeqNo=60,Updated=TO_TIMESTAMP('2023-05-29 13:34:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3819
;
-- May 29, 2023, 1:34:28 PM CEST
UPDATE AD_Field SET SeqNo=70,Updated=TO_TIMESTAMP('2023-05-29 13:34:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10074
;
-- May 29, 2023, 1:34:28 PM CEST
UPDATE AD_Field SET SeqNo=80,Updated=TO_TIMESTAMP('2023-05-29 13:34:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206604
;
-- May 29, 2023, 1:34:28 PM CEST
UPDATE AD_Field SET SeqNo=90,Updated=TO_TIMESTAMP('2023-05-29 13:34:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=961
;
-- May 29, 2023, 1:35:34 PM CEST
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2023-05-29 13:35:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2097
;
-- May 29, 2023, 1:35:36 PM CEST
INSERT INTO t_alter_column values('ad_attachment','Record_ID','NUMERIC(10)',null,'NULL')
;
-- May 29, 2023, 1:35:36 PM CEST
INSERT INTO t_alter_column values('ad_attachment','Record_ID',null,'NULL',null)
;
-- May 29, 2023, 1:36:50 PM CEST
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,IsKey) VALUES (0,0,201249,'38483bb0-dc89-4202-b098-e600bb71e448',TO_TIMESTAMP('2023-05-29 13:36:50','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','ad_attachment_record_uu',TO_TIMESTAMP('2023-05-29 13:36:50','YYYY-MM-DD HH24:MI:SS'),100,254,'N','N','N','N')
;
-- May 29, 2023, 1:36:58 PM CEST
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,201689,'caebdbe7-e600-49fa-82d6-fc9c952e3f07',TO_TIMESTAMP('2023-05-29 13:36:58','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-05-29 13:36:58','YYYY-MM-DD HH24:MI:SS'),100,215842,201249,10)
;
-- May 29, 2023, 1:37:02 PM CEST
CREATE INDEX ad_attachment_record_uu ON AD_Attachment (Record_UU)
;
-- May 29, 2023, 3:53:58 PM CEST
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_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,IsHtml,FKConstraintType) VALUES (215843,0,'Record UUID',876,'Record_UU',36,'N','N','N','N','N',0,'N',200240,0,0,'Y',TO_TIMESTAMP('2023-05-29 15:53:58','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-29 15:53:58','YYYY-MM-DD HH24:MI:SS'),100,203804,'N','N','D','N','N','N','Y','6ff5f5d7-73e0-40ad-b0fb-24c7fa905bed','Y','N','N','N','O')
;
-- May 29, 2023, 5:14:56 PM CEST
ALTER TABLE CM_Chat ADD COLUMN Record_UU VARCHAR(36) DEFAULT NULL
;
-- May 29, 2023, 5:14:31 PM CEST
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,IsKey) VALUES (0,0,201250,'79030873-e8df-4b29-bb22-78f8cab89eab',TO_TIMESTAMP('2023-05-29 17:14:30','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','cm_chat_record_uu',TO_TIMESTAMP('2023-05-29 17:14:30','YYYY-MM-DD HH24:MI:SS'),100,876,'N','Y','N','N')
;
-- May 29, 2023, 5:14:36 PM CEST
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,201690,'e1dd3f51-921e-44bb-bada-1f047a4b1629',TO_TIMESTAMP('2023-05-29 17:14:36','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-05-29 17:14:36','YYYY-MM-DD HH24:MI:SS'),100,215843,201250,10)
;
-- May 29, 2023, 5:15:06 PM CEST
CREATE UNIQUE INDEX cm_chat_record_uu ON CM_Chat (Record_UU)
;
-- May 29, 2023, 3:54:59 PM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,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 (207628,'Record UUID',821,215843,'Y',36,100,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-05-29 15:54:59','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-29 15:54:59','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','d5e76de8-7b65-46c3-b168-192f78e30b29','Y',100,2)
;
-- May 29, 2023, 3:55:18 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 15:55:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207628
;
-- May 29, 2023, 3:55:18 PM CEST
UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2023-05-29 15:55:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204751
;
-- May 29, 2023, 3:56:02 PM CEST
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2023-05-29 15:56:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=15514
;
-- May 29, 2023, 3:56:04 PM CEST
INSERT INTO t_alter_column values('cm_chat','Record_ID','NUMERIC(10)',null,'NULL')
;
-- May 29, 2023, 3:56:04 PM CEST
INSERT INTO t_alter_column values('cm_chat','Record_ID',null,'NULL',null)
;
-- May 29, 2023, 5:23:31 PM CEST
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_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (215844,0,'Record UUID',200215,'Record_UU',36,'N','N','N','N','N',0,'N',200240,0,0,'Y',TO_TIMESTAMP('2023-05-29 17:23:31','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-29 17:23:31','YYYY-MM-DD HH24:MI:SS'),100,203804,'Y','N','D','Y','N','N','Y','a3fa71ca-eb2c-47eb-b388-d3da2a6989ee','Y',0,'N','N','M','N')
;
-- May 29, 2023, 5:23:33 PM CEST
ALTER TABLE AD_PostIt ADD COLUMN Record_UU VARCHAR(36) DEFAULT NULL
;
-- May 29, 2023, 5:23:52 PM CEST
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,201251,'652cadb1-d5dc-4fa8-86d6-a8ff7718551c',TO_TIMESTAMP('2023-05-29 17:23:52','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','AD_PostIt_Record_UU',TO_TIMESTAMP('2023-05-29 17:23:52','YYYY-MM-DD HH24:MI:SS'),100,200215,'N','Y','N','N','N')
;
-- May 29, 2023, 5:23:58 PM CEST
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,201691,'797e1821-2972-47be-a881-bba8f3f993a6',TO_TIMESTAMP('2023-05-29 17:23:58','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-05-29 17:23:58','YYYY-MM-DD HH24:MI:SS'),100,215844,201251,10)
;
-- May 29, 2023, 5:24:01 PM CEST
CREATE UNIQUE INDEX AD_PostIt_Record_UU ON AD_PostIt (Record_UU)
;
-- May 29, 2023, 5:24:27 PM CEST
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 (207629,'AD_PostIt_UU',200220,212933,'N',36,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-05-29 17:24:26','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-29 17:24:26','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','514955cd-1967-403f-baf0-ef2f7ae05d37','N',2)
;
-- May 29, 2023, 5:24:27 PM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,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 (207630,'Record UUID',200220,215844,'Y',36,60,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-05-29 17:24:27','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-29 17:24:27','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','3f4dd6e1-1e7e-47a5-984e-a88c7f9ab349','Y',50,2)
;
-- May 29, 2023, 5:24:54 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=50, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 17:24:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207630
;
-- May 29, 2023, 5:24:54 PM CEST
UPDATE AD_Field SET SeqNo=60,Updated=TO_TIMESTAMP('2023-05-29 17:24:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204349
;
-- May 29, 2023, 5:24:54 PM CEST
UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2023-05-29 17:24:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207629
;
-- May 29, 2023, 5:26:00 PM CEST
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_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (215845,0,'Record UUID',200347,'Record_UU',36,'N','N','N','N','N',0,'N',200240,0,0,'Y',TO_TIMESTAMP('2023-05-29 17:25:59','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-29 17:25:59','YYYY-MM-DD HH24:MI:SS'),100,203804,'N','N','D','N','N','N','Y','8a9d216d-4e90-4c52-aa15-f8beefcb7d84','Y',0,'N','N','M','N')
;
-- May 29, 2023, 5:26:02 PM CEST
ALTER TABLE AD_LabelAssignment ADD COLUMN Record_UU VARCHAR(36) DEFAULT NULL
;
-- May 29, 2023, 5:26:07 PM CEST
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2023-05-29 17:26:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=214903
;
-- May 29, 2023, 5:26:09 PM CEST
INSERT INTO t_alter_column values('ad_labelassignment','Record_ID','NUMERIC(10)',null,'NULL')
;
-- May 29, 2023, 5:26:09 PM CEST
INSERT INTO t_alter_column values('ad_labelassignment','Record_ID',null,'NULL',null)
;
-- May 29, 2023, 5:26:27 PM CEST
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,201252,'7e1b1e58-f2e6-4b2d-be6d-7fcbce5da426',TO_TIMESTAMP('2023-05-29 17:26:26','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','ad_labelassignment_record_uu',TO_TIMESTAMP('2023-05-29 17:26:26','YYYY-MM-DD HH24:MI:SS'),100,200347,'N','N','N','N','N')
;
-- May 29, 2023, 5:26:33 PM CEST
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,201692,'daba3554-2805-465b-afd5-0ad29fe9bd79',TO_TIMESTAMP('2023-05-29 17:26:32','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-05-29 17:26:32','YYYY-MM-DD HH24:MI:SS'),100,215845,201252,10)
;
-- May 29, 2023, 5:26:36 PM CEST
CREATE INDEX ad_labelassignment_record_uu ON AD_LabelAssignment (Record_UU)
;
-- May 29, 2023, 7:20:16 PM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,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 (207631,'Record UUID',200324,215845,'Y',36,80,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-05-29 19:20:16','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-05-29 19:20:16','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','989dacd0-f98d-410f-a43a-6eb5ff27bea0','Y',80,2)
;
-- May 29, 2023, 7:20:28 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=80, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 19:20:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207631
;
-- May 29, 2023, 7:30:02 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', DisplayLogic='@Record_UU@!''''', SeqNo=70, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 19:30:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207631
;
-- May 29, 2023, 7:30:02 PM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@=''''', SeqNo=80,Updated=TO_TIMESTAMP('2023-05-29 19:30:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207107
;
-- May 29, 2023, 7:33:52 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', DisplayLogic='@Record_UU@!''''', SeqNo=40, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 19:33:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207630
;
-- May 29, 2023, 7:33:52 PM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@=''''', SeqNo=50,Updated=TO_TIMESTAMP('2023-05-29 19:33:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204348
;
-- May 29, 2023, 7:35:06 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', DisplayLogic='@Record_UU@!''''', SeqNo=80, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 19:35:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207628
;
-- May 29, 2023, 7:35:06 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', DisplayLogic='@Record_UU@=''''', SeqNo=100, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 19:35:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13396
;
-- May 29, 2023, 7:35:49 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', DisplayLogic='@Record_UU@!''''', SeqNo=40, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 19:35:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207627
;
-- May 29, 2023, 7:35:49 PM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@=''''', SeqNo=50,Updated=TO_TIMESTAMP('2023-05-29 19:35:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=964
;
-- May 29, 2023, 7:37:52 PM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@=''''', SeqNo=90,Updated=TO_TIMESTAMP('2023-05-29 19:37:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6781
;
-- May 29, 2023, 7:37:52 PM CEST
UPDATE AD_Field SET SeqNo=100,Updated=TO_TIMESTAMP('2023-05-29 19:37:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6779
;
-- May 29, 2023, 7:37:52 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', DisplayLogic='@Record_UU@!''''', SeqNo=110, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 19:37:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207619
;
-- May 29, 2023, 7:38:12 PM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@=''''', SeqNo=90,Updated=TO_TIMESTAMP('2023-05-29 19:38:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6771
;
-- May 29, 2023, 7:38:12 PM CEST
UPDATE AD_Field SET SeqNo=100,Updated=TO_TIMESTAMP('2023-05-29 19:38:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6769
;
-- May 29, 2023, 7:38:12 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', DisplayLogic='@Record_UU@!''''', SeqNo=110, XPosition=4,Updated=TO_TIMESTAMP('2023-05-29 19:38:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207620
;
-- Set Record_UU for existing records
DO $$
DECLARE
cmd varchar(2000);
r record;
v_cnt numeric;
BEGIN
FOR r IN
SELECT DISTINCT t.TableName, at.AD_Table_ID
FROM AD_Attachment at JOIN AD_Table t ON (at.AD_Table_ID=t.AD_Table_ID)
WHERE at.Record_UU IS NULL AND at.Record_ID IS NOT NULL
LOOP
cmd := 'UPDATE AD_Attachment SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|| ' WHERE ' || r.TableName || '_ID=AD_Attachment.Record_ID) WHERE AD_Table_ID=' || r.AD_Table_ID
|| ' AND Record_ID IS NOT NULL AND Record_UU IS NULL';
EXECUTE cmd;
GET DIAGNOSTICS v_cnt = ROW_COUNT;
RAISE NOTICE '% AD_Attachment.Record_UU set in %', v_cnt, r.TableName;
END LOOP;
FOR r IN
SELECT DISTINCT t.TableName, ch.AD_Table_ID
FROM CM_Chat ch JOIN AD_Table t ON (ch.AD_Table_ID=t.AD_Table_ID)
WHERE ch.Record_UU IS NULL AND ch.Record_ID IS NOT NULL
LOOP
cmd := 'UPDATE CM_Chat SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|| ' WHERE ' || r.TableName || '_ID=CM_Chat.Record_ID) WHERE AD_Table_ID=' || r.AD_Table_ID
|| ' AND Record_ID IS NOT NULL AND Record_UU IS NULL';
EXECUTE cmd;
GET DIAGNOSTICS v_cnt = ROW_COUNT;
RAISE NOTICE '% CM_Chat.Record_UU set in %', v_cnt, r.TableName;
END LOOP;
FOR r IN
SELECT DISTINCT t.TableName, po.AD_Table_ID
FROM AD_PostIt po JOIN AD_Table t ON (po.AD_Table_ID=t.AD_Table_ID)
WHERE po.Record_UU IS NULL AND po.Record_ID IS NOT NULL
LOOP
cmd := 'UPDATE AD_PostIt SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|| ' WHERE ' || r.TableName || '_ID=AD_PostIt.Record_ID) WHERE AD_Table_ID=' || r.AD_Table_ID
|| ' AND Record_ID IS NOT NULL AND Record_UU IS NULL';
EXECUTE cmd;
GET DIAGNOSTICS v_cnt = ROW_COUNT;
RAISE NOTICE '% AD_PostIt.Record_UU set in %', v_cnt, r.TableName;
END LOOP;
FOR r IN
SELECT DISTINCT t.TableName, la.AD_Table_ID
FROM AD_LabelAssignment la JOIN AD_Table t ON (la.AD_Table_ID=t.AD_Table_ID)
WHERE la.Record_UU IS NULL AND la.Record_ID IS NOT NULL
LOOP
cmd := 'UPDATE AD_LabelAssignment SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|| ' WHERE ' || r.TableName || '_ID=AD_LabelAssignment.Record_ID) WHERE AD_Table_ID=' || r.AD_Table_ID
|| ' AND Record_ID IS NOT NULL AND Record_UU IS NULL';
EXECUTE cmd;
GET DIAGNOSTICS v_cnt = ROW_COUNT;
RAISE NOTICE '% AD_LabelAssignment.Record_UU set in %', v_cnt, r.TableName;
END LOOP;
END;
$$
;

View File

@ -2104,7 +2104,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
*/
public boolean canHaveAttachment()
{
if (getKeyColumnName().endsWith("_ID"))
if (getKeyColumnName().endsWith("_ID") || getKeyColumnName().endsWith("_UU"))
return true;
return false;
} // canHaveAttachment
@ -2126,8 +2126,8 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
{
if (!canHaveAttachment())
return 0;
int recordID = m_mTable.getKeyID(m_currentRow);
return MAttachment.getID(m_vo.AD_Table_ID, recordID);
String recordUU = m_mTable.getKeyUUID(m_currentRow);
return MAttachment.getID(m_vo.AD_Table_ID, recordUU);
} // getAttachmentID
/**
@ -2147,8 +2147,8 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
{
if (!canHaveAttachment())
return 0;
int recordID = m_mTable.getKeyID(m_currentRow);
return MChat.getID(m_vo.AD_Table_ID, recordID);
String recordUU = m_mTable.getKeyUUID(m_currentRow);
return MChat.getID(m_vo.AD_Table_ID, recordUU);
} // getCM_ChatID
public boolean hasPostIt()
@ -2164,8 +2164,8 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
{
if (!canHaveAttachment())
return 0;
int recordID = m_mTable.getKeyID(m_currentRow);
return MPostIt.getID(m_vo.AD_Table_ID, recordID);
String recordUU = m_mTable.getKeyUUID(m_currentRow);
return MPostIt.getID(m_vo.AD_Table_ID, recordUU);
} // getAD_PostIt_ID
/**
@ -2176,8 +2176,8 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
{
if (!canHaveAttachment())
return false;
int recordID = m_mTable.getKeyID(m_currentRow);
return MLabelAssignment.hasAnyAssignment(m_vo.AD_Table_ID, recordID);
String recordUU = m_mTable.getKeyUUID(m_currentRow);
return MLabelAssignment.hasAnyAssignment(m_vo.AD_Table_ID, recordUU);
} // hasLabel
/**

View File

@ -1043,11 +1043,11 @@ public class GridTable extends AbstractTableModel
} // getKeyID
/**
* Get UUID or null of none
* Get Key UUID or null of none
* @param row row
* @return UUID or null
* @return ID or null
*/
public UUID getUUID (int row)
public String getKeyUUID (int row)
{
if (m_indexUUIDColumn != -1)
{
@ -1056,7 +1056,7 @@ public class GridTable extends AbstractTableModel
String ii = (String)getValueAt(row, m_indexUUIDColumn);
if (ii == null)
return null;
return UUID.fromString(ii);
return ii;
}
catch (Exception e)
{
@ -1064,6 +1064,19 @@ public class GridTable extends AbstractTableModel
}
}
return null;
} // getKeyUUID
/**
* Get UUID or null of none
* @param row row
* @return UUID or null
*/
public UUID getUUID (int row)
{
String keyUUID = getKeyUUID(row);
if (keyUUID != null)
return UUID.fromString(keyUUID);
return null;
} // getUUID
/**

View File

@ -165,6 +165,15 @@ public interface I_AD_Attachment
*/
public int getRecord_ID();
/** Column name Record_UU */
public static final String COLUMNNAME_Record_UU = "Record_UU";
/** Set Record UUID */
public void setRecord_UU (String Record_UU);
/** Get Record UUID */
public String getRecord_UU();
/** Column name TextMsg */
public static final String COLUMNNAME_TextMsg = "TextMsg";

View File

@ -165,6 +165,15 @@ public interface I_AD_LabelAssignment
*/
public int getRecord_ID();
/** Column name Record_UU */
public static final String COLUMNNAME_Record_UU = "Record_UU";
/** Set Record UUID */
public void setRecord_UU (String Record_UU);
/** Get Record UUID */
public String getRecord_UU();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";

View File

@ -137,6 +137,15 @@ public interface I_AD_PostIt
*/
public int getRecord_ID();
/** Column name Record_UU */
public static final String COLUMNNAME_Record_UU = "Record_UU";
/** Set Record UUID */
public void setRecord_UU (String Record_UU);
/** Get Record UUID */
public String getRecord_UU();
/** Column name Text */
public static final String COLUMNNAME_Text = "Text";

View File

@ -195,6 +195,15 @@ public interface I_CM_Chat
*/
public int getRecord_ID();
/** Column name Record_UU */
public static final String COLUMNNAME_Record_UU = "Record_UU";
/** Set Record UUID */
public void setRecord_UU (String Record_UU);
/** Get Record UUID */
public String getRecord_UU();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";

View File

@ -58,7 +58,7 @@ public class MAttachment extends X_AD_Attachment
/**
*
*/
private static final long serialVersionUID = -1685512419870004665L;
private static final long serialVersionUID = 1447398065894212273L;
/**
*
@ -126,13 +126,33 @@ public class MAttachment extends X_AD_Attachment
* @param AD_Table_ID table
* @param Record_ID record
* @param trxName transaction
* @deprecated Use {@link MAttachment#MAttachment(Properties, int, int, String, String)} instead
*/
public MAttachment(Properties ctx, int AD_Table_ID, int Record_ID, String trxName)
{
this (ctx, MAttachment.getID(AD_Table_ID, Record_ID) > 0 ? MAttachment.getID(AD_Table_ID, Record_ID) : 0, trxName);
this(ctx, AD_Table_ID, Record_ID, null, trxName);
if (Record_ID > 0) {
MTable table = MTable.get(AD_Table_ID);
PO po = table.getPO(Record_ID, trxName);
setRecord_UU(po.get_UUID());
}
}
/**
* New Constructor
* @param ctx context
* @param AD_Table_ID table
* @param Record_ID record
* @param Record_UU record UUID
* @param trxName transaction
*/
public MAttachment(Properties ctx, int AD_Table_ID, int Record_ID, String Record_UU, String trxName)
{
this (ctx, MAttachment.getID(AD_Table_ID, Record_UU) > 0 ? MAttachment.getID(AD_Table_ID, Record_UU) : 0, trxName);
if (get_ID() == 0) {
setAD_Table_ID (AD_Table_ID);
setRecord_ID (Record_ID);
setRecord_UU (Record_UU);
}
} // MAttachment
@ -659,6 +679,7 @@ public class MAttachment extends X_AD_Attachment
* @param Table_ID
* @param Record_ID
* @return AD_Attachment_ID
* @deprecated Use {@link MAttachment#getID(int, String)} instead
*/
public static int getID(int Table_ID, int Record_ID) {
String sql="SELECT AD_Attachment_ID FROM AD_Attachment WHERE AD_Table_ID=? AND Record_ID=?";
@ -666,6 +687,19 @@ public class MAttachment extends X_AD_Attachment
return attachid;
}
/**
* IDEMPIERE-530
* Get the attachment ID based on table_id and record_id
* @param Table_ID
* @param Record_UU record UUID
* @return AD_Attachment_ID
*/
public static int getID(int Table_ID, String Record_UU) {
String sql="SELECT AD_Attachment_ID FROM AD_Attachment WHERE AD_Table_ID=? AND Record_UU=?";
int attachid = DB.getSQLValue(null, sql, Table_ID, Record_UU);
return attachid;
}
public File saveAsZip() {
if (getEntryCount() < 1) {
return null;

View File

@ -16,21 +16,17 @@
*****************************************************************************/
package org.compiere.model;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import org.apache.ecs.xhtml.b;
import org.apache.ecs.xhtml.hr;
import org.apache.ecs.xhtml.p;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Util;
/**
@ -44,7 +40,7 @@ public class MChat extends X_CM_Chat
/**
*
*/
private static final long serialVersionUID = 9165439123618441913L;
private static final long serialVersionUID = -8255793171229953201L;
/**
* Get Chats Of Table - of client in context
@ -54,44 +50,17 @@ public class MChat extends X_CM_Chat
*/
public static MChat[] getOfTable (Properties ctx, int AD_Table_ID)
{
int AD_Client_ID = Env.getAD_Client_ID(ctx);
ArrayList<MChat> list = new ArrayList<MChat>();
//
String sql = "SELECT * FROM CM_Chat "
+ "WHERE AD_Client_ID=? AND AD_Table_ID=? ORDER BY Record_ID";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement (sql, null);
pstmt.setInt (1, AD_Client_ID);
pstmt.setInt (2, AD_Table_ID);
rs = pstmt.executeQuery ();
while (rs.next ())
{
list.add (new MChat (ctx, rs, null));
}
}
catch (Exception e)
{
s_log.log (Level.SEVERE, sql, e);
}
finally
{
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
List<MChat> list = new Query(ctx, Table_Name, "AD_Table_ID=?", null)
.setClient_ID()
.setParameters(AD_Table_ID)
.setOrderBy(COLUMNNAME_Record_ID)
.list();
//
MChat[] retValue = new MChat[list.size()];
list.toArray (retValue);
return retValue;
} // get
/** Logger */
private static CLogger s_log = CLogger.getCLogger (MChat.class);
/**
* UUID based Constructor
* @param ctx Context
@ -142,6 +111,25 @@ public class MChat extends X_CM_Chat
setDescription (Description);
} // MChat
/**
* Full Constructor
* @param ctx context
* @param AD_Table_ID table
* @param Record_ID record
* @param Record_UU record UUI
* @param Description description
* @param trxName transaction
*/
public MChat (Properties ctx, int AD_Table_ID, int Record_ID, String Record_UU,
String Description, String trxName)
{
this (ctx, 0, trxName);
setAD_Table_ID (AD_Table_ID);
setRecord_ID (Record_ID);
setRecord_UU (Record_UU);
setDescription (Description);
} // MChat
/**
* Load Constructor
* @param ctx context
@ -168,30 +156,10 @@ public class MChat extends X_CM_Chat
{
if (m_entries != null && !reload)
return m_entries;
ArrayList<MChatEntry> list = new ArrayList<MChatEntry>();
String sql = "SELECT * FROM CM_ChatEntry WHERE CM_Chat_ID=? ORDER BY Created";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement (sql, null);
pstmt.setInt (1, getCM_Chat_ID());
rs = pstmt.executeQuery ();
while (rs.next ())
{
list.add (new MChatEntry (getCtx(), rs, get_TrxName()));
}
}
catch (Exception e)
{
log.log (Level.SEVERE, sql, e);
}
finally
{
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
List<MChatEntry> list = new Query(getCtx(), MChatEntry.Table_Name, "CM_Chat_ID=?", null)
.setParameters(getCM_Chat_ID())
.setOrderBy(COLUMNNAME_Created)
.list();
//
m_entries = new MChatEntry[list.size ()];
list.toArray (m_entries);
@ -260,6 +228,7 @@ public class MChat extends X_CM_Chat
* @param Table_ID
* @param Record_ID
* @return CM_Chat_ID
* @deprecated Use {@link MChat#getID(int, String)} instead
*/
public static int getID(int Table_ID, int Record_ID) {
String sql="SELECT CM_Chat_ID FROM CM_Chat WHERE AD_Table_ID=? AND Record_ID=?";
@ -267,4 +236,16 @@ public class MChat extends X_CM_Chat
return chatID;
}
/**
* Get the chat ID based on table_id and record_id
* @param Table_ID
* @param Record_UU
* @return CM_Chat_ID
*/
public static int getID(int Table_ID, String Record_UU) {
String sql="SELECT CM_Chat_ID FROM CM_Chat WHERE AD_Table_ID=? AND Record_UU=?";
int chatID = DB.getSQLValueEx(null, sql, Table_ID, Record_UU);
return chatID;
}
} // MChat

View File

@ -35,9 +35,12 @@ import org.compiere.util.DB;
* Label Assignment Model
*/
public class MLabelAssignment extends X_AD_LabelAssignment {
private static final long serialVersionUID = -964945898771768568L;
/**
*
*/
private static final long serialVersionUID = 2245405505404999887L;
/**
/**
* UUID based Constructor
* @param ctx Context
* @param AD_LabelAssignment_UU UUID key
@ -72,6 +75,7 @@ public class MLabelAssignment extends X_AD_LabelAssignment {
* @param Table_ID
* @param Record_ID
* @return true if record has any label assigned
* @deprecated Use {@link MLabelAssignment#hasAnyAssignment(int, String)} instead
*/
public static boolean hasAnyAssignment(int Table_ID, int Record_ID) {
String sql="SELECT COUNT(*) FROM AD_LabelAssignment WHERE AD_Table_ID=? AND Record_ID=?";
@ -79,16 +83,43 @@ public class MLabelAssignment extends X_AD_LabelAssignment {
return counter > 0;
}
/**
* Check if record has any label assigned
* @param Table_ID
* @param Record_UU
* @return true if record has any label assigned
*/
public static boolean hasAnyAssignment(int Table_ID, String Record_UU) {
String sql="SELECT COUNT(*) FROM AD_LabelAssignment WHERE AD_Table_ID=? AND Record_UU=?";
int counter = DB.getSQLValueEx(null, sql, Table_ID, Record_UU);
return counter > 0;
}
/**
* Check if a label is assigned to a record
* @param AD_Label_ID
* @param Table_ID
* @param Record_ID
* @return true if label is assigned
* @deprecated Use {@link MLabelAssignment#hasLabelAssignment(int, int, String)} instead
*/
public static boolean hasLabelAssignment(int AD_Label_ID, int Table_ID, int Record_ID) {
String sql="SELECT COUNT(*) FROM AD_LabelAssignment WHERE AD_Label_ID = ? AND AD_Table_ID=? AND Record_ID=?";
int counter = DB.getSQLValueEx(null, sql, AD_Label_ID, Table_ID, Record_ID);
return counter > 0;
}
/**
* Check if a label is assigned to a record
* @param AD_Label_ID
* @param Table_ID
* @param Record_UU
* @return true if label is assigned
*/
public static boolean hasLabelAssignment(int AD_Label_ID, int Table_ID, String Record_UU) {
String sql="SELECT COUNT(*) FROM AD_LabelAssignment WHERE AD_Label_ID = ? AND AD_Table_ID=? AND Record_UU=?";
int counter = DB.getSQLValueEx(null, sql, AD_Label_ID, Table_ID, Record_UU);
return counter > 0;
}
}

View File

@ -31,9 +31,12 @@ import org.compiere.util.Msg;
*/
public class MPostIt extends X_AD_PostIt
{
private static final long serialVersionUID = -5053130533036069784L;
/**
*
*/
private static final long serialVersionUID = -1450160105051825278L;
/**
/**
* UUID based Constructor
* @param ctx Context
* @param AD_PostIt_UU UUID key
@ -68,6 +71,21 @@ public class MPostIt extends X_AD_PostIt
setRecord_ID (Record_ID);
} // MPostIt
/**
* Full Constructor
* @param ctx context
* @param AD_Table_ID table
* @param Record_ID record
* @param trxName transaction
*/
public MPostIt (Properties ctx, int AD_Table_ID, int Record_ID, String Record_UU, String trxName)
{
this (ctx, 0, trxName);
setAD_Table_ID (AD_Table_ID);
setRecord_ID (Record_ID);
setRecord_UU (Record_UU);
} // MPostIt
/**
* Load Constructor
* @param ctx context
@ -103,9 +121,27 @@ public class MPostIt extends X_AD_PostIt
return retValue;
} // getUpdatedString
/**
* @param Table_ID
* @param Record_ID
* @return
* @deprecated Use {@link MPostIt#getID(int, String)} instead
*/
public static int getID(int Table_ID, int Record_ID) {
String sql="SELECT AD_PostIt_ID FROM AD_PostIt WHERE AD_Table_ID=? AND Record_ID=?";
int postItID = DB.getSQLValueEx(null, sql, Table_ID, Record_ID);
return postItID;
}
/**
* @param Table_ID
* @param Record_UU
* @return
*/
public static int getID(int Table_ID, String Record_UU) {
String sql="SELECT AD_PostIt_ID FROM AD_PostIt WHERE AD_Table_ID=? AND Record_UU=?";
int postItID = DB.getSQLValueEx(null, sql, Table_ID, Record_UU);
return postItID;
}
} // MPostIt

View File

@ -3373,7 +3373,7 @@ public abstract class PO
set_ValueNoCheck(m_KeyColumns[0], m_IDs[0]);
}
if (!Env.isUseCentralizedId(p_info.getTableName()))
if (withValues && !Env.isUseCentralizedId(p_info.getTableName()))
{
int ki = p_info.getColumnIndex(m_KeyColumns[0]);
// Change Log - Only
@ -3386,7 +3386,8 @@ public abstract class PO
&& ( insertLog.equalsIgnoreCase("Y")
|| ( insertLog.equalsIgnoreCase("K")
&& ( p_info.getColumn(ki).IsKey
|| p_info.getColumn(ki).ColumnName.equals(PO.getUUIDColumnName(p_info.getTableName()))))))
|| ( !p_info.hasKeyColumn()
&& p_info.getColumn(ki).ColumnName.equals(PO.getUUIDColumnName(p_info.getTableName())))))))
{
int id = (m_IDs.length == 1 ? get_ID() : 0);
// change log on new
@ -3658,7 +3659,10 @@ public abstract class PO
&& !p_info.isVirtualColumn(i) // no virtual column
&& !"Password".equals(p_info.getColumnName(i))
&& (insertLog.equalsIgnoreCase("Y")
|| (insertLog.equalsIgnoreCase("K") && p_info.getColumn(i).IsKey))
|| (insertLog.equalsIgnoreCase("K")
&& ( p_info.getColumn(i).IsKey)
|| ( !p_info.hasKeyColumn()
&& p_info.getColumn(i).ColumnName.equals(PO.getUUIDColumnName(p_info.getTableName())))))
)
{
// change log on new
@ -4995,7 +4999,7 @@ public abstract class PO
{
getAttachment (false);
if (m_attachment == null)
m_attachment = new MAttachment (getCtx(), p_info.getAD_Table_ID(), get_ID(), null);
m_attachment = new MAttachment (getCtx(), p_info.getAD_Table_ID(), get_ID(), get_UUID(), null);
return m_attachment;
} // createAttachment

View File

@ -31,7 +31,7 @@ public class X_AD_Attachment extends PO implements I_AD_Attachment, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20230409L;
private static final long serialVersionUID = 20230529L;
/** Standard Constructor */
public X_AD_Attachment (Properties ctx, int AD_Attachment_ID, String trxName)
@ -41,7 +41,6 @@ public class X_AD_Attachment extends PO implements I_AD_Attachment, I_Persistent
{
setAD_Attachment_ID (0);
setAD_Table_ID (0);
setRecord_ID (0);
setTitle (null);
} */
}
@ -54,7 +53,6 @@ public class X_AD_Attachment extends PO implements I_AD_Attachment, I_Persistent
{
setAD_Attachment_ID (0);
setAD_Table_ID (0);
setRecord_ID (0);
setTitle (null);
} */
}
@ -67,7 +65,6 @@ public class X_AD_Attachment extends PO implements I_AD_Attachment, I_Persistent
{
setAD_Attachment_ID (0);
setAD_Table_ID (0);
setRecord_ID (0);
setTitle (null);
} */
}
@ -80,7 +77,6 @@ public class X_AD_Attachment extends PO implements I_AD_Attachment, I_Persistent
{
setAD_Attachment_ID (0);
setAD_Table_ID (0);
setRecord_ID (0);
setTitle (null);
} */
}
@ -243,6 +239,21 @@ public class X_AD_Attachment extends PO implements I_AD_Attachment, I_Persistent
return ii.intValue();
}
/** Set Record UUID.
@param Record_UU Record UUID
*/
public void setRecord_UU (String Record_UU)
{
set_ValueNoCheck (COLUMNNAME_Record_UU, Record_UU);
}
/** Get Record UUID.
@return Record UUID */
public String getRecord_UU()
{
return (String)get_Value(COLUMNNAME_Record_UU);
}
/** Set Text Message.
@param TextMsg Text Message
*/

View File

@ -30,7 +30,7 @@ public class X_AD_LabelAssignment extends PO implements I_AD_LabelAssignment, I_
/**
*
*/
private static final long serialVersionUID = 20230409L;
private static final long serialVersionUID = 20230529L;
/** Standard Constructor */
public X_AD_LabelAssignment (Properties ctx, int AD_LabelAssignment_ID, String trxName)
@ -40,7 +40,6 @@ public class X_AD_LabelAssignment extends PO implements I_AD_LabelAssignment, I_
{
setAD_Label_ID (0);
setAD_Table_ID (0);
setRecord_ID (0);
} */
}
@ -52,7 +51,6 @@ public class X_AD_LabelAssignment extends PO implements I_AD_LabelAssignment, I_
{
setAD_Label_ID (0);
setAD_Table_ID (0);
setRecord_ID (0);
} */
}
@ -64,7 +62,6 @@ public class X_AD_LabelAssignment extends PO implements I_AD_LabelAssignment, I_
{
setAD_Label_ID (0);
setAD_Table_ID (0);
setRecord_ID (0);
} */
}
@ -76,7 +73,6 @@ public class X_AD_LabelAssignment extends PO implements I_AD_LabelAssignment, I_
{
setAD_Label_ID (0);
setAD_Table_ID (0);
setRecord_ID (0);
} */
}
@ -237,4 +233,19 @@ public class X_AD_LabelAssignment extends PO implements I_AD_LabelAssignment, I_
return 0;
return ii.intValue();
}
/** Set Record UUID.
@param Record_UU Record UUID
*/
public void setRecord_UU (String Record_UU)
{
set_ValueNoCheck (COLUMNNAME_Record_UU, Record_UU);
}
/** Get Record UUID.
@return Record UUID */
public String getRecord_UU()
{
return (String)get_Value(COLUMNNAME_Record_UU);
}
}

View File

@ -30,7 +30,7 @@ public class X_AD_PostIt extends PO implements I_AD_PostIt, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20230409L;
private static final long serialVersionUID = 20230529L;
/** Standard Constructor */
public X_AD_PostIt (Properties ctx, int AD_PostIt_ID, String trxName)
@ -186,6 +186,21 @@ public class X_AD_PostIt extends PO implements I_AD_PostIt, I_Persistent
return ii.intValue();
}
/** Set Record UUID.
@param Record_UU Record UUID
*/
public void setRecord_UU (String Record_UU)
{
set_Value (COLUMNNAME_Record_UU, Record_UU);
}
/** Get Record UUID.
@return Record UUID */
public String getRecord_UU()
{
return (String)get_Value(COLUMNNAME_Record_UU);
}
/** Set Description.
@param Text Description
*/

View File

@ -31,7 +31,7 @@ public class X_CM_Chat extends PO implements I_CM_Chat, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20230409L;
private static final long serialVersionUID = 20230529L;
/** Standard Constructor */
public X_CM_Chat (Properties ctx, int CM_Chat_ID, String trxName)
@ -43,7 +43,6 @@ public class X_CM_Chat extends PO implements I_CM_Chat, I_Persistent
setCM_Chat_ID (0);
setConfidentialType (null);
setDescription (null);
setRecord_ID (0);
} */
}
@ -57,7 +56,6 @@ public class X_CM_Chat extends PO implements I_CM_Chat, I_Persistent
setCM_Chat_ID (0);
setConfidentialType (null);
setDescription (null);
setRecord_ID (0);
} */
}
@ -71,7 +69,6 @@ public class X_CM_Chat extends PO implements I_CM_Chat, I_Persistent
setCM_Chat_ID (0);
setConfidentialType (null);
setDescription (null);
setRecord_ID (0);
} */
}
@ -85,7 +82,6 @@ public class X_CM_Chat extends PO implements I_CM_Chat, I_Persistent
setCM_Chat_ID (0);
setConfidentialType (null);
setDescription (null);
setRecord_ID (0);
} */
}
@ -307,4 +303,19 @@ public class X_CM_Chat extends PO implements I_CM_Chat, I_Persistent
return 0;
return ii.intValue();
}
/** Set Record UUID.
@param Record_UU Record UUID
*/
public void setRecord_UU (String Record_UU)
{
set_ValueNoCheck (COLUMNNAME_Record_UU, Record_UU);
}
/** Get Record UUID.
@return Record UUID */
public String getRecord_UU()
{
return (String)get_Value(COLUMNNAME_Record_UU);
}
}

View File

@ -1163,7 +1163,7 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
note.setRecord(getAD_Table_ID(), getRecord_ID());
note.saveEx();
// Attachment
MAttachment attachment = new MAttachment (getCtx(), MNote.Table_ID, note.getAD_Note_ID(), get_TrxName());
MAttachment attachment = new MAttachment (getCtx(), MNote.Table_ID, note.getAD_Note_ID(), note.getAD_Note_UU(), get_TrxName());
attachment.addEntry(report);
attachment.setTextMsg(m_node.getName(true));
attachment.saveEx();

View File

@ -132,7 +132,7 @@ public class PipoDictionaryService implements IDictionaryService {
// Add the attachment to the packin for possible reprocessing
if (MSysConfig.getBooleanValue(MSysConfig.ATTACH_EMBEDDED_2PACK, true) || ! packIn.isSuccess()) {
// TODO: This sometimes fails with error No archive storage provider found - because the IAttachmentStore required is still not loaded
MAttachment attachment = new MAttachment (adPackageImp.getCtx(), X_AD_Package_Imp_Proc.Table_ID, adPackageImp.getAD_Package_Imp_Proc_ID(), null);
MAttachment attachment = new MAttachment (adPackageImp.getCtx(), X_AD_Package_Imp_Proc.Table_ID, adPackageImp.getAD_Package_Imp_Proc_ID(), adPackageImp.getAD_Package_Imp_Proc_UU(), null);
attachment.addEntry(packageFile);
attachment.save(); // ignoring exceptions
}

View File

@ -291,7 +291,7 @@ public class AlertProcessor extends AdempiereServer
note.saveEx();
if (attachments.size() > 0) {
// Attachment
MAttachment attachment = new MAttachment (getCtx(), MNote.Table_ID, note.getAD_Note_ID(), trx.getTrxName());
MAttachment attachment = new MAttachment (getCtx(), MNote.Table_ID, note.getAD_Note_ID(), note.getAD_Note_UU(), trx.getTrxName());
attachment.setClientOrg(alert.getAD_Client_ID(), alert.getAD_Org_ID());
for (File f : attachments) {
attachment.addEntry(f);

View File

@ -258,7 +258,7 @@ public class Scheduler extends AdempiereServer
note.saveEx();
String log = pi.getLogInfo(true);
if (log != null && log.trim().length() > 0) {
MAttachment attachment = new MAttachment (getCtx(), MNote.Table_ID, note.getAD_Note_ID(), null);
MAttachment attachment = new MAttachment (getCtx(), MNote.Table_ID, note.getAD_Note_ID(), note.getAD_Note_UU(), null);
attachment.setClientOrg(scheduler.getAD_Client_ID(), scheduler.getAD_Org_ID());
attachment.setTextMsg(schedulerName);
attachment.addEntry("ProcessLog.html", log.getBytes("UTF-8"));
@ -307,7 +307,7 @@ public class Scheduler extends AdempiereServer
MAttachment attachment = null;
if (fileList != null && !fileList.isEmpty()) {
// Attachment
attachment = new MAttachment (getCtx(), MNote.Table_ID, note.getAD_Note_ID(), null);
attachment = new MAttachment (getCtx(), MNote.Table_ID, note.getAD_Note_ID(), note.getAD_Note_UU(), null);
attachment.setClientOrg(scheduler.getAD_Client_ID(), scheduler.getAD_Org_ID());
attachment.setTextMsg(schedulerName);
for (File entry : fileList)
@ -317,7 +317,7 @@ public class Scheduler extends AdempiereServer
String log = pi.getLogInfo(true);
if (log != null && log.trim().length() > 0) {
if (attachment == null) {
attachment = new MAttachment (getCtx(), MNote.Table_ID, note.getAD_Note_ID(), null);
attachment = new MAttachment (getCtx(), MNote.Table_ID, note.getAD_Note_ID(), note.getAD_Note_UU(), null);
attachment.setClientOrg(scheduler.getAD_Client_ID(), scheduler.getAD_Org_ID());
attachment.setTextMsg(schedulerName);
}

View File

@ -1152,9 +1152,10 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
public void onAttachment()
{
int record_ID = adTabbox.getSelectedGridTab().getRecord_ID();
String recordUU = adTabbox.getSelectedGridTab().getRecord_UU();
if (logger.isLoggable(Level.INFO)) logger.info("Record_ID=" + record_ID);
if (record_ID == -1) // No Key
if (record_ID== -1 && Util.isEmpty(recordUU)) // No Key
{
return;
}
@ -1168,7 +1169,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
};
// Attachment va =
WAttachment win = new WAttachment ( curWindowNo, adTabbox.getSelectedGridTab().getAD_AttachmentID(),
adTabbox.getSelectedGridTab().getAD_Table_ID(), record_ID, null, listener);
adTabbox.getSelectedGridTab().getAD_Table_ID(), record_ID, recordUU, null, listener);
win.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
@ -1185,9 +1186,10 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
public void onChat()
{
int recordId = adTabbox.getSelectedGridTab().getRecord_ID();
if (logger.isLoggable(Level.INFO)) logger.info("Record_ID=" + recordId);
String recordUU = adTabbox.getSelectedGridTab().getRecord_UU();
if (logger.isLoggable(Level.INFO)) logger.info("Record_ID=" + recordId + ", Record_UU=" + recordUU);
if (recordId== -1) // No Key
if (recordId== -1 && Util.isEmpty(recordUU)) // No Key
{
return;
}
@ -1211,7 +1213,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
}
String description = infoName + ": " + infoDisplay;
WChat chat = new WChat(curWindowNo, adTabbox.getSelectedGridTab().getCM_ChatID(), adTabbox.getSelectedGridTab().getAD_Table_ID(), recordId, description, null);
WChat chat = new WChat(curWindowNo, adTabbox.getSelectedGridTab().getCM_ChatID(), adTabbox.getSelectedGridTab().getAD_Table_ID(),
recordId, recordUU, description, null);
chat.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
@ -1232,7 +1235,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
public void onPostIt()
{
int recordId = adTabbox.getSelectedGridTab().getRecord_ID();
if (recordId== -1) // No Key
String recordUU = adTabbox.getSelectedGridTab().getRecord_UU();
if (recordId== -1 && Util.isEmpty(recordUU)) // No Key
{
return;
}
@ -1253,7 +1257,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
}
String header = infoName + ": " + infoDisplay;
WPostIt postit = new WPostIt(header, adTabbox.getSelectedGridTab().getAD_PostIt_ID(), adTabbox.getSelectedGridTab().getAD_Table_ID(), recordId, null);
WPostIt postit = new WPostIt(header, adTabbox.getSelectedGridTab().getAD_PostIt_ID(), adTabbox.getSelectedGridTab().getAD_Table_ID(), recordId, recordUU, null);
postit.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
@ -2057,7 +2061,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
{
canHaveAttachment = false;
}
if (canHaveAttachment && adTabbox.getSelectedGridTab().getRecord_ID() == -1) // No Key
if (canHaveAttachment && adTabbox.getSelectedGridTab().getRecord_ID() == -1 && Util.isEmpty(adTabbox.getSelectedGridTab().getRecord_UU())) // No Key
{
canHaveAttachment = false;
}
@ -2078,7 +2082,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
{
canHaveChat = false;
}
if (canHaveChat && adTabbox.getSelectedGridTab().getRecord_ID() == -1) // No Key
if (canHaveChat && adTabbox.getSelectedGridTab().getRecord_ID() == -1 && Util.isEmpty(adTabbox.getSelectedGridTab().getRecord_UU())) // No Key
{
canHaveChat = false;
}

View File

@ -74,7 +74,7 @@ public class LabelsSearchController implements EventListener<Event>{
private ListModelList<LabelItem> model;
/** main layout **/
private Vlayout layout;
/** label window panel, provider for AD_Table_ID and Record_ID **/
/** label window panel, provider for AD_Table_ID and Record_UU **/
private LabelsPanel labelsPanel;
/**
@ -248,12 +248,13 @@ public class LabelsSearchController implements EventListener<Event>{
// Assign
if (!MLabelAssignment.hasLabelAssignment(label.get_ID(),
labelsPanel.getAD_Table_ID(),
labelsPanel.getRecord_ID())) {
labelsPanel.getRecord_UU())) {
MLabelAssignment assign = new MLabelAssignment(Env.getCtx(), 0, null);
assign.setAD_Org_ID(label.getAD_Org_ID());
assign.setAD_Label_ID(label.get_ID());
assign.setAD_Table_ID(labelsPanel.getAD_Table_ID());
assign.setRecord_ID(labelsPanel.getRecord_ID());
assign.setRecord_UU(labelsPanel.getRecord_UU());
assign.saveEx();
}

View File

@ -35,6 +35,8 @@ import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ZkCssHelper;
import org.compiere.model.MLabel;
import org.compiere.model.MLabelAssignment;
import org.compiere.model.MTable;
import org.compiere.model.PO;
import org.compiere.model.Query;
import org.compiere.util.Env;
import org.zkoss.zk.ui.Component;
@ -45,21 +47,45 @@ import org.zkoss.zul.Div;
import org.zkoss.zul.Groupbox;
public class LabelsPanel extends Div implements EventListener<Event> {
private static final long serialVersionUID = 2232899183255702050L;
/**
*
*/
private static final long serialVersionUID = 8776043844483214400L;
private AbstractADWindowContent abstractADWindowContent;
private int AD_Table_ID;
private int Record_ID;
private String Record_UU;
/**
* Standard constructor
* @param abstractADWindowContent
* @param AD_Table_ID
* @param Record_ID
* @deprecated Use {@link LabelsPanel#LabelsPanel(AbstractADWindowContent, int, int, String)} instead
*/
@Deprecated
public LabelsPanel(AbstractADWindowContent abstractADWindowContent, int AD_Table_ID, int Record_ID) {
this(abstractADWindowContent, AD_Table_ID, Record_ID, null);
if (Record_ID > 0) {
MTable table = MTable.get(AD_Table_ID);
PO po = table.getPO(Record_ID, null);
this.Record_UU = po.get_UUID();
}
}
/**
* Standard constructor
* @param abstractADWindowContent
* @param AD_Table_ID
* @param Record_ID
* @param Record_UU
*/
public LabelsPanel(AbstractADWindowContent abstractADWindowContent, int AD_Table_ID, int Record_ID, String Record_UU) {
this.abstractADWindowContent = abstractADWindowContent;
this.AD_Table_ID = AD_Table_ID;
this.Record_ID = Record_ID;
this.Record_UU = Record_UU;
setStyle("padding:0px 5px;");
addEventListener(LabelsSearchController.ON_POST_SELECT_LABELITEM_EVENT, this);
update();
@ -81,6 +107,14 @@ public class LabelsPanel extends Div implements EventListener<Event> {
return Record_ID;
}
/**
* Get current record uuid
* @return
*/
public String getRecord_UU() {
return Record_UU;
}
@Override
public void onEvent(Event event) throws Exception {
if (event.getName().equals(LabelsSearchController.ON_POST_SELECT_LABELITEM_EVENT)) {
@ -98,8 +132,8 @@ public class LabelsPanel extends Div implements EventListener<Event> {
// Query
List<MLabelAssignment> assignmentsList = new Query(Env.getCtx(),
MLabelAssignment.Table_Name, "AD_Table_ID=? AND Record_ID=?", null)
.setParameters(AD_Table_ID, Record_ID)
MLabelAssignment.Table_Name, "AD_Table_ID=? AND Record_UU=?", null)
.setParameters(AD_Table_ID, Record_UU)
.setOrderBy(MLabelAssignment.COLUMNNAME_Created)
.list();

View File

@ -94,7 +94,7 @@ public class WAttachment extends Window implements EventListener<Event>
/**
*
*/
private static final long serialVersionUID = -710884973406502168L;
private static final long serialVersionUID = -8534334828539841412L;
private static final CLogger log = CLogger.getCLogger(WAttachment.class);
@ -170,10 +170,11 @@ public class WAttachment extends Window implements EventListener<Event>
* @param Record_ID record key
* @param trxName transaction
*/
@Deprecated
public WAttachment( int WindowNo, int AD_Attachment_ID,
int AD_Table_ID, int Record_ID, String trxName)
{
this(WindowNo, AD_Attachment_ID, AD_Table_ID, Record_ID, trxName, (EventListener<Event>)null);
this(WindowNo, AD_Attachment_ID, AD_Table_ID, Record_ID, null, trxName, (EventListener<Event>)null);
}
/**
@ -186,13 +187,31 @@ public class WAttachment extends Window implements EventListener<Event>
* @param trxName transaction
* @param eventListener
*/
@Deprecated
public WAttachment( int WindowNo, int AD_Attachment_ID,
int AD_Table_ID, int Record_ID, String trxName, EventListener<Event> eventListener)
int AD_Table_ID, int Record_ID, String trxName, EventListener<Event> eventListener)
{
this(WindowNo, AD_Attachment_ID, AD_Table_ID, Record_ID, null, trxName, eventListener);
}
/**
* Constructor.
* loads Attachment, if ID &lt;&gt; 0
* @param WindowNo window no
* @param AD_Attachment_ID attachment
* @param AD_Table_ID table
* @param Record_ID record key
* @param Record_UU record UUID
* @param trxName transaction
* @param eventListener
*/
public WAttachment( int WindowNo, int AD_Attachment_ID,
int AD_Table_ID, int Record_ID, String Record_UU, String trxName, EventListener<Event> eventListener)
{
super();
maxPreviewSize = MSysConfig.getIntValue(MSysConfig.ZK_MAX_ATTACHMENT_PREVIEW_SIZE, 1048576, Env.getAD_Client_ID(Env.getCtx()));
if (log.isLoggable(Level.CONFIG)) log.config("ID=" + AD_Attachment_ID + ", Table=" + AD_Table_ID + ", Record=" + Record_ID);
if (log.isLoggable(Level.CONFIG)) log.config("ID=" + AD_Attachment_ID + ", Table=" + AD_Table_ID + ", Record=" + Record_ID + ", RecordUU=" + Record_UU);
m_WindowNo = WindowNo;
this.addEventListener(DialogEvents.ON_WINDOW_CLOSE, this);
@ -215,7 +234,7 @@ public class WAttachment extends Window implements EventListener<Event>
if (AD_Attachment_ID > 0)
m_attachment = new MAttachment (Env.getCtx(), AD_Attachment_ID, trxName);
else
m_attachment = new MAttachment (Env.getCtx(), AD_Table_ID, Record_ID, trxName);
m_attachment = new MAttachment (Env.getCtx(), AD_Table_ID, Record_ID, Record_UU, trxName);
loadAttachments();

View File

@ -50,7 +50,8 @@ public class LabelAction {
this.panel = panel;
int AD_Table_ID = panel.getActiveGridTab().getAD_Table_ID();
int Record_ID = panel.getActiveGridTab().getRecord_ID();
labelsPanel = new LabelsPanel(panel, AD_Table_ID, Record_ID);
String Record_UU = panel.getActiveGridTab().getRecord_UU();
labelsPanel = new LabelsPanel(panel, AD_Table_ID, Record_ID, Record_UU);
}
/**

View File

@ -66,7 +66,7 @@ public class WChat extends Window implements EventListener<Event>, DialogEvents
/**
*
*/
private static final long serialVersionUID = -5265835393257520762L;
private static final long serialVersionUID = 8839053486411714175L;
private static final String USER_LABEL_STYLE = "font-weight: bold";
private static final String TIME_LABEL_STYLE = "font-size:xx-small;color:gray;margin-left:20px";
@ -78,11 +78,12 @@ public class WChat extends Window implements EventListener<Event>, DialogEvents
* @param CM_Chat_ID chat
* @param AD_Table_ID table
* @param Record_ID record key
* @param Record_UU record UUID
* @param Description description
* @param trxName transaction
*/
public WChat (int WindowNo, int CM_Chat_ID,
int AD_Table_ID, int Record_ID, String Description,
int AD_Table_ID, int Record_ID, String Record_UU, String Description,
String trxName)
{
super();
@ -104,7 +105,7 @@ public class WChat extends Window implements EventListener<Event>, DialogEvents
if (CM_Chat_ID > 0)
m_chat = new MChat (Env.getCtx(), CM_Chat_ID, trxName);
else
m_chat = new MChat (Env.getCtx(), AD_Table_ID, Record_ID, Description, trxName);
m_chat = new MChat (Env.getCtx(), AD_Table_ID, Record_ID, Record_UU, Description, trxName);
loadChat();
//
} // Attachment

View File

@ -41,8 +41,11 @@ import org.zkoss.zul.Separator;
*
*/
public class WPostIt extends Window implements EventListener<Event>{
/**
*
*/
private static final long serialVersionUID = -9092535255629718710L;
private static final long serialVersionUID = -3852236029054284848L;
private boolean editable;
private int maxSize;
private String note;
@ -61,9 +64,10 @@ public class WPostIt extends Window implements EventListener<Event>{
* @param postItID
* @param tableID
* @param recordID
* @param recordUU record UUID
* @param trxName
*/
public WPostIt(String title, int postItID, int tableID, int recordID, /*String created, String updated,*/ String trxName) {
public WPostIt(String title, int postItID, int tableID, int recordID, String recordUU, String trxName) {
super();
setTitle(title);
this.editable = true;
@ -72,7 +76,7 @@ public class WPostIt extends Window implements EventListener<Event>{
if (postItID > 0)
m_postIt = new MPostIt (Env.getCtx(), postItID, trxName);
else
m_postIt = new MPostIt (Env.getCtx(), tableID, recordID, trxName);
m_postIt = new MPostIt (Env.getCtx(), tableID, recordID, recordUU, trxName);
String created = null;
if (m_postIt.getAD_PostIt_ID() > 0)