IDEMPIERE-6013 Implement a way to filter dinamically records on MRole.addAccessSQL (#2209)

* IDEMPIERE-6013 Implement a way to filter dinamically records on MRole.addAccessSQL

* - do not create sequence

* - move scripts to r11
This commit is contained in:
Carlos Ruiz 2024-02-17 12:14:31 +01:00
parent 34492d1cbf
commit fa09eb5187
6 changed files with 1129 additions and 0 deletions

View File

@ -0,0 +1,244 @@
-- IDEMPIERE-6013 Implement a way to filter dinamically records on MRole.addAccessSQL
SELECT register_migration_script('202401251553_IDEMPIERE-6013.sql') FROM dual;
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Jan 25, 2024, 3:53:32 PM CET
INSERT INTO AD_Window (AD_Window_ID,Name,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,WindowType,Processing,EntityType,IsSOTrx,IsDefault,IsBetaFunctionality,AD_Window_UU) VALUES (200150,'Dynamic Validation per Table',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:32','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:32','YYYY-MM-DD HH24:MI:SS'),100,'M','N','D','Y','N','N','7d7acdf6-a331-49dc-a3c8-0b5ce376ddc9')
;
-- Jan 25, 2024, 3:53:33 PM CET
INSERT INTO AD_Table (AD_Table_ID,Name,AD_Window_ID,TableName,LoadSeq,AccessLevel,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSecurityEnabled,IsDeleteable,IsHighVolume,IsView,EntityType,ImportTable,IsChangeLog,ReplicationType,CopyColumnsFromTable,IsCentrallyMaintained,AD_Table_UU,Processing,DatabaseViewDrop,CopyComponentsFromView,CreateWindowFromTable,IsShowInDrillOptions,IsPartition,CreatePartition) VALUES (200415,'Dynamic Validation per Table',200150,'AD_TableValRule',0,'6',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:33','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:33','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','N','N','D','N','Y','L','N','Y','42023256-9f38-4db3-907e-6758ef65c934','N','N','N','N','N','N','N')
;
-- Jan 25, 2024, 3:53:34 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,ReadOnlyLogic,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintName,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216445,0.0,'Tenant','Tenant for this installation.','A Tenant is a company or a legal entity. You cannot share data between Tenants.',200415,'AD_Client_ID','@#AD_Client_ID@',10,'N','N','Y','N','N','N',30,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:34','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:34','YYYY-MM-DD HH24:MI:SS'),100,102,'N','N','1=1','D','Y','N','N','Y','3da0fdb2-d027-4c60-af5c-7e44b5f0a1e1','N','N','N','ADClient_ADTableValRule','N','N','N')
;
-- Jan 25, 2024, 3:53:34 PM CET
CREATE TABLE AD_TableValRule (AD_Client_ID NUMBER(10) NOT NULL)
;
-- Jan 25, 2024, 3:53:35 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintName,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216446,0.0,'Organization','Organizational entity within tenant','An organization is a unit of your tenant or legal entity - examples are store, department. You can share data between organizations.',200415,'AD_Org_ID','@AD_Org_ID@',10,'N','N','Y','N','N','N',19,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:34','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:34','YYYY-MM-DD HH24:MI:SS'),100,113,'N','N','D','Y','N','N','Y','5706e86f-6f5c-476e-89e1-fd5fb8bbb165','N','N','N','ADOrg_ADTableValRule','N','N','N')
;
-- Jan 25, 2024, 3:53:35 PM CET
ALTER TABLE AD_TableValRule ADD AD_Org_ID NUMBER(10) NOT NULL
;
-- Jan 25, 2024, 3:53:35 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216447,0.0,'Created','Date this record was created','The Created field indicates the date that this record was created.',200415,'Created',7,'N','N','Y','N','N','N',16,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:35','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:35','YYYY-MM-DD HH24:MI:SS'),100,245,'N','N','D','Y','N','N','Y','038379c3-b03f-459e-bcd1-0e64f4c728b4','N','N','N','N','N','N')
;
-- Jan 25, 2024, 3:53:35 PM CET
ALTER TABLE AD_TableValRule ADD Created DATE NOT NULL
;
-- Jan 25, 2024, 3:53:36 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintName,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216448,0.0,'Created By','User who created this records','The Created By field indicates the user who created this record.',200415,'CreatedBy',10,'N','N','Y','N','N','N',30,110,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:35','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:35','YYYY-MM-DD HH24:MI:SS'),100,246,'N','N','D','Y','N','N','Y','73139319-8b80-4546-8be5-ee4febbf1687','N','N','N','CreatedBy_ADTableValRule','N','N','N')
;
-- Jan 25, 2024, 3:53:36 PM CET
ALTER TABLE AD_TableValRule ADD CreatedBy NUMBER(10) NOT NULL
;
-- Jan 25, 2024, 3:53:36 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216449,0.0,'Updated','Date this record was updated','The Updated field indicates the date that this record was updated.',200415,'Updated',7,'N','N','Y','N','N','N',16,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:36','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:36','YYYY-MM-DD HH24:MI:SS'),100,607,'N','N','D','Y','N','N','Y','d0de3c6e-8e0d-4f58-b48b-07222bfe9bda','N','N','N','N','N','N')
;
-- Jan 25, 2024, 3:53:36 PM CET
ALTER TABLE AD_TableValRule ADD Updated DATE NOT NULL
;
-- Jan 25, 2024, 3:53:37 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintName,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216450,0.0,'Updated By','User who updated this records','The Updated By field indicates the user who updated this record.',200415,'UpdatedBy',10,'N','N','Y','N','N','N',30,110,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:36','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:36','YYYY-MM-DD HH24:MI:SS'),100,608,'N','N','D','Y','N','N','Y','3200f9c8-3d92-4a05-bdc5-2c05682d7ba2','N','N','N','UpdatedBy_ADTableValRule','N','N','N')
;
-- Jan 25, 2024, 3:53:37 PM CET
ALTER TABLE AD_TableValRule ADD UpdatedBy NUMBER(10) NOT NULL
;
-- Jan 25, 2024, 3:53:37 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216451,0.0,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports.
There are two reasons for de-activating and not deleting records:
(1) The system requires the record for audit purposes.
(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200415,'IsActive','Y',1,'N','N','Y','N','N','N',20,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:37','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:37','YYYY-MM-DD HH24:MI:SS'),100,348,'Y','N','D','Y','N','N','Y','65da9adc-d313-44c4-8c3b-40a5d0655a99','N','N','N','N','N','N')
;
-- Jan 25, 2024, 3:53:37 PM CET
ALTER TABLE AD_TableValRule ADD IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')) NOT NULL
;
-- Jan 25, 2024, 3:53:37 PM CET
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203905,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:37','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:37','YYYY-MM-DD HH24:MI:SS'),100,'AD_TableValRule_UU','AD_TableValRule_UU','AD_TableValRule_UU','D','cb4a6da9-64a3-4003-8642-25478dd3a7f9')
;
-- Jan 25, 2024, 3:53:38 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216452,0.0,'AD_TableValRule_UU',200415,'AD_TableValRule_UU',36,'N','N','N','N','N','N',200231,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:37','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:37','YYYY-MM-DD HH24:MI:SS'),100,203905,'Y','N','D','Y','N','N','Y','42c87f0a-9754-4f27-a859-1205989f5074','N','N','N','N','N','N')
;
-- Jan 25, 2024, 3:53:38 PM CET
ALTER TABLE AD_TableValRule ADD AD_TableValRule_UU VARCHAR2(36 CHAR) DEFAULT NULL
;
-- Jan 25, 2024, 3:53:38 PM CET
ALTER TABLE AD_TableValRule ADD CONSTRAINT AD_TableValRule_UU_idx UNIQUE (AD_TableValRule_UU)
;
-- Jan 25, 2024, 3:53:38 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216453,0.0,'Description','Optional short description of the record','A description is limited to 255 characters.',200415,'Description',255,'N','N','N','N','N','N',10,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:38','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:38','YYYY-MM-DD HH24:MI:SS'),100,275,'Y','N','D','Y','N','N','Y','4d32c358-8b59-4e15-bb61-c44f3b9327ea','Y','N','N','N','N','N')
;
-- Jan 25, 2024, 3:53:38 PM CET
ALTER TABLE AD_TableValRule ADD Description VARCHAR2(255 CHAR) DEFAULT NULL
;
-- Jan 25, 2024, 3:53:39 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,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,FKConstraintName,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216454,0,'Table','Database Table information','The Database Table provides the information of the table definition',200415,'AD_Table_ID',10,'N','N','Y','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:38','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:38','YYYY-MM-DD HH24:MI:SS'),100,126,'Y','N','D','Y','N','N','Y','a5f38788-d59d-40d1-ac82-1c07e5b795ec','Y',0,'N','N','ADTable_ADTableValRule','N','N','N')
;
-- Jan 25, 2024, 3:53:39 PM CET
ALTER TABLE AD_TableValRule ADD AD_Table_ID NUMBER(10) NOT NULL
;
-- Jan 25, 2024, 3:53:39 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,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,IsPartitionKey) VALUES (216455,0,'Validation code','Validation Code','The Validation Code displays the date, time and message of the error.',200415,'Code',4000,'N','N','Y','N','N',0,'N',10,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:39','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:39','YYYY-MM-DD HH24:MI:SS'),100,227,'Y','N','D','Y','N','N','Y','f5dae707-97a4-4cd7-836b-e3c759bfadd0','Y',0,'N','N','N','N','N')
;
-- Jan 25, 2024, 3:53:39 PM CET
ALTER TABLE AD_TableValRule ADD Code VARCHAR2(4000 CHAR) NOT NULL
;
-- Jan 25, 2024, 3:53:39 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,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,FKConstraintName,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216456,0,'Role','Responsibility Role','The Role determines security and access a user who has this Role will have in the System.',200415,'AD_Role_ID','NULL',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:39','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:39','YYYY-MM-DD HH24:MI:SS'),100,123,'Y','N','D','Y','N','N','Y','537b6ba6-d9a6-4b4b-8482-7f97bc1d90cc','Y',0,'N','N','ADRole_ADTableValRule','C','N','N')
;
-- Jan 25, 2024, 3:53:40 PM CET
ALTER TABLE AD_TableValRule ADD AD_Role_ID NUMBER(10) DEFAULT NULL
;
-- Jan 25, 2024, 3:53:40 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,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,FKConstraintName,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216457,0,'User/Contact','User within the system - Internal or Business Partner Contact','The User identifies a unique user in the system. This could be an internal user or a business partner contact',200415,'AD_User_ID','NULL',22,'N','N','N','N','N',0,'N',30,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:40','YYYY-MM-DD HH24:MI:SS'),100,138,'Y','N','D','Y','N','N','Y','9ae5e470-5185-4015-bd5f-b88cc1728cce','Y',0,'N','N','ADUser_ADTableValRule','N','N','N')
;
-- Jan 25, 2024, 3:53:40 PM CET
ALTER TABLE AD_TableValRule ADD AD_User_ID NUMBER(10) DEFAULT NULL
;
-- Jan 25, 2024, 3:53:40 PM CET
INSERT INTO AD_TableIndex (AD_Client_ID,AD_Org_ID,AD_TableIndex_ID,AD_TableIndex_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Table_ID,IsCreateConstraint,IsUnique,Processing,IsKey) VALUES (0,0,201269,'e3e8630e-49ee-431b-992d-81476a16a701',TO_TIMESTAMP('2024-01-25 15:53:40','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','AD_TableValRule_uu_idx',TO_TIMESTAMP('2024-01-25 15:53:40','YYYY-MM-DD HH24:MI:SS'),100,200415,'Y','Y','N','Y')
;
-- Jan 25, 2024, 3:53:41 PM CET
INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201722,'0f4ab741-34bb-4a58-a7c6-e21a5f9097d0',TO_TIMESTAMP('2024-01-25 15:53:40','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2024-01-25 15:53:40','YYYY-MM-DD HH24:MI:SS'),100,216452,201269,10)
;
-- Jan 25, 2024, 3:53:41 PM CET
INSERT INTO AD_TableIndex (AD_Client_ID,AD_Org_ID,AD_TableIndex_ID,AD_TableIndex_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Table_ID,IsCreateConstraint,IsUnique,Processing,TableIndexDrop,IsKey) VALUES (0,0,201270,'58c81ee9-9e77-4bfe-845c-5283cb46e2c2',TO_TIMESTAMP('2024-01-25 15:53:41','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','AD_TableValRule_Unq',TO_TIMESTAMP('2024-01-25 15:53:41','YYYY-MM-DD HH24:MI:SS'),100,200415,'N','Y','N','N','N')
;
-- Jan 25, 2024, 3:53:41 PM CET
INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201723,'c72e5505-c213-45bf-8ba3-31b6215774f6',TO_TIMESTAMP('2024-01-25 15:53:41','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2024-01-25 15:53:41','YYYY-MM-DD HH24:MI:SS'),100,216454,201270,10)
;
-- Jan 25, 2024, 3:53:42 PM CET
INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201724,'a958a52a-e176-4e56-9cb9-7a90a3f901f9',TO_TIMESTAMP('2024-01-25 15:53:41','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2024-01-25 15:53:41','YYYY-MM-DD HH24:MI:SS'),100,216445,201270,20)
;
-- Jan 25, 2024, 3:53:42 PM CET
INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,ColumnSQL,SeqNo) VALUES (0,0,201725,'dd86e335-e80a-4b76-8f3d-a8255808a148',TO_TIMESTAMP('2024-01-25 15:53:42','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2024-01-25 15:53:42','YYYY-MM-DD HH24:MI:SS'),100,216456,201270,'COALESCE(AD_Role_ID,-1)',30)
;
-- Jan 25, 2024, 3:53:42 PM CET
INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,ColumnSQL,SeqNo) VALUES (0,0,201726,'0201f3ef-8a68-49f5-bec2-a3554188d848',TO_TIMESTAMP('2024-01-25 15:53:42','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2024-01-25 15:53:42','YYYY-MM-DD HH24:MI:SS'),100,216457,201270,'COALESCE(AD_User_ID,-1)',40)
;
-- Jan 25, 2024, 3:53:42 PM CET
CREATE UNIQUE INDEX AD_TableValRule_Unq ON AD_TableValRule (AD_Table_ID,AD_Client_ID,COALESCE(AD_Role_ID,-1),COALESCE(AD_User_ID,-1))
;
-- Jan 25, 2024, 3:53:43 PM CET
INSERT INTO AD_Tab (AD_Tab_ID,Name,AD_Window_ID,SeqNo,IsSingleRow,AD_Table_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,HasTree,IsInfoTab,IsTranslationTab,IsReadOnly,OrderByClause,Processing,TabLevel,IsSortTab,EntityType,IsInsertRecord,IsAdvancedTab,AD_Tab_UU,TreeDisplayedOn,IsLookupOnlySelection,IsAllowAdvancedLookup,MaxQueryRecords) VALUES (200385,'Dynamic Validation per Table',200150,10,'Y',200415,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:42','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:42','YYYY-MM-DD HH24:MI:SS'),100,'N','N','N','N','AD_TableValRule.Created DESC','N',0,'N','D','Y','Y','72743e37-0045-4f00-b049-0d00b10d845b','B','N','Y',0)
;
-- Jan 25, 2024, 3:53:43 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (208355,'AD_TableValRule_UU',200385,216452,'N',36,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:43','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:43','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','a648d911-37b4-48c7-972a-4446ea8b2ee2','N',1,2,1,'N','N','N','N')
;
-- Jan 25, 2024, 3:53:43 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (208356,'Tenant','Tenant for this installation.','A Tenant is a company or a legal entity. You cannot share data between Tenants.',200385,216445,'Y',10,10,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:43','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:43','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','689964ca-3099-46ba-ab4f-7421fa3edc35','Y',10,1,2,1,'N','N','N','N')
;
-- Jan 25, 2024, 3:53:44 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsAllowCopy,IsDisplayedGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (208357,'Organization','Organizational entity within tenant','An organization is a unit of your tenant or legal entity - examples are store, department. You can share data between organizations.',200385,216446,'Y',10,20,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:43','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:43','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','a8807d22-5c3d-4711-99d3-85f5e87cf340','Y','N',4,2,1,'N','N','N','N')
;
-- Jan 25, 2024, 3:53:44 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (208358,'Table','Database Table information','The Database Table provides the information of the table definition',200385,216454,'Y',10,30,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:44','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:44','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','d4c082b5-c333-4584-8c29-d5804aa8f77e','Y',40,1,2,1,'N','N','N','N')
;
-- Jan 25, 2024, 3:53:45 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (208359,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports.
There are two reasons for de-activating and not deleting records:
(1) The system requires the record for audit purposes.
(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200385,216451,'Y',1,40,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:44','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:44','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','2ce3d4ca-431d-4955-9f7b-7fd9129926a1','Y',80,5,2,1,'N','N','N','N')
;
-- Jan 25, 2024, 3:53:45 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (208360,'Role','Responsibility Role','The Role determines security and access a user who has this Role will have in the System.',200385,216456,'Y',22,50,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:45','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:45','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','67a35371-6841-4cee-b22d-12ed859c3047','Y',60,1,2,1,'N','N','N','N')
;
-- Jan 25, 2024, 3:53:45 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (208361,'User/Contact','User within the system - Internal or Business Partner Contact','The User identifies a unique user in the system. This could be an internal user or a business partner contact',200385,216457,'Y',22,60,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:45','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:45','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','f4356264-6227-408c-9768-5b7b1febc140','Y',70,1,2,1,'N','N','N','N')
;
-- Jan 25, 2024, 3:53:46 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (208362,'Description','Optional short description of the record','A description is limited to 255 characters.',200385,216453,'Y',255,70,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:45','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:45','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','9deb3d72-98e3-47e3-8e92-de733e1d0818','Y',20,1,5,1,'N','N','N','N')
;
-- Jan 25, 2024, 3:53:46 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (208363,'SQL Filter','SQL Filter','Enter a valid WHERE SQL fully qualified clause. The WHERE is not needed, the code will be surrounded within parenthesis before applied',200385,216455,'Y',4000,90,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:46','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:46','YYYY-MM-DD HH24:MI:SS'),100,'N','N','D','354c9fcc-9961-4c76-8040-3bc0727a8be0','Y',50,1,5,8,'N','N','N','N')
;
-- Jan 25, 2024, 3:53:46 PM CET
INSERT INTO AD_Menu (AD_Menu_ID,Name,Action,AD_Window_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSummary,IsSOTrx,IsReadOnly,EntityType,IsCentrallyMaintained,AD_Menu_UU) VALUES (200234,'Dynamic Validation per Table','W',200150,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:46','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:46','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','N','D','Y','a1cd8878-33b0-4228-9d0f-00aa536134c0')
;
-- Jan 25, 2024, 3:53:46 PM CET
UPDATE AD_TREENODEMM SET SeqNo=SeqNo+1 WHERE Parent_ID=367 AND SeqNo>=10 AND AD_Tree_ID=10
;
-- Jan 25, 2024, 3:53:46 PM CET
INSERT INTO AD_TreeNodeMM (AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Parent_ID,SeqNo,AD_Tree_ID,Node_ID,AD_Client_ID,AD_TreeNodeMM_UU) VALUES (0,'Y',TO_TIMESTAMP('2024-01-25 15:53:46','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:46','YYYY-MM-DD HH24:MI:SS'),100,367,10,10,200234,0,'b4f8ea74-a8d3-4d4a-a43b-9e1c09ec6ec0')
;
-- Jan 25, 2024, 3:53:46 PM CET
ALTER TABLE AD_TableValRule ADD CONSTRAINT ADClient_ADTableValRule FOREIGN KEY (AD_Client_ID) REFERENCES ad_client(ad_client_id) DEFERRABLE INITIALLY DEFERRED
;
-- Jan 25, 2024, 3:53:46 PM CET
ALTER TABLE AD_TableValRule ADD CONSTRAINT ADOrg_ADTableValRule FOREIGN KEY (AD_Org_ID) REFERENCES ad_org(ad_org_id) DEFERRABLE INITIALLY DEFERRED
;
-- Jan 25, 2024, 3:53:46 PM CET
ALTER TABLE AD_TableValRule ADD CONSTRAINT CreatedBy_ADTableValRule FOREIGN KEY (CreatedBy) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED
;
-- Jan 25, 2024, 3:53:46 PM CET
ALTER TABLE AD_TableValRule ADD CONSTRAINT UpdatedBy_ADTableValRule FOREIGN KEY (UpdatedBy) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED
;
-- Jan 25, 2024, 3:53:46 PM CET
ALTER TABLE AD_TableValRule ADD CONSTRAINT ADTable_ADTableValRule FOREIGN KEY (AD_Table_ID) REFERENCES ad_table(ad_table_id) DEFERRABLE INITIALLY DEFERRED
;
-- Jan 25, 2024, 3:53:46 PM CET
ALTER TABLE AD_TableValRule ADD CONSTRAINT ADRole_ADTableValRule FOREIGN KEY (AD_Role_ID) REFERENCES ad_role(ad_role_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
;
-- Jan 25, 2024, 3:53:47 PM CET
ALTER TABLE AD_TableValRule ADD CONSTRAINT ADUser_ADTableValRule FOREIGN KEY (AD_User_ID) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED
;

View File

@ -0,0 +1,241 @@
-- IDEMPIERE-6013 Implement a way to filter dinamically records on MRole.addAccessSQL
SELECT register_migration_script('202401251553_IDEMPIERE-6013.sql') FROM dual;
-- Jan 25, 2024, 3:53:32 PM CET
INSERT INTO AD_Window (AD_Window_ID,Name,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,WindowType,Processing,EntityType,IsSOTrx,IsDefault,IsBetaFunctionality,AD_Window_UU) VALUES (200150,'Dynamic Validation per Table',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:32','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:32','YYYY-MM-DD HH24:MI:SS'),100,'M','N','D','Y','N','N','7d7acdf6-a331-49dc-a3c8-0b5ce376ddc9')
;
-- Jan 25, 2024, 3:53:33 PM CET
INSERT INTO AD_Table (AD_Table_ID,Name,AD_Window_ID,TableName,LoadSeq,AccessLevel,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSecurityEnabled,IsDeleteable,IsHighVolume,IsView,EntityType,ImportTable,IsChangeLog,ReplicationType,CopyColumnsFromTable,IsCentrallyMaintained,AD_Table_UU,Processing,DatabaseViewDrop,CopyComponentsFromView,CreateWindowFromTable,IsShowInDrillOptions,IsPartition,CreatePartition) VALUES (200415,'Dynamic Validation per Table',200150,'AD_TableValRule',0,'6',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:33','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:33','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','N','N','D','N','Y','L','N','Y','42023256-9f38-4db3-907e-6758ef65c934','N','N','N','N','N','N','N')
;
-- Jan 25, 2024, 3:53:34 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,ReadOnlyLogic,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintName,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216445,0.0,'Tenant','Tenant for this installation.','A Tenant is a company or a legal entity. You cannot share data between Tenants.',200415,'AD_Client_ID','@#AD_Client_ID@',10,'N','N','Y','N','N','N',30,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:34','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:34','YYYY-MM-DD HH24:MI:SS'),100,102,'N','N','1=1','D','Y','N','N','Y','3da0fdb2-d027-4c60-af5c-7e44b5f0a1e1','N','N','N','ADClient_ADTableValRule','N','N','N')
;
-- Jan 25, 2024, 3:53:34 PM CET
CREATE TABLE AD_TableValRule (AD_Client_ID NUMERIC(10) NOT NULL)
;
-- Jan 25, 2024, 3:53:35 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintName,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216446,0.0,'Organization','Organizational entity within tenant','An organization is a unit of your tenant or legal entity - examples are store, department. You can share data between organizations.',200415,'AD_Org_ID','@AD_Org_ID@',10,'N','N','Y','N','N','N',19,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:34','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:34','YYYY-MM-DD HH24:MI:SS'),100,113,'N','N','D','Y','N','N','Y','5706e86f-6f5c-476e-89e1-fd5fb8bbb165','N','N','N','ADOrg_ADTableValRule','N','N','N')
;
-- Jan 25, 2024, 3:53:35 PM CET
ALTER TABLE AD_TableValRule ADD COLUMN AD_Org_ID NUMERIC(10) NOT NULL
;
-- Jan 25, 2024, 3:53:35 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216447,0.0,'Created','Date this record was created','The Created field indicates the date that this record was created.',200415,'Created',7,'N','N','Y','N','N','N',16,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:35','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:35','YYYY-MM-DD HH24:MI:SS'),100,245,'N','N','D','Y','N','N','Y','038379c3-b03f-459e-bcd1-0e64f4c728b4','N','N','N','N','N','N')
;
-- Jan 25, 2024, 3:53:35 PM CET
ALTER TABLE AD_TableValRule ADD COLUMN Created TIMESTAMP NOT NULL
;
-- Jan 25, 2024, 3:53:36 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintName,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216448,0.0,'Created By','User who created this records','The Created By field indicates the user who created this record.',200415,'CreatedBy',10,'N','N','Y','N','N','N',30,110,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:35','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:35','YYYY-MM-DD HH24:MI:SS'),100,246,'N','N','D','Y','N','N','Y','73139319-8b80-4546-8be5-ee4febbf1687','N','N','N','CreatedBy_ADTableValRule','N','N','N')
;
-- Jan 25, 2024, 3:53:36 PM CET
ALTER TABLE AD_TableValRule ADD COLUMN CreatedBy NUMERIC(10) NOT NULL
;
-- Jan 25, 2024, 3:53:36 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216449,0.0,'Updated','Date this record was updated','The Updated field indicates the date that this record was updated.',200415,'Updated',7,'N','N','Y','N','N','N',16,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:36','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:36','YYYY-MM-DD HH24:MI:SS'),100,607,'N','N','D','Y','N','N','Y','d0de3c6e-8e0d-4f58-b48b-07222bfe9bda','N','N','N','N','N','N')
;
-- Jan 25, 2024, 3:53:36 PM CET
ALTER TABLE AD_TableValRule ADD COLUMN Updated TIMESTAMP NOT NULL
;
-- Jan 25, 2024, 3:53:37 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintName,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216450,0.0,'Updated By','User who updated this records','The Updated By field indicates the user who updated this record.',200415,'UpdatedBy',10,'N','N','Y','N','N','N',30,110,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:36','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:36','YYYY-MM-DD HH24:MI:SS'),100,608,'N','N','D','Y','N','N','Y','3200f9c8-3d92-4a05-bdc5-2c05682d7ba2','N','N','N','UpdatedBy_ADTableValRule','N','N','N')
;
-- Jan 25, 2024, 3:53:37 PM CET
ALTER TABLE AD_TableValRule ADD COLUMN UpdatedBy NUMERIC(10) NOT NULL
;
-- Jan 25, 2024, 3:53:37 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216451,0.0,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports.
There are two reasons for de-activating and not deleting records:
(1) The system requires the record for audit purposes.
(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200415,'IsActive','Y',1,'N','N','Y','N','N','N',20,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:37','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:37','YYYY-MM-DD HH24:MI:SS'),100,348,'Y','N','D','Y','N','N','Y','65da9adc-d313-44c4-8c3b-40a5d0655a99','N','N','N','N','N','N')
;
-- Jan 25, 2024, 3:53:37 PM CET
ALTER TABLE AD_TableValRule ADD COLUMN IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')) NOT NULL
;
-- Jan 25, 2024, 3:53:37 PM CET
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203905,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:37','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:37','YYYY-MM-DD HH24:MI:SS'),100,'AD_TableValRule_UU','AD_TableValRule_UU','AD_TableValRule_UU','D','cb4a6da9-64a3-4003-8642-25478dd3a7f9')
;
-- Jan 25, 2024, 3:53:38 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216452,0.0,'AD_TableValRule_UU',200415,'AD_TableValRule_UU',36,'N','N','N','N','N','N',200231,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:37','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:37','YYYY-MM-DD HH24:MI:SS'),100,203905,'Y','N','D','Y','N','N','Y','42c87f0a-9754-4f27-a859-1205989f5074','N','N','N','N','N','N')
;
-- Jan 25, 2024, 3:53:38 PM CET
ALTER TABLE AD_TableValRule ADD COLUMN AD_TableValRule_UU VARCHAR(36) DEFAULT NULL
;
-- Jan 25, 2024, 3:53:38 PM CET
ALTER TABLE AD_TableValRule ADD CONSTRAINT AD_TableValRule_UU_idx UNIQUE (AD_TableValRule_UU)
;
-- Jan 25, 2024, 3:53:38 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216453,0.0,'Description','Optional short description of the record','A description is limited to 255 characters.',200415,'Description',255,'N','N','N','N','N','N',10,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:38','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:38','YYYY-MM-DD HH24:MI:SS'),100,275,'Y','N','D','Y','N','N','Y','4d32c358-8b59-4e15-bb61-c44f3b9327ea','Y','N','N','N','N','N')
;
-- Jan 25, 2024, 3:53:38 PM CET
ALTER TABLE AD_TableValRule ADD COLUMN Description VARCHAR(255) DEFAULT NULL
;
-- Jan 25, 2024, 3:53:39 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,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,FKConstraintName,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216454,0,'Table','Database Table information','The Database Table provides the information of the table definition',200415,'AD_Table_ID',10,'N','N','Y','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:38','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:38','YYYY-MM-DD HH24:MI:SS'),100,126,'Y','N','D','Y','N','N','Y','a5f38788-d59d-40d1-ac82-1c07e5b795ec','Y',0,'N','N','ADTable_ADTableValRule','N','N','N')
;
-- Jan 25, 2024, 3:53:39 PM CET
ALTER TABLE AD_TableValRule ADD COLUMN AD_Table_ID NUMERIC(10) NOT NULL
;
-- Jan 25, 2024, 3:53:39 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,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,IsPartitionKey) VALUES (216455,0,'Validation code','Validation Code','The Validation Code displays the date, time and message of the error.',200415,'Code',4000,'N','N','Y','N','N',0,'N',10,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:39','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:39','YYYY-MM-DD HH24:MI:SS'),100,227,'Y','N','D','Y','N','N','Y','f5dae707-97a4-4cd7-836b-e3c759bfadd0','Y',0,'N','N','N','N','N')
;
-- Jan 25, 2024, 3:53:39 PM CET
ALTER TABLE AD_TableValRule ADD COLUMN Code VARCHAR(4000) NOT NULL
;
-- Jan 25, 2024, 3:53:39 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,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,FKConstraintName,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216456,0,'Role','Responsibility Role','The Role determines security and access a user who has this Role will have in the System.',200415,'AD_Role_ID','NULL',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:39','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:39','YYYY-MM-DD HH24:MI:SS'),100,123,'Y','N','D','Y','N','N','Y','537b6ba6-d9a6-4b4b-8482-7f97bc1d90cc','Y',0,'N','N','ADRole_ADTableValRule','C','N','N')
;
-- Jan 25, 2024, 3:53:40 PM CET
ALTER TABLE AD_TableValRule ADD COLUMN AD_Role_ID NUMERIC(10) DEFAULT NULL
;
-- Jan 25, 2024, 3:53:40 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,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,FKConstraintName,FKConstraintType,IsHtml,IsPartitionKey) VALUES (216457,0,'User/Contact','User within the system - Internal or Business Partner Contact','The User identifies a unique user in the system. This could be an internal user or a business partner contact',200415,'AD_User_ID','NULL',22,'N','N','N','N','N',0,'N',30,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:40','YYYY-MM-DD HH24:MI:SS'),100,138,'Y','N','D','Y','N','N','Y','9ae5e470-5185-4015-bd5f-b88cc1728cce','Y',0,'N','N','ADUser_ADTableValRule','N','N','N')
;
-- Jan 25, 2024, 3:53:40 PM CET
ALTER TABLE AD_TableValRule ADD COLUMN AD_User_ID NUMERIC(10) DEFAULT NULL
;
-- Jan 25, 2024, 3:53:40 PM CET
INSERT INTO AD_TableIndex (AD_Client_ID,AD_Org_ID,AD_TableIndex_ID,AD_TableIndex_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Table_ID,IsCreateConstraint,IsUnique,Processing,IsKey) VALUES (0,0,201269,'e3e8630e-49ee-431b-992d-81476a16a701',TO_TIMESTAMP('2024-01-25 15:53:40','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','AD_TableValRule_uu_idx',TO_TIMESTAMP('2024-01-25 15:53:40','YYYY-MM-DD HH24:MI:SS'),100,200415,'Y','Y','N','Y')
;
-- Jan 25, 2024, 3:53:41 PM CET
INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201722,'0f4ab741-34bb-4a58-a7c6-e21a5f9097d0',TO_TIMESTAMP('2024-01-25 15:53:40','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2024-01-25 15:53:40','YYYY-MM-DD HH24:MI:SS'),100,216452,201269,10)
;
-- Jan 25, 2024, 3:53:41 PM CET
INSERT INTO AD_TableIndex (AD_Client_ID,AD_Org_ID,AD_TableIndex_ID,AD_TableIndex_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Table_ID,IsCreateConstraint,IsUnique,Processing,TableIndexDrop,IsKey) VALUES (0,0,201270,'58c81ee9-9e77-4bfe-845c-5283cb46e2c2',TO_TIMESTAMP('2024-01-25 15:53:41','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','AD_TableValRule_Unq',TO_TIMESTAMP('2024-01-25 15:53:41','YYYY-MM-DD HH24:MI:SS'),100,200415,'N','Y','N','N','N')
;
-- Jan 25, 2024, 3:53:41 PM CET
INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201723,'c72e5505-c213-45bf-8ba3-31b6215774f6',TO_TIMESTAMP('2024-01-25 15:53:41','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2024-01-25 15:53:41','YYYY-MM-DD HH24:MI:SS'),100,216454,201270,10)
;
-- Jan 25, 2024, 3:53:42 PM CET
INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201724,'a958a52a-e176-4e56-9cb9-7a90a3f901f9',TO_TIMESTAMP('2024-01-25 15:53:41','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2024-01-25 15:53:41','YYYY-MM-DD HH24:MI:SS'),100,216445,201270,20)
;
-- Jan 25, 2024, 3:53:42 PM CET
INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,ColumnSQL,SeqNo) VALUES (0,0,201725,'dd86e335-e80a-4b76-8f3d-a8255808a148',TO_TIMESTAMP('2024-01-25 15:53:42','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2024-01-25 15:53:42','YYYY-MM-DD HH24:MI:SS'),100,216456,201270,'COALESCE(AD_Role_ID,-1)',30)
;
-- Jan 25, 2024, 3:53:42 PM CET
INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,ColumnSQL,SeqNo) VALUES (0,0,201726,'0201f3ef-8a68-49f5-bec2-a3554188d848',TO_TIMESTAMP('2024-01-25 15:53:42','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2024-01-25 15:53:42','YYYY-MM-DD HH24:MI:SS'),100,216457,201270,'COALESCE(AD_User_ID,-1)',40)
;
-- Jan 25, 2024, 3:53:42 PM CET
CREATE UNIQUE INDEX AD_TableValRule_Unq ON AD_TableValRule (AD_Table_ID,AD_Client_ID,COALESCE(AD_Role_ID,-1),COALESCE(AD_User_ID,-1))
;
-- Jan 25, 2024, 3:53:43 PM CET
INSERT INTO AD_Tab (AD_Tab_ID,Name,AD_Window_ID,SeqNo,IsSingleRow,AD_Table_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,HasTree,IsInfoTab,IsTranslationTab,IsReadOnly,OrderByClause,Processing,TabLevel,IsSortTab,EntityType,IsInsertRecord,IsAdvancedTab,AD_Tab_UU,TreeDisplayedOn,IsLookupOnlySelection,IsAllowAdvancedLookup,MaxQueryRecords) VALUES (200385,'Dynamic Validation per Table',200150,10,'Y',200415,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:42','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:42','YYYY-MM-DD HH24:MI:SS'),100,'N','N','N','N','AD_TableValRule.Created DESC','N',0,'N','D','Y','Y','72743e37-0045-4f00-b049-0d00b10d845b','B','N','Y',0)
;
-- Jan 25, 2024, 3:53:43 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (208355,'AD_TableValRule_UU',200385,216452,'N',36,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:43','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:43','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','a648d911-37b4-48c7-972a-4446ea8b2ee2','N',1,2,1,'N','N','N','N')
;
-- Jan 25, 2024, 3:53:43 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (208356,'Tenant','Tenant for this installation.','A Tenant is a company or a legal entity. You cannot share data between Tenants.',200385,216445,'Y',10,10,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:43','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:43','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','689964ca-3099-46ba-ab4f-7421fa3edc35','Y',10,1,2,1,'N','N','N','N')
;
-- Jan 25, 2024, 3:53:44 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsAllowCopy,IsDisplayedGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (208357,'Organization','Organizational entity within tenant','An organization is a unit of your tenant or legal entity - examples are store, department. You can share data between organizations.',200385,216446,'Y',10,20,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:43','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:43','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','a8807d22-5c3d-4711-99d3-85f5e87cf340','Y','N',4,2,1,'N','N','N','N')
;
-- Jan 25, 2024, 3:53:44 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (208358,'Table','Database Table information','The Database Table provides the information of the table definition',200385,216454,'Y',10,30,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:44','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:44','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','d4c082b5-c333-4584-8c29-d5804aa8f77e','Y',40,1,2,1,'N','N','N','N')
;
-- Jan 25, 2024, 3:53:45 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (208359,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports.
There are two reasons for de-activating and not deleting records:
(1) The system requires the record for audit purposes.
(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200385,216451,'Y',1,40,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:44','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:44','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','2ce3d4ca-431d-4955-9f7b-7fd9129926a1','Y',80,5,2,1,'N','N','N','N')
;
-- Jan 25, 2024, 3:53:45 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (208360,'Role','Responsibility Role','The Role determines security and access a user who has this Role will have in the System.',200385,216456,'Y',22,50,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:45','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:45','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','67a35371-6841-4cee-b22d-12ed859c3047','Y',60,1,2,1,'N','N','N','N')
;
-- Jan 25, 2024, 3:53:45 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (208361,'User/Contact','User within the system - Internal or Business Partner Contact','The User identifies a unique user in the system. This could be an internal user or a business partner contact',200385,216457,'Y',22,60,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:45','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:45','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','f4356264-6227-408c-9768-5b7b1febc140','Y',70,1,2,1,'N','N','N','N')
;
-- Jan 25, 2024, 3:53:46 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (208362,'Description','Optional short description of the record','A description is limited to 255 characters.',200385,216453,'Y',255,70,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:45','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:45','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','9deb3d72-98e3-47e3-8e92-de733e1d0818','Y',20,1,5,1,'N','N','N','N')
;
-- Jan 25, 2024, 3:53:46 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (208363,'SQL Filter','SQL Filter','Enter a valid WHERE SQL fully qualified clause. The WHERE is not needed, the code will be surrounded within parenthesis before applied',200385,216455,'Y',4000,90,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:46','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:46','YYYY-MM-DD HH24:MI:SS'),100,'N','N','D','354c9fcc-9961-4c76-8040-3bc0727a8be0','Y',50,1,5,8,'N','N','N','N')
;
-- Jan 25, 2024, 3:53:46 PM CET
INSERT INTO AD_Menu (AD_Menu_ID,Name,"action",AD_Window_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSummary,IsSOTrx,IsReadOnly,EntityType,IsCentrallyMaintained,AD_Menu_UU) VALUES (200234,'Dynamic Validation per Table','W',200150,0,0,'Y',TO_TIMESTAMP('2024-01-25 15:53:46','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:46','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','N','D','Y','a1cd8878-33b0-4228-9d0f-00aa536134c0')
;
-- Jan 25, 2024, 3:53:46 PM CET
UPDATE AD_TREENODEMM SET SeqNo=SeqNo+1 WHERE Parent_ID=367 AND SeqNo>=10 AND AD_Tree_ID=10
;
-- Jan 25, 2024, 3:53:46 PM CET
INSERT INTO AD_TreeNodeMM (AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Parent_ID,SeqNo,AD_Tree_ID,Node_ID,AD_Client_ID,AD_TreeNodeMM_UU) VALUES (0,'Y',TO_TIMESTAMP('2024-01-25 15:53:46','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-01-25 15:53:46','YYYY-MM-DD HH24:MI:SS'),100,367,10,10,200234,0,'b4f8ea74-a8d3-4d4a-a43b-9e1c09ec6ec0')
;
-- Jan 25, 2024, 3:53:46 PM CET
ALTER TABLE AD_TableValRule ADD CONSTRAINT ADClient_ADTableValRule FOREIGN KEY (AD_Client_ID) REFERENCES ad_client(ad_client_id) DEFERRABLE INITIALLY DEFERRED
;
-- Jan 25, 2024, 3:53:46 PM CET
ALTER TABLE AD_TableValRule ADD CONSTRAINT ADOrg_ADTableValRule FOREIGN KEY (AD_Org_ID) REFERENCES ad_org(ad_org_id) DEFERRABLE INITIALLY DEFERRED
;
-- Jan 25, 2024, 3:53:46 PM CET
ALTER TABLE AD_TableValRule ADD CONSTRAINT CreatedBy_ADTableValRule FOREIGN KEY (CreatedBy) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED
;
-- Jan 25, 2024, 3:53:46 PM CET
ALTER TABLE AD_TableValRule ADD CONSTRAINT UpdatedBy_ADTableValRule FOREIGN KEY (UpdatedBy) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED
;
-- Jan 25, 2024, 3:53:46 PM CET
ALTER TABLE AD_TableValRule ADD CONSTRAINT ADTable_ADTableValRule FOREIGN KEY (AD_Table_ID) REFERENCES ad_table(ad_table_id) DEFERRABLE INITIALLY DEFERRED
;
-- Jan 25, 2024, 3:53:46 PM CET
ALTER TABLE AD_TableValRule ADD CONSTRAINT ADRole_ADTableValRule FOREIGN KEY (AD_Role_ID) REFERENCES ad_role(ad_role_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
;
-- Jan 25, 2024, 3:53:47 PM CET
ALTER TABLE AD_TableValRule ADD CONSTRAINT ADUser_ADTableValRule FOREIGN KEY (AD_User_ID) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED
;

View File

@ -0,0 +1,189 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for AD_TableValRule
* @author iDempiere (generated)
* @version Release 12
*/
public interface I_AD_TableValRule
{
/** TableName=AD_TableValRule */
public static final String Table_Name = "AD_TableValRule";
/** AD_Table_ID=200415 */
public static final int Table_ID = 200415;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 6 - System - Client
*/
BigDecimal accessLevel = BigDecimal.valueOf(6);
/** Load Meta Data */
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Tenant.
* Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within tenant
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within tenant
*/
public int getAD_Org_ID();
/** Column name AD_Role_ID */
public static final String COLUMNNAME_AD_Role_ID = "AD_Role_ID";
/** Set Role.
* Responsibility Role
*/
public void setAD_Role_ID (int AD_Role_ID);
/** Get Role.
* Responsibility Role
*/
public int getAD_Role_ID();
public org.compiere.model.I_AD_Role getAD_Role() throws RuntimeException;
/** Column name AD_Table_ID */
public static final String COLUMNNAME_AD_Table_ID = "AD_Table_ID";
/** Set Table.
* Database Table information
*/
public void setAD_Table_ID (int AD_Table_ID);
/** Get Table.
* Database Table information
*/
public int getAD_Table_ID();
public org.compiere.model.I_AD_Table getAD_Table() throws RuntimeException;
/** Column name AD_TableValRule_UU */
public static final String COLUMNNAME_AD_TableValRule_UU = "AD_TableValRule_UU";
/** Set AD_TableValRule_UU */
public void setAD_TableValRule_UU (String AD_TableValRule_UU);
/** Get AD_TableValRule_UU */
public String getAD_TableValRule_UU();
/** Column name AD_User_ID */
public static final String COLUMNNAME_AD_User_ID = "AD_User_ID";
/** Set User/Contact.
* User within the system - Internal or Business Partner Contact
*/
public void setAD_User_ID (int AD_User_ID);
/** Get User/Contact.
* User within the system - Internal or Business Partner Contact
*/
public int getAD_User_ID();
public org.compiere.model.I_AD_User getAD_User() throws RuntimeException;
/** Column name Code */
public static final String COLUMNNAME_Code = "Code";
/** Set Validation code.
* Validation Code
*/
public void setCode (String Code);
/** Get Validation code.
* Validation Code
*/
public String getCode();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name Description */
public static final String COLUMNNAME_Description = "Description";
/** Set Description.
* Optional short description of the record
*/
public void setDescription (String Description);
/** Get Description.
* Optional short description of the record
*/
public String getDescription();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
}

View File

@ -2540,6 +2540,14 @@ public final class MRole extends X_AD_Role implements ImmutablePOSupport
sb.append(keyColumnName).append(lockedIDs).append(") "); sb.append(keyColumnName).append(lockedIDs).append(") ");
} }
} }
for (MTableValRule tvr : MTableValRule.get(p_ctx, AD_Table_ID, Env.getAD_Client_ID(p_ctx), Env.getAD_Role_ID(p_ctx), Env.getAD_User_ID(p_ctx))) {
if (sb.length() > 0)
sb.append(" AND ");
String wherevr = Env.parseContext(p_ctx, 0, tvr.getCode(), false);
sb.append(" (").append(wherevr).append(") ");
}
// //
return sb.toString(); return sb.toString();
} // getRecordWhere } // getRecordWhere

View File

@ -0,0 +1,232 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Carlos Ruiz - globalqss - bxservice *
**********************************************************************/
package org.compiere.model;
import java.sql.ResultSet;
import java.util.List;
import java.util.Properties;
import org.compiere.util.CCache;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.idempiere.cache.ImmutablePOCache;
import org.idempiere.cache.ImmutablePOSupport;
/**
* Persistence model for table val rule
*
* @author Carlos Ruiz - globalqss - bxservice
*/
public class MTableValRule extends X_AD_TableValRule implements ImmutablePOSupport {
/**
*
*/
private static final long serialVersionUID = -5156583311055069139L;
/** Cache */
private static ImmutablePOCache<String, MTableValRule> s_cache = new ImmutablePOCache<String, MTableValRule>(Table_Name, 20);
private static CCache<String, List<MTableValRule>> s_cachesession = new CCache<String, List<MTableValRule>>(Table_Name, 5);
/** Static Logger */
@SuppressWarnings("unused")
private static CLogger s_log = CLogger.getCLogger(MTableValRule.class);
/**
* UUID based Constructor
*
* @param ctx Context
* @param AD_TableValRule_UU UUID key
* @param trxName Transaction
*/
public MTableValRule(Properties ctx, String AD_TableValRule_UU, String trxName) {
super(ctx, AD_TableValRule_UU, trxName);
}
/**
* Load Constructor
*
* @param ctx context
* @param rs result set
* @param trxName transaction
*/
public MTableValRule(Properties ctx, ResultSet rs, String trxName) {
super(ctx, rs, trxName);
} // MTableValRule
/**
*
* @param copy
*/
public MTableValRule(MTableValRule copy) {
this(Env.getCtx(), copy);
}
/**
*
* @param ctx
* @param copy
*/
public MTableValRule(Properties ctx, MTableValRule copy) {
this(ctx, copy, (String) null);
}
/**
*
* @param ctx
* @param copy
* @param trxName
*/
public MTableValRule(Properties ctx, MTableValRule copy, String trxName) {
this(ctx, PO.UUID_NEW_RECORD, trxName);
copyPO(copy);
}
/**
* Get Rule from Cache (immutable)
*
* @param AD_TableValRule_UU UUID
* @return MTableValRule
*/
public static MTableValRule get(String AD_TableValRule_UU) {
return get(Env.getCtx(), AD_TableValRule_UU);
}
/**
* Get Rule from Cache (immutable)
*
* @param ctx context
* @param AD_TableValRule_UU UUID
* @return MTableValRule
*/
public static MTableValRule get(Properties ctx, String AD_TableValRule_UU) {
return get(ctx, AD_TableValRule_UU, (String) null);
}
/**
* Get Rule from Cache (immutable)
*
* @param ctx context
* @param AD_TableValRule_UU UUID
* @param trxName
* @return MTableValRule
*/
public static MTableValRule get(Properties ctx, String AD_TableValRule_UU, String trxName) {
String key = AD_TableValRule_UU;
MTableValRule retValue = s_cache.get(ctx, key, e -> new MTableValRule(ctx, e));
if (retValue != null)
return retValue;
retValue = new MTableValRule(ctx, AD_TableValRule_UU, trxName);
if (retValue.get_UUID() == AD_TableValRule_UU) {
s_cache.put(key, retValue, e -> new MTableValRule(Env.getCtx(), e));
return retValue;
}
return null;
} // get
/**
* Get updateable copy of MTableValRule from cache
*
* @param ctx
* @param AD_TableValRule_UU UUID
* @param trxName
* @return MTableValRule
*/
public static MTableValRule getCopy(Properties ctx, String AD_TableValRule_UU, String trxName) {
MTableValRule vr = get(ctx, AD_TableValRule_UU, trxName);
if (vr != null)
vr = new MTableValRule(ctx, vr, trxName);
return vr;
}
/**
* Get Rules applicable to session
* @param ctx
* @param AD_Table_ID
* @param AD_Client_ID
* @param AD_Role_ID
* @param AD_User_ID
* @return List of MTableValRule
*/
public static List<MTableValRule> get(Properties ctx, int AD_Table_ID, int AD_Client_ID, int AD_Role_ID, int AD_User_ID) {
String keySession = new StringBuilder()
.append(AD_Table_ID).append("|")
.append(AD_Client_ID).append("|")
.append(AD_Role_ID).append("|")
.append(AD_User_ID)
.toString();
if (s_cachesession.containsKey(keySession))
return s_cachesession.get(keySession);
final String where = "AD_Table_ID=? AND AD_Client_ID IN (0,?) AND (AD_Role_ID IS NULL OR AD_Role_ID=?) AND (AD_User_ID IS NULL OR AD_User_ID=?)";
List<MTableValRule> retValue = new Query(ctx, Table_Name, where, null)
.setOnlyActiveRecords(true)
.setParameters(AD_Table_ID, AD_Client_ID, AD_Role_ID, AD_User_ID)
.list();
s_cachesession.put(keySession, retValue);
return retValue;
}
@Override
public MTableValRule markImmutable() {
if (is_Immutable())
return this;
makeImmutable();
return this;
}
/**
* Called before Save for Pre-Save Operation
* @param newRecord new record
* @return true if record can be saved
*/
@Override
protected boolean beforeSave(boolean newRecord) {
if (getAD_Org_ID() > 0)
setAD_Org_ID(0);
return true;
}
/**
* String representation of this object, used in Recent Items
* @return info
*/
@Override
public String toString() {
MTable table = MTable.get(getAD_Table_ID());
StringBuilder sb = new StringBuilder (table.getName());
if (getAD_User_ID() > 0) {
MUser user = MUser.get(getAD_User_ID());
sb.append(" -> User=").append(user.getName());
}
if (getAD_Role_ID() > 0) {
MRole role = MRole.get(getCtx(), getAD_Role_ID());
sb.append(" -> Role=").append(role.getName());
}
return sb.toString();
}
} // MTableValRule

View File

@ -0,0 +1,215 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
/** Generated Model for AD_TableValRule
* @author iDempiere (generated)
* @version Release 12 - $Id$ */
@org.adempiere.base.Model(table="AD_TableValRule")
public class X_AD_TableValRule extends PO implements I_AD_TableValRule, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20240125L;
/** Standard Constructor */
public X_AD_TableValRule (Properties ctx, String AD_TableValRule_UU, String trxName)
{
super (ctx, AD_TableValRule_UU, trxName);
/** if (AD_TableValRule_UU == null)
{
setAD_Table_ID (0);
setCode (null);
} */
}
/** Standard Constructor */
public X_AD_TableValRule (Properties ctx, String AD_TableValRule_UU, String trxName, String ... virtualColumns)
{
super (ctx, AD_TableValRule_UU, trxName, virtualColumns);
/** if (AD_TableValRule_UU == null)
{
setAD_Table_ID (0);
setCode (null);
} */
}
/** Load Constructor */
public X_AD_TableValRule (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 6 - System - Client
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuilder sb = new StringBuilder ("X_AD_TableValRule[")
.append(get_UUID()).append("]");
return sb.toString();
}
public org.compiere.model.I_AD_Role getAD_Role() throws RuntimeException
{
return (org.compiere.model.I_AD_Role)MTable.get(getCtx(), org.compiere.model.I_AD_Role.Table_ID)
.getPO(getAD_Role_ID(), get_TrxName());
}
/** Set Role.
@param AD_Role_ID Responsibility Role
*/
public void setAD_Role_ID (int AD_Role_ID)
{
if (AD_Role_ID < 0)
set_Value (COLUMNNAME_AD_Role_ID, null);
else
set_Value (COLUMNNAME_AD_Role_ID, Integer.valueOf(AD_Role_ID));
}
/** Get Role.
@return Responsibility Role
*/
public int getAD_Role_ID()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Role_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_AD_Table getAD_Table() throws RuntimeException
{
return (org.compiere.model.I_AD_Table)MTable.get(getCtx(), org.compiere.model.I_AD_Table.Table_ID)
.getPO(getAD_Table_ID(), get_TrxName());
}
/** Set Table.
@param AD_Table_ID Database Table information
*/
public void setAD_Table_ID (int AD_Table_ID)
{
if (AD_Table_ID < 1)
set_Value (COLUMNNAME_AD_Table_ID, null);
else
set_Value (COLUMNNAME_AD_Table_ID, Integer.valueOf(AD_Table_ID));
}
/** Get Table.
@return Database Table information
*/
public int getAD_Table_ID()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Table_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set AD_TableValRule_UU.
@param AD_TableValRule_UU AD_TableValRule_UU
*/
public void setAD_TableValRule_UU (String AD_TableValRule_UU)
{
set_Value (COLUMNNAME_AD_TableValRule_UU, AD_TableValRule_UU);
}
/** Get AD_TableValRule_UU.
@return AD_TableValRule_UU */
public String getAD_TableValRule_UU()
{
return (String)get_Value(COLUMNNAME_AD_TableValRule_UU);
}
public org.compiere.model.I_AD_User getAD_User() throws RuntimeException
{
return (org.compiere.model.I_AD_User)MTable.get(getCtx(), org.compiere.model.I_AD_User.Table_ID)
.getPO(getAD_User_ID(), get_TrxName());
}
/** Set User/Contact.
@param AD_User_ID User within the system - Internal or Business Partner Contact
*/
public void setAD_User_ID (int AD_User_ID)
{
if (AD_User_ID < 1)
set_Value (COLUMNNAME_AD_User_ID, null);
else
set_Value (COLUMNNAME_AD_User_ID, Integer.valueOf(AD_User_ID));
}
/** Get User/Contact.
@return User within the system - Internal or Business Partner Contact
*/
public int getAD_User_ID()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Validation code.
@param Code Validation Code
*/
public void setCode (String Code)
{
set_Value (COLUMNNAME_Code, Code);
}
/** Get Validation code.
@return Validation Code
*/
public String getCode()
{
return (String)get_Value(COLUMNNAME_Code);
}
/** Set Description.
@param Description Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription()
{
return (String)get_Value(COLUMNNAME_Description);
}
}