IDEMPIERE-5567 Support of UUID as Key (FHCA-4195) - Implement support for Requests on UUID Based Tables (#1910)

* IDEMPIERE-5567 Support of UUID as Key (FHCA-4195) - Implement support for Requests on UUID Based Tables

* - minor typo

* - improve javadoc
This commit is contained in:
Carlos Ruiz 2023-07-08 06:09:56 +02:00 committed by GitHub
parent fce4d5cf9c
commit b7c089fc1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 562 additions and 53 deletions

View File

@ -0,0 +1,215 @@
-- IDEMPIERE-5567 Support of UUID as Key (FHCA-4195) Request
SELECT register_migration_script('202306241143_IDEMPIERE-5567-Request.sql') FROM dual;
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Jun 24, 2023, 11:43:21 AM 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 (215854,1,'Record UUID',417,'Record_UU',36,'N','N','N','N','N',0,'N',200240,0,0,'Y',TO_TIMESTAMP('2023-06-24 11:43:21','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-06-24 11:43:21','YYYY-MM-DD HH24:MI:SS'),100,203804,'N','N','D','Y','N','N','Y','bc1cf1fc-c939-40ec-812f-616fbe68189e','Y','N','N','O','N')
;
-- Jun 24, 2023, 11:43:24 AM CEST
ALTER TABLE R_Request ADD Record_UU VARCHAR2(36 CHAR) DEFAULT NULL
;
-- Jun 24, 2023, 11:46:05 AM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Table_ID@!0',Updated=TO_TIMESTAMP('2023-06-24 11:46:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11179
;
-- Jun 24, 2023, 11:46:22 AM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (207655,'Change Request','BOM (Engineering) Change Request','Change requests for a Bill of Materials. They can be automatically created from Requests, if enabled in the Request Type and the Request Group refers to a Bill of Materials',402,13952,'Y',10,570,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-06-24 11:46:21','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-06-24 11:46:21','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','6ed163da-2362-47dd-ab2c-00336bc392b5','Y',570,2)
;
-- Jun 24, 2023, 11:46:22 AM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (207656,'Quantity Plan','Planned Quantity','Planned Quantity',402,14727,'Y',22,580,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-06-24 11:46:22','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-06-24 11:46:22','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','ec6b1107-4581-45a0-8d93-75d47fdf4af3','Y',580,2)
;
-- Jun 24, 2023, 11:46:23 AM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,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 (207657,'Fixed in','Fixed in Change Notice',402,14981,'Y',10,590,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-06-24 11:46:22','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-06-24 11:46:22','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','8de7366d-03fa-424c-9b0e-91e5a07893ce','Y',590,2)
;
-- Jun 24, 2023, 11:46:23 AM 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 (207658,'Record UUID',402,215854,'Y',36,600,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-06-24 11:46:23','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-06-24 11:46:23','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','79804c32-87c3-434c-985d-85350f6d902a','Y',600,2)
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET IsDisplayed='Y', DisplayLogic='@Record_UU@=''''', SeqNo=470, IsReadOnly='Y', XPosition=4,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207658
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=480, XPosition=4,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11179
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET SeqNo=490,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5176
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET SeqNo=500,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10906
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET SeqNo=510,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5180
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET SeqNo=520,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5842
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET SeqNo=530,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5841
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET SeqNo=540,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5844
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET SeqNo=550,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5843
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET SeqNo=560,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5184
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET SeqNo=570,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11450
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET IsDisplayed='N', SeqNo=0, XPosition=1,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207655
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET IsDisplayed='N', SeqNo=0, XPosition=1,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207657
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET IsDisplayed='N', SeqNo=0, XPosition=1,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207656
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205036
;
-- Jun 24, 2023, 11:49:25 AM 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 (207659,'Record UUID',344,215854,'Y',36,600,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-06-24 11:49:25','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-06-24 11:49:25','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','dc2ce699-ed8c-47de-ae7a-3559af264c73','Y',590,2)
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET IsDisplayed='Y', DisplayLogic='@Record_UU@!''''', SeqNo=490, IsReadOnly='Y', XPosition=4,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207659
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@=''''', SeqNo=500,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11177
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=510,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4292
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=520,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10905
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=530,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4298
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=540,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5846
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=550,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5845
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=560,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5848
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=570,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5847
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=580,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12748
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=590,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11414
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=600,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4303
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205035
;
-- Jun 24, 2023, 11:57:32 AM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@='''' & @AD_Table_ID@!0', SeqNo=470,Updated=TO_TIMESTAMP('2023-06-24 11:57:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207658
;
-- Jun 24, 2023, 11:57:32 AM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@='''' & @AD_Table_ID@!0', SeqNo=480,Updated=TO_TIMESTAMP('2023-06-24 11:57:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11179
;
-- Jun 24, 2023, 11:57:58 AM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@!'''' & @AD_Table_ID@!0', SeqNo=490,Updated=TO_TIMESTAMP('2023-06-24 11:57:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207659
;
-- Jun 24, 2023, 11:57:58 AM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@='''' & @AD_Table_ID@!0', SeqNo=500,Updated=TO_TIMESTAMP('2023-06-24 11:57:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11177
;
-- Jun 24, 2023, 12:02:54 PM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@!'''' & @AD_Table_ID@!0',Updated=TO_TIMESTAMP('2023-06-24 12:02:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207658
;
-- Jun 24, 2023, 12:10:06 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,201255,'5a052f32-d102-4397-a44b-4684d89cd0eb',TO_TIMESTAMP('2023-06-24 12:10:06','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','r_request_table_recorduu_idx',TO_TIMESTAMP('2023-06-24 12:10:06','YYYY-MM-DD HH24:MI:SS'),100,417,'N','N','N','N','N')
;
-- Jun 24, 2023, 12:10:29 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,201696,'eec90d65-d247-40e2-84b4-bce888dbee11',TO_TIMESTAMP('2023-06-24 12:10:29','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-06-24 12:10:29','YYYY-MM-DD HH24:MI:SS'),100,13078,201255,10)
;
-- Jun 24, 2023, 12:10:35 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,201697,'c2f68e3d-8183-46cc-a896-bbae326aafbb',TO_TIMESTAMP('2023-06-24 12:10:34','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-06-24 12:10:34','YYYY-MM-DD HH24:MI:SS'),100,215854,201255,20)
;
-- Jun 24, 2023, 12:10:43 PM CEST
CREATE INDEX r_request_table_recorduu_idx ON R_Request (AD_Table_ID,Record_UU)
;
SET SERVEROUTPUT on;
-- Set Record_UU for existing records
DECLARE
cmd varchar2(2000);
v_cnt numeric;
BEGIN
FOR r IN (
SELECT DISTINCT t.TableName, a.AD_Table_ID
FROM R_Request a
JOIN AD_Table t ON (a.AD_Table_ID=t.AD_Table_ID)
WHERE a.Record_UU IS NULL
AND a.Record_ID > 0
) LOOP
cmd := 'UPDATE R_Request SET Record_UU=(SELECT '
|| r.TableName
|| '_UU FROM '
|| r.TableName
|| ' WHERE '
|| r.TableName
|| '_ID=R_Request.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 || ' R_Request.Record_UU set in ' || r.TableName);
END LOOP;
END;
/

View File

@ -0,0 +1,214 @@
-- IDEMPIERE-5567 Support of UUID as Key (FHCA-4195) Request
SELECT register_migration_script('202306241143_IDEMPIERE-5567-Request.sql') FROM dual;
-- Jun 24, 2023, 11:43:21 AM 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 (215854,1,'Record UUID',417,'Record_UU',36,'N','N','N','N','N',0,'N',200240,0,0,'Y',TO_TIMESTAMP('2023-06-24 11:43:21','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-06-24 11:43:21','YYYY-MM-DD HH24:MI:SS'),100,203804,'N','N','D','Y','N','N','Y','bc1cf1fc-c939-40ec-812f-616fbe68189e','Y','N','N','O','N')
;
-- Jun 24, 2023, 11:43:24 AM CEST
ALTER TABLE R_Request ADD COLUMN Record_UU VARCHAR(36) DEFAULT NULL
;
-- Jun 24, 2023, 11:46:05 AM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Table_ID@!0',Updated=TO_TIMESTAMP('2023-06-24 11:46:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11179
;
-- Jun 24, 2023, 11:46:22 AM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (207655,'Change Request','BOM (Engineering) Change Request','Change requests for a Bill of Materials. They can be automatically created from Requests, if enabled in the Request Type and the Request Group refers to a Bill of Materials',402,13952,'Y',10,570,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-06-24 11:46:21','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-06-24 11:46:21','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','6ed163da-2362-47dd-ab2c-00336bc392b5','Y',570,2)
;
-- Jun 24, 2023, 11:46:22 AM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (207656,'Quantity Plan','Planned Quantity','Planned Quantity',402,14727,'Y',22,580,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-06-24 11:46:22','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-06-24 11:46:22','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','ec6b1107-4581-45a0-8d93-75d47fdf4af3','Y',580,2)
;
-- Jun 24, 2023, 11:46:23 AM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,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 (207657,'Fixed in','Fixed in Change Notice',402,14981,'Y',10,590,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-06-24 11:46:22','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-06-24 11:46:22','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','8de7366d-03fa-424c-9b0e-91e5a07893ce','Y',590,2)
;
-- Jun 24, 2023, 11:46:23 AM 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 (207658,'Record UUID',402,215854,'Y',36,600,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-06-24 11:46:23','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-06-24 11:46:23','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','79804c32-87c3-434c-985d-85350f6d902a','Y',600,2)
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET IsDisplayed='Y', DisplayLogic='@Record_UU@=''''', SeqNo=470, IsReadOnly='Y', XPosition=4,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207658
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=480, XPosition=4,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11179
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET SeqNo=490,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5176
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET SeqNo=500,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10906
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET SeqNo=510,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5180
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET SeqNo=520,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5842
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET SeqNo=530,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5841
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET SeqNo=540,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5844
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET SeqNo=550,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5843
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET SeqNo=560,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5184
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET SeqNo=570,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11450
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET IsDisplayed='N', SeqNo=0, XPosition=1,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207655
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET IsDisplayed='N', SeqNo=0, XPosition=1,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207657
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET IsDisplayed='N', SeqNo=0, XPosition=1,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207656
;
-- Jun 24, 2023, 11:49:15 AM CEST
UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2023-06-24 11:49:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205036
;
-- Jun 24, 2023, 11:49:25 AM 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 (207659,'Record UUID',344,215854,'Y',36,600,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-06-24 11:49:25','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-06-24 11:49:25','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','dc2ce699-ed8c-47de-ae7a-3559af264c73','Y',590,2)
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET IsDisplayed='Y', DisplayLogic='@Record_UU@!''''', SeqNo=490, IsReadOnly='Y', XPosition=4,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207659
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@=''''', SeqNo=500,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11177
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=510,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4292
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=520,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10905
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=530,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4298
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=540,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5846
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=550,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5845
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=560,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5848
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=570,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5847
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=580,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12748
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=590,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11414
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=600,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4303
;
-- Jun 24, 2023, 11:50:31 AM CEST
UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2023-06-24 11:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205035
;
-- Jun 24, 2023, 11:57:32 AM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@='''' & @AD_Table_ID@!0', SeqNo=470,Updated=TO_TIMESTAMP('2023-06-24 11:57:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207658
;
-- Jun 24, 2023, 11:57:32 AM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@='''' & @AD_Table_ID@!0', SeqNo=480,Updated=TO_TIMESTAMP('2023-06-24 11:57:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11179
;
-- Jun 24, 2023, 11:57:58 AM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@!'''' & @AD_Table_ID@!0', SeqNo=490,Updated=TO_TIMESTAMP('2023-06-24 11:57:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207659
;
-- Jun 24, 2023, 11:57:58 AM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@='''' & @AD_Table_ID@!0', SeqNo=500,Updated=TO_TIMESTAMP('2023-06-24 11:57:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11177
;
-- Jun 24, 2023, 12:02:54 PM CEST
UPDATE AD_Field SET DisplayLogic='@Record_UU@!'''' & @AD_Table_ID@!0',Updated=TO_TIMESTAMP('2023-06-24 12:02:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207658
;
-- Jun 24, 2023, 12:10:06 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,201255,'5a052f32-d102-4397-a44b-4684d89cd0eb',TO_TIMESTAMP('2023-06-24 12:10:06','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','r_request_table_recorduu_idx',TO_TIMESTAMP('2023-06-24 12:10:06','YYYY-MM-DD HH24:MI:SS'),100,417,'N','N','N','N','N')
;
-- Jun 24, 2023, 12:10:29 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,201696,'eec90d65-d247-40e2-84b4-bce888dbee11',TO_TIMESTAMP('2023-06-24 12:10:29','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-06-24 12:10:29','YYYY-MM-DD HH24:MI:SS'),100,13078,201255,10)
;
-- Jun 24, 2023, 12:10:35 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,201697,'c2f68e3d-8183-46cc-a896-bbae326aafbb',TO_TIMESTAMP('2023-06-24 12:10:34','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-06-24 12:10:34','YYYY-MM-DD HH24:MI:SS'),100,215854,201255,20)
;
-- Jun 24, 2023, 12:10:43 PM CEST
CREATE INDEX r_request_table_recorduu_idx ON R_Request (AD_Table_ID,Record_UU)
;
-- Set Record_UU for existing records
DO $$
DECLARE
cmd varchar(2000);
r record;
v_cnt numeric;
BEGIN
FOR r IN
SELECT DISTINCT t.TableName, a.AD_Table_ID
FROM R_Request a
JOIN AD_Table t ON (a.AD_Table_ID=t.AD_Table_ID)
WHERE a.Record_UU IS NULL
AND a.Record_ID > 0
LOOP
cmd := 'UPDATE R_Request SET Record_UU=(SELECT '
|| r.TableName
|| '_UU FROM '
|| r.TableName
|| ' WHERE '
|| r.TableName
|| '_ID=R_Request.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 '% R_Request.Record_UU set in %', v_cnt, r.TableName;
END LOOP;
END;
$$
;

View File

@ -675,6 +675,15 @@ public interface I_R_Request
*/ */
public int getRecord_ID(); 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 RequestAmt */ /** Column name RequestAmt */
public static final String COLUMNNAME_RequestAmt = "RequestAmt"; public static final String COLUMNNAME_RequestAmt = "RequestAmt";

View File

@ -307,10 +307,11 @@ public class MArchive extends X_AD_Archive {
byte[] data = super.getBinaryData(); byte[] data = super.getBinaryData();
if (data == null || data.length == 0) if (data == null || data.length == 0)
return false; return false;
if (getRecord_ID() > 0 && Util.isEmpty(getRecord_UU())) { if (getRecord_ID() > 0 && getAD_Table_ID() > 0 && Util.isEmpty(getRecord_UU())) {
MTable table = MTable.get(getAD_Table_ID()); MTable table = MTable.get(getAD_Table_ID());
PO po = table.getPO(getRecord_ID(), get_TrxName()); PO po = table.getPO(getRecord_ID(), get_TrxName());
setRecord_UU(po.get_UUID()); if (po != null)
setRecord_UU(po.get_UUID());
} }
// //
if (log.isLoggable(Level.FINE)) log.fine(toString()); if (log.isLoggable(Level.FINE)) log.fine(toString());

View File

@ -131,11 +131,7 @@ public class MAttachment extends X_AD_Attachment
public MAttachment(Properties ctx, int AD_Table_ID, int Record_ID, String trxName) public MAttachment(Properties ctx, int AD_Table_ID, int Record_ID, String trxName)
{ {
this(ctx, AD_Table_ID, Record_ID, null, trxName); this(ctx, AD_Table_ID, Record_ID, null, trxName);
if (Record_ID > 0) { // Record_UU will be set in beforeSave
MTable table = MTable.get(AD_Table_ID);
PO po = table.getPO(Record_ID, trxName);
setRecord_UU(po.get_UUID());
}
} }
/** /**
@ -552,10 +548,11 @@ public class MAttachment extends X_AD_Attachment
{ {
if (Util.isEmpty(getTitle())) if (Util.isEmpty(getTitle()))
setTitle(NONE); setTitle(NONE);
if (getRecord_ID() > 0 && Util.isEmpty(getRecord_UU())) { if (getRecord_ID() > 0 && getAD_Table_ID() > 0 && Util.isEmpty(getRecord_UU())) {
MTable table = MTable.get(getAD_Table_ID()); MTable table = MTable.get(getAD_Table_ID());
PO po = table.getPO(getRecord_ID(), get_TrxName()); PO po = table.getPO(getRecord_ID(), get_TrxName());
setRecord_UU(po.get_UUID()); if (po != null)
setRecord_UU(po.get_UUID());
} }
return saveLOBData(); // save in BinaryData return saveLOBData(); // save in BinaryData
} // beforeSave } // beforeSave

View File

@ -255,10 +255,11 @@ public class MChat extends X_CM_Chat
*/ */
@Override @Override
protected boolean beforeSave(boolean newRecord) { protected boolean beforeSave(boolean newRecord) {
if (getRecord_ID() > 0 && Util.isEmpty(getRecord_UU())) { if (getRecord_ID() > 0 && getAD_Table_ID() > 0 && Util.isEmpty(getRecord_UU())) {
MTable table = MTable.get(getAD_Table_ID()); MTable table = MTable.get(getAD_Table_ID());
PO po = table.getPO(getRecord_ID(), get_TrxName()); PO po = table.getPO(getRecord_ID(), get_TrxName());
setRecord_UU(po.get_UUID()); if (po != null)
setRecord_UU(po.get_UUID());
} }
return true; return true;
} }

View File

@ -130,10 +130,11 @@ public class MLabelAssignment extends X_AD_LabelAssignment {
*/ */
@Override @Override
protected boolean beforeSave(boolean newRecord) { protected boolean beforeSave(boolean newRecord) {
if (getRecord_ID() > 0 && Util.isEmpty(getRecord_UU())) { if (getRecord_ID() > 0 && getAD_Table_ID() > 0 && Util.isEmpty(getRecord_UU())) {
MTable table = MTable.get(getAD_Table_ID()); MTable table = MTable.get(getAD_Table_ID());
PO po = table.getPO(getRecord_ID(), get_TrxName()); PO po = table.getPO(getRecord_ID(), get_TrxName());
setRecord_UU(po.get_UUID()); if (po != null)
setRecord_UU(po.get_UUID());
} }
return true; return true;
} }

View File

@ -152,10 +152,11 @@ public class MPostIt extends X_AD_PostIt
*/ */
@Override @Override
protected boolean beforeSave(boolean newRecord) { protected boolean beforeSave(boolean newRecord) {
if (getRecord_ID() > 0 && Util.isEmpty(getRecord_UU())) { if (getRecord_ID() > 0 && getAD_Table_ID() > 0 && Util.isEmpty(getRecord_UU())) {
MTable table = MTable.get(getAD_Table_ID()); MTable table = MTable.get(getAD_Table_ID());
PO po = table.getPO(getRecord_ID(), get_TrxName()); PO po = table.getPO(getRecord_ID(), get_TrxName());
setRecord_UU(po.get_UUID()); if (po != null)
setRecord_UU(po.get_UUID());
} }
return true; return true;
} }

View File

@ -42,7 +42,7 @@ public class MRequest extends X_R_Request
/** /**
* *
*/ */
private static final long serialVersionUID = -6049674214655497548L; private static final long serialVersionUID = -3807801381988066060L;
/** /**
* Get Request ID from mail text * Get Request ID from mail text
@ -790,6 +790,13 @@ public class MRequest extends X_R_Request
// Importance / Priority // Importance / Priority
setPriority(); setPriority();
if (getRecord_ID() > 0 && getAD_Table_ID() > 0 && Util.isEmpty(getRecord_UU())) {
MTable table = MTable.get(getAD_Table_ID());
PO po = table.getPO(getRecord_ID(), get_TrxName());
if (po != null)
setRecord_UU(po.get_UUID());
}
return true; return true;
} // beforeSave } // beforeSave
@ -942,13 +949,31 @@ public class MRequest extends X_R_Request
* @param whereClause * @param whereClause
* @param trxName * @param trxName
* @return int[], [0] = inactive request count and [1] = active request count * @return int[], [0] = inactive request count and [1] = active request count
* @deprecated - use {@link #getRequestCount(int, int, String, StringBuilder, String)} instead
*/ */
public static int[] getRequestCount(int AD_Table_ID, int Record_ID, StringBuilder whereClause, String trxName) { public static int[] getRequestCount(int AD_Table_ID, int Record_ID, StringBuilder whereClause, String trxName) {
return getRequestCount(AD_Table_ID, Record_ID, null, whereClause, trxName);
}
/**
* Get number of active and inactive request
* @param AD_Table_ID
* @param Record_ID Record ID - used when Record_UU is null, and also to compare with User, BPartner, Order, Invoice, Payment, Project, Campaign and Asset
* @param Record_UU Record UUID
* @param whereClause
* @param trxName
* @return int[], [0] = inactive request count and [1] = active request count
*/
public static int[] getRequestCount(int AD_Table_ID, int Record_ID, String Record_UU, StringBuilder whereClause, String trxName) {
int[] counts = new int[] {0, 0}; int[] counts = new int[] {0, 0};
whereClause.append("(AD_Table_ID=").append(AD_Table_ID) whereClause.append("(AD_Table_ID=").append(AD_Table_ID);
.append(" AND Record_ID=").append(Record_ID) if (Util.isEmpty(Record_UU)) {
.append(")"); whereClause.append(" AND Record_ID=").append(Record_ID);
} else {
whereClause.append(" AND Record_UU=").append(DB.TO_STRING(Record_UU));
}
whereClause.append(")");
// //
if (AD_Table_ID == MUser.Table_ID) if (AD_Table_ID == MUser.Table_ID)
whereClause.append(" OR AD_User_ID=").append(Record_ID) whereClause.append(" OR AD_User_ID=").append(Record_ID)
@ -1006,11 +1031,26 @@ public class MRequest extends X_R_Request
* @param AD_Table_ID * @param AD_Table_ID
* @param Record_ID * @param Record_ID
* @param C_BPartner_ID * @param C_BPartner_ID
* @deprecated - use {@link #newRequest(GridTab, int, int, String, int)} instead
*/ */
public static void newRequest(GridTab tab, int AD_Table_ID, int Record_ID, int C_BPartner_ID) { public static void newRequest(GridTab tab, int AD_Table_ID, int Record_ID, int C_BPartner_ID) {
newRequest(tab, AD_Table_ID, Record_ID, null, C_BPartner_ID);
}
/**
* Create new request
* @param tab Grid Tab for request
* @param AD_Table_ID
* @param Record_ID Record ID - to fill Record_ID and also to fill with BPartner, User, Project, Asset,
* Order (also from OrderLine), Invoice, Product, Payment, InOut, RMA, RequestRelated (when from Request)
* @param Record_UU Record UUID
* @param C_BPartner_ID
*/
public static void newRequest(GridTab tab, int AD_Table_ID, int Record_ID, String Record_UU, int C_BPartner_ID) {
tab.dataNew (false); tab.dataNew (false);
tab.setValue("AD_Table_ID", Integer.valueOf(AD_Table_ID)); tab.setValue("AD_Table_ID", Integer.valueOf(AD_Table_ID));
tab.setValue("Record_ID", Integer.valueOf(Record_ID)); tab.setValue("Record_ID", Integer.valueOf(Record_ID));
tab.setValue("Record_UU", Record_UU);
// //
if (C_BPartner_ID != 0) if (C_BPartner_ID != 0)
tab.setValue("C_BPartner_ID", Integer.valueOf(C_BPartner_ID)); tab.setValue("C_BPartner_ID", Integer.valueOf(C_BPartner_ID));
@ -1053,4 +1093,5 @@ public class MRequest extends X_R_Request
} }
} }
} }
} // MRequest } // MRequest

View File

@ -34,7 +34,7 @@ public class X_R_Request extends PO implements I_R_Request, I_Persistent
/** /**
* *
*/ */
private static final long serialVersionUID = 20230409L; private static final long serialVersionUID = 20230624L;
/** Standard Constructor */ /** Standard Constructor */
public X_R_Request (Properties ctx, int R_Request_ID, String trxName) public X_R_Request (Properties ctx, int R_Request_ID, String trxName)
@ -1187,6 +1187,21 @@ public class X_R_Request extends PO implements I_R_Request, I_Persistent
return ii.intValue(); 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 Request Amount. /** Set Request Amount.
@param RequestAmt Amount associated with this request @param RequestAmt Amount associated with this request
*/ */

View File

@ -51,23 +51,39 @@ public class WRequest implements EventListener<Event>
* Constructor * Constructor
* @param invoker invoker button * @param invoker invoker button
* @param AD_Table_ID table * @param AD_Table_ID table
* @param Record_ID record * @param Record_ID record ID
* @param Record_UU record UUID
* @param C_BPartner_ID optional bp * @param C_BPartner_ID optional bp
*/ */
public WRequest (Component invoker, int AD_Table_ID, int Record_ID, int C_BPartner_ID) public WRequest (Component invoker, int AD_Table_ID, int Record_ID, String Record_UU, int C_BPartner_ID)
{ {
if (log.isLoggable(Level.CONFIG)) log.config("AD_Table_ID=" + AD_Table_ID + ", Record_ID=" + Record_ID); if (log.isLoggable(Level.CONFIG)) log.config("AD_Table_ID=" + AD_Table_ID + ", Record_ID=" + Record_ID + ", Record_UU=" + Record_UU);
m_AD_Table_ID = AD_Table_ID; m_AD_Table_ID = AD_Table_ID;
m_Record_ID = Record_ID; m_Record_ID = Record_ID;
m_Record_UU = Record_UU;
m_C_BPartner_ID = C_BPartner_ID; m_C_BPartner_ID = C_BPartner_ID;
getRequests(invoker); getRequests(invoker);
} // WRequest } // WRequest
/**
* Constructor
* @param invoker invoker button
* @param AD_Table_ID table
* @param Record_ID record
* @param C_BPartner_ID optional bp
*/
public WRequest (Component invoker, int AD_Table_ID, int Record_ID, int C_BPartner_ID)
{
this(invoker, AD_Table_ID, Record_ID, null, C_BPartner_ID);
} // WRequest
/** The Table */ /** The Table */
private int m_AD_Table_ID; private int m_AD_Table_ID;
/** The Record */ /** The Record ID */
private int m_Record_ID; private int m_Record_ID;
/** The Record UUID */
private String m_Record_UU;
/** BPartner */ /** BPartner */
private int m_C_BPartner_ID; private int m_C_BPartner_ID;
@ -97,7 +113,7 @@ public class WRequest implements EventListener<Event>
m_popup.appendChild(m_new); m_popup.appendChild(m_new);
// //
m_where = new StringBuilder(); m_where = new StringBuilder();
int[] counts = MRequest.getRequestCount(m_AD_Table_ID, m_Record_ID, m_where, null); int[] counts = MRequest.getRequestCount(m_AD_Table_ID, m_Record_ID, m_Record_UU, m_where, null);
int activeCount = counts[1]; int activeCount = counts[1];
int inactiveCount = counts[0]; int inactiveCount = counts[0];
if (activeCount > 0) if (activeCount > 0)
@ -182,7 +198,7 @@ public class WRequest implements EventListener<Event>
if (e.getTarget() == m_new) if (e.getTarget() == m_new)
{ {
GridTab tab = frame.getADWindowContent().getActiveGridTab(); GridTab tab = frame.getADWindowContent().getActiveGridTab();
MRequest.newRequest(tab, m_AD_Table_ID, m_Record_ID, m_C_BPartner_ID); MRequest.newRequest(tab, m_AD_Table_ID, m_Record_ID, m_Record_UU, m_C_BPartner_ID);
} }
} }
} }

View File

@ -3391,15 +3391,12 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
{ {
if (toolbar.getEvent() != null) if (toolbar.getEvent() != null)
{ {
if (adTabbox.getSelectedGridTab().getRecord_ID() <= 0)
return;
int C_BPartner_ID = 0; int C_BPartner_ID = 0;
Object bpartner = adTabbox.getSelectedGridTab().getValue("C_BPartner_ID"); Object bpartner = adTabbox.getSelectedGridTab().getValue("C_BPartner_ID");
if(bpartner != null) if(bpartner != null)
C_BPartner_ID = Integer.valueOf(bpartner.toString()); C_BPartner_ID = Integer.valueOf(bpartner.toString());
new WRequest(toolbar.getToolbarItem("Requests"), adTabbox.getSelectedGridTab().getAD_Table_ID(), adTabbox.getSelectedGridTab().getRecord_ID(), C_BPartner_ID); new WRequest(toolbar.getToolbarItem("Requests"), adTabbox.getSelectedGridTab().getAD_Table_ID(), adTabbox.getSelectedGridTab().getRecord_ID(), adTabbox.getSelectedGridTab().getRecord_UU(), C_BPartner_ID);
} }
} }

View File

@ -118,22 +118,24 @@ public final class DictionaryIDs {
} }
public enum C_BPartner { public enum C_BPartner {
STANDARD(112), STANDARD(112,"dc4962ad-066f-4ebf-88ac-545d12c9f1f0"),
TREE_FARM(114), TREE_FARM(114,"5c557ed6-c443-4b99-ae77-546ccd46bc1f"),
C_AND_W(117), C_AND_W(117,"037972d8-b74c-462d-b407-4a9b60e66ca8"),
JOE_BLOCK(118), JOE_BLOCK(118,"bead5eef-774d-45f5-9634-0210b4122340"),
SEED_FARM(120), SEED_FARM(120,"f6efd81a-abe6-4bca-86fe-810d4355d572"),
PATIO(121), PATIO(121,"39e85feb-94a2-4e41-ae45-e7d49d7be077"),
WOOD_INC(50000), WOOD_INC(50000,"9944d7a8-76bd-4d57-8ceb-2c0327e58bda"),
COLOR_INC(50001), COLOR_INC(50001,"6e967db4-e6a9-488f-ae76-f811fb86186e"),
CHROME_INC(50002), CHROME_INC(50002,"e1b92d09-ca76-4326-aa45-449e0c4509a3"),
CHEMICAL_INC(50003), CHEMICAL_INC(50003,"26abfd12-5aa2-4668-b0c7-76d680ccfb10"),
AGRI_TECH(200000); AGRI_TECH(200000,"605450c7-24a7-4da9-990d-a8e5e7dd57eb");
public final int id; public final int id;
public final String uuid;
private C_BPartner(int id) { private C_BPartner(int id, String uuid) {
this.id = id; this.id = id;
this.uuid = uuid;
} }
} }

View File

@ -46,7 +46,7 @@ public class MRequestTest extends AbstractTestCase {
@Test @Test
public void testRequestCount() { public void testRequestCount() {
int[] counts = MRequest.getRequestCount(MBPartner.Table_ID, DictionaryIDs.C_BPartner.PATIO.id, new StringBuilder(), getTrxName()); int[] counts = MRequest.getRequestCount(MBPartner.Table_ID, DictionaryIDs.C_BPartner.PATIO.id, DictionaryIDs.C_BPartner.PATIO.uuid, new StringBuilder(), getTrxName());
MRequest req = new MRequest(Env.getCtx(), 0, getTrxName()); MRequest req = new MRequest(Env.getCtx(), 0, getTrxName());
req.setC_BPartner_ID(DictionaryIDs.C_BPartner.PATIO.id); req.setC_BPartner_ID(DictionaryIDs.C_BPartner.PATIO.id);
@ -58,14 +58,14 @@ public class MRequestTest extends AbstractTestCase {
req.setSalesRep_ID(getAD_User_ID()); req.setSalesRep_ID(getAD_User_ID());
req.saveEx(); req.saveEx();
int[] counts1 = MRequest.getRequestCount(MBPartner.Table_ID, DictionaryIDs.C_BPartner.PATIO.id, new StringBuilder(), getTrxName()); int[] counts1 = MRequest.getRequestCount(MBPartner.Table_ID, DictionaryIDs.C_BPartner.PATIO.id, DictionaryIDs.C_BPartner.PATIO.uuid, new StringBuilder(), getTrxName());
assertEquals(counts[0], counts1[0], "Unexpected processed request count"); assertEquals(counts[0], counts1[0], "Unexpected processed request count");
assertEquals(counts[1]+1, counts1[1], "Unexpected not processed request count"); assertEquals(counts[1]+1, counts1[1], "Unexpected not processed request count");
req.setProcessed(true); req.setProcessed(true);
req.saveEx(); req.saveEx();
counts1 = MRequest.getRequestCount(MBPartner.Table_ID, DictionaryIDs.C_BPartner.PATIO.id, new StringBuilder(), getTrxName()); counts1 = MRequest.getRequestCount(MBPartner.Table_ID, DictionaryIDs.C_BPartner.PATIO.id, DictionaryIDs.C_BPartner.PATIO.uuid, new StringBuilder(), getTrxName());
assertEquals(counts[0]+1, counts1[0], "Unexpected processed request count"); assertEquals(counts[0]+1, counts1[0], "Unexpected processed request count");
assertEquals(counts[1], counts1[1], "Unexpected not processed request count"); assertEquals(counts[1], counts1[1], "Unexpected not processed request count");
} }
@ -80,7 +80,7 @@ public class MRequestTest extends AbstractTestCase {
query.addRestriction("1=2"); query.addRestriction("1=2");
gridTab.setQuery(query); gridTab.setQuery(query);
gridTab.query(false); gridTab.query(false);
MRequest.newRequest(gridTab, MBPartner.Table_ID, DictionaryIDs.C_BPartner.PATIO.id, DictionaryIDs.C_BPartner.PATIO.id); MRequest.newRequest(gridTab, MBPartner.Table_ID, DictionaryIDs.C_BPartner.PATIO.id, DictionaryIDs.C_BPartner.PATIO.uuid, DictionaryIDs.C_BPartner.PATIO.id);
assertTrue(gridTab.isNew(), "Current row of Grid Tab is not a new row"); assertTrue(gridTab.isNew(), "Current row of Grid Tab is not a new row");
assertEquals(MBPartner.Table_ID, gridTab.getValue("AD_Table_ID")); assertEquals(MBPartner.Table_ID, gridTab.getValue("AD_Table_ID"));
assertEquals(DictionaryIDs.C_BPartner.PATIO.id, gridTab.getValue("Record_ID"), "Unexpected Record_ID value"); assertEquals(DictionaryIDs.C_BPartner.PATIO.id, gridTab.getValue("Record_ID"), "Unexpected Record_ID value");

View File

@ -48,8 +48,7 @@ import org.junit.jupiter.api.Test;
public class MTestTest extends AbstractTestCase { public class MTestTest extends AbstractTestCase {
private static final String TestInGardenWorld = "6846b9eb-aff1-47c8-8b50-e9632b39c0c7"; private static final String TestInGardenWorld = "6846b9eb-aff1-47c8-8b50-e9632b39c0c7";
private static final String TestInSystem = "d08e9de9-39e5-485c-ad50-e8bc7ee0f575" private static final String TestInSystem = "d08e9de9-39e5-485c-ad50-e8bc7ee0f575";
+ "";
public MTestTest() { public MTestTest() {
} }