IDEMPIERE-5567 Support of UUID as Key (FHCA-4195) - Archive (#1895)

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

* - Support for master/detail reports on UUID based tables

* - Archive button

* - Add test print format for UU Based Table

* - backward compatibility on MArchive.getReportAndDocumentCountByRecordId

* - Backward compatibility with filesystem storage

* - Improve naming of temporary folder for 2Pack

* - Improve query to use correctly the index

* - Improve method to use ID when no UUID

* - Ensure the Record_UU is filled even when called from foreign sources

* - Implement the same provision for exceptional cases on MAttachment, MChat, MLabelAssignment, MPostIt to fill the UUID when not passed (f.e. when created by a plugin)
This commit is contained in:
Carlos Ruiz 2023-06-23 05:17:51 +02:00 committed by GitHub
parent 7e225c4c8c
commit 7adbc91505
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 740 additions and 102 deletions

View File

@ -0,0 +1,72 @@
-- IDEMPIERE-5567 Support of UUID as Key (FHCA-4195)
SELECT register_migration_script('202306101412_IDEMPIERE-5567-Archive.sql') FROM dual;
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Jun 10, 2023, 2:12:27 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 (215850,0,'Record UUID',754,'Record_UU',36,'N','N','N','N','N',0,'N',200240,0,0,'Y',TO_TIMESTAMP('2023-06-10 14:12:27','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-06-10 14:12:27','YYYY-MM-DD HH24:MI:SS'),100,203804,'Y','N','D','N','N','N','Y','85e84f16-6122-46ec-9048-39cb57718754','Y',0,'N','N','M','N')
;
-- Jun 10, 2023, 2:12:29 PM CEST
ALTER TABLE AD_Archive ADD Record_UU VARCHAR2(36 CHAR) DEFAULT NULL
;
-- Jun 10, 2023, 3:46:29 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,201253,'9208ce54-2d15-4640-acee-6ccc5729c62e',TO_TIMESTAMP('2023-06-10 15:46:29','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','ad_archive_tab_rec',TO_TIMESTAMP('2023-06-10 15:46:29','YYYY-MM-DD HH24:MI:SS'),100,754,'N','N','N','N','N')
;
-- Jun 10, 2023, 3:46:43 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,201693,'1bc7c2c5-c99c-4803-94fc-1ee5c82236d4',TO_TIMESTAMP('2023-06-10 15:46:43','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-06-10 15:46:43','YYYY-MM-DD HH24:MI:SS'),100,13070,201253,10)
;
-- Jun 10, 2023, 3:46:48 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,201694,'1ac17e80-215d-4266-9cf6-5c1bf51fbed7',TO_TIMESTAMP('2023-06-10 15:46:47','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-06-10 15:46:47','YYYY-MM-DD HH24:MI:SS'),100,215850,201253,20)
;
-- Jun 10, 2023, 3:46:51 PM CEST
CREATE INDEX ad_archive_tab_rec ON AD_Archive (AD_Table_ID,Record_UU)
;
-- Jun 10, 2023, 3:47:02 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,201254,'4751d300-f63a-4ae2-b9f5-2a7309edd93f',TO_TIMESTAMP('2023-06-10 15:47:02','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','ad_archive_c_bpartner',TO_TIMESTAMP('2023-06-10 15:47:02','YYYY-MM-DD HH24:MI:SS'),100,754,'N','N','N','N','N')
;
-- Jun 10, 2023, 3:47:07 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,201695,'779b9d2a-f83c-4582-89f2-1a6f096bdd80',TO_TIMESTAMP('2023-06-10 15:47:06','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-06-10 15:47:06','YYYY-MM-DD HH24:MI:SS'),100,13075,201254,10)
;
-- Jun 10, 2023, 3:47:10 PM CEST
CREATE INDEX ad_archive_c_bpartner ON AD_Archive (C_BPartner_ID)
;
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 AD_Archive 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 AD_Archive SET Record_UU=(SELECT '
|| r.TableName
|| '_UU FROM '
|| r.TableName
|| ' WHERE '
|| r.TableName
|| '_ID=AD_Archive.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_Archive.Record_UU set in ' || r.TableName);
END LOOP;
END;
/

View File

@ -0,0 +1,106 @@
-- IDEMPIERE-5567 Support of UUID as Key (FHCA-4195) - test data
SELECT register_migration_script('202306101728_IDEMPIERE-5567-TestPrintFormat.sql') FROM dual;
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Jun 10, 2023, 5:28:56 PM CEST
INSERT INTO AD_PrintFormat (Updated,CreatedBy,IsTableBased,IsActive,IsStandardHeaderFooter,AD_PrintFont_ID,AD_Table_ID,IsForm,HeaderMargin,UpdatedBy,AD_PrintColor_ID,Created,Name,FooterMargin,AD_Client_ID,AD_PrintPaper_ID,AD_Org_ID,AD_PrintFormat_ID,IsDefault,AD_PrintFormat_UU,IsBreakPagePerRecord) VALUES (TO_TIMESTAMP('2023-06-10 17:28:56','YYYY-MM-DD HH24:MI:SS'),100,'Y','Y','Y',130,200384,'N',0,100,100,TO_TIMESTAMP('2023-06-10 17:28:56','YYYY-MM-DD HH24:MI:SS'),'TestUUDet Print Format',0,0,100,0,200016,'N','431e6b2e-3a28-4d0f-8fed-9aa94a922e28','Y')
;
-- Jun 10, 2023, 5:28:57 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (0,'Active',TO_TIMESTAMP('2023-06-10 17:28:56','YYYY-MM-DD HH24:MI:SS'),'N',0,'Active',0,0,215801,'N','Y',100,0,200396,100,'N',0,TO_TIMESTAMP('2023-06-10 17:28:56','YYYY-MM-DD HH24:MI:SS'),200016,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','f84e0f71-b380-42ce-9d6c-b16238708e98','N','Y','N')
;
-- Jun 10, 2023, 5:28:57 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (0,'Organization',TO_TIMESTAMP('2023-06-10 17:28:57','YYYY-MM-DD HH24:MI:SS'),'N',0,'Organization',0,0,215796,'N','Y',100,0,200397,100,'N',0,TO_TIMESTAMP('2023-06-10 17:28:57','YYYY-MM-DD HH24:MI:SS'),200016,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','14f52d41-e411-4be0-a2c3-885470f11173','N','Y','N')
;
-- Jun 10, 2023, 5:28:58 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (0,'Tenant',TO_TIMESTAMP('2023-06-10 17:28:57','YYYY-MM-DD HH24:MI:SS'),'N',0,'Tenant',0,0,215795,'N','Y',100,0,200398,100,'N',0,TO_TIMESTAMP('2023-06-10 17:28:57','YYYY-MM-DD HH24:MI:SS'),200016,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','bb9a523d-be00-4436-8a4b-afec620505c5','N','Y','N')
;
-- Jun 10, 2023, 5:28:58 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (10,'Test UU',TO_TIMESTAMP('2023-06-10 17:28:58','YYYY-MM-DD HH24:MI:SS'),'N',0,'Test UU',0,0,215805,'N','Y',100,0,200399,100,'N',0,TO_TIMESTAMP('2023-06-10 17:28:58','YYYY-MM-DD HH24:MI:SS'),200016,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','64332931-f7a2-4cad-b786-89503d0b0776','N','Y','N')
;
-- Jun 10, 2023, 5:28:58 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (10,'Name',TO_TIMESTAMP('2023-06-10 17:28:58','YYYY-MM-DD HH24:MI:SS'),'N',0,'Name',0,10,215803,'N','Y',100,0,200400,100,'N',0,TO_TIMESTAMP('2023-06-10 17:28:58','YYYY-MM-DD HH24:MI:SS'),200016,0,0,'Y','N',0,0,'L','Y','Y','N','X','F','C','N','Y','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','27039afc-be5b-495a-8c3f-1ea07dfbbab6','N','Y','N')
;
-- Jun 10, 2023, 5:28:59 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (30,'Alternate Test UU',TO_TIMESTAMP('2023-06-10 17:28:58','YYYY-MM-DD HH24:MI:SS'),'N',0,'Alternate Test UU',0,0,215804,'N','Y',100,0,200401,100,'N',0,TO_TIMESTAMP('2023-06-10 17:28:58','YYYY-MM-DD HH24:MI:SS'),200016,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','c8dd6f7f-3e84-441d-b09d-5d208ca58942','N','Y','N')
;
-- Jun 10, 2023, 5:28:59 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (40,'Multi Test UU',TO_TIMESTAMP('2023-06-10 17:28:59','YYYY-MM-DD HH24:MI:SS'),'N',0,'Multi Test UU',0,0,215809,'N','Y',100,0,200402,100,'N',0,TO_TIMESTAMP('2023-06-10 17:28:59','YYYY-MM-DD HH24:MI:SS'),200016,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','8f140fde-3690-40d2-b59d-43925a6a5fd6','N','Y','N')
;
-- Jun 10, 2023, 5:28:59 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (50,'TestUUDet_UU',TO_TIMESTAMP('2023-06-10 17:28:59','YYYY-MM-DD HH24:MI:SS'),'N',0,'TestUUDet_UU',0,0,215802,'N','Y',100,0,200403,100,'N',0,TO_TIMESTAMP('2023-06-10 17:28:59','YYYY-MM-DD HH24:MI:SS'),200016,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','ffb87f00-8fff-4aaf-a293-beb25b2c17a9','N','Y','N')
;
-- Jun 10, 2023, 5:29:00 PM CEST
INSERT INTO AD_PrintFormat (Updated,CreatedBy,IsTableBased,IsActive,IsStandardHeaderFooter,AD_PrintFont_ID,AD_Table_ID,IsForm,HeaderMargin,UpdatedBy,AD_PrintColor_ID,Created,Name,FooterMargin,AD_Client_ID,AD_PrintPaper_ID,AD_Org_ID,AD_PrintFormat_ID,IsDefault,AD_PrintFormat_UU,IsBreakPagePerRecord) VALUES (TO_TIMESTAMP('2023-06-10 17:28:59','YYYY-MM-DD HH24:MI:SS'),100,'Y','Y','Y',130,200383,'Y',0,100,100,TO_TIMESTAMP('2023-06-10 17:28:59','YYYY-MM-DD HH24:MI:SS'),'TestUU Print Format',0,0,100,0,200017,'N','44b67140-a8da-49df-8bc6-6a696ff85edb','Y')
;
-- Jun 10, 2023, 5:29:00 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (0,'Test UU',TO_TIMESTAMP('2023-06-10 17:29:00','YYYY-MM-DD HH24:MI:SS'),'N',0,'Test UU',0,0,215785,'N','Y',100,0,200404,100,'N',0,TO_TIMESTAMP('2023-06-10 17:29:00','YYYY-MM-DD HH24:MI:SS'),200017,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','f5fce7a0-eb52-4cce-a31d-94a6fdd3b355','N','Y','N')
;
-- Jun 10, 2023, 5:29:00 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (0,'Organization',TO_TIMESTAMP('2023-06-10 17:29:00','YYYY-MM-DD HH24:MI:SS'),'N',0,'Organization',0,0,215779,'N','Y',100,0,200405,100,'N',0,TO_TIMESTAMP('2023-06-10 17:29:00','YYYY-MM-DD HH24:MI:SS'),200017,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','fa2ce6fb-9314-4c81-822d-232def5e5d71','N','Y','N')
;
-- Jun 10, 2023, 5:29:01 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (0,'Tenant',TO_TIMESTAMP('2023-06-10 17:29:00','YYYY-MM-DD HH24:MI:SS'),'N',0,'Tenant',0,0,215778,'N','Y',100,0,200406,100,'N',0,TO_TIMESTAMP('2023-06-10 17:29:00','YYYY-MM-DD HH24:MI:SS'),200017,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','2ad4b8ce-229f-4e9d-bcb1-490394b76b36','N','Y','N')
;
-- Jun 10, 2023, 5:29:01 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (0,'Active',TO_TIMESTAMP('2023-06-10 17:29:01','YYYY-MM-DD HH24:MI:SS'),'N',0,'Active',0,0,215784,'N','Y',100,0,200407,100,'N',0,TO_TIMESTAMP('2023-06-10 17:29:01','YYYY-MM-DD HH24:MI:SS'),200017,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','ba512d33-5da1-4d20-9a6e-1749cc199caf','N','Y','N')
;
-- Jun 10, 2023, 5:29:02 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,YSpace,SortNo,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,AD_PrintColor_ID,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,AD_PrintFont_ID,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,BelowColumn,IsNextPage,IsFixedWidth,IsMaxCalc,RunningTotalLines,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (10,'Test Print Format for UUID Based Table',TO_TIMESTAMP('2023-06-10 17:29:01','YYYY-MM-DD HH24:MI:SS'),'Y',0,0,0,'N','N',100,0,200408,100,'N',10,100,TO_TIMESTAMP('2023-06-10 17:29:01','YYYY-MM-DD HH24:MI:SS'),200017,0,0,129,'Y','Y',0,70,'D','Y','N','N','X','T','C','N','N','N','N','N',0,'N','N','N',20,'N','N','N','N','N',1,0,'N','N','N','N','b3023947-0014-4657-a1cc-9952453cc9da','N','Y','N')
;
-- Jun 10, 2023, 5:29:02 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (20,'Name',TO_TIMESTAMP('2023-06-10 17:29:02','YYYY-MM-DD HH24:MI:SS'),'N',0,'Name: ',0,0,215787,'N','N',100,0,200409,100,'N',50,TO_TIMESTAMP('2023-06-10 17:29:02','YYYY-MM-DD HH24:MI:SS'),200017,0,0,'Y','N',0,70,'L','Y','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','76c7238b-246b-4671-be0d-37f16d8703e5','N','Y','N')
;
-- Jun 10, 2023, 5:29:02 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (20,'Search Key',TO_TIMESTAMP('2023-06-10 17:29:02','YYYY-MM-DD HH24:MI:SS'),'N',0,'Search Key: ',0,0,215786,'N','N',100,0,200410,100,'N',30,TO_TIMESTAMP('2023-06-10 17:29:02','YYYY-MM-DD HH24:MI:SS'),200017,0,0,'Y','N',0,70,'L','Y','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','25b9320b-e435-4941-b4b9-bd9203385b33','N','Y','N')
;
-- Jun 10, 2023, 5:29:03 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (30,'Description',TO_TIMESTAMP('2023-06-10 17:29:03','YYYY-MM-DD HH24:MI:SS'),'N',0,'Description: ',0,0,215788,'N','N',100,0,200411,100,'N',70,TO_TIMESTAMP('2023-06-10 17:29:03','YYYY-MM-DD HH24:MI:SS'),200017,0,0,'Y','N',0,70,'L','Y','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','ea793329-5def-472c-8054-6c7f46acaf09','N','Y','N')
;
-- Jun 10, 2023, 5:29:03 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (40,'Comment/Help',TO_TIMESTAMP('2023-06-10 17:29:03','YYYY-MM-DD HH24:MI:SS'),'N',0,'Comment: ',0,0,215789,'N','N',100,0,200412,100,'N',90,TO_TIMESTAMP('2023-06-10 17:29:03','YYYY-MM-DD HH24:MI:SS'),200017,0,0,'Y','N',0,70,'L','Y','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','ebd17120-96e7-4b12-be6f-e49c44210dae','N','Y','N')
;
-- Jun 10, 2023, 5:29:04 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,AD_PrintFormatChild_ID,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,AD_PrintColor_ID,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,AD_PrintFont_ID,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,BelowColumn,IsNextPage,IsFixedWidth,IsMaxCalc,RunningTotalLines,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (60,'Detail',TO_TIMESTAMP('2023-06-10 17:29:03','YYYY-MM-DD HH24:MI:SS'),'Y',0,200016,0,0,215785,'N','Y',100,0,200413,100,'N',0,100,TO_TIMESTAMP('2023-06-10 17:29:03','YYYY-MM-DD HH24:MI:SS'),200017,0,0,130,'Y','Y',0,0,'D','Y','N','N','X','P','C','N','N','N','N','N',0,'N','N','N',20,'N','N','N','N','N',1,0,'N','N','N','N','7c7eb707-29bb-4950-96d7-b06c93122ac2','N','Y','N')
;
-- Jun 10, 2023, 5:29:04 PM CEST
INSERT INTO AD_Process (AD_Process_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,IsReport,Value,IsDirectPrint,AccessLevel,EntityType,Statistic_Count,Statistic_Seconds,AD_PrintFormat_ID,IsBetaFunctionality,ShowHelp,CopyFromProcess,AD_Process_UU,AllowMultipleExecution) VALUES (200153,0,0,'Y',TO_TIMESTAMP('2023-06-10 17:29:04','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-06-10 17:29:04','YYYY-MM-DD HH24:MI:SS'),100,'TestUU Form Report','Y','TestUU Form Report','N','7','D',5,21,200017,'N','Y','N','75f5cbfa-5ac5-4438-98bf-82115d2d5981','P')
;
-- Jun 10, 2023, 5:30:29 PM CEST
UPDATE AD_Tab SET AD_Process_ID=200153,Updated=TO_TIMESTAMP('2023-06-10 17:30:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=200348
;
-- Jun 10, 2023, 5:31:48 PM CEST
UPDATE TestUU SET Description='Lorem ipsum dolor sit amet', Help='consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut',Updated=TO_TIMESTAMP('2023-06-10 17:31:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE TestUU_UU='8858ecc2-cf1d-405f-987f-793536037e76'
;
-- Jun 10, 2023, 5:32:02 PM CEST
INSERT INTO TestUUDet (AD_Client_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,IsActive,TestUUDet_UU,Name,TestUU_UU) VALUES (11,0,TO_TIMESTAMP('2023-06-10 17:32:02','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-06-10 17:32:02','YYYY-MM-DD HH24:MI:SS'),100,'Y','d1f6b029-7d24-4ec6-bfc7-99d5a1e997c2','Detail One','8858ecc2-cf1d-405f-987f-793536037e76')
;
-- Jun 10, 2023, 5:32:09 PM CEST
INSERT INTO TestUUDet (AD_Client_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,IsActive,TestUUDet_UU,Name,TestUU_UU) VALUES (11,0,TO_TIMESTAMP('2023-06-10 17:32:09','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-06-10 17:32:09','YYYY-MM-DD HH24:MI:SS'),100,'Y','b341e80b-841c-41c8-9643-d4299155db09','Detail Two','8858ecc2-cf1d-405f-987f-793536037e76')
;

View File

@ -0,0 +1,70 @@
-- IDEMPIERE-5567 Support of UUID as Key (FHCA-4195)
SELECT register_migration_script('202306101412_IDEMPIERE-5567-Archive.sql') FROM dual;
-- Jun 10, 2023, 2:12:27 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 (215850,0,'Record UUID',754,'Record_UU',36,'N','N','N','N','N',0,'N',200240,0,0,'Y',TO_TIMESTAMP('2023-06-10 14:12:27','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-06-10 14:12:27','YYYY-MM-DD HH24:MI:SS'),100,203804,'Y','N','D','N','N','N','Y','85e84f16-6122-46ec-9048-39cb57718754','Y',0,'N','N','M','N')
;
-- Jun 10, 2023, 2:12:29 PM CEST
ALTER TABLE AD_Archive ADD COLUMN Record_UU VARCHAR(36) DEFAULT NULL
;
-- Jun 10, 2023, 3:46:29 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,201253,'9208ce54-2d15-4640-acee-6ccc5729c62e',TO_TIMESTAMP('2023-06-10 15:46:29','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','ad_archive_tab_rec',TO_TIMESTAMP('2023-06-10 15:46:29','YYYY-MM-DD HH24:MI:SS'),100,754,'N','N','N','N','N')
;
-- Jun 10, 2023, 3:46:43 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,201693,'1bc7c2c5-c99c-4803-94fc-1ee5c82236d4',TO_TIMESTAMP('2023-06-10 15:46:43','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-06-10 15:46:43','YYYY-MM-DD HH24:MI:SS'),100,13070,201253,10)
;
-- Jun 10, 2023, 3:46:48 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,201694,'1ac17e80-215d-4266-9cf6-5c1bf51fbed7',TO_TIMESTAMP('2023-06-10 15:46:47','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-06-10 15:46:47','YYYY-MM-DD HH24:MI:SS'),100,215850,201253,20)
;
-- Jun 10, 2023, 3:46:51 PM CEST
CREATE INDEX ad_archive_tab_rec ON AD_Archive (AD_Table_ID,Record_UU)
;
-- Jun 10, 2023, 3:47:02 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,201254,'4751d300-f63a-4ae2-b9f5-2a7309edd93f',TO_TIMESTAMP('2023-06-10 15:47:02','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','ad_archive_c_bpartner',TO_TIMESTAMP('2023-06-10 15:47:02','YYYY-MM-DD HH24:MI:SS'),100,754,'N','N','N','N','N')
;
-- Jun 10, 2023, 3:47:07 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,201695,'779b9d2a-f83c-4582-89f2-1a6f096bdd80',TO_TIMESTAMP('2023-06-10 15:47:06','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2023-06-10 15:47:06','YYYY-MM-DD HH24:MI:SS'),100,13075,201254,10)
;
-- Jun 10, 2023, 3:47:10 PM CEST
CREATE INDEX ad_archive_c_bpartner ON AD_Archive (C_BPartner_ID)
;
-- 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 AD_Archive 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 AD_Archive SET Record_UU=(SELECT '
|| r.TableName
|| '_UU FROM '
|| r.TableName
|| ' WHERE '
|| r.TableName
|| '_ID=AD_Archive.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_Archive.Record_UU set in %', v_cnt, r.TableName;
END LOOP;
END;
$$
;

View File

@ -0,0 +1,103 @@
-- IDEMPIERE-5567 Support of UUID as Key (FHCA-4195) - test data
SELECT register_migration_script('202306101728_IDEMPIERE-5567-TestPrintFormat.sql') FROM dual;
-- Jun 10, 2023, 5:28:56 PM CEST
INSERT INTO AD_PrintFormat (Updated,CreatedBy,IsTableBased,IsActive,IsStandardHeaderFooter,AD_PrintFont_ID,AD_Table_ID,IsForm,HeaderMargin,UpdatedBy,AD_PrintColor_ID,Created,Name,FooterMargin,AD_Client_ID,AD_PrintPaper_ID,AD_Org_ID,AD_PrintFormat_ID,IsDefault,AD_PrintFormat_UU,IsBreakPagePerRecord) VALUES (TO_TIMESTAMP('2023-06-10 17:28:56','YYYY-MM-DD HH24:MI:SS'),100,'Y','Y','Y',130,200384,'N',0,100,100,TO_TIMESTAMP('2023-06-10 17:28:56','YYYY-MM-DD HH24:MI:SS'),'TestUUDet Print Format',0,0,100,0,200016,'N','431e6b2e-3a28-4d0f-8fed-9aa94a922e28','Y')
;
-- Jun 10, 2023, 5:28:57 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (0,'Active',TO_TIMESTAMP('2023-06-10 17:28:56','YYYY-MM-DD HH24:MI:SS'),'N',0,'Active',0,0,215801,'N','Y',100,0,200396,100,'N',0,TO_TIMESTAMP('2023-06-10 17:28:56','YYYY-MM-DD HH24:MI:SS'),200016,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','f84e0f71-b380-42ce-9d6c-b16238708e98','N','Y','N')
;
-- Jun 10, 2023, 5:28:57 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (0,'Organization',TO_TIMESTAMP('2023-06-10 17:28:57','YYYY-MM-DD HH24:MI:SS'),'N',0,'Organization',0,0,215796,'N','Y',100,0,200397,100,'N',0,TO_TIMESTAMP('2023-06-10 17:28:57','YYYY-MM-DD HH24:MI:SS'),200016,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','14f52d41-e411-4be0-a2c3-885470f11173','N','Y','N')
;
-- Jun 10, 2023, 5:28:58 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (0,'Tenant',TO_TIMESTAMP('2023-06-10 17:28:57','YYYY-MM-DD HH24:MI:SS'),'N',0,'Tenant',0,0,215795,'N','Y',100,0,200398,100,'N',0,TO_TIMESTAMP('2023-06-10 17:28:57','YYYY-MM-DD HH24:MI:SS'),200016,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','bb9a523d-be00-4436-8a4b-afec620505c5','N','Y','N')
;
-- Jun 10, 2023, 5:28:58 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (10,'Test UU',TO_TIMESTAMP('2023-06-10 17:28:58','YYYY-MM-DD HH24:MI:SS'),'N',0,'Test UU',0,0,215805,'N','Y',100,0,200399,100,'N',0,TO_TIMESTAMP('2023-06-10 17:28:58','YYYY-MM-DD HH24:MI:SS'),200016,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','64332931-f7a2-4cad-b786-89503d0b0776','N','Y','N')
;
-- Jun 10, 2023, 5:28:58 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (10,'Name',TO_TIMESTAMP('2023-06-10 17:28:58','YYYY-MM-DD HH24:MI:SS'),'N',0,'Name',0,10,215803,'N','Y',100,0,200400,100,'N',0,TO_TIMESTAMP('2023-06-10 17:28:58','YYYY-MM-DD HH24:MI:SS'),200016,0,0,'Y','N',0,0,'L','Y','Y','N','X','F','C','N','Y','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','27039afc-be5b-495a-8c3f-1ea07dfbbab6','N','Y','N')
;
-- Jun 10, 2023, 5:28:59 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (30,'Alternate Test UU',TO_TIMESTAMP('2023-06-10 17:28:58','YYYY-MM-DD HH24:MI:SS'),'N',0,'Alternate Test UU',0,0,215804,'N','Y',100,0,200401,100,'N',0,TO_TIMESTAMP('2023-06-10 17:28:58','YYYY-MM-DD HH24:MI:SS'),200016,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','c8dd6f7f-3e84-441d-b09d-5d208ca58942','N','Y','N')
;
-- Jun 10, 2023, 5:28:59 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (40,'Multi Test UU',TO_TIMESTAMP('2023-06-10 17:28:59','YYYY-MM-DD HH24:MI:SS'),'N',0,'Multi Test UU',0,0,215809,'N','Y',100,0,200402,100,'N',0,TO_TIMESTAMP('2023-06-10 17:28:59','YYYY-MM-DD HH24:MI:SS'),200016,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','8f140fde-3690-40d2-b59d-43925a6a5fd6','N','Y','N')
;
-- Jun 10, 2023, 5:28:59 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (50,'TestUUDet_UU',TO_TIMESTAMP('2023-06-10 17:28:59','YYYY-MM-DD HH24:MI:SS'),'N',0,'TestUUDet_UU',0,0,215802,'N','Y',100,0,200403,100,'N',0,TO_TIMESTAMP('2023-06-10 17:28:59','YYYY-MM-DD HH24:MI:SS'),200016,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','ffb87f00-8fff-4aaf-a293-beb25b2c17a9','N','Y','N')
;
-- Jun 10, 2023, 5:29:00 PM CEST
INSERT INTO AD_PrintFormat (Updated,CreatedBy,IsTableBased,IsActive,IsStandardHeaderFooter,AD_PrintFont_ID,AD_Table_ID,IsForm,HeaderMargin,UpdatedBy,AD_PrintColor_ID,Created,Name,FooterMargin,AD_Client_ID,AD_PrintPaper_ID,AD_Org_ID,AD_PrintFormat_ID,IsDefault,AD_PrintFormat_UU,IsBreakPagePerRecord) VALUES (TO_TIMESTAMP('2023-06-10 17:28:59','YYYY-MM-DD HH24:MI:SS'),100,'Y','Y','Y',130,200383,'Y',0,100,100,TO_TIMESTAMP('2023-06-10 17:28:59','YYYY-MM-DD HH24:MI:SS'),'TestUU Print Format',0,0,100,0,200017,'N','44b67140-a8da-49df-8bc6-6a696ff85edb','Y')
;
-- Jun 10, 2023, 5:29:00 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (0,'Test UU',TO_TIMESTAMP('2023-06-10 17:29:00','YYYY-MM-DD HH24:MI:SS'),'N',0,'Test UU',0,0,215785,'N','Y',100,0,200404,100,'N',0,TO_TIMESTAMP('2023-06-10 17:29:00','YYYY-MM-DD HH24:MI:SS'),200017,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','f5fce7a0-eb52-4cce-a31d-94a6fdd3b355','N','Y','N')
;
-- Jun 10, 2023, 5:29:00 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (0,'Organization',TO_TIMESTAMP('2023-06-10 17:29:00','YYYY-MM-DD HH24:MI:SS'),'N',0,'Organization',0,0,215779,'N','Y',100,0,200405,100,'N',0,TO_TIMESTAMP('2023-06-10 17:29:00','YYYY-MM-DD HH24:MI:SS'),200017,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','fa2ce6fb-9314-4c81-822d-232def5e5d71','N','Y','N')
;
-- Jun 10, 2023, 5:29:01 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (0,'Tenant',TO_TIMESTAMP('2023-06-10 17:29:00','YYYY-MM-DD HH24:MI:SS'),'N',0,'Tenant',0,0,215778,'N','Y',100,0,200406,100,'N',0,TO_TIMESTAMP('2023-06-10 17:29:00','YYYY-MM-DD HH24:MI:SS'),200017,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','2ad4b8ce-229f-4e9d-bcb1-490394b76b36','N','Y','N')
;
-- Jun 10, 2023, 5:29:01 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (0,'Active',TO_TIMESTAMP('2023-06-10 17:29:01','YYYY-MM-DD HH24:MI:SS'),'N',0,'Active',0,0,215784,'N','Y',100,0,200407,100,'N',0,TO_TIMESTAMP('2023-06-10 17:29:01','YYYY-MM-DD HH24:MI:SS'),200017,0,0,'Y','N',0,0,'L','N','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','ba512d33-5da1-4d20-9a6e-1749cc199caf','N','Y','N')
;
-- Jun 10, 2023, 5:29:02 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,YSpace,SortNo,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,AD_PrintColor_ID,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,AD_PrintFont_ID,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,BelowColumn,IsNextPage,IsFixedWidth,IsMaxCalc,RunningTotalLines,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (10,'Test Print Format for UUID Based Table',TO_TIMESTAMP('2023-06-10 17:29:01','YYYY-MM-DD HH24:MI:SS'),'Y',0,0,0,'N','N',100,0,200408,100,'N',10,100,TO_TIMESTAMP('2023-06-10 17:29:01','YYYY-MM-DD HH24:MI:SS'),200017,0,0,129,'Y','Y',0,70,'D','Y','N','N','X','T','C','N','N','N','N','N',0,'N','N','N',20,'N','N','N','N','N',1,0,'N','N','N','N','b3023947-0014-4657-a1cc-9952453cc9da','N','Y','N')
;
-- Jun 10, 2023, 5:29:02 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (20,'Name',TO_TIMESTAMP('2023-06-10 17:29:02','YYYY-MM-DD HH24:MI:SS'),'N',0,'Name: ',0,0,215787,'N','N',100,0,200409,100,'N',50,TO_TIMESTAMP('2023-06-10 17:29:02','YYYY-MM-DD HH24:MI:SS'),200017,0,0,'Y','N',0,70,'L','Y','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','76c7238b-246b-4671-be0d-37f16d8703e5','N','Y','N')
;
-- Jun 10, 2023, 5:29:02 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (20,'Search Key',TO_TIMESTAMP('2023-06-10 17:29:02','YYYY-MM-DD HH24:MI:SS'),'N',0,'Search Key: ',0,0,215786,'N','N',100,0,200410,100,'N',30,TO_TIMESTAMP('2023-06-10 17:29:02','YYYY-MM-DD HH24:MI:SS'),200017,0,0,'Y','N',0,70,'L','Y','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','25b9320b-e435-4941-b4b9-bd9203385b33','N','Y','N')
;
-- Jun 10, 2023, 5:29:03 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (30,'Description',TO_TIMESTAMP('2023-06-10 17:29:03','YYYY-MM-DD HH24:MI:SS'),'N',0,'Description: ',0,0,215788,'N','N',100,0,200411,100,'N',70,TO_TIMESTAMP('2023-06-10 17:29:03','YYYY-MM-DD HH24:MI:SS'),200017,0,0,'Y','N',0,70,'L','Y','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','ea793329-5def-472c-8054-6c7f46acaf09','N','Y','N')
;
-- Jun 10, 2023, 5:29:03 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,PrintName,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,IsNextPage,IsFixedWidth,IsMaxCalc,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (40,'Comment/Help',TO_TIMESTAMP('2023-06-10 17:29:03','YYYY-MM-DD HH24:MI:SS'),'N',0,'Comment: ',0,0,215789,'N','N',100,0,200412,100,'N',90,TO_TIMESTAMP('2023-06-10 17:29:03','YYYY-MM-DD HH24:MI:SS'),200017,0,0,'Y','N',0,70,'L','Y','N','N','X','F','C','N','N','N','N','N','N','N','N','N','N','N','N','N',1,0,'N','Y','N','N','ebd17120-96e7-4b12-be6f-e49c44210dae','N','Y','N')
;
-- Jun 10, 2023, 5:29:04 PM CEST
INSERT INTO AD_PrintFormatItem (SeqNo,Name,Created,IsNextLine,AD_Client_ID,AD_PrintFormatChild_ID,YSpace,SortNo,AD_Column_ID,IsPageBreak,IsRelativePosition,UpdatedBy,MaxWidth,AD_PrintFormatItem_ID,CreatedBy,IsSummarized,YPosition,AD_PrintColor_ID,Updated,AD_PrintFormat_ID,AD_Org_ID,XSpace,AD_PrintFont_ID,IsActive,IsHeightOneLine,MaxHeight,XPosition,FieldAlignmentType,IsPrinted,IsOrderBy,IsGroupBy,LineAlignmentType,PrintFormatType,PrintAreaType,ImageIsAttached,IsCounted,IsAveraged,IsSuppressNull,IsSetNLPosition,BelowColumn,IsNextPage,IsFixedWidth,IsMaxCalc,RunningTotalLines,IsRunningTotal,IsMinCalc,IsVarianceCalc,IsDeviationCalc,IsFilledRectangle,LineWidth,ArcDiameter,ShapeType,IsCentrallyMaintained,IsImageField,IsSuppressRepeats,AD_PrintFormatItem_UU,IsDesc,IsPrintBarcodeText,IsPrintInstanceAttributes) VALUES (60,'Detail',TO_TIMESTAMP('2023-06-10 17:29:03','YYYY-MM-DD HH24:MI:SS'),'Y',0,200016,0,0,215785,'N','Y',100,0,200413,100,'N',0,100,TO_TIMESTAMP('2023-06-10 17:29:03','YYYY-MM-DD HH24:MI:SS'),200017,0,0,130,'Y','Y',0,0,'D','Y','N','N','X','P','C','N','N','N','N','N',0,'N','N','N',20,'N','N','N','N','N',1,0,'N','N','N','N','7c7eb707-29bb-4950-96d7-b06c93122ac2','N','Y','N')
;
-- Jun 10, 2023, 5:29:04 PM CEST
INSERT INTO AD_Process (AD_Process_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,IsReport,Value,IsDirectPrint,AccessLevel,EntityType,Statistic_Count,Statistic_Seconds,AD_PrintFormat_ID,IsBetaFunctionality,ShowHelp,CopyFromProcess,AD_Process_UU,AllowMultipleExecution) VALUES (200153,0,0,'Y',TO_TIMESTAMP('2023-06-10 17:29:04','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-06-10 17:29:04','YYYY-MM-DD HH24:MI:SS'),100,'TestUU Form Report','Y','TestUU Form Report','N','7','D',5,21,200017,'N','Y','N','75f5cbfa-5ac5-4438-98bf-82115d2d5981','P')
;
-- Jun 10, 2023, 5:30:29 PM CEST
UPDATE AD_Tab SET AD_Process_ID=200153,Updated=TO_TIMESTAMP('2023-06-10 17:30:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=200348
;
-- Jun 10, 2023, 5:31:48 PM CEST
UPDATE TestUU SET Description='Lorem ipsum dolor sit amet', Help='consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut',Updated=TO_TIMESTAMP('2023-06-10 17:31:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE TestUU_UU='8858ecc2-cf1d-405f-987f-793536037e76'
;
-- Jun 10, 2023, 5:32:02 PM CEST
INSERT INTO TestUUDet (AD_Client_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,IsActive,TestUUDet_UU,Name,TestUU_UU) VALUES (11,0,TO_TIMESTAMP('2023-06-10 17:32:02','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-06-10 17:32:02','YYYY-MM-DD HH24:MI:SS'),100,'Y','d1f6b029-7d24-4ec6-bfc7-99d5a1e997c2','Detail One','8858ecc2-cf1d-405f-987f-793536037e76')
;
-- Jun 10, 2023, 5:32:09 PM CEST
INSERT INTO TestUUDet (AD_Client_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,IsActive,TestUUDet_UU,Name,TestUU_UU) VALUES (11,0,TO_TIMESTAMP('2023-06-10 17:32:09','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-06-10 17:32:09','YYYY-MM-DD HH24:MI:SS'),100,'Y','b341e80b-841c-41c8-9643-d4299155db09','Detail Two','8858ecc2-cf1d-405f-987f-793536037e76')
;

View File

@ -47,11 +47,17 @@ public class ReportSendEMailEventData {
private String m_subject; private String m_subject;
private int m_tableId; private int m_tableId;
private int m_recordId; private int m_recordId;
private String m_recordUU;
public ReportSendEMailEventData(int windowNo, int tableId, int recordId, PrintInfo printInfo, String subject) { public ReportSendEMailEventData(int windowNo, int tableId, int recordId, PrintInfo printInfo, String subject) {
this(windowNo, tableId, recordId, null, printInfo, subject);
}
public ReportSendEMailEventData(int windowNo, int tableId, int recordId, String recordUU, PrintInfo printInfo, String subject) {
m_windowNo = windowNo; m_windowNo = windowNo;
m_tableId = tableId; m_tableId = tableId;
m_recordId = recordId; m_recordId = recordId;
m_recordUU = recordUU;
m_printInfo = printInfo; m_printInfo = printInfo;
m_subject = subject; m_subject = subject;
} }
@ -80,6 +86,14 @@ public class ReportSendEMailEventData {
m_recordId = recordId; m_recordId = recordId;
} }
public String getRecordUU() {
return m_recordUU;
}
public void setRecordUU(String recordUU) {
m_recordUU = recordUU;
}
public PrintInfo getFrom() { public PrintInfo getFrom() {
return m_printInfo; return m_printInfo;
} }

View File

@ -282,7 +282,11 @@ public class AttachmentFileSystem implements IAttachmentStore {
StringBuilder msgreturn = new StringBuilder().append(attach.getAD_Client_ID()).append(File.separator) StringBuilder msgreturn = new StringBuilder().append(attach.getAD_Client_ID()).append(File.separator)
.append(attach.getAD_Org_ID()).append(File.separator) .append(attach.getAD_Org_ID()).append(File.separator)
.append(attach.getAD_Table_ID()).append(File.separator).append(attach.getRecord_ID()); .append(attach.getAD_Table_ID()).append(File.separator);
if (attach.getRecord_ID() > 0)
msgreturn.append(attach.getRecord_ID());
else
msgreturn.append(attach.getRecord_UU());
return msgreturn.toString(); return msgreturn.toString();
} }

View File

@ -247,6 +247,15 @@ public interface I_AD_Archive
*/ */
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 Updated */ /** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated"; public static final String COLUMNNAME_Updated = "Updated";

View File

@ -48,7 +48,7 @@ public class MArchive extends X_AD_Archive {
/** /**
* *
*/ */
private static final long serialVersionUID = -6343913337999164991L; private static final long serialVersionUID = 1195510484179775189L;
/** /**
* Get Archives * Get Archives
@ -155,6 +155,7 @@ public class MArchive extends X_AD_Archive {
setAD_Process_ID(info.getAD_Process_ID()); setAD_Process_ID(info.getAD_Process_ID());
setAD_Table_ID(info.getAD_Table_ID()); setAD_Table_ID(info.getAD_Table_ID());
setRecord_ID(info.getRecord_ID()); setRecord_ID(info.getRecord_ID());
setRecord_UU(info.getRecord_UU());
setC_BPartner_ID(info.getC_BPartner_ID()); setC_BPartner_ID(info.getC_BPartner_ID());
} // MArchive } // MArchive
@ -269,6 +270,8 @@ public class MArchive extends X_AD_Archive {
} }
if (this.getRecord_ID() > 0) { if (this.getRecord_ID() > 0) {
path.append(this.getRecord_ID()).append(File.separator); path.append(this.getRecord_ID()).append(File.separator);
} else if (!Util.isEmpty(this.getRecord_UU())) {
path.append(this.getRecord_UU()).append(File.separator);
} }
return path.toString(); return path.toString();
@ -304,6 +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())) {
MTable table = MTable.get(getAD_Table_ID());
PO po = table.getPO(getRecord_ID(), get_TrxName());
setRecord_UU(po.get_UUID());
}
// //
if (log.isLoggable(Level.FINE)) log.fine(toString()); if (log.isLoggable(Level.FINE)) log.fine(toString());
return true; return true;
@ -342,11 +350,16 @@ public class MArchive extends X_AD_Archive {
* @return File - the temporary file * @return File - the temporary file
*/ */
public File saveAsZip() { public File saveAsZip() {
String name = MTable.get(Env.getCtx(), getAD_Table_ID()).getTableName() + "_" + getRecord_ID(); StringBuilder name = new StringBuilder(MTable.get(Env.getCtx(), getAD_Table_ID()).getTableName())
.append("_");
if (getRecord_ID() > 0)
name.append(getRecord_ID()).append("_");
else if (!Util.isEmpty(getRecord_UU()))
name.append(getRecord_UU()).append("_");
File tempfolder = null; File tempfolder = null;
try { try {
Path tempPath = Files.createTempDirectory(name); Path tempPath = Files.createTempDirectory(name.toString());
tempfolder = tempPath.toFile(); tempfolder = tempPath.toFile();
} catch (IOException e1) { } catch (IOException e1) {
throw new AdempiereException("Unable to create temp folder", e1); throw new AdempiereException("Unable to create temp folder", e1);
@ -402,12 +415,29 @@ public class MArchive extends X_AD_Archive {
* @param Record_ID * @param Record_ID
* @param trxName * @param trxName
* @return int[], [0] = report count and [1] = document count * @return int[], [0] = report count and [1] = document count
* @deprecated - use {@link #getReportAndDocumentCountByRecordId(int, int, String, String)} instead
*/ */
public static int[] getReportAndDocumentCountByRecordId(int AD_Table_ID, int Record_ID, String trxName) { public static int[] getReportAndDocumentCountByRecordId(int AD_Table_ID, int Record_ID, String trxName) {
return getReportAndDocumentCountByRecordId(AD_Table_ID, Record_ID, null, trxName);
}
/**
* Get number of document and report archive by table and record UUID
*
* @param AD_Table_ID
* @param Record_ID - record ID used when UUID comes empty, or C_BPartner_ID when searching for this table
* @param Record_UU - record UUID
* @param trxName
* @return int[], [0] = report count and [1] = document count
*/
public static int[] getReportAndDocumentCountByRecordId(int AD_Table_ID, int Record_ID, String Record_UU, String trxName) {
int reportCount = 0; int reportCount = 0;
int documentCount = 0; int documentCount = 0;
StringBuilder sql = new StringBuilder("SELECT IsReport, COUNT(*) FROM AD_Archive ") StringBuilder sql = new StringBuilder("SELECT IsReport, COUNT(*) FROM AD_Archive ");
.append("WHERE (AD_Table_ID=? AND Record_ID=?) "); if (Util.isEmpty(Record_UU))
sql.append("WHERE (AD_Table_ID=? AND Record_ID=?) ");
else
sql.append("WHERE (AD_Table_ID=? AND Record_UU=?) ");
if (AD_Table_ID == MBPartner.Table_ID) if (AD_Table_ID == MBPartner.Table_ID)
sql.append(" OR C_BPartner_ID=?"); sql.append(" OR C_BPartner_ID=?");
sql.append(" GROUP BY IsReport"); sql.append(" GROUP BY IsReport");
@ -417,7 +447,10 @@ public class MArchive extends X_AD_Archive {
{ {
pstmt = DB.prepareStatement (sql.toString(), trxName); pstmt = DB.prepareStatement (sql.toString(), trxName);
pstmt.setInt(1, AD_Table_ID); pstmt.setInt(1, AD_Table_ID);
pstmt.setInt(2, Record_ID); if (Util.isEmpty(Record_UU))
pstmt.setInt(2, Record_ID);
else
pstmt.setString(2, Record_UU);
if (AD_Table_ID == MBPartner.Table_ID) if (AD_Table_ID == MBPartner.Table_ID)
pstmt.setInt(3, Record_ID); pstmt.setInt(3, Record_ID);
rs = pstmt.executeQuery (); rs = pstmt.executeQuery ();
@ -448,7 +481,7 @@ public class MArchive extends X_AD_Archive {
* @return Number of report archive for AD_Table_ID * @return Number of report archive for AD_Table_ID
*/ */
public static int getReportCountByTableId(int AD_Table_ID, String trxName) { public static int getReportCountByTableId(int AD_Table_ID, String trxName) {
String sql = "SELECT COUNT(*) FROM AD_Archive WHERE AD_Table_ID=? AND IsReport='Y'"; final String sql = "SELECT COUNT(*) FROM AD_Archive WHERE AD_Table_ID=? AND IsReport='Y'";
return DB.getSQLValueEx(trxName, sql, AD_Table_ID); return DB.getSQLValueEx(trxName, sql, AD_Table_ID);
} }
} // MArchive } // MArchive

View File

@ -552,6 +552,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())) {
MTable table = MTable.get(getAD_Table_ID());
PO po = table.getPO(getRecord_ID(), get_TrxName());
setRecord_UU(po.get_UUID());
}
return saveLOBData(); // save in BinaryData return saveLOBData(); // save in BinaryData
} // beforeSave } // beforeSave
@ -705,7 +710,8 @@ public class MAttachment extends X_AD_Attachment
return null; return null;
} }
String name = MTable.get(Env.getCtx(), getAD_Table_ID()).getTableName() + "_" + getRecord_ID(); String name = MTable.get(Env.getCtx(), getAD_Table_ID()).getTableName() + "_"
+ (getRecord_ID() > 0 ? getRecord_ID() : getRecord_UU());
File tempfolder = null; File tempfolder = null;
try { try {

View File

@ -40,7 +40,7 @@ public class MChat extends X_CM_Chat
/** /**
* *
*/ */
private static final long serialVersionUID = -8255793171229953201L; private static final long serialVersionUID = -1188256932717048308L;
/** /**
* Get Chats Of Table - of client in context * Get Chats Of Table - of client in context
@ -248,4 +248,19 @@ public class MChat extends X_CM_Chat
return chatID; return chatID;
} }
/**
* Before Save
* @param newRecord new
* @return true if can be saved
*/
@Override
protected boolean beforeSave(boolean newRecord) {
if (getRecord_ID() > 0 && Util.isEmpty(getRecord_UU())) {
MTable table = MTable.get(getAD_Table_ID());
PO po = table.getPO(getRecord_ID(), get_TrxName());
setRecord_UU(po.get_UUID());
}
return true;
}
} // MChat } // MChat

View File

@ -30,6 +30,7 @@ import java.sql.ResultSet;
import java.util.Properties; import java.util.Properties;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Util;
/** /**
* Label Assignment Model * Label Assignment Model
@ -38,7 +39,7 @@ public class MLabelAssignment extends X_AD_LabelAssignment {
/** /**
* *
*/ */
private static final long serialVersionUID = 2245405505404999887L; private static final long serialVersionUID = 310053368504090622L;
/** /**
* UUID based Constructor * UUID based Constructor
@ -122,4 +123,19 @@ public class MLabelAssignment extends X_AD_LabelAssignment {
return counter > 0; return counter > 0;
} }
/**
* Before Save
* @param newRecord new
* @return true if can be saved
*/
@Override
protected boolean beforeSave(boolean newRecord) {
if (getRecord_ID() > 0 && Util.isEmpty(getRecord_UU())) {
MTable table = MTable.get(getAD_Table_ID());
PO po = table.getPO(getRecord_ID(), get_TrxName());
setRecord_UU(po.get_UUID());
}
return true;
}
} }

View File

@ -22,6 +22,7 @@ import java.util.Properties;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.Util;
/** /**
* PostIt Model * PostIt Model
@ -34,7 +35,7 @@ public class MPostIt extends X_AD_PostIt
/** /**
* *
*/ */
private static final long serialVersionUID = -1450160105051825278L; private static final long serialVersionUID = 7817778632231317976L;
/** /**
* UUID based Constructor * UUID based Constructor
@ -144,4 +145,19 @@ public class MPostIt extends X_AD_PostIt
return postItID; return postItID;
} }
/**
* Before Save
* @param newRecord new
* @return true if can be saved
*/
@Override
protected boolean beforeSave(boolean newRecord) {
if (getRecord_ID() > 0 && Util.isEmpty(getRecord_UU())) {
MTable table = MTable.get(getAD_Table_ID());
PO po = table.getPO(getRecord_ID(), get_TrxName());
setRecord_UU(po.get_UUID());
}
return true;
}
} // MPostIt } // MPostIt

View File

@ -17,6 +17,7 @@
package org.compiere.model; package org.compiere.model;
import org.compiere.process.ProcessInfo; import org.compiere.process.ProcessInfo;
import org.compiere.util.Util;
/** /**
@ -37,6 +38,7 @@ public class PrintInfo
setAD_Process_ID(pi.getAD_Process_ID()); setAD_Process_ID(pi.getAD_Process_ID());
setAD_Table_ID(pi.getTable_ID()); setAD_Table_ID(pi.getTable_ID());
setRecord_ID(pi.getRecord_ID()); setRecord_ID(pi.getRecord_ID());
setRecord_UU(pi.getRecord_UU());
} // PrintInfo } // PrintInfo
@ -48,10 +50,24 @@ public class PrintInfo
* @param C_BPartner_ID bpartner * @param C_BPartner_ID bpartner
*/ */
public PrintInfo (String Name, int AD_Table_ID, int Record_ID, int C_BPartner_ID) public PrintInfo (String Name, int AD_Table_ID, int Record_ID, int C_BPartner_ID)
{
this (Name, AD_Table_ID, Record_ID, null, C_BPartner_ID);
}
/**
* Document Archive Info
* @param Name name
* @param AD_Table_ID table
* @param Record_ID record ID
* @param Record_UU record UUID
* @param C_BPartner_ID bpartner
*/
public PrintInfo (String Name, int AD_Table_ID, int Record_ID, String Record_UU, int C_BPartner_ID)
{ {
setName(Name); setName(Name);
setAD_Table_ID(AD_Table_ID); setAD_Table_ID(AD_Table_ID);
setRecord_ID(Record_ID); setRecord_ID(Record_ID);
setRecord_UU(Record_UU);
setC_BPartner_ID(C_BPartner_ID); setC_BPartner_ID(C_BPartner_ID);
} // ArchiveInfo } // ArchiveInfo
@ -62,11 +78,24 @@ public class PrintInfo
* @param Record_ID record * @param Record_ID record
*/ */
public PrintInfo (String Name, int AD_Table_ID, int Record_ID) public PrintInfo (String Name, int AD_Table_ID, int Record_ID)
{
this (Name, AD_Table_ID, Record_ID, null);
}
/**
* Report Archive Info
* @param Name name
* @param AD_Table_ID table
* @param Record_ID record ID
* @param Record_UU record UUID
*/
public PrintInfo (String Name, int AD_Table_ID, int Record_ID, String Record_UU)
{ {
setName(Name); setName(Name);
setAD_Table_ID(AD_Table_ID); setAD_Table_ID(AD_Table_ID);
setRecord_ID(Record_ID); setRecord_ID(Record_ID);
} // ArchiveInfo setRecord_UU(Record_UU);
} // PrintInfo
boolean m_withDialog = false; boolean m_withDialog = false;
private int m_copies = 1; private int m_copies = 1;
@ -79,6 +108,7 @@ public class PrintInfo
private int m_AD_Process_ID = 0; private int m_AD_Process_ID = 0;
private int m_AD_Table_ID = 0; private int m_AD_Table_ID = 0;
private int m_Record_ID = 0; private int m_Record_ID = 0;
private String m_Record_UU = null;
private int m_C_BPartner_ID = 0; private int m_C_BPartner_ID = 0;
@ -259,6 +289,20 @@ public class PrintInfo
{ {
m_Record_ID = record_ID; m_Record_ID = record_ID;
} }
/**
* @return Returns the record_UU.
*/
public String getRecord_UU ()
{
return m_Record_UU;
}
/**
* @param record_UU The record_UU to set.
*/
public void setRecord_UU (String record_UU)
{
m_Record_UU = record_UU;
}
/** /**
* String Representation * String Representation
@ -274,6 +318,8 @@ public class PrintInfo
sb.append(",AD_Table_ID=").append(getAD_Table_ID()); sb.append(",AD_Table_ID=").append(getAD_Table_ID());
if (getRecord_ID()!= 0) if (getRecord_ID()!= 0)
sb.append(",Record_ID=").append(getRecord_ID()); sb.append(",Record_ID=").append(getRecord_ID());
if (!Util.isEmpty(getRecord_UU()))
sb.append(",Record_UU=").append(getRecord_UU());
if (getC_BPartner_ID() != 0) if (getC_BPartner_ID() != 0)
sb.append(",C_BPartner_ID=").append(getC_BPartner_ID()); sb.append(",C_BPartner_ID=").append(getC_BPartner_ID());

View File

@ -31,7 +31,7 @@ public class X_AD_Archive extends PO implements I_AD_Archive, I_Persistent
/** /**
* *
*/ */
private static final long serialVersionUID = 20230409L; private static final long serialVersionUID = 20230610L;
/** Standard Constructor */ /** Standard Constructor */
public X_AD_Archive (Properties ctx, int AD_Archive_ID, String trxName) public X_AD_Archive (Properties ctx, int AD_Archive_ID, String trxName)
@ -377,4 +377,19 @@ public class X_AD_Archive extends PO implements I_AD_Archive, I_Persistent
return 0; return 0;
return ii.intValue(); 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);
}
} }

View File

@ -27,6 +27,7 @@ import org.compiere.util.KeyNamePair;
import org.compiere.util.Language; import org.compiere.util.Language;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.NamePair; import org.compiere.util.NamePair;
import org.compiere.util.Util;
/** /**
* Print Data Element * Print Data Element
@ -308,6 +309,8 @@ public class PrintDataElement implements Serializable
return ""; return "";
if (m_value instanceof NamePair) if (m_value instanceof NamePair)
return ((NamePair)m_value).getID(); return ((NamePair)m_value).getID();
if (m_value instanceof String && Util.isUUID((String) m_value))
return (String) m_value;
return ""; return "";
} // getValueKey } // getValueKey

View File

@ -94,6 +94,7 @@ import org.compiere.model.MRole;
import org.compiere.model.MStyle; import org.compiere.model.MStyle;
import org.compiere.model.MSysConfig; import org.compiere.model.MSysConfig;
import org.compiere.model.MTable; import org.compiere.model.MTable;
import org.compiere.model.PO;
import org.compiere.model.PrintInfo; import org.compiere.model.PrintInfo;
import org.compiere.model.X_AD_StyleLine; import org.compiere.model.X_AD_StyleLine;
import org.compiere.print.layout.InstanceAttributeColumn; import org.compiere.print.layout.InstanceAttributeColumn;
@ -2003,10 +2004,13 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
// Create Query from Parameters // Create Query from Parameters
MQuery query = null; MQuery query = null;
if (IsForm && pi.getRecord_ID() != 0 // Form = one record if (IsForm && (pi.getRecord_ID() > 0 || !Util.isEmpty(pi.getRecord_UU())) // Form = one record
&& !TableName.startsWith("T_") ) // Not temporary table - teo_sarca, BF [ 2828886 ] && !TableName.startsWith("T_") ) // Not temporary table - teo_sarca, BF [ 2828886 ]
{ {
query = MQuery.getEqualQuery(TableName + "_ID", pi.getRecord_ID()); if (pi.getRecord_ID() > 0)
query = MQuery.getEqualQuery(TableName + "_ID", pi.getRecord_ID());
else
query = MQuery.getEqualQuery(PO.getUUIDColumnName(TableName), pi.getRecord_UU());
} }
else else
{ {

View File

@ -1271,21 +1271,25 @@ public class LayoutEngine implements Pageable, Printable, Doc
+ " - AD_Column_ID=" + AD_Column_ID + " - " + item); + " - AD_Column_ID=" + AD_Column_ID + " - " + item);
return null; return null;
} }
int Record_ID = 0;
try
{
Record_ID = Integer.parseInt(recordString);
}
catch (Exception e)
{
data.dumpCurrentRow();
log.log(Level.SEVERE, "Invalid Record Key - " + recordString
+ " (" + e.getMessage()
+ ") - AD_Column_ID=" + AD_Column_ID + " - " + item);
return null;
}
MQuery query = new MQuery (format.getAD_Table_ID()); MQuery query = new MQuery (format.getAD_Table_ID());
query.addRestriction(item.getColumnName(), MQuery.EQUAL, Integer.valueOf(Record_ID)); if (Util.isUUID(recordString)) {
query.addRestriction(item.getColumnName(), MQuery.EQUAL, recordString);
} else {
int Record_ID = 0;
try
{
Record_ID = Integer.parseInt(recordString);
}
catch (Exception e)
{
data.dumpCurrentRow();
log.log(Level.SEVERE, "Invalid Record Key - " + recordString
+ " (" + e.getMessage()
+ ") - AD_Column_ID=" + AD_Column_ID + " - " + item);
return null;
}
query.addRestriction(item.getColumnName(), MQuery.EQUAL, Integer.valueOf(Record_ID));
}
format.setTranslationViewQuery(query); format.setTranslationViewQuery(query);
if (log.isLoggable(Level.FINE)) if (log.isLoggable(Level.FINE))
log.fine(query.toString()); log.fine(query.toString());

View File

@ -54,7 +54,7 @@ public class ProcessInfo implements Serializable
/** /**
* *
*/ */
private static final long serialVersionUID = -4648764346588157872L; private static final long serialVersionUID = -795798319865809959L;
private static final CLogger logger = CLogger.getCLogger(ProcessInfo.class); private static final CLogger logger = CLogger.getCLogger(ProcessInfo.class);
@ -65,12 +65,26 @@ public class ProcessInfo implements Serializable
* @param Table_ID AD_Table_ID * @param Table_ID AD_Table_ID
* @param Record_ID Record_ID * @param Record_ID Record_ID
*/ */
public ProcessInfo (String Title, int AD_Process_ID, int Table_ID, int Record_ID) public ProcessInfo(String Title, int AD_Process_ID, int Table_ID, int Record_ID)
{
this (Title, AD_Process_ID, Table_ID, Record_ID, null);
}
/**
* Constructor
* @param Title Title
* @param AD_Process_ID AD_Process_ID
* @param Table_ID AD_Table_ID
* @param Record_ID Record ID
* @param Record_UU Record UUID
*/
public ProcessInfo(String Title, int AD_Process_ID, int Table_ID, int Record_ID, String Record_UU)
{ {
setTitle (Title); setTitle (Title);
setAD_Process_ID(AD_Process_ID); setAD_Process_ID(AD_Process_ID);
setTable_ID (Table_ID); setTable_ID (Table_ID);
setRecord_ID (Record_ID); setRecord_ID (Record_ID);
setRecord_UU (Record_UU);
if (Ini.isPropertyBool(Ini.P_PRINTPREVIEW)) if (Ini.isPropertyBool(Ini.P_PRINTPREVIEW))
m_printPreview = true; m_printPreview = true;
else else
@ -98,6 +112,8 @@ public class ProcessInfo implements Serializable
private int m_Table_ID; private int m_Table_ID;
/** Record ID if the Process */ /** Record ID if the Process */
private int m_Record_ID; private int m_Record_ID;
/** Record UUID if the Process */
private String m_Record_UU;
/** User_ID */ /** User_ID */
private Integer m_AD_User_ID; private Integer m_AD_User_ID;
/** Client_ID */ /** Client_ID */
@ -230,6 +246,8 @@ public class ProcessInfo implements Serializable
sb.append(",AD_PInstance_ID=").append(m_AD_PInstance_ID); sb.append(",AD_PInstance_ID=").append(m_AD_PInstance_ID);
if (m_Record_ID != 0) if (m_Record_ID != 0)
sb.append(",Record_ID=").append(m_Record_ID); sb.append(",Record_ID=").append(m_Record_ID);
if (!Util.isEmpty(m_Record_UU))
sb.append(",Record_UU=").append(m_Record_UU);
if (m_ClassName != null) if (m_ClassName != null)
sb.append(",ClassName=").append(m_ClassName); sb.append(",ClassName=").append(m_ClassName);
sb.append(",Error=").append(isError()); sb.append(",Error=").append(isError());
@ -559,6 +577,23 @@ public class ProcessInfo implements Serializable
m_Record_ID = Record_ID; m_Record_ID = Record_ID;
} }
/**
* Method getRecord_UU
* @return String
*/
public String getRecord_UU()
{
return m_Record_UU;
}
/**
* Method setRecord_UU
* @param Record_UU int
*/
public void setRecord_UU(String Record_UU)
{
m_Record_UU = Record_UU;
}
/** /**
* Method getTitle * Method getTitle
* @return String * @return String

View File

@ -24,6 +24,8 @@
**********************************************************************/ **********************************************************************/
package org.adempiere.webui; package org.adempiere.webui;
import static org.compiere.model.SystemIDs.FORM_ARCHIVEVIEWER;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.webui.apps.form.WArchiveViewer; import org.adempiere.webui.apps.form.WArchiveViewer;
@ -31,8 +33,6 @@ import org.adempiere.webui.component.Window;
import org.adempiere.webui.panel.ADForm; import org.adempiere.webui.panel.ADForm;
import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.session.SessionManager;
import org.compiere.model.MArchive; import org.compiere.model.MArchive;
import org.compiere.model.MBPartner;
import static org.compiere.model.SystemIDs.*;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
@ -57,20 +57,36 @@ public class WArchive implements EventListener<Event>
* Constructor * Constructor
* @param invoker button * @param invoker button
* @param AD_Table_ID table * @param AD_Table_ID table
* @param Record_ID record * @param Record_ID record ID
* @deprecated - use {@link #WArchive(Component, int, int, String)} instead
*/ */
public WArchive (Component invoker, int AD_Table_ID, int Record_ID) public WArchive (Component invoker, int AD_Table_ID, int Record_ID)
{ {
if (log.isLoggable(Level.CONFIG)) log.config("AD_Table_ID=" + AD_Table_ID + ", Record_ID=" + Record_ID); this(invoker, AD_Table_ID, Record_ID, null);
}
/**
* Constructor
* @param invoker button
* @param AD_Table_ID table
* @param Record_ID record ID
* @param Record_UU record UUID
*/
public WArchive (Component invoker, int AD_Table_ID, int Record_ID, String Record_UU)
{
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;
getArchives(invoker); getArchives(invoker);
} }
/** 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;
/** The Popup */ /** The Popup */
private Menupopup m_popup = new Menupopup(); private Menupopup m_popup = new Menupopup();
@ -78,9 +94,6 @@ public class WArchive implements EventListener<Event>
private Menuitem m_reportsAll = null; private Menuitem m_reportsAll = null;
private Menuitem m_documents = null; private Menuitem m_documents = null;
/** Where Clause */
protected StringBuffer m_where = null;
/** Logger */ /** Logger */
private static final CLogger log = CLogger.getCLogger (WArchive.class); private static final CLogger log = CLogger.getCLogger (WArchive.class);
@ -90,15 +103,7 @@ public class WArchive implements EventListener<Event>
*/ */
private void getArchives(Component invoker) private void getArchives(Component invoker)
{ {
m_where = new StringBuffer(); int[] counts = MArchive.getReportAndDocumentCountByRecordId(m_AD_Table_ID, m_Record_ID, m_Record_UU, null);
m_where.append("(AD_Table_ID=").append(m_AD_Table_ID)
.append(" AND Record_ID=").append(m_Record_ID)
.append(")");
// Get all for BP
if (m_AD_Table_ID == MBPartner.Table_ID)
m_where.append(" OR C_BPartner_ID=").append(m_Record_ID);
//
int[] counts = MArchive.getReportAndDocumentCountByRecordId(m_AD_Table_ID, m_Record_ID, null);
int reportCount = counts[0]; int reportCount = counts[0];
int documentCount = counts[1]; int documentCount = counts[1];
// //

View File

@ -3250,8 +3250,9 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (result) { if (result) {
int table_ID = adTabbox.getSelectedGridTab().getAD_Table_ID(); int table_ID = adTabbox.getSelectedGridTab().getAD_Table_ID();
int record_ID = adTabbox.getSelectedGridTab().getRecord_ID(); int record_ID = adTabbox.getSelectedGridTab().getRecord_ID();
String record_UU = adTabbox.getSelectedGridTab().getRecord_UU();
final ProcessModalDialog dialog = new ProcessModalDialog(AbstractADWindowContent.this, getWindowNo(), AD_Process_ID,table_ID, record_ID, true); final ProcessModalDialog dialog = new ProcessModalDialog(AbstractADWindowContent.this, getWindowNo(), AD_Process_ID,table_ID, record_ID, record_UU, true);
if (dialog.isValid()) { if (dialog.isValid()) {
dialog.setBorder("normal"); dialog.setBorder("normal");
getComponent().getParent().appendChild(dialog); getComponent().getParent().appendChild(dialog);
@ -3420,10 +3421,10 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
{ {
if (toolbar.getEvent() != null) if (toolbar.getEvent() != null)
{ {
if (adTabbox.getSelectedGridTab().getRecord_ID() <= 0) new WArchive(toolbar.getToolbarItem("Archive"),
return; adTabbox.getSelectedGridTab().getAD_Table_ID(),
adTabbox.getSelectedGridTab().getRecord_ID(),
new WArchive(toolbar.getToolbarItem("Archive"), adTabbox.getSelectedGridTab().getAD_Table_ID(), adTabbox.getSelectedGridTab().getRecord_ID()); adTabbox.getSelectedGridTab().getRecord_UU());
} }
} }

View File

@ -53,7 +53,7 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi
/** /**
* generated serial id * generated serial id
*/ */
private static final long serialVersionUID = -6227339628038418701L; private static final long serialVersionUID = -3116200847404416861L;
/** /**
* Event echo form {@link #onOk()} to defer execution of {@link #onOk()}. * Event echo form {@link #onOk()} to defer execution of {@link #onOk()}.
@ -215,6 +215,20 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi
this(listener, WindowNo, new ProcessInfo("", AD_Process_ID, tableId, recordId), autoStart); this(listener, WindowNo, new ProcessInfo("", AD_Process_ID, tableId, recordId), autoStart);
} }
/**
* Dialog to start a process/report
* @param WindowNo
* @param AD_Process_ID
* @param tableId
* @param recordId
* @param recordUU
* @param autoStart
*/
public ProcessModalDialog (EventListener<Event> listener, int WindowNo, int AD_Process_ID, int tableId, int recordId, String recordUU, boolean autoStart)
{
this(listener, WindowNo, new ProcessInfo("", AD_Process_ID, tableId, recordId, recordUU), autoStart);
}
/** /**
* Dialog to start a process/report * Dialog to start a process/report
* @param parent not used * @param parent not used

View File

@ -742,7 +742,7 @@ public class WArchiveViewer extends Archive implements IFormController, EventLis
WEMailDialog dialog = new WEMailDialog (Msg.getMsg(Env.getCtx(), "SendMail"), WEMailDialog dialog = new WEMailDialog (Msg.getMsg(Env.getCtx(), "SendMail"),
from, "", "", "", new FileDataSource(attachment), from, "", "", "", new FileDataSource(attachment),
m_WindowNo, m_AD_Table_ID, m_Record_ID, null); m_WindowNo, ar.getAD_Table_ID(), ar.getRecord_ID(), ar.getRecord_UU(), null);
AEnv.showWindow(dialog); AEnv.showWindow(dialog);
} }
@ -867,14 +867,27 @@ public class WArchiveViewer extends Archive implements IFormController, EventLis
* Execute query. * Execute query.
* @param isReport report * @param isReport report
* @param AD_Table_ID table * @param AD_Table_ID table
* @param Record_ID tecord * @param Record_ID record
*/ */
public void query (boolean isReport, int AD_Table_ID, int Record_ID) public void query(boolean isReport, int AD_Table_ID, int Record_ID)
{ {
if (log.isLoggable(Level.CONFIG)) log.config("Report=" + isReport + ", AD_Table_ID=" + AD_Table_ID + ",Record_ID=" + Record_ID); query(isReport, AD_Table_ID, Record_ID, null);
}
/**
* Execute query.
* @param isReport report
* @param AD_Table_ID table
* @param Record_ID record ID
* @param Record_UU record UUID
*/
public void query(boolean isReport, int AD_Table_ID, int Record_ID, String Record_UU)
{
if (log.isLoggable(Level.CONFIG)) log.config("Report=" + isReport + ", AD_Table_ID=" + AD_Table_ID + ", Record_ID=" + Record_ID + ", Record_UU=" + Record_UU);
reportField.setChecked(isReport); reportField.setChecked(isReport);
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;
cmd_query(); cmd_query();
} // query } // query

View File

@ -928,7 +928,7 @@ public class WAttachment extends Window implements EventListener<Event>
WEMailDialog dialog = new WEMailDialog (Msg.getMsg(Env.getCtx(), "SendMail"), WEMailDialog dialog = new WEMailDialog (Msg.getMsg(Env.getCtx(), "SendMail"),
from, "", "", "", new FileDataSource(attachment), from, "", "", "", new FileDataSource(attachment),
m_WindowNo, m_attachment.getAD_Table_ID(), m_attachment.getRecord_ID(), null); m_WindowNo, m_attachment.getAD_Table_ID(), m_attachment.getRecord_ID(), m_attachment.getRecord_UU(), null);
AEnv.showWindow(dialog); AEnv.showWindow(dialog);
} }

View File

@ -138,9 +138,29 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
*/ */
public WEMailDialog(String title, MUser from, String to, String subject, String message, DataSource attachment, public WEMailDialog(String title, MUser from, String to, String subject, String message, DataSource attachment,
int m_WindowNo, int ad_Table_ID, int record_ID, PrintInfo printInfo) { int m_WindowNo, int ad_Table_ID, int record_ID, PrintInfo printInfo) {
this(title, from, to, subject, message, attachment, m_WindowNo, ad_Table_ID, record_ID, null, printInfo);
}
/**
* EMail Dialog
* @param title title
* @param from from
* @param to to
* @param subject subject
* @param message message
* @param attachment optional attachment
* @param m_WindowNo
* @param ad_Table_ID
* @param record_ID
* @param record_UU
* @param printInfo
*/
public WEMailDialog(String title, MUser from, String to, String subject, String message, DataSource attachment,
int m_WindowNo, int ad_Table_ID, int record_ID, String record_UU, PrintInfo printInfo) {
super(); super();
this.m_AD_Table_ID = ad_Table_ID; this.m_AD_Table_ID = ad_Table_ID;
this.m_Record_ID = record_ID; this.m_Record_ID = record_ID;
this.m_Record_UU = record_UU;
this.setTitle(title); this.setTitle(title);
this.setSclass("popup-dialog email-dialog"); this.setSclass("popup-dialog email-dialog");
this.setClosable(true); this.setClosable(true);
@ -167,7 +187,7 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
commonInit(from, to, subject, message, attachment); commonInit(from, to, subject, message, attachment);
clearEMailContext(m_WindowNo); clearEMailContext(m_WindowNo);
sendEvent(m_WindowNo, m_AD_Table_ID, m_Record_ID, null, ""); sendEvent(m_WindowNo, m_AD_Table_ID, m_Record_ID, m_Record_UU, null, "");
setValuesFromContext(m_WindowNo); setValuesFromContext(m_WindowNo);
} }
@ -224,6 +244,7 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
private String m_subject; private String m_subject;
private String m_message; private String m_message;
private int m_Record_ID; private int m_Record_ID;
private String m_Record_UU;
private int m_AD_Table_ID; private int m_AD_Table_ID;
/** File to be optionally attached */ /** File to be optionally attached */
private DataSource m_attachment; private DataSource m_attachment;
@ -952,12 +973,12 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
* @param windowNo * @param windowNo
* @param tableId * @param tableId
* @param recordId * @param recordId
* @param recordUU
* @param printInfo * @param printInfo
* @param subject * @param subject
*/ */
private void sendEvent(int windowNo, int tableId, int recordId, PrintInfo printInfo, String subject) { private void sendEvent(int windowNo, int tableId, int recordId, String recordUU, PrintInfo printInfo, String subject) {
ReportSendEMailEventData eventData = new ReportSendEMailEventData(windowNo, tableId, recordId, printInfo, ReportSendEMailEventData eventData = new ReportSendEMailEventData(windowNo, tableId, recordId, recordUU, printInfo, subject);
subject);
org.osgi.service.event.Event event = EventManager.newEvent(IEventTopics.REPORT_SEND_EMAIL, eventData); org.osgi.service.event.Event event = EventManager.newEvent(IEventTopics.REPORT_SEND_EMAIL, eventData);
EventManager.getInstance().sendEvent(event); EventManager.getInstance().sendEvent(event);
} }

View File

@ -643,7 +643,8 @@ public class ZkJRViewer extends Window implements EventListener<Event>, ITabOnCl
WEMailDialog dialog = new WEMailDialog (Msg.getMsg(Env.getCtx(), "SendMail"), WEMailDialog dialog = new WEMailDialog (Msg.getMsg(Env.getCtx(), "SendMail"),
from, to, subject, "", new FileDataSource(attachment), from, to, subject, "", new FileDataSource(attachment),
m_WindowNo, m_printInfo.getAD_Table_ID(), m_printInfo.getRecord_ID(), m_printInfo); m_WindowNo, m_printInfo.getAD_Table_ID(), m_printInfo.getRecord_ID(),
m_printInfo.getRecord_UU(), m_printInfo);
AEnv.showWindow(dialog); AEnv.showWindow(dialog);
} // cmd_sendMail } // cmd_sendMail

View File

@ -1315,7 +1315,9 @@ public class ZkReportViewer extends Window implements EventListener<Event>, IRep
WEMailDialog dialog = new WEMailDialog (Msg.getMsg(Env.getCtx(), "SendMail"), WEMailDialog dialog = new WEMailDialog (Msg.getMsg(Env.getCtx(), "SendMail"),
from, to, subject, message, new FileDataSource(attachment), from, to, subject, message, new FileDataSource(attachment),
m_WindowNo, m_reportEngine.getPrintInfo().getAD_Table_ID(), m_WindowNo, m_reportEngine.getPrintInfo().getAD_Table_ID(),
m_reportEngine.getPrintInfo().getRecord_ID(), m_reportEngine.getPrintInfo()); m_reportEngine.getPrintInfo().getRecord_ID(),
m_reportEngine.getPrintInfo().getRecord_UU(),
m_reportEngine.getPrintInfo());
AEnv.showWindow(dialog); AEnv.showWindow(dialog);
} // cmd_sendMail } // cmd_sendMail

View File

@ -30,6 +30,7 @@ import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.TimeUtil; import org.compiere.util.TimeUtil;
import org.compiere.util.Util;
public class Archive { public class Archive {
@ -43,6 +44,8 @@ public class Archive {
protected int m_AD_Table_ID = 0; protected int m_AD_Table_ID = 0;
/** Record direct */ /** Record direct */
protected int m_Record_ID = 0; protected int m_Record_ID = 0;
/** Record UUID */
protected String m_Record_UU = null;
/** Logger */ /** Logger */
protected static final CLogger log = CLogger.getCLogger(Archive.class); protected static final CLogger log = CLogger.getCLogger(Archive.class);
@ -175,6 +178,8 @@ public class Archive {
sql.append(" AND ((AD_Table_ID=").append(m_AD_Table_ID); sql.append(" AND ((AD_Table_ID=").append(m_AD_Table_ID);
if (m_Record_ID > 0) if (m_Record_ID > 0)
sql.append(" AND Record_ID=").append(m_Record_ID); sql.append(" AND Record_ID=").append(m_Record_ID);
if (!Util.isEmpty(m_Record_UU))
sql.append(" AND Record_UU=").append(DB.TO_STRING(m_Record_UU));
sql.append(")"); sql.append(")");
if (m_AD_Table_ID == MBPartner.Table_ID && m_Record_ID > 0) if (m_AD_Table_ID == MBPartner.Table_ID && m_Record_ID > 0)
sql.append(" OR C_BPartner_ID=").append(m_Record_ID); sql.append(" OR C_BPartner_ID=").append(m_Record_ID);
@ -182,6 +187,7 @@ public class Archive {
// Reset for query // Reset for query
m_AD_Table_ID = 0; m_AD_Table_ID = 0;
m_Record_ID = 0; m_Record_ID = 0;
m_Record_UU = null;
} }
else else
{ {

View File

@ -444,39 +444,41 @@ public final class DictionaryIDs {
} }
public enum M_Product { public enum M_Product {
STANDARD(122), STANDARD(122,"c713192a-9ed3-4740-ad32-9583c30d0206"),
OAK(123), OAK(123,"220b7a9a-4917-4bb2-b431-1426afacd7b8"),
ELM(124), ELM(124,"2e706162-5fcf-433e-903e-f8700e7ed4ad"),
GRASS(125), GRASS(125,"a81f9ffd-b2a3-41fa-8520-b32621a4f51b"),
PLANTING(126), PLANTING(126,"75578656-51c3-49b1-8a87-f45bc38613a1"),
ROSE_BUSH(127), ROSE_BUSH(127,"1d267d9d-d444-464a-8a07-c92d7d212cf8"),
AZALEA_BUSH(128), AZALEA_BUSH(128,"edcd645a-213a-4b4c-8a15-f979c5e4a727"),
HOLLY_BUSH(129), HOLLY_BUSH(129,"aa32010a-c8a9-4d63-9b25-677a513be556"),
PLUM_TREE(130), PLUM_TREE(130,"cd3edcee-bb8d-4c55-95fb-7b37f69a9a90"),
TRAVEL(131), TRAVEL(131,"77858609-ff72-45a1-a803-fb16df1bef90"),
MARY(132), MARY(132,"fe577e00-b949-40ee-86b0-0c25a0f6831a"),
P_CHAIR(133), P_CHAIR(133,"a4794a39-658e-4244-ba19-386bb93706c1"),
P_TABLE(134), P_TABLE(134,"01254fee-c75f-42f0-941c-142e27078643"),
SCREEN(135), SCREEN(135,"3147635c-ab6e-4bee-9682-13b20d3add0b"),
FERTILIZER_50(136), FERTILIZER_50(136,"31fda1eb-715c-42d1-b846-0c4dd11b2ec8"),
MULCH(137), MULCH(137,"26a7e6d7-e2c1-4c21-97f2-773dc222e6a2"),
HOE(138), HOE(138,"7ec2b803-d69c-435f-8b23-83ca38997aa7"),
RAKE_BAMBOO(139), RAKE_BAMBOO(139,"d12f4691-5b0c-408f-8b05-4e8307df086c"),
RAKE_METAL(140), RAKE_METAL(140,"ac55361b-0dc9-4622-bc16-c4ba3efc091d"),
WEEDER(141), WEEDER(141,"3aabcc6a-5671-4742-abfd-c8b21c2d3be7"),
TRANSPLANTER(142), TRANSPLANTER(142,"abcac8f4-513c-440e-b4fd-02ed8b694060"),
SEEDER(143), SEEDER(143,"06ec5b0d-acd1-4b1a-b457-4340f3259872"),
TILLER(144), TILLER(144,"6d716b98-3fac-4ee5-8b44-8a8af196df12"),
PATIOSET(145), PATIOSET(145,"f254b06d-110d-486a-9dfb-d4d760228fbb"),
DOC(146), DOC(146,"c3ed3055-c11a-498e-a506-25ea570e0765"),
TSHIRT_RL(147), TSHIRT_RL(147,"402ccffb-16be-42df-917f-69a42f3c4124"),
TSHIRT_GL(148), TSHIRT_GL(148,"128a4a31-58d1-4967-8793-c13ed65faa5d"),
ASSET_VEHICLE(200001); ASSET_VEHICLE(200001,"fa1fe0de-9c64-4c9d-a17f-125f8a0e630a");
public final int id; public final int id;
public final String uuid;
private M_Product(int id) { private M_Product(int id, String uuid) {
this.id = id; this.id = id;
this.uuid = uuid;
} }
} }

View File

@ -41,20 +41,21 @@ public class MArchiveTest extends AbstractTestCase {
@Test @Test
public void testArchive() { public void testArchive() {
int allReportCount = MArchive.getReportCountByTableId(MProduct.Table_ID, getTrxName()); int allReportCount = MArchive.getReportCountByTableId(MProduct.Table_ID, getTrxName());
int[] recordCounts = MArchive.getReportAndDocumentCountByRecordId(MProduct.Table_ID, DictionaryIDs.M_Product.AZALEA_BUSH.id, getTrxName()); int[] recordCounts = MArchive.getReportAndDocumentCountByRecordId(MProduct.Table_ID, DictionaryIDs.M_Product.AZALEA_BUSH.id, DictionaryIDs.M_Product.AZALEA_BUSH.uuid, getTrxName());
MArchive marchive = new MArchive(Env.getCtx(), 0, getTrxName()); MArchive marchive = new MArchive(Env.getCtx(), 0, getTrxName());
marchive.setAD_Table_ID(MProduct.Table_ID); marchive.setAD_Table_ID(MProduct.Table_ID);
marchive.setIsReport(true); marchive.setIsReport(true);
marchive.setName(getClass().getName()); marchive.setName(getClass().getName());
marchive.setRecord_ID(DictionaryIDs.M_Product.AZALEA_BUSH.id); marchive.setRecord_ID(DictionaryIDs.M_Product.AZALEA_BUSH.id);
marchive.setRecord_UU(DictionaryIDs.M_Product.AZALEA_BUSH.uuid);
marchive.setBinaryData("test".getBytes()); marchive.setBinaryData("test".getBytes());
marchive.saveEx(); marchive.saveEx();
int allReportCount1 = MArchive.getReportCountByTableId(MProduct.Table_ID, getTrxName()); int allReportCount1 = MArchive.getReportCountByTableId(MProduct.Table_ID, getTrxName());
assertEquals(allReportCount+1, allReportCount1, "Unexpected all archive report counts by table"); assertEquals(allReportCount+1, allReportCount1, "Unexpected all archive report counts by table");
int[] recordCounts1 = MArchive.getReportAndDocumentCountByRecordId(MProduct.Table_ID, DictionaryIDs.M_Product.AZALEA_BUSH.id, getTrxName()); int[] recordCounts1 = MArchive.getReportAndDocumentCountByRecordId(MProduct.Table_ID, DictionaryIDs.M_Product.AZALEA_BUSH.id, DictionaryIDs.M_Product.AZALEA_BUSH.uuid, getTrxName());
assertEquals(recordCounts[0]+1, recordCounts1[0], "Unexpected archive report counts by table and record id"); assertEquals(recordCounts[0]+1, recordCounts1[0], "Unexpected archive report counts by table and record id");
assertEquals(recordCounts[1], recordCounts1[1], "Unexpected archive document counts by table and record id"); assertEquals(recordCounts[1], recordCounts1[1], "Unexpected archive document counts by table and record id");
@ -63,10 +64,11 @@ public class MArchiveTest extends AbstractTestCase {
marchive.setIsReport(false); marchive.setIsReport(false);
marchive.setName(getClass().getName()); marchive.setName(getClass().getName());
marchive.setRecord_ID(DictionaryIDs.M_Product.AZALEA_BUSH.id); marchive.setRecord_ID(DictionaryIDs.M_Product.AZALEA_BUSH.id);
marchive.setRecord_UU(DictionaryIDs.M_Product.AZALEA_BUSH.uuid);
marchive.setBinaryData("test1".getBytes()); marchive.setBinaryData("test1".getBytes());
marchive.saveEx(); marchive.saveEx();
recordCounts1 = MArchive.getReportAndDocumentCountByRecordId(MProduct.Table_ID, DictionaryIDs.M_Product.AZALEA_BUSH.id, getTrxName()); recordCounts1 = MArchive.getReportAndDocumentCountByRecordId(MProduct.Table_ID, DictionaryIDs.M_Product.AZALEA_BUSH.id, DictionaryIDs.M_Product.AZALEA_BUSH.uuid, getTrxName());
assertEquals(recordCounts[0]+1, recordCounts1[0], "Unexpected archive report counts by table and record id"); assertEquals(recordCounts[0]+1, recordCounts1[0], "Unexpected archive report counts by table and record id");
assertEquals(recordCounts[1]+1, recordCounts1[1], "Unexpected archive document counts by table and record id"); assertEquals(recordCounts[1]+1, recordCounts1[1], "Unexpected archive document counts by table and record id");
} }