IDempiere-2999: on Attribute adding all reference type support except… (#287)

* IDempiere-2999: on Attribute adding all reference type support except path, images.

* IDEMPIERE-2999 : Removing isQuickForm reference from migration script and fixing url issue.
This commit is contained in:
Deepak Pansheriya 2020-10-21 17:28:23 +05:30 committed by GitHub
parent 08f6fb17d3
commit 78f388d450
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 819 additions and 311 deletions

View File

@ -0,0 +1,110 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-2999 Attribute, Table Direct and date field support
-- Mar 3, 2016 11:15:59 AM IST
INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,Description,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200352,'Reference','Reference',326,'R',0,0,'Y',TO_DATE('2016-03-03 11:15:58','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2016-03-03 11:15:58','YYYY-MM-DD HH24:MI:SS'),100,'D','57503d9a-9bd2-4eb9-b2cf-1f43dc144dcc')
;
-- Mar 3, 2016 11:16:56 AM IST
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_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,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType) VALUES (212643,0,'Reference','System Reference and Validation','The Reference could be a display type, list or table validation.',562,'AD_Reference_ID',22,'N','N','N','N','N',0,'N',18,1,0,0,'Y',TO_DATE('2016-03-03 11:16:55','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2016-03-03 11:16:55','YYYY-MM-DD HH24:MI:SS'),100,120,'Y','N','D','N','N','N','Y','30425bec-829d-4fdd-9781-be453810859b','Y',0,'N','N','N')
;
-- Mar 3, 2016 11:16:59 AM IST
UPDATE AD_Column SET FKConstraintName='ADReference_MAttribute', FKConstraintType='N',Updated=TO_DATE('2016-03-03 11:16:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212643
;
-- Mar 3, 2016 11:16:59 AM IST
ALTER TABLE M_Attribute ADD AD_Reference_ID NUMBER(10) DEFAULT NULL
;
-- Mar 3, 2016 11:16:59 AM IST
ALTER TABLE M_Attribute ADD CONSTRAINT ADReference_MAttribute FOREIGN KEY (AD_Reference_ID) REFERENCES ad_reference(ad_reference_id) DEFERRABLE INITIALLY DEFERRED
;
-- Mar 3, 2016 11:17:19 AM IST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,AD_Val_Rule_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,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,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType) VALUES (212644,0,'Reference Key','Required to specify, if data type is Table or List','The Reference Value indicates where the reference values are stored. It must be specified if the data type is Table or List. ',562,115,'AD_Reference_Value_ID',22,'N','N','N','N','N',0,'N',18,4,0,0,'Y',TO_DATE('2016-03-03 11:17:19','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2016-03-03 11:17:19','YYYY-MM-DD HH24:MI:SS'),100,121,'Y','N','D','N','N','N','Y','4773b14c-3fd5-4a27-b612-f2c055e30906','Y',0,'N','N','N')
;
-- Mar 3, 2016 11:17:28 AM IST
UPDATE AD_Column SET FKConstraintName='ADReferenceValue_MAttribute', FKConstraintType='N',Updated=TO_DATE('2016-03-03 11:17:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212644
;
-- Mar 3, 2016 11:17:28 AM IST
ALTER TABLE M_Attribute ADD AD_Reference_Value_ID NUMBER(10) DEFAULT NULL
;
-- Mar 3, 2016 11:17:28 AM IST
ALTER TABLE M_Attribute ADD CONSTRAINT ADReferenceValue_MAttribute FOREIGN KEY (AD_Reference_Value_ID) REFERENCES ad_reference(ad_reference_id) DEFERRABLE INITIALLY DEFERRED
;
-- Mar 3, 2016 11:25:44 AM IST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLogic,DisplayLength,SeqNo,SortNo,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) VALUES (204143,'Reference','System Reference and Validation','The Reference could be a display type, list or table validation.',462,212643,'Y','@AttributeValueType@=''R''',0,90,0,'N','N','N','N',0,0,'Y',TO_DATE('2016-03-03 11:25:42','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2016-03-03 11:25:42','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','6662da7e-b41c-44d0-aa42-edc15857a9f3','Y',100,1,1,1,'N','N','N')
;
-- Mar 3, 2016 11:38:57 AM IST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLogic,DisplayLength,SeqNo,SortNo,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) VALUES (204144,'Reference Key','Required to specify, if data type is Table or List','The Reference Value indicates where the reference values are stored. It must be specified if the data type is Table or List. ',462,212644,'Y','@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 & @AttributeValueType@=''R''',0,100,0,'N','N','N','N',0,0,'Y',TO_DATE('2016-03-03 11:38:56','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2016-03-03 11:38:56','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','0ac3e965-019d-4da4-a8c5-7fa0ced885fa','Y',110,1,1,1,'N','N','N')
;
-- Mar 3, 2016 11:39:18 AM IST
UPDATE AD_Field SET SeqNo=90, ColumnSpan=2,Updated=TO_DATE('2016-03-03 11:39:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204143
;
-- Mar 3, 2016 11:39:18 AM IST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100, XPosition=4, ColumnSpan=2,Updated=TO_DATE('2016-03-03 11:39:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204144
;
-- Mar 3, 2016 11:40:04 AM IST
INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200090,'AD_Reference Attribute','S','AD_Reference_ID IN (10,11,12,13,14,15,16,17,18,19,20,22,24,25,27,29,30,31,32,33,34,36,37,38,39,40)',0,0,'Y',TO_DATE('2016-03-03 11:40:03','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2016-03-03 11:40:03','YYYY-MM-DD HH24:MI:SS'),100,'D','df9e32eb-59df-49b8-a7fa-a6fb9c1f6786')
;
-- Mar 3, 2016 11:40:25 AM IST
UPDATE AD_Column SET AD_Val_Rule_ID=200090,Updated=TO_DATE('2016-03-03 11:40:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212643
;
-- Sep 18, 2020, 10:02:10 PM IST
UPDATE AD_Tab SET ReadOnlyLogic='@AttributeValueType@!L',Updated=TO_DATE('2020-09-18 22:02:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=463
;
-- Sep 21, 2020, 3:02:02 PM IST
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) VALUES (214317,0,'Dynamic Validation','Dynamic Validation Rule','These rules define how an entry is determined to valid. You can use variables for dynamic (context sensitive) validation.',562,'AD_Val_Rule_ID',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_DATE('2020-09-21 15:02:00','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-09-21 15:02:00','YYYY-MM-DD HH24:MI:SS'),100,139,'Y','N','D','N','N','N','Y','6e0bea95-2518-4833-b8c4-3c65f94b07ea','Y',0,'N','N','N','N')
;
-- Sep 21, 2020, 3:02:14 PM IST
UPDATE AD_Column SET FKConstraintName='ADValRule_MAttribute', FKConstraintType='N',Updated=TO_DATE('2020-09-21 15:02:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=214317
;
-- Sep 21, 2020, 3:02:14 PM IST
ALTER TABLE M_Attribute ADD AD_Val_Rule_ID NUMBER(10) DEFAULT NULL
;
-- Sep 21, 2020, 3:02:14 PM IST
ALTER TABLE M_Attribute ADD CONSTRAINT ADValRule_MAttribute FOREIGN KEY (AD_Val_Rule_ID) REFERENCES ad_val_rule(ad_val_rule_id) DEFERRABLE INITIALLY DEFERRED
;
-- Sep 21, 2020, 3:04:22 PM IST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLogic,DisplayLength,SeqNo,SortNo,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) VALUES (206510,'Dynamic Validation','Dynamic Validation Rule','These rules define how an entry is determined to valid. You can use variables for dynamic (context sensitive) validation.',462,214317,'Y','@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=19 | @AD_Reference_ID@=30 & @AttributeValueType@=''R''',0,110,0,'N','N','N','N',0,0,'Y',TO_DATE('2020-09-21 15:04:20','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-09-21 15:04:20','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','544966ca-d50d-4481-ae43-cc56b1a0c478','Y',120,4,2,1,'N','N','N')
;
-- Sep 21, 2020, 3:04:50 PM IST
UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-09-21 15:04:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204144
;
-- Sep 21, 2020, 3:04:50 PM IST
UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-09-21 15:04:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206510
;
-- Sep 21, 2020, 3:04:50 PM IST
UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-09-21 15:04:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204868
;
-- Sep 21, 2020, 3:09:42 PM IST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_DATE('2020-09-21 15:09:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204144
;
-- Sep 21, 2020, 3:09:42 PM IST
UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-09-21 15:09:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203472
;
SELECT register_migration_script('201602171713_IDEMPIERE-2999.sql') FROM dual
;

View File

@ -0,0 +1,107 @@
-- IDEMPIERE-2999 Attribute, Table Direct and date field support
-- Mar 3, 2016 11:15:59 AM IST
INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,Description,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200352,'Reference','Reference',326,'R',0,0,'Y',TO_TIMESTAMP('2016-03-03 11:15:58','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2016-03-03 11:15:58','YYYY-MM-DD HH24:MI:SS'),100,'D','57503d9a-9bd2-4eb9-b2cf-1f43dc144dcc')
;
-- Mar 3, 2016 11:16:56 AM IST
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_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,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType) VALUES (212643,0,'Reference','System Reference and Validation','The Reference could be a display type, list or table validation.',562,'AD_Reference_ID',22,'N','N','N','N','N',0,'N',18,1,0,0,'Y',TO_TIMESTAMP('2016-03-03 11:16:55','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2016-03-03 11:16:55','YYYY-MM-DD HH24:MI:SS'),100,120,'Y','N','D','N','N','N','Y','30425bec-829d-4fdd-9781-be453810859b','Y',0,'N','N','N')
;
-- Mar 3, 2016 11:16:59 AM IST
UPDATE AD_Column SET FKConstraintName='ADReference_MAttribute', FKConstraintType='N',Updated=TO_TIMESTAMP('2016-03-03 11:16:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212643
;
-- Mar 3, 2016 11:16:59 AM IST
ALTER TABLE M_Attribute ADD COLUMN AD_Reference_ID NUMERIC(10) DEFAULT NULL
;
-- Mar 3, 2016 11:16:59 AM IST
ALTER TABLE M_Attribute ADD CONSTRAINT ADReference_MAttribute FOREIGN KEY (AD_Reference_ID) REFERENCES ad_reference(ad_reference_id) DEFERRABLE INITIALLY DEFERRED
;
-- Mar 3, 2016 11:17:19 AM IST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,AD_Val_Rule_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,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,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType) VALUES (212644,0,'Reference Key','Required to specify, if data type is Table or List','The Reference Value indicates where the reference values are stored. It must be specified if the data type is Table or List. ',562,115,'AD_Reference_Value_ID',22,'N','N','N','N','N',0,'N',18,4,0,0,'Y',TO_TIMESTAMP('2016-03-03 11:17:19','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2016-03-03 11:17:19','YYYY-MM-DD HH24:MI:SS'),100,121,'Y','N','D','N','N','N','Y','4773b14c-3fd5-4a27-b612-f2c055e30906','Y',0,'N','N','N')
;
-- Mar 3, 2016 11:17:28 AM IST
UPDATE AD_Column SET FKConstraintName='ADReferenceValue_MAttribute', FKConstraintType='N',Updated=TO_TIMESTAMP('2016-03-03 11:17:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212644
;
-- Mar 3, 2016 11:17:28 AM IST
ALTER TABLE M_Attribute ADD COLUMN AD_Reference_Value_ID NUMERIC(10) DEFAULT NULL
;
-- Mar 3, 2016 11:17:28 AM IST
ALTER TABLE M_Attribute ADD CONSTRAINT ADReferenceValue_MAttribute FOREIGN KEY (AD_Reference_Value_ID) REFERENCES ad_reference(ad_reference_id) DEFERRABLE INITIALLY DEFERRED
;
-- Mar 3, 2016 11:25:44 AM IST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLogic,DisplayLength,SeqNo,SortNo,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) VALUES (204143,'Reference','System Reference and Validation','The Reference could be a display type, list or table validation.',462,212643,'Y','@AttributeValueType@=''R''',0,90,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2016-03-03 11:25:42','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2016-03-03 11:25:42','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','6662da7e-b41c-44d0-aa42-edc15857a9f3','Y',100,1,1,1,'N','N','N')
;
-- Mar 3, 2016 11:38:57 AM IST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLogic,DisplayLength,SeqNo,SortNo,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) VALUES (204144,'Reference Key','Required to specify, if data type is Table or List','The Reference Value indicates where the reference values are stored. It must be specified if the data type is Table or List. ',462,212644,'Y','@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 & @AttributeValueType@=''R''',0,100,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2016-03-03 11:38:56','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2016-03-03 11:38:56','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','0ac3e965-019d-4da4-a8c5-7fa0ced885fa','Y',110,1,1,1,'N','N','N')
;
-- Mar 3, 2016 11:39:18 AM IST
UPDATE AD_Field SET SeqNo=90, ColumnSpan=2,Updated=TO_TIMESTAMP('2016-03-03 11:39:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204143
;
-- Mar 3, 2016 11:39:18 AM IST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100, XPosition=4, ColumnSpan=2,Updated=TO_TIMESTAMP('2016-03-03 11:39:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204144
;
-- Mar 3, 2016 11:40:04 AM IST
INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200090,'AD_Reference Attribute','S','AD_Reference_ID IN (10,11,12,13,14,15,16,17,18,19,20,22,24,25,27,29,30,31,32,33,34,36,37,38,39,40)',0,0,'Y',TO_TIMESTAMP('2016-03-03 11:40:03','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2016-03-03 11:40:03','YYYY-MM-DD HH24:MI:SS'),100,'D','df9e32eb-59df-49b8-a7fa-a6fb9c1f6786')
;
-- Mar 3, 2016 11:40:25 AM IST
UPDATE AD_Column SET AD_Val_Rule_ID=200090,Updated=TO_TIMESTAMP('2016-03-03 11:40:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212643
;
-- Sep 18, 2020, 10:02:10 PM IST
UPDATE AD_Tab SET ReadOnlyLogic='@AttributeValueType@!L',Updated=TO_TIMESTAMP('2020-09-18 22:02:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=463
;
-- Sep 21, 2020, 3:02:02 PM IST
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) VALUES (214317,0,'Dynamic Validation','Dynamic Validation Rule','These rules define how an entry is determined to valid. You can use variables for dynamic (context sensitive) validation.',562,'AD_Val_Rule_ID',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2020-09-21 15:02:00','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-09-21 15:02:00','YYYY-MM-DD HH24:MI:SS'),100,139,'Y','N','D','N','N','N','Y','6e0bea95-2518-4833-b8c4-3c65f94b07ea','Y',0,'N','N','N','N')
;
-- Sep 21, 2020, 3:02:14 PM IST
UPDATE AD_Column SET FKConstraintName='ADValRule_MAttribute', FKConstraintType='N',Updated=TO_TIMESTAMP('2020-09-21 15:02:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=214317
;
-- Sep 21, 2020, 3:02:14 PM IST
ALTER TABLE M_Attribute ADD COLUMN AD_Val_Rule_ID NUMERIC(10) DEFAULT NULL
;
-- Sep 21, 2020, 3:02:14 PM IST
ALTER TABLE M_Attribute ADD CONSTRAINT ADValRule_MAttribute FOREIGN KEY (AD_Val_Rule_ID) REFERENCES ad_val_rule(ad_val_rule_id) DEFERRABLE INITIALLY DEFERRED
;
-- Sep 21, 2020, 3:04:22 PM IST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLogic,DisplayLength,SeqNo,SortNo,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) VALUES (206510,'Dynamic Validation','Dynamic Validation Rule','These rules define how an entry is determined to valid. You can use variables for dynamic (context sensitive) validation.',462,214317,'Y','@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=19 | @AD_Reference_ID@=30 & @AttributeValueType@=''R''',0,110,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2020-09-21 15:04:20','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-09-21 15:04:20','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','544966ca-d50d-4481-ae43-cc56b1a0c478','Y',120,4,2,1,'N','N','N')
;
-- Sep 21, 2020, 3:04:50 PM IST
UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-09-21 15:04:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204144
;
-- Sep 21, 2020, 3:04:50 PM IST
UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-09-21 15:04:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206510
;
-- Sep 21, 2020, 3:04:50 PM IST
UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-09-21 15:04:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204868
;
-- Sep 21, 2020, 3:09:42 PM IST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-09-21 15:09:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204144
;
-- Sep 21, 2020, 3:09:42 PM IST
UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-09-21 15:09:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203472
;
SELECT register_migration_script('201602171713_IDEMPIERE-2999.sql') FROM dual
;

View File

@ -62,6 +62,51 @@ public interface I_M_Attribute
*/
public int getAD_Org_ID();
/** Column name AD_Reference_ID */
public static final String COLUMNNAME_AD_Reference_ID = "AD_Reference_ID";
/** Set Reference.
* System Reference and Validation
*/
public void setAD_Reference_ID (int AD_Reference_ID);
/** Get Reference.
* System Reference and Validation
*/
public int getAD_Reference_ID();
public org.compiere.model.I_AD_Reference getAD_Reference() throws RuntimeException;
/** Column name AD_Reference_Value_ID */
public static final String COLUMNNAME_AD_Reference_Value_ID = "AD_Reference_Value_ID";
/** Set Reference Key.
* Required to specify, if data type is Table or List
*/
public void setAD_Reference_Value_ID (int AD_Reference_Value_ID);
/** Get Reference Key.
* Required to specify, if data type is Table or List
*/
public int getAD_Reference_Value_ID();
public org.compiere.model.I_AD_Reference getAD_Reference_Value() throws RuntimeException;
/** Column name AD_Val_Rule_ID */
public static final String COLUMNNAME_AD_Val_Rule_ID = "AD_Val_Rule_ID";
/** Set Dynamic Validation.
* Dynamic Validation Rule
*/
public void setAD_Val_Rule_ID (int AD_Val_Rule_ID);
/** Get Dynamic Validation.
* Dynamic Validation Rule
*/
public int getAD_Val_Rule_ID();
public org.compiere.model.I_AD_Val_Rule getAD_Val_Rule() throws RuntimeException;
/** Column name AttributeValueType */
public static final String COLUMNNAME_AttributeValueType = "AttributeValueType";

View File

@ -25,6 +25,7 @@ import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import org.compiere.util.CCache;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
@ -41,7 +42,14 @@ public class MAttribute extends X_M_Attribute implements ImmutablePOSupport
/**
*
*/
private static final long serialVersionUID = 7513117649181926813L;
private static final long serialVersionUID = 7869800574413317999L;
/** Logger */
private static CLogger s_log = CLogger.getCLogger (MAttribute.class);
private static CCache<Integer, MAttribute> s_cache = new CCache<Integer, MAttribute>(Table_Name, 30, 60);
/** Values */
private MAttributeValue[] m_values = null;
/**
* Get Attributes Of Client
@ -58,15 +66,15 @@ public class MAttribute extends X_M_Attribute implements ImmutablePOSupport
ArrayList<Object> params = new ArrayList<Object>();
params.add(AD_Client_ID);
if (onlyProductAttributes)
{
sql += " AND IsInstanceAttribute=?";
params.add(false);
}
{
sql += " AND IsInstanceAttribute=?";
params.add(false);
}
if (onlyListAttributes)
{
sql += " AND AttributeValueType=?";
params.add(MAttribute.ATTRIBUTEVALUETYPE_List);
}
{
sql += " AND AttributeValueType=?";
params.add(MAttribute.ATTRIBUTEVALUETYPE_List);
}
StringBuilder whereClause = new StringBuilder("AD_Client_ID=?").append(sql);
List<MAttribute>list = new Query(ctx,I_M_Attribute.Table_Name,whereClause.toString(),null)
@ -80,11 +88,7 @@ public class MAttribute extends X_M_Attribute implements ImmutablePOSupport
if (s_log.isLoggable(Level.FINE)) s_log.fine("AD_Client_ID=" + AD_Client_ID + " - #" + list.size());
return retValue;
} // getOfClient
/** Logger */
private static CLogger s_log = CLogger.getCLogger (MAttribute.class);
/**
* Standard Constructor
* @param ctx context
@ -144,9 +148,6 @@ public class MAttribute extends X_M_Attribute implements ImmutablePOSupport
copyPO(copy);
this.m_values = copy.m_values != null ? Arrays.stream(copy.m_values).map(e -> {return new MAttributeValue(ctx, e, trxName);}).toArray(MAttributeValue[]::new) : null;
}
/** Values */
private MAttributeValue[] m_values = null;
/**
* Get Values if List
@ -170,6 +171,20 @@ public class MAttribute extends X_M_Attribute implements ImmutablePOSupport
return m_values;
} // getValues
public static MAttribute get(Properties ctx, int M_Attribute_ID)
{
Integer key = Integer.valueOf(M_Attribute_ID);
MAttribute retValue = (MAttribute) s_cache.get(key);
if (retValue != null)
return retValue;
retValue = (MAttribute) MTable.get(ctx, MAttribute.Table_ID).getPO(M_Attribute_ID, null);
s_cache.put(key, retValue);
return retValue;
} // get
/**************************************************************************
* Get Attribute Instance
@ -252,6 +267,22 @@ public class MAttribute extends X_M_Attribute implements ImmutablePOSupport
instance.saveEx();
} // setAttributeInstance
/**
* Set Attribute Instance
*
* @param valueInt Integer value
* @param M_AttributeSetInstance_ID id
* @param value
*/
public void setMAttributeInstance(int M_AttributeSetInstance_ID, int valueInt, String value)
{
MAttributeInstance instance = getMAttributeInstance(M_AttributeSetInstance_ID);
if (instance == null)
instance = new MAttributeInstance(getCtx(), getM_Attribute_ID(), M_AttributeSetInstance_ID, valueInt, get_TrxName());
else
instance.setValueInt(valueInt, value);
instance.saveEx();
} // setAttributeInstance
public void setMAttributeInstance(int M_AttributeSetInstance_ID, Timestamp value)
{
@ -302,6 +333,11 @@ public class MAttribute extends X_M_Attribute implements ImmutablePOSupport
}
return success;
} // afterSave
public boolean isAttributeValueTypeReference()
{
return ATTRIBUTEVALUETYPE_Reference.equals(getAttributeValueType());
} // isAttributeValueTypeReference
@Override
public MAttribute markImmutable() {

View File

@ -22,6 +22,8 @@ import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Properties;
import org.compiere.util.DisplayType;
/**
* Product Attribute Set
*
@ -33,7 +35,7 @@ public class MAttributeInstance extends X_M_AttributeInstance
/**
*
*/
private static final long serialVersionUID = 6154044437449512042L;
private static final long serialVersionUID = 5697542928282761922L;
/**
@ -61,7 +63,7 @@ public class MAttributeInstance extends X_M_AttributeInstance
} // MAttributeInstance
/**
* String Value Constructior
* String Value Constructor
* @param ctx context
* @param M_Attribute_ID attribute
* @param M_AttributeSetInstance_ID instance
@ -95,7 +97,7 @@ public class MAttributeInstance extends X_M_AttributeInstance
} // MAttributeInstance
/**
* Selection Value Constructior
* Selection Value Constructor
* @param ctx context
* @param M_Attribute_ID attribute
* @param M_AttributeSetInstance_ID instance
@ -113,6 +115,16 @@ public class MAttributeInstance extends X_M_AttributeInstance
setValue(Value);
} // MAttributeInstance
public MAttributeInstance (Properties ctx, int M_Attribute_ID,
int M_AttributeSetInstance_ID, int Value, String trxName)
{
super(ctx, 0, trxName);
setM_Attribute_ID (M_Attribute_ID);
setM_AttributeSetInstance_ID (M_AttributeSetInstance_ID);
setValueNumber(BigDecimal.valueOf(Value));
} // MAttributeInstance
public MAttributeInstance(Properties ctx, int m_Attribute_ID, int m_AttributeSetInstance_ID, Timestamp value,
String trxName)
{
@ -120,9 +132,8 @@ public class MAttributeInstance extends X_M_AttributeInstance
setM_Attribute_ID(m_Attribute_ID);
setM_AttributeSetInstance_ID(m_AttributeSetInstance_ID);
setValueDate(value);
}
} // MAttributeInstance
/**
* Set ValueNumber
* @param ValueNumber number
@ -165,20 +176,63 @@ public class MAttributeInstance extends X_M_AttributeInstance
setValue(display.toString());
} // setValueNumber
/**
* Set valueDate
*
* @param valueDate
*/
public void setValueDate(Timestamp valueDate)
{
super.setValueDate(valueDate);
if (valueDate != null)
{
SimpleDateFormat sdf = new SimpleDateFormat(
new MAttribute(getCtx(), getM_Attribute_ID(), get_TrxName()).getDateFormat());
setValue(sdf.format(valueDate));
}
else
if (valueDate == null)
{
setValue(null);
return;
}
}
SimpleDateFormat sdf = null;
MAttribute attribute = MAttribute.get(getCtx(), getM_Attribute_ID());
int displayType = attribute.getAD_Reference_ID();
if (MAttribute.ATTRIBUTEVALUETYPE_Date.equals(attribute.getAttributeValueType()))
sdf = DisplayType.getDateFormat_JDBC();
// Based on reference type, Format timestamp into string value
else if (displayType == DisplayType.DateTime)
sdf = DisplayType.getTimestampFormat_Default();
else if (displayType == DisplayType.Time)
sdf = DisplayType.getTimeFormat_Default();
else
sdf = DisplayType.getDateFormat_JDBC();
setValue(sdf.format(valueDate));
} // setValueDate
/**
* Set ValueInt
*
* @param valueInt
* @param value
*/
public void setValueInt(int valueInt, String value)
{
super.setValueNumber(BigDecimal.valueOf(valueInt));
if (value == null)
value = String.valueOf(valueInt);
setValue(value);
} // setValueInt
/**
* Get Value as Integer
*
* @return
*/
public int getValueInt()
{
if (super.getValueNumber() == null)
return 0;
else
return super.getValueNumber().intValue();
} // getValueInt
/**
* String Representation

View File

@ -30,7 +30,7 @@ public class X_M_Attribute extends PO implements I_M_Attribute, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20200413L;
private static final long serialVersionUID = 20200921L;
/** Standard Constructor */
public X_M_Attribute (Properties ctx, int M_Attribute_ID, String trxName)
@ -75,6 +75,90 @@ public class X_M_Attribute extends PO implements I_M_Attribute, I_Persistent
return sb.toString();
}
public org.compiere.model.I_AD_Reference getAD_Reference() throws RuntimeException
{
return (org.compiere.model.I_AD_Reference)MTable.get(getCtx(), org.compiere.model.I_AD_Reference.Table_Name)
.getPO(getAD_Reference_ID(), get_TrxName()); }
/** Set Reference.
@param AD_Reference_ID
System Reference and Validation
*/
public void setAD_Reference_ID (int AD_Reference_ID)
{
if (AD_Reference_ID < 1)
set_Value (COLUMNNAME_AD_Reference_ID, null);
else
set_Value (COLUMNNAME_AD_Reference_ID, Integer.valueOf(AD_Reference_ID));
}
/** Get Reference.
@return System Reference and Validation
*/
public int getAD_Reference_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Reference_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_AD_Reference getAD_Reference_Value() throws RuntimeException
{
return (org.compiere.model.I_AD_Reference)MTable.get(getCtx(), org.compiere.model.I_AD_Reference.Table_Name)
.getPO(getAD_Reference_Value_ID(), get_TrxName()); }
/** Set Reference Key.
@param AD_Reference_Value_ID
Required to specify, if data type is Table or List
*/
public void setAD_Reference_Value_ID (int AD_Reference_Value_ID)
{
if (AD_Reference_Value_ID < 1)
set_Value (COLUMNNAME_AD_Reference_Value_ID, null);
else
set_Value (COLUMNNAME_AD_Reference_Value_ID, Integer.valueOf(AD_Reference_Value_ID));
}
/** Get Reference Key.
@return Required to specify, if data type is Table or List
*/
public int getAD_Reference_Value_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Reference_Value_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_AD_Val_Rule getAD_Val_Rule() throws RuntimeException
{
return (org.compiere.model.I_AD_Val_Rule)MTable.get(getCtx(), org.compiere.model.I_AD_Val_Rule.Table_Name)
.getPO(getAD_Val_Rule_ID(), get_TrxName()); }
/** Set Dynamic Validation.
@param AD_Val_Rule_ID
Dynamic Validation Rule
*/
public void setAD_Val_Rule_ID (int AD_Val_Rule_ID)
{
if (AD_Val_Rule_ID < 1)
set_Value (COLUMNNAME_AD_Val_Rule_ID, null);
else
set_Value (COLUMNNAME_AD_Val_Rule_ID, Integer.valueOf(AD_Val_Rule_ID));
}
/** Get Dynamic Validation.
@return Dynamic Validation Rule
*/
public int getAD_Val_Rule_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Val_Rule_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** AttributeValueType AD_Reference_ID=326 */
public static final int ATTRIBUTEVALUETYPE_AD_Reference_ID=326;
/** String (max 40) = S */
@ -85,6 +169,8 @@ public class X_M_Attribute extends PO implements I_M_Attribute, I_Persistent
public static final String ATTRIBUTEVALUETYPE_List = "L";
/** Date = D */
public static final String ATTRIBUTEVALUETYPE_Date = "D";
/** Reference = R */
public static final String ATTRIBUTEVALUETYPE_Reference = "R";
/** Set Attribute Value Type.
@param AttributeValueType
Type of Attribute Value

View File

@ -33,7 +33,7 @@ public class X_M_AttributeInstance extends PO implements I_M_AttributeInstance,
/**
*
*/
private static final long serialVersionUID = 20200413L;
private static final long serialVersionUID = 20201006L;
/** Standard Constructor */
public X_M_AttributeInstance (Properties ctx, int M_AttributeInstance_ID, String trxName)

View File

@ -39,16 +39,22 @@ import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.NumberBox;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.Urlbox;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WebEditorFactory;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener;
import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.ZKUpdateUtil;
import org.compiere.model.GridField;
import org.compiere.model.GridFieldVO;
import org.compiere.model.MAttribute;
import org.compiere.model.MAttributeInstance;
import org.compiere.model.MAttributeSet;
@ -63,11 +69,12 @@ import org.compiere.model.MSerNoCtl;
import org.compiere.model.X_M_MovementLine;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.compiere.util.Trx;
import org.zkoss.zk.ui.HtmlBasedComponent;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
@ -77,7 +84,6 @@ import org.zkoss.zul.Menuitem;
import org.zkoss.zul.Menupopup;
import org.zkoss.zul.South;
import org.zkoss.zul.Space;
import org.zkoss.zul.impl.InputElement;
/**
* Product Attribute Set Product/Instance Dialog Editor.
@ -172,7 +178,7 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
/** Row Counter */
private int m_row = 0;
/** List of Editors */
private ArrayList<HtmlBasedComponent> m_editors = new ArrayList<HtmlBasedComponent>();
private ArrayList<WEditor> m_editors = new ArrayList<WEditor>();
/** Length of Instance value (40) */
//private static final int INSTANCE_VALUE_LENGTH = 40;
@ -506,15 +512,8 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
boolean rw = m_M_AttributeSetInstance_ID == 0;
for (int i = 0; i < m_editors.size(); i++)
{
HtmlBasedComponent editor = m_editors.get(i);
if (editor instanceof Listbox)
((Listbox)editor).setEnabled(rw);
else if (editor instanceof NumberBox)
((NumberBox)editor).setEnabled(rw);
else if (editor instanceof Datebox)
((Datebox)editor).setEnabled(rw);
else if (editor instanceof InputElement)
((InputElement)editor).setReadonly(!rw);
WEditor editor = m_editors.get(i);
editor.setReadWrite(rw);
}
}
@ -543,141 +542,185 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
if (log.isLoggable(Level.FINE)) log.fine(attribute + ", Product=" + product + ", R/O=" + readOnly);
m_row++;
Label label = new Label (attribute.getName());
if (product)
label.setStyle("font-weight: bold");
if (attribute.getDescription() != null)
label.setTooltiptext(attribute.getDescription());
Row row = rows.newRow();
row.appendChild(label.rightAlign());
WEditor editor = null;
//
if (MAttribute.ATTRIBUTEVALUETYPE_List.equals(attribute.getAttributeValueType()))
{
MAttributeValue[] values = attribute.getMAttributeValues(); // optional = null
Listbox editor = new Listbox();
editor.setMold("select");
for (MAttributeValue value : values)
{
ListItem item = new ListItem(value != null ? value.getName() : "", value);
editor.appendChild(item);
}
if (readOnly)
editor.setEnabled(false);
else
m_editors.add (editor);
row.appendChild(editor);
ZKUpdateUtil.setHflex(editor, "1");
setListAttribute(attribute, editor);
editor = WebEditorFactory.getEditor(getListTypeGridField(attribute), true);
}
else if (MAttribute.ATTRIBUTEVALUETYPE_Number.equals(attribute.getAttributeValueType()))
{
NumberBox editor = new NumberBox(false);
setNumberAttribute(attribute, editor);
row.appendChild(editor);
ZKUpdateUtil.setHflex(editor, "1");
if (readOnly)
editor.setEnabled(false);
else
m_editors.add (editor);
editor = WebEditorFactory.getEditor(getNumberGridField(attribute), true);
}
else if(MAttribute.ATTRIBUTEVALUETYPE_Date.equals(attribute.getAttributeValueType()))
else if (MAttribute.ATTRIBUTEVALUETYPE_Reference.equals(attribute.getAttributeValueType()))
{
Datebox editor = new Datebox();
setDateAttribute(attribute, editor);
row.appendChild(editor);
if(readOnly)
editor.setEnabled(false);
editor = WebEditorFactory.getEditor(getGridField(attribute), true);
}
else if (MAttribute.ATTRIBUTEVALUETYPE_Date.equals(attribute.getAttributeValueType()))
{
editor = WebEditorFactory.getEditor(getDateGridField(attribute), true);
}
else // Text Field
{
editor = WebEditorFactory.getEditor(getStringGridField(attribute), true);
}
if (editor != null)
{
Row row = rows.newRow();
Label label = editor.getLabel();
if (label.getValue() == null || label.getValue().trim().length() < 1)
label.setValue(attribute.getName());
if (product)
label.setStyle("font-weight: bold");
row.appendChild(label.rightAlign());
editor.setMandatory(attribute.isMandatory());
editor.fillHorizontal();
setEditorAttribute(attribute, editor);
editor.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent evt)
{
if (evt.getSource() instanceof WEditor)
{
WEditor sourceEditor = (WEditor) evt.getSource();
// IDEMPIERE-2999 - set value in online button as HRef
if (sourceEditor.getGridField().getDisplayType() == DisplayType.URL)
((Urlbox) sourceEditor.getComponent()).setText((String) evt.getNewValue());
}
}
});
Component fieldEditor = editor.getComponent();
row.appendChild(fieldEditor);
editor.showMenu();
if (readOnly)
editor.setReadWrite(false);
else
m_editors.add(editor);
}
else // Text Field
{
Textbox editor = new Textbox();
setStringAttribute(attribute, editor);
row.appendChild(editor);
ZKUpdateUtil.setHflex(editor, "1");
if (readOnly)
editor.setEnabled(false);
else
m_editors.add (editor);
}
} // addAttributeLine
private void updateAttributeEditor(MAttribute attribute, int index) {
if (MAttribute.ATTRIBUTEVALUETYPE_List.equals(attribute.getAttributeValueType()))
{
Listbox editor = (Listbox) m_editors.get(index);
setListAttribute(attribute, editor);
}
else if (MAttribute.ATTRIBUTEVALUETYPE_Number.equals(attribute.getAttributeValueType()))
{
NumberBox editor = (NumberBox) m_editors.get(index);
setNumberAttribute(attribute, editor);
}
else if(MAttribute.ATTRIBUTEVALUETYPE_Date.equals(attribute.getAttributeValueType()))
{
Datebox editor = (Datebox)m_editors.get(index);
setDateAttribute(attribute, editor);
}
else // Text Field
{
Textbox editor = (Textbox) m_editors.get(index);
setStringAttribute(attribute, editor);
}
}
private void setStringAttribute(MAttribute attribute, Textbox editor) {
MAttributeInstance instance = attribute.getMAttributeInstance (m_M_AttributeSetInstance_ID);
if (instance != null)
editor.setText(instance.getValue());
}
public GridField getGridField(MAttribute attribute)
{
GridFieldVO vo = GridFieldVO.createParameter(Env.getCtx(), m_WindowNo, AEnv.getADWindowID(m_WindowNo), 0, 0, attribute.getName(),
Msg.translate(Env.getCtx(), attribute.get_Translation("Name")), attribute.getAD_Reference_ID(),
attribute.getAD_Reference_Value_ID(), false, false, null);
private void setNumberAttribute(MAttribute attribute, NumberBox editor) {
MAttributeInstance instance = attribute.getMAttributeInstance (m_M_AttributeSetInstance_ID);
if (instance != null)
editor.setValue(instance.getValueNumber());
else
editor.setValue(Env.ZERO);
}
private void setDateAttribute(MAttribute attribute,Datebox editor)
if (attribute.isAttributeValueTypeReference() && DisplayType.isLookup(attribute.getAD_Reference_ID()) && attribute.getAD_Val_Rule_ID() > 0)
{
vo.ValidationCode = attribute.getAD_Val_Rule().getCode();
if (vo.lookupInfo != null)
{
vo.lookupInfo.ValidationCode = vo.ValidationCode;
vo.lookupInfo.IsValidated = false;
}
}
return createGridField(attribute, vo);
} // getGridField
public GridField getStringGridField(MAttribute attribute)
{
GridFieldVO vo = GridFieldVO.createParameter(Env.getCtx(), m_WindowNo, AEnv.getADWindowID(m_WindowNo), 0, 0, attribute.getName(),
Msg.translate(Env.getCtx(), attribute.get_Translation("Name")), DisplayType.String, 0, false, false, null);
return createGridField(attribute, vo);
} // getStringGridField
public GridField getNumberGridField(MAttribute attribute)
{
GridFieldVO vo = GridFieldVO.createParameter(Env.getCtx(), m_WindowNo, AEnv.getADWindowID(m_WindowNo), 0, 0, attribute.getName(),
Msg.translate(Env.getCtx(), attribute.get_Translation("Name")), DisplayType.Number, 0, false, false, null);
return createGridField(attribute, vo);
} // getNumberGridField
public GridField getDateGridField(MAttribute attribute)
{
GridFieldVO vo = GridFieldVO.createParameter(Env.getCtx(), m_WindowNo, AEnv.getADWindowID(m_WindowNo), 0, 0, attribute.getName(),
Msg.translate(Env.getCtx(), attribute.get_Translation("Name")), DisplayType.Date, 0, false, false, null);
return createGridField(attribute, vo);
} // getDateGridField
public GridField getListTypeGridField(MAttribute attribute)
{
GridFieldVO vo = GridFieldVO.createParameter(Env.getCtx(), m_WindowNo, AEnv.getADWindowID(m_WindowNo), 0, 0,
"M_AttributeValue_ID", attribute.getName(), DisplayType.TableDir, 0, false, false, null);
// Validation for List - Attribute Values
vo.ValidationCode = "M_AttributeValue.M_Attribute_ID=" + attribute.get_ID();
vo.lookupInfo.ValidationCode = vo.ValidationCode;
vo.lookupInfo.IsValidated = false;
return createGridField(attribute, vo);
} // getListTypeGridField
private GridField createGridField(MAttribute attribute, GridFieldVO vo)
{
String desc = attribute.get_Translation("Description");
vo.Description = desc != null ? desc : "";
return new GridField(vo);
} // createGridField
public void updateAttributeEditor(MAttribute attribute, int index)
{
WEditor editor = m_editors.get(index);
if (editor != null)
setEditorAttribute(attribute, editor);
} // updateAttributeEditor
public void setEditorAttribute(MAttribute attribute, WEditor editor)
{
MAttributeInstance instance = attribute.getMAttributeInstance(m_M_AttributeSetInstance_ID);
if(instance != null)
editor.setValue(instance.getValueDate());
else
editor.setValue(null);
}
private void setListAttribute(MAttribute attribute, Listbox editor) {
boolean found = false;
MAttributeInstance instance = attribute.getMAttributeInstance (m_M_AttributeSetInstance_ID);
MAttributeValue[] values = attribute.getMAttributeValues(); // optional = null
if (instance != null)
{
for (int i = 0; i < values.length; i++)
if (MAttribute.ATTRIBUTEVALUETYPE_List.equals(attribute.getAttributeValueType()))
{
if (values[i] != null && values[i].getM_AttributeValue_ID () == instance.getM_AttributeValue_ID ())
if (instance.getM_AttributeValue_ID() > 0)
editor.setValue(instance.getM_AttributeValue_ID());
}
else
{
int displayType = editor.getGridField().getDisplayType();
if (displayType == DisplayType.Date || displayType == DisplayType.DateTime || displayType == DisplayType.Time)
{
editor.setSelectedIndex (i);
found = true;
break;
if (instance.getValueDate() != null)
editor.setValue(instance.getValueDate());
}
else if (displayType == DisplayType.Image || displayType == DisplayType.Assignment
|| displayType == DisplayType.Locator
|| displayType == DisplayType.TableDir
|| displayType == DisplayType.Table
|| displayType == DisplayType.Search
|| displayType == DisplayType.Account)
{
if (instance.getValueInt() > 0)
editor.setValue(instance.getValueInt());
}
else if (displayType == DisplayType.Integer)
{
editor.setValue(instance.getValueInt());
}
else if (DisplayType.isNumeric(displayType))
{
if (instance.getValueNumber() != null)
editor.setValue(instance.getValueNumber());
}
else
{
if (instance.getValue() != null)
editor.setValue(instance.getValue());
}
}
if (found ){
if (log.isLoggable(Level.FINE)) log.fine("Attribute=" + attribute.getName() + " #" + values.length + " - found: " + instance);
} else {
log.warning("Attribute=" + attribute.getName() + " #" + values.length + " - NOT found: " + instance);
}
} // setComboBox
else
if (log.isLoggable(Level.FINE)) log.fine("Attribute=" + attribute.getName() + " #" + values.length + " no instance");
}
}
} // setEditorAttribute
/**
* dispose
@ -810,27 +853,9 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
m_masi = new MAttributeSetInstance (Env.getCtx(), m_M_AttributeSetInstance_ID, M_AttributeSet_ID, null);
for (int i = 0; i < m_editors.size(); i++)
{
HtmlBasedComponent editor = m_editors.get(i);
if (editor instanceof Listbox)
{
((Listbox)editor).setEnabled(true);
((Listbox)editor).setSelectedItem(null);
}
else if (editor instanceof NumberBox)
{
((NumberBox)editor).setEnabled(true);
((NumberBox)editor).setValue(null);
}
else if (editor instanceof Datebox)
{
((Datebox)editor).setEnabled(true);
((Datebox)editor).setValue(null);
}
else if (editor instanceof InputElement)
{
((InputElement)editor).setReadonly(false);
((InputElement)editor).setText(null);
}
WEditor editor = m_editors.get(i);
editor.setReadWrite(true);
editor.setValue(null);
}
fieldDescription.setText("");
}
@ -839,18 +864,9 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
boolean check = cbNewEdit.isSelected();
for (int i = 0; i < m_editors.size(); i++)
{
HtmlBasedComponent editor = m_editors.get(i);
if (editor instanceof Datebox)
((Datebox) editor).setEnabled(check);
else if (editor instanceof Listbox)
((Listbox) editor).setEnabled(check);
else if (editor instanceof NumberBox)
((NumberBox) editor).setEnabled(check);
else if (editor instanceof InputElement)
((InputElement) editor).setReadonly(!check);
WEditor editor = m_editors.get(i);
editor.setReadWrite(check);
}
}
/**
@ -941,16 +957,8 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
//
for (int i = 0; i < m_editors.size(); i++)
{
HtmlBasedComponent editor = m_editors.get(i);
if (editor instanceof Listbox)
((Listbox) editor).setEnabled(rw);
else if (editor instanceof NumberBox)
((NumberBox) editor).setEnabled(rw);
else if (editor instanceof Datebox)
((Datebox) editor).setEnabled(rw);
else if (editor instanceof InputElement)
((InputElement) editor).setReadonly(!rw);
WEditor editor = m_editors.get(i);
editor.setReadWrite(rw);
}
} // cmd_newEdit
@ -997,119 +1005,122 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
}
Trx trx = null;
String mandatory = "";
try {
String trxName = Trx.createTrxName("WPAD");
trx = Trx.get(trxName, false);
trx.setDisplayName(getClass().getName()+"_saveSelection");
m_masi.set_TrxName(trxName);
as.set_TrxName(trxName);
//
m_changed = false;
if (!m_productWindow && as.isLot())
{
if (log.isLoggable(Level.FINE)) log.fine("Lot=" + fieldLotString.getText ());
String text = fieldLotString.getText();
m_masi.setLot (text);
if (as.isLotMandatory() && (text == null || text.length() == 0))
mandatory += " - " + Msg.translate(Env.getCtx(), "Lot");
m_changed = true;
} // Lot
if (!m_productWindow && as.isSerNo())
{
if (log.isLoggable(Level.FINE)) log.fine("SerNo=" + fieldSerNo.getText());
String text = fieldSerNo.getText();
m_masi.setSerNo(text);
if (as.isSerNoMandatory() && (text == null || text.length() == 0))
mandatory += " - " + Msg.translate(Env.getCtx(), "SerNo");
m_changed = true;
} // SerNo
if (!m_productWindow && as.isGuaranteeDate())
{
if (log.isLoggable(Level.FINE)) log.fine("GuaranteeDate=" + fieldGuaranteeDate.getValue());
Date gDate = fieldGuaranteeDate.getValue();
Timestamp ts = gDate != null ? new Timestamp(gDate.getTime()) : null;
m_masi.setGuaranteeDate(ts);
if (as.isGuaranteeDateMandatory() && ts == null)
mandatory += " - " + Msg.translate(Env.getCtx(), "GuaranteeDate");
m_changed = true;
} // GuaranteeDate
// *** Save Attributes ***
// New Instance
if (mandatory.isEmpty() && (m_changed || m_masi.getM_AttributeSetInstance_ID() == 0))
{
m_masi.saveEx();
try {
String trxName = Trx.createTrxName("WPAD");
trx = Trx.get(trxName, false);
trx.setDisplayName(getClass().getName()+"_saveSelection");
m_masi.set_TrxName(trxName);
as.set_TrxName(trxName);
//
m_changed = false;
if (!m_productWindow && as.isLot())
{
if (log.isLoggable(Level.FINE)) log.fine("Lot=" + fieldLotString.getText ());
String text = fieldLotString.getText();
m_masi.setLot (text);
if (as.isLotMandatory() && (text == null || text.length() == 0))
mandatory += " - " + Msg.translate(Env.getCtx(), "Lot");
m_changed = true;
} // Lot
if (!m_productWindow && as.isSerNo())
{
if (log.isLoggable(Level.FINE)) log.fine("SerNo=" + fieldSerNo.getText());
String text = fieldSerNo.getText();
m_masi.setSerNo(text);
if (as.isSerNoMandatory() && (text == null || text.length() == 0))
mandatory += " - " + Msg.translate(Env.getCtx(), "SerNo");
m_changed = true;
} // SerNo
if (!m_productWindow && as.isGuaranteeDate())
{
if (log.isLoggable(Level.FINE)) log.fine("GuaranteeDate=" + fieldGuaranteeDate.getValue());
Date gDate = fieldGuaranteeDate.getValue();
Timestamp ts = gDate != null ? new Timestamp(gDate.getTime()) : null;
m_masi.setGuaranteeDate(ts);
if (as.isGuaranteeDateMandatory() && ts == null)
mandatory += " - " + Msg.translate(Env.getCtx(), "GuaranteeDate");
m_changed = true;
} // GuaranteeDate
// *** Save Attributes ***
// New Instance
if (mandatory.isEmpty() && (m_changed || m_masi.getM_AttributeSetInstance_ID() == 0))
{
m_masi.saveEx();
m_M_AttributeSetInstance_ID = m_masi.getM_AttributeSetInstance_ID ();
m_M_AttributeSetInstanceName = m_masi.getDescription();
}
// Save Instance Attributes
MAttribute[] attributes = as.getMAttributes(!m_productWindow);
MAttribute.set_TrxName(attributes, trxName);
for (int i = 0; i < attributes.length; i++)
{
if (MAttribute.ATTRIBUTEVALUETYPE_List.equals(attributes[i].getAttributeValueType()))
{
WEditor editor = (WEditor) m_editors.get(i);
Object item = editor.getValue();
MAttributeValue value = (item != null && Integer.valueOf(String.valueOf(item)) > 0) ? new MAttributeValue(
Env.getCtx(), Integer.valueOf(String.valueOf(item)), null) : null;
if (log.isLoggable(Level.FINE)) log.fine(attributes[i].getName() + "=" + value);
if (attributes[i].isMandatory() && value == null)
mandatory += " - " + attributes[i].getName();
attributes[i].setMAttributeInstance(m_M_AttributeSetInstance_ID, value);
}
else if (MAttribute.ATTRIBUTEVALUETYPE_Number.equals(attributes[i].getAttributeValueType()))
{
WEditor editor = (WEditor)m_editors.get(i);
BigDecimal value = (BigDecimal) editor.getValue();
if (log.isLoggable(Level.FINE)) log.fine(attributes[i].getName() + "=" + value);
if (attributes[i].isMandatory() && value == null)
mandatory += " - " + attributes[i].getName();
//setMAttributeInstance doesn't work without decimal point
if (value != null && value.scale() == 0)
value = value.setScale(1, RoundingMode.HALF_UP);
attributes[i].setMAttributeInstance(m_M_AttributeSetInstance_ID, value);
}
else if (MAttribute.ATTRIBUTEVALUETYPE_Date.equals(attributes[i].getAttributeValueType()))
{
WEditor editor = (WEditor) m_editors.get(i);
Date value = (Date)editor.getValue();
Timestamp ts = value != null ? new Timestamp(value.getTime()) : null;
if (attributes[i].isMandatory() && value == null)
mandatory += " - " + attributes[i].getName();
attributes[i].setMAttributeInstance(m_M_AttributeSetInstance_ID, ts);
}
else if(MAttribute.ATTRIBUTEVALUETYPE_Reference.equals(attributes[i].getAttributeValueType()))
{
setEditorValue(mandatory, attributes[i], m_editors.get(i));
}
else
{
WEditor editor = m_editors.get(i);
String value = String.valueOf(editor.getValue());
if (log.isLoggable(Level.FINE)) log.fine(attributes[i].getName() + "=" + value);
if (attributes[i].isMandatory() && (value == null || value.length() == 0))
mandatory += " - " + attributes[i].getName();
attributes[i].setMAttributeInstance(m_M_AttributeSetInstance_ID, value);
}
m_changed = true;
} // for all attributes
m_M_AttributeSetInstance_ID = m_masi.getM_AttributeSetInstance_ID ();
m_M_AttributeSetInstanceName = m_masi.getDescription();
//
if (mandatory.length() > 0)
{
FDialog.error(m_WindowNo, this, "FillMandatory", mandatory);
return false;
}
// Save Model
else if (m_changed)
{
m_masi.setDescription ();
m_masi.saveEx();
}
}
// Save Instance Attributes
MAttribute[] attributes = as.getMAttributes(!m_productWindow);
MAttribute.set_TrxName(attributes, trxName);
for (int i = 0; i < attributes.length; i++)
{
if (MAttribute.ATTRIBUTEVALUETYPE_List.equals(attributes[i].getAttributeValueType()))
{
Listbox editor = (Listbox)m_editors.get(i);
ListItem item = editor.getSelectedItem();
MAttributeValue value = item != null ? (MAttributeValue)item.getValue() : null;
if (log.isLoggable(Level.FINE)) log.fine(attributes[i].getName() + "=" + value);
if (attributes[i].isMandatory() && value == null)
mandatory += " - " + attributes[i].getName();
attributes[i].setMAttributeInstance(m_M_AttributeSetInstance_ID, value);
}
else if (MAttribute.ATTRIBUTEVALUETYPE_Number.equals(attributes[i].getAttributeValueType()))
{
NumberBox editor = (NumberBox)m_editors.get(i);
BigDecimal value = editor.getValue();
if (log.isLoggable(Level.FINE)) log.fine(attributes[i].getName() + "=" + value);
if (attributes[i].isMandatory() && value == null)
mandatory += " - " + attributes[i].getName();
//setMAttributeInstance doesn't work without decimal point
if (value != null && value.scale() == 0)
value = value.setScale(1, RoundingMode.HALF_UP);
attributes[i].setMAttributeInstance(m_M_AttributeSetInstance_ID, value);
}
else if (MAttribute.ATTRIBUTEVALUETYPE_Date.equals(attributes[i].getAttributeValueType()))
{
Datebox editor = (Datebox) m_editors.get(i);
Date value = editor.getValue();
Timestamp ts = value != null ? new Timestamp(value.getTime()) : null;
if (attributes[i].isMandatory() && value == null)
mandatory += " - " + attributes[i].getName();
attributes[i].setMAttributeInstance(m_M_AttributeSetInstance_ID, ts);
}
else
{
Textbox editor = (Textbox)m_editors.get(i);
String value = editor.getText();
if (log.isLoggable(Level.FINE)) log.fine(attributes[i].getName() + "=" + value);
if (attributes[i].isMandatory() && (value == null || value.length() == 0))
mandatory += " - " + attributes[i].getName();
attributes[i].setMAttributeInstance(m_M_AttributeSetInstance_ID, value);
}
m_changed = true;
} // for all attributes
m_M_AttributeSetInstance_ID = m_masi.getM_AttributeSetInstance_ID ();
m_M_AttributeSetInstanceName = m_masi.getDescription();
//
if (mandatory.length() > 0)
{
FDialog.error(m_WindowNo, this, "FillMandatory", mandatory);
return false;
}
// Save Model
else if (m_changed)
{
m_masi.setDescription ();
m_masi.saveEx();
}
}
finally {
if (trx != null) {
finally {
if (trx != null) {
if (!m_changed || mandatory.length() > 0)
{
// Rollback
@ -1122,11 +1133,70 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
}
trx.close();
trx = null;
}
}
}
}
return true;
} // saveSelection
public String setEditorValue(String mandatory, MAttribute attributes, WEditor editor)
{
int displayType = editor.getGridField().getDisplayType();
if (displayType == DisplayType.YesNo)
{
String value = (boolean) editor.getValue() ? "Y" : "N";
attributes.setMAttributeInstance(m_M_AttributeSetInstance_ID, value);
}
else if (displayType == DisplayType.Date || displayType == DisplayType.DateTime || displayType == DisplayType.Time)
{
Timestamp valueTimeStamp = (Timestamp) editor.getValue();
if (attributes.isMandatory() && valueTimeStamp == null)
mandatory += " - " + attributes.getName();
attributes.setMAttributeInstance(m_M_AttributeSetInstance_ID, valueTimeStamp);
}
else if (DisplayType.isNumeric(displayType))
{
Object value = editor.getValue();
if (attributes.isMandatory() && value == null)
mandatory += " - " + attributes.getName();
if (displayType == DisplayType.Integer)
attributes.setMAttributeInstance(m_M_AttributeSetInstance_ID, value == null ? 0 : ((Number) value).intValue(), null);
else
attributes.setMAttributeInstance(m_M_AttributeSetInstance_ID, (BigDecimal) value);
}
else if (displayType == DisplayType.Image
|| displayType == DisplayType.Assignment
|| displayType == DisplayType.Locator
|| displayType == DisplayType.TableDir
|| displayType == DisplayType.Table
|| displayType == DisplayType.Search
|| displayType == DisplayType.Account)
{
Integer value = (Integer) editor.getValue();
if (attributes.isMandatory() && value == null)
mandatory += " - " + attributes.getName();
String valueLable = null;
if (displayType == DisplayType.TableDir
|| displayType == DisplayType.Table
|| displayType == DisplayType.Search
|| displayType == DisplayType.Account)
{
valueLable = editor.getDisplay();
}
attributes.setMAttributeInstance(m_M_AttributeSetInstance_ID, value == null ? 0 : value.intValue(), valueLable);
}
else
{
String value = (String) editor.getValue();
if (attributes.isMandatory() && value == null)
mandatory += " - " + attributes.getName();
attributes.setMAttributeInstance(m_M_AttributeSetInstance_ID, value);
}
return mandatory;
} // setEditorValue
/**************************************************************************
* Get Instance ID