diff --git a/db/ddlutils/oracle/views/AD_FIELD_V.sql b/db/ddlutils/oracle/views/AD_FIELD_V.sql index d91cefc714..7fecce15af 100644 --- a/db/ddlutils/oracle/views/AD_FIELD_V.sql +++ b/db/ddlutils/oracle/views/AD_FIELD_V.sql @@ -3,7 +3,7 @@ CREATE OR REPLACE VIEW AD_FIELD_V AS f.NAME, f.Description, f.Help, f.IsDisplayed, f.DisplayLogic, f.DisplayLength, f.SeqNo, f.SortNo, f.IsSameLine, f.IsHeading, f.IsFieldOnly, f.IsReadOnly, f.IsEncrypted AS IsEncryptedField, f.ObscureType, - c.ColumnName, c.ColumnSQL, c.FieldLength, c.VFormat, + c.ColumnName, c.ColumnSQL, c.FieldLength, COALESCE(f.VFormat, c.VFormat) AS VFormat, COALESCE(f.DefaultValue, c.DefaultValue) AS DefaultValue, c.IsKey, c.IsParent, COALESCE(f.IsMandatory, c.IsMandatory) AS IsMandatory, diff --git a/db/ddlutils/oracle/views/AD_FIELD_VT.sql b/db/ddlutils/oracle/views/AD_FIELD_VT.sql index 2dd8cf90d6..2c097744bc 100644 --- a/db/ddlutils/oracle/views/AD_FIELD_VT.sql +++ b/db/ddlutils/oracle/views/AD_FIELD_VT.sql @@ -3,7 +3,7 @@ CREATE OR REPLACE VIEW AD_FIELD_VT AS trl.NAME, trl.Description, trl.Help, f.IsDisplayed, f.DisplayLogic, f.DisplayLength, f.SeqNo, f.SortNo, f.IsSameLine, f.IsHeading, f.IsFieldOnly, f.IsReadOnly, f.IsEncrypted AS IsEncryptedField, f.ObscureType, - c.ColumnName, c.ColumnSQL, c.FieldLength, c.VFormat, + c.ColumnName, c.ColumnSQL, c.FieldLength, COALESCE(f.VFormat, c.VFormat) AS VFormat, COALESCE(f.DefaultValue, c.DefaultValue) AS DefaultValue, c.IsKey, c.IsParent, COALESCE(f.IsMandatory, c.IsMandatory) AS IsMandatory, diff --git a/db/ddlutils/postgresql/views/AD_FIELD_V.sql b/db/ddlutils/postgresql/views/AD_FIELD_V.sql index 0bea1acc23..e00ed02966 100644 --- a/db/ddlutils/postgresql/views/AD_FIELD_V.sql +++ b/db/ddlutils/postgresql/views/AD_FIELD_V.sql @@ -2,7 +2,7 @@ CREATE OR REPLACE VIEW ad_field_v AS SELECT t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, f.name, f.description, f.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, - c.fieldlength, c.vformat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, c.iskey, c.isparent, + c.fieldlength, COALESCE(f.vformat, c.vformat) AS vformat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, diff --git a/db/ddlutils/postgresql/views/AD_FIELD_VT.sql b/db/ddlutils/postgresql/views/AD_FIELD_VT.sql index 294da51db3..7e03965532 100644 --- a/db/ddlutils/postgresql/views/AD_FIELD_VT.sql +++ b/db/ddlutils/postgresql/views/AD_FIELD_VT.sql @@ -2,7 +2,7 @@ CREATE OR REPLACE VIEW ad_field_vt AS SELECT trl.ad_language, t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, trl.name, trl.description, trl.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, -c.columnname, c.columnsql, c.fieldlength, c.vformat, +c.columnname, c.columnsql, c.fieldlength, COALESCE(f.vformat, c.vformat) AS vformat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, c.callout, diff --git a/migration/i3.1/oracle/201605052331_IDEMPIERE-2020.sql b/migration/i3.1/oracle/201605052331_IDEMPIERE-2020.sql new file mode 100644 index 0000000000..2072ac9d55 --- /dev/null +++ b/migration/i3.1/oracle/201605052331_IDEMPIERE-2020.sql @@ -0,0 +1,266 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-2020 Value Format for ZK +-- Feb 25, 2015 5:45:01 PM COT +UPDATE AD_Column SET ReadOnlyLogic=NULL,Updated=TO_DATE('2015-02-25 17:45:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=1179 +; + +-- Feb 25, 2015 5:54:41 PM COT +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) VALUES (211839,0,'Value Format','Format of the value; Can contain fixed format elements, Variables: "_lLoOaAcCa09"','Validation elements: + (Space) any character +_ Space (fixed character) +l any Letter a..Z NO space +L any Letter a..Z NO space converted to upper case +o any Letter a..Z or space +O any Letter a..Z or space converted to upper case +a any Letters & Digits NO space +A any Letters & Digits NO space converted to upper case +c any Letters & Digits or space +C any Letters & Digits or space converted to upper case +0 Digits 0..9 NO space +9 Digits 0..9 or space + +Example of format "(000)_000-0000"',107,'VFormat',255,'N','N','N','N','N',0,'N',10,0,0,'Y',TO_DATE('2015-02-25 17:54:41','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-25 17:54:41','YYYY-MM-DD HH24:MI:SS'),100,616,'Y','N','D','N','N','N','Y','a585debb-2c2f-4a8f-89c9-28281fd44b62','Y',0,'N','N') +; + +-- Feb 25, 2015 5:55:50 PM COT +UPDATE AD_Column SET FieldLength=255,Updated=TO_DATE('2015-02-25 17:55:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=1179 +; + +-- Feb 25, 2015 5:55:52 PM COT +ALTER TABLE AD_Column MODIFY VFormat VARCHAR2(255) DEFAULT NULL +; + +-- Feb 25, 2015 5:56:14 PM COT +UPDATE AD_Column SET FieldLength=255,Updated=TO_DATE('2015-02-25 17:56:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3740 +; + +-- Feb 25, 2015 5:56:15 PM COT +ALTER TABLE AD_Process_Para MODIFY VFormat VARCHAR2(255) DEFAULT NULL +; + +-- Feb 25, 2015 5:57:01 PM COT +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) VALUES (211840,0,'Value Format','Format of the value; Can contain fixed format elements, Variables: "_lLoOaAcCa09"','Validation elements: + (Space) any character +_ Space (fixed character) +l any Letter a..Z NO space +L any Letter a..Z NO space converted to upper case +o any Letter a..Z or space +O any Letter a..Z or space converted to upper case +a any Letters & Digits NO space +A any Letters & Digits NO space converted to upper case +c any Letters & Digits or space +C any Letters & Digits or space converted to upper case +0 Digits 0..9 NO space +9 Digits 0..9 or space + +Example of format "(000)_000-0000"',464,'VFormat',255,'N','N','N','N','N',0,'N',10,0,0,'Y',TO_DATE('2015-02-25 17:57:00','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-25 17:57:00','YYYY-MM-DD HH24:MI:SS'),100,616,'Y','N','U','N','N','N','Y','35514060-1c96-435d-b3bf-101ed064d4f6','Y',0,'N','N') +; + +-- Feb 25, 2015 5:57:03 PM COT +ALTER TABLE AD_UserDef_Field ADD VFormat VARCHAR2(255) DEFAULT NULL +; + +-- Feb 25, 2015 5:57:30 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (203499,'Value Format','Format of the value; Can contain fixed format elements, Variables: "_lLoOaAcCa09"','Validation elements: + (Space) any character +_ Space (fixed character) +l any Letter a..Z NO space +L any Letter a..Z NO space converted to upper case +o any Letter a..Z or space +O any Letter a..Z or space converted to upper case +a any Letters & Digits NO space +A any Letters & Digits NO space converted to upper case +c any Letters & Digits or space +C any Letters & Digits or space converted to upper case +0 Digits 0..9 NO space +9 Digits 0..9 or space + +Example of format "(000)_000-0000"',395,211840,'Y',255,290,'N','N','N','N',0,0,'Y',TO_DATE('2015-02-25 17:57:30','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-25 17:57:30','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','f8a92fba-ee26-4ccc-95ed-62dcfd3d7207','Y',290,5) +; + +-- Feb 25, 2015 6:00:15 PM COT +ALTER TABLE AD_Field ADD VFormat VARCHAR2(255) DEFAULT NULL +; + +-- Feb 25, 2015 6:04:12 PM COT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=270, XPosition=1,Updated=TO_DATE('2015-02-25 18:04:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203499 +; + +-- Feb 25, 2015 6:04:12 PM COT +UPDATE AD_Field SET SeqNo=280,Updated=TO_DATE('2015-02-25 18:04:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5051 +; + +-- Feb 25, 2015 6:04:12 PM COT +UPDATE AD_Field SET SeqNo=290,Updated=TO_DATE('2015-02-25 18:04:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5057 +; + +-- Feb 25, 2015 6:04:41 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (203500,'Value Format','Format of the value; Can contain fixed format elements, Variables: "_lLoOaAcCa09"','Validation elements: + (Space) any character +_ Space (fixed character) +l any Letter a..Z NO space +L any Letter a..Z NO space converted to upper case +o any Letter a..Z or space +O any Letter a..Z or space converted to upper case +a any Letters & Digits NO space +A any Letters & Digits NO space converted to upper case +c any Letters & Digits or space +C any Letters & Digits or space converted to upper case +0 Digits 0..9 NO space +9 Digits 0..9 or space + +Example of format "(000)_000-0000"',107,211839,'Y',255,410,'N','N','N','N',0,0,'Y',TO_DATE('2015-02-25 18:04:41','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-25 18:04:41','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','8eb1b299-24e3-4c1b-bbc6-5c3b92e1adf8','Y',400,5) +; + +-- Feb 25, 2015 6:05:15 PM COT +UPDATE AD_Field SET SeqNo=250,Updated=TO_DATE('2015-02-25 18:05:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=141 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=260,Updated=TO_DATE('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200350 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=270,Updated=TO_DATE('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200348 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=280,Updated=TO_DATE('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200349 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=290,Updated=TO_DATE('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13425 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=300,Updated=TO_DATE('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200837 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=310,Updated=TO_DATE('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54402 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=320,Updated=TO_DATE('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54401 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=330,Updated=TO_DATE('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200838 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=340,Updated=TO_DATE('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200834 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=350,Updated=TO_DATE('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13424 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=360,Updated=TO_DATE('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62468 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=370,Updated=TO_DATE('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53280 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=380,Updated=TO_DATE('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200836 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=390,Updated=TO_DATE('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200835 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=400, XPosition=1,Updated=TO_DATE('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203500 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=410,Updated=TO_DATE('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=136 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=420,Updated=TO_DATE('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=139 +; + +CREATE OR REPLACE VIEW AD_FIELD_V AS + SELECT t.AD_Window_ID, f.AD_Tab_ID, f.AD_Field_ID, tbl.AD_Table_ID, f.AD_Column_ID, + f.NAME, f.Description, f.Help, f.IsDisplayed, f.DisplayLogic, f.DisplayLength, + f.SeqNo, f.SortNo, f.IsSameLine, f.IsHeading, f.IsFieldOnly, f.IsReadOnly, + f.IsEncrypted AS IsEncryptedField, f.ObscureType, + c.ColumnName, c.ColumnSQL, c.FieldLength, COALESCE(f.VFormat, c.VFormat) AS VFormat, + COALESCE(f.DefaultValue, c.DefaultValue) AS DefaultValue, + c.IsKey, c.IsParent, + COALESCE(f.IsMandatory, c.IsMandatory) AS IsMandatory, + c.IsIdentifier, c.IsTranslated, COALESCE(f.AD_Reference_Value_ID, c.AD_Reference_Value_ID) AS AD_Reference_Value_ID, + c.Callout, COALESCE(f.AD_Reference_ID, c.AD_Reference_ID) AS AD_Reference_ID, + COALESCE(f.AD_Val_Rule_ID, c.AD_Val_Rule_ID) AS AD_Val_Rule_ID, c.AD_Process_ID, + COALESCE(f.Isalwaysupdateable , C.Isalwaysupdateable) As Isalwaysupdateable, + COALESCE(f.Readonlylogic, c.Readonlylogic ) As Readonlylogic, + COALESCE(f.Mandatorylogic , C.Mandatorylogic) As Mandatorylogic, + COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, c.IsEncrypted AS IsEncryptedColumn, + c.IsSelectionColumn, + tbl.TableName, c.ValueMin, c.ValueMax, + fg.NAME AS FieldGroup, vr.Code AS ValidationCode, + f.Included_Tab_ID, fg.FieldGroupType, fg.IsCollapsedByDefault, + COALESCE(f.InfoFactoryClass, c.InfoFactoryClass) as InfoFactoryClass, + c.IsAutocomplete, COALESCE(f.IsAllowCopy, c.IsAllowCopy) AS IsAllowCopy, + f.isdisplayedgrid, + f.seqnogrid, + c.seqnoselection, f.xposition, f.columnspan, f.numlines, + COALESCE(f.istoolbarbutton , c.istoolbarbutton ) As istoolbarbutton, + c.FormatPattern, f.isadvancedfield, f.IsDefaultFocus, c.AD_Chart_ID +FROM AD_FIELD f + INNER JOIN AD_TAB t ON (f.AD_Tab_ID = t.AD_Tab_ID) + LEFT OUTER JOIN AD_FIELDGROUP fg ON (f.AD_FieldGroup_ID = fg.AD_FieldGroup_ID) + LEFT OUTER JOIN AD_COLUMN c ON (f.AD_Column_ID = c.AD_Column_ID) + INNER JOIN AD_TABLE tbl ON (c.AD_Table_ID = tbl.AD_Table_ID) + LEFT OUTER JOIN AD_VAL_RULE vr ON (vr.AD_Val_Rule_ID = COALESCE(f.AD_Val_Rule_ID, c.AD_Val_Rule_ID)) +WHERE f.IsActive = 'Y' + AND c.IsActive = 'Y' +; + +CREATE OR REPLACE VIEW AD_FIELD_VT AS + SELECT trl.AD_LANGUAGE, t.AD_Window_ID, f.AD_Tab_ID, f.AD_Field_ID, tbl.AD_Table_ID, f.AD_Column_ID, + trl.NAME, trl.Description, trl.Help, f.IsDisplayed, f.DisplayLogic, f.DisplayLength, + f.SeqNo, f.SortNo, f.IsSameLine, f.IsHeading, f.IsFieldOnly, f.IsReadOnly, + f.IsEncrypted AS IsEncryptedField, f.ObscureType, + c.ColumnName, c.ColumnSQL, c.FieldLength, COALESCE(f.VFormat, c.VFormat) AS VFormat, + COALESCE(f.DefaultValue, c.DefaultValue) AS DefaultValue, + c.IsKey, c.IsParent, + COALESCE(f.IsMandatory, c.IsMandatory) AS IsMandatory, + c.IsIdentifier, c.IsTranslated, COALESCE(f.AD_Reference_Value_ID, c.AD_Reference_Value_ID) AS AD_Reference_Value_ID, + c.Callout, COALESCE(f.AD_Reference_ID, c.AD_Reference_ID) AS AD_Reference_ID, + COALESCE(f.AD_Val_Rule_ID, c.AD_Val_Rule_ID) as AD_Val_Rule_ID, c.AD_Process_ID, + COALESCE(f.Isalwaysupdateable , C.Isalwaysupdateable) As Isalwaysupdateable, + COALESCE(f.Readonlylogic, c.Readonlylogic ) As Readonlylogic, + COALESCE(f.Mandatorylogic , C.Mandatorylogic) As Mandatorylogic, + COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, c.IsEncrypted AS IsEncryptedColumn, c.IsSelectionColumn, + tbl.TableName, c.ValueMin, c.ValueMax, + fgt.NAME AS FieldGroup, vr.Code AS ValidationCode, + f.Included_Tab_ID, fg.FieldGroupType, fg.IsCollapsedByDefault, + COALESCE(f.InfoFactoryClass, c.InfoFactoryClass) as InfoFactoryClass, + c.IsAutocomplete, COALESCE(f.IsAllowCopy, c.IsAllowCopy) AS IsAllowCopy, + f.isdisplayedgrid, + f.seqnogrid, + c.seqnoselection, f.xposition, f.columnspan, f.numlines, + COALESCE(f.istoolbarbutton , c.istoolbarbutton ) As istoolbarbutton, + c.FormatPattern, f.isadvancedfield, f.IsDefaultFocus, c.AD_Chart_ID + FROM AD_FIELD f + INNER JOIN AD_FIELD_TRL trl ON (f.AD_Field_ID = trl.AD_Field_ID) + INNER JOIN AD_TAB t ON (f.AD_Tab_ID = t.AD_Tab_ID) + LEFT OUTER JOIN AD_FIELDGROUP fg ON (f.AD_FieldGroup_ID = fg.AD_FieldGroup_ID) + LEFT OUTER JOIN AD_FIELDGROUP_TRL fgt ON + (f.AD_FieldGroup_ID = fgt.AD_FieldGroup_ID AND trl.AD_LANGUAGE=fgt.AD_LANGUAGE) + LEFT OUTER JOIN AD_COLUMN c ON (f.AD_Column_ID = c.AD_Column_ID) + INNER JOIN AD_TABLE tbl ON (c.AD_Table_ID = tbl.AD_Table_ID) + LEFT OUTER JOIN AD_VAL_RULE vr ON (vr.AD_Val_Rule_ID=COALESCE(f.AD_Val_Rule_ID, c.AD_Val_Rule_ID)) + WHERE f.IsActive = 'Y' + AND c.IsActive = 'Y' +; + +SELECT register_migration_script('201605052331_IDEMPIERE-2020.sql') FROM dual +; diff --git a/migration/i3.1/postgresql/201605052331_IDEMPIERE-2020.sql b/migration/i3.1/postgresql/201605052331_IDEMPIERE-2020.sql new file mode 100644 index 0000000000..2837baada8 --- /dev/null +++ b/migration/i3.1/postgresql/201605052331_IDEMPIERE-2020.sql @@ -0,0 +1,246 @@ +-- IDEMPIERE-2020 Value Format for ZK +-- Feb 25, 2015 5:45:01 PM COT +UPDATE AD_Column SET ReadOnlyLogic=NULL,Updated=TO_TIMESTAMP('2015-02-25 17:45:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=1179 +; + +-- Feb 25, 2015 5:54:41 PM COT +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) VALUES (211839,0,'Value Format','Format of the value; Can contain fixed format elements, Variables: "_lLoOaAcCa09"','Validation elements: + (Space) any character +_ Space (fixed character) +l any Letter a..Z NO space +L any Letter a..Z NO space converted to upper case +o any Letter a..Z or space +O any Letter a..Z or space converted to upper case +a any Letters & Digits NO space +A any Letters & Digits NO space converted to upper case +c any Letters & Digits or space +C any Letters & Digits or space converted to upper case +0 Digits 0..9 NO space +9 Digits 0..9 or space + +Example of format "(000)_000-0000"',107,'VFormat',255,'N','N','N','N','N',0,'N',10,0,0,'Y',TO_TIMESTAMP('2015-02-25 17:54:41','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-25 17:54:41','YYYY-MM-DD HH24:MI:SS'),100,616,'Y','N','D','N','N','N','Y','a585debb-2c2f-4a8f-89c9-28281fd44b62','Y',0,'N','N') +; + +-- Feb 25, 2015 5:55:50 PM COT +UPDATE AD_Column SET FieldLength=255,Updated=TO_TIMESTAMP('2015-02-25 17:55:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=1179 +; + +-- Feb 25, 2015 5:55:52 PM COT +INSERT INTO t_alter_column values('ad_column','VFormat','VARCHAR(255)',null,'NULL') +; + +-- Feb 25, 2015 5:56:14 PM COT +UPDATE AD_Column SET FieldLength=255,Updated=TO_TIMESTAMP('2015-02-25 17:56:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3740 +; + +-- Feb 25, 2015 5:56:15 PM COT +INSERT INTO t_alter_column values('ad_process_para','VFormat','VARCHAR(255)',null,'NULL') +; + +-- Feb 25, 2015 5:57:01 PM COT +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) VALUES (211840,0,'Value Format','Format of the value; Can contain fixed format elements, Variables: "_lLoOaAcCa09"','Validation elements: + (Space) any character +_ Space (fixed character) +l any Letter a..Z NO space +L any Letter a..Z NO space converted to upper case +o any Letter a..Z or space +O any Letter a..Z or space converted to upper case +a any Letters & Digits NO space +A any Letters & Digits NO space converted to upper case +c any Letters & Digits or space +C any Letters & Digits or space converted to upper case +0 Digits 0..9 NO space +9 Digits 0..9 or space + +Example of format "(000)_000-0000"',464,'VFormat',255,'N','N','N','N','N',0,'N',10,0,0,'Y',TO_TIMESTAMP('2015-02-25 17:57:00','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-25 17:57:00','YYYY-MM-DD HH24:MI:SS'),100,616,'Y','N','U','N','N','N','Y','35514060-1c96-435d-b3bf-101ed064d4f6','Y',0,'N','N') +; + +-- Feb 25, 2015 5:57:03 PM COT +ALTER TABLE AD_UserDef_Field ADD COLUMN VFormat VARCHAR(255) DEFAULT NULL +; + +-- Feb 25, 2015 5:57:30 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (203499,'Value Format','Format of the value; Can contain fixed format elements, Variables: "_lLoOaAcCa09"','Validation elements: + (Space) any character +_ Space (fixed character) +l any Letter a..Z NO space +L any Letter a..Z NO space converted to upper case +o any Letter a..Z or space +O any Letter a..Z or space converted to upper case +a any Letters & Digits NO space +A any Letters & Digits NO space converted to upper case +c any Letters & Digits or space +C any Letters & Digits or space converted to upper case +0 Digits 0..9 NO space +9 Digits 0..9 or space + +Example of format "(000)_000-0000"',395,211840,'Y',255,290,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2015-02-25 17:57:30','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-25 17:57:30','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','f8a92fba-ee26-4ccc-95ed-62dcfd3d7207','Y',290,5) +; + +-- Feb 25, 2015 6:00:15 PM COT +ALTER TABLE AD_Field ADD COLUMN VFormat VARCHAR(255) DEFAULT NULL +; + +-- Feb 25, 2015 6:04:12 PM COT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=270, XPosition=1,Updated=TO_TIMESTAMP('2015-02-25 18:04:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203499 +; + +-- Feb 25, 2015 6:04:12 PM COT +UPDATE AD_Field SET SeqNo=280,Updated=TO_TIMESTAMP('2015-02-25 18:04:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5051 +; + +-- Feb 25, 2015 6:04:12 PM COT +UPDATE AD_Field SET SeqNo=290,Updated=TO_TIMESTAMP('2015-02-25 18:04:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5057 +; + +-- Feb 25, 2015 6:04:41 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (203500,'Value Format','Format of the value; Can contain fixed format elements, Variables: "_lLoOaAcCa09"','Validation elements: + (Space) any character +_ Space (fixed character) +l any Letter a..Z NO space +L any Letter a..Z NO space converted to upper case +o any Letter a..Z or space +O any Letter a..Z or space converted to upper case +a any Letters & Digits NO space +A any Letters & Digits NO space converted to upper case +c any Letters & Digits or space +C any Letters & Digits or space converted to upper case +0 Digits 0..9 NO space +9 Digits 0..9 or space + +Example of format "(000)_000-0000"',107,211839,'Y',255,410,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2015-02-25 18:04:41','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-25 18:04:41','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','8eb1b299-24e3-4c1b-bbc6-5c3b92e1adf8','Y',400,5) +; + +-- Feb 25, 2015 6:05:15 PM COT +UPDATE AD_Field SET SeqNo=250,Updated=TO_TIMESTAMP('2015-02-25 18:05:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=141 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=260,Updated=TO_TIMESTAMP('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200350 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=270,Updated=TO_TIMESTAMP('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200348 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=280,Updated=TO_TIMESTAMP('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200349 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=290,Updated=TO_TIMESTAMP('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13425 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=300,Updated=TO_TIMESTAMP('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200837 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=310,Updated=TO_TIMESTAMP('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54402 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=320,Updated=TO_TIMESTAMP('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54401 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=330,Updated=TO_TIMESTAMP('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200838 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=340,Updated=TO_TIMESTAMP('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200834 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=350,Updated=TO_TIMESTAMP('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13424 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=360,Updated=TO_TIMESTAMP('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62468 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=370,Updated=TO_TIMESTAMP('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53280 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=380,Updated=TO_TIMESTAMP('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200836 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=390,Updated=TO_TIMESTAMP('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200835 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=400, XPosition=1,Updated=TO_TIMESTAMP('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203500 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=410,Updated=TO_TIMESTAMP('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=136 +; + +-- Feb 25, 2015 6:05:16 PM COT +UPDATE AD_Field SET SeqNo=420,Updated=TO_TIMESTAMP('2015-02-25 18:05:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=139 +; + +CREATE OR REPLACE VIEW ad_field_v AS + SELECT t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, f.name, f.description, + f.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline, f.isheading, + f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, + c.fieldlength, COALESCE(f.vformat, c.vformat) AS vformat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, c.iskey, c.isparent, + COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, + COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, c.callout, + COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, + COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, + COALESCE(f.isalwaysupdateable, c.isalwaysupdateable) AS isalwaysupdateable, + COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, + COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, + COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, c.isencrypted AS isencryptedcolumn, + c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fg.name AS fieldgroup, + vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype, fg.iscollapsedbydefault, + COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, + COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid, f.seqnogrid, c.seqnoselection, + f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, + c.formatpattern, f.isadvancedfield, f.IsDefaultFocus, c.AD_Chart_ID + FROM ad_field f + JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id + LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id + LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id + JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id + LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) + WHERE f.isactive = 'Y'::bpchar AND c.isactive = 'Y'::bpchar +; + +CREATE OR REPLACE VIEW ad_field_vt AS + SELECT trl.ad_language, t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, + trl.name, trl.description, trl.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, + f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, +c.columnname, c.columnsql, c.fieldlength, COALESCE(f.vformat, c.vformat) AS vformat, +COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, c.iskey, c.isparent, +COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, +COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, c.callout, +COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, +COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, +COALESCE(f.isalwaysupdateable, c.isalwaysupdateable) AS isalwaysupdateable, +COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, +COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, +COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, c.isencrypted AS isencryptedcolumn, +c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fgt.name AS fieldgroup, vr.code AS validationcode, +f.included_tab_id, fg.fieldgrouptype, fg.iscollapsedbydefault, +COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, +COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid, f.seqnogrid, c.seqnoselection, +f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, +c.formatpattern, f.isadvancedfield, f.IsDefaultFocus, c.AD_Chart_ID + FROM ad_field f + JOIN ad_field_trl trl ON f.ad_field_id = trl.ad_field_id + JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id + LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id + LEFT JOIN ad_fieldgroup_trl fgt ON f.ad_fieldgroup_id = fgt.ad_fieldgroup_id AND trl.ad_language::text = fgt.ad_language::text + LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id + JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id + LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) + WHERE f.isactive = 'Y'::bpchar AND c.isactive = 'Y'::bpchar +; + +SELECT register_migration_script('201605052331_IDEMPIERE-2020.sql') FROM dual +; diff --git a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java index b38563c10e..4c21644a1c 100644 --- a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java +++ b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java @@ -299,6 +299,8 @@ public class GridFieldVO implements Serializable vo.NumLines=userDef.getNumLines(); if (userDef.getIsToolbarButton() != null) vo.IsToolbarButton = userDef.getIsToolbarButton(); + if (userDef.getVFormat() != null) + vo.VFormat = userDef.getVFormat(); //IDEMPIERE-1120 Implement Field SeqNo customization if (userDef.getSeqNo() > 0) vo.SeqNo = userDef.getSeqNo(); diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_Field.java b/org.adempiere.base/src/org/compiere/model/I_AD_Field.java index ac05c64b08..5377effa2a 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_Field.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_Field.java @@ -619,6 +619,21 @@ public interface I_AD_Field */ public int getUpdatedBy(); + /** Column name VFormat */ + public static final String COLUMNNAME_VFormat = "VFormat"; + + /** Set Value Format. + * Format of the value; + Can contain fixed format elements, Variables: "_lLoOaAcCa09" + */ + public void setVFormat (String VFormat); + + /** Get Value Format. + * Format of the value; + Can contain fixed format elements, Variables: "_lLoOaAcCa09" + */ + public String getVFormat(); + /** Column name XPosition */ public static final String COLUMNNAME_XPosition = "XPosition"; diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_UserDef_Field.java b/org.adempiere.base/src/org/compiere/model/I_AD_UserDef_Field.java index 940b81496a..86cfb60277 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_UserDef_Field.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_UserDef_Field.java @@ -443,6 +443,21 @@ public interface I_AD_UserDef_Field */ public int getUpdatedBy(); + /** Column name VFormat */ + public static final String COLUMNNAME_VFormat = "VFormat"; + + /** Set Value Format. + * Format of the value; + Can contain fixed format elements, Variables: "_lLoOaAcCa09" + */ + public void setVFormat (String VFormat); + + /** Get Value Format. + * Format of the value; + Can contain fixed format elements, Variables: "_lLoOaAcCa09" + */ + public String getVFormat(); + /** Column name XPosition */ public static final String COLUMNNAME_XPosition = "XPosition"; diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_Field.java b/org.adempiere.base/src/org/compiere/model/X_AD_Field.java index 938455d6dd..c537d5f130 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_Field.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_Field.java @@ -32,7 +32,7 @@ public class X_AD_Field extends PO implements I_AD_Field, I_Persistent /** * */ - private static final long serialVersionUID = 20151030L; + private static final long serialVersionUID = 20160505L; /** Standard Constructor */ public X_AD_Field (Properties ctx, int AD_Field_ID, String trxName) @@ -986,6 +986,23 @@ public class X_AD_Field extends PO implements I_AD_Field, I_Persistent return bd; } + /** Set Value Format. + @param VFormat + Format of the value; Can contain fixed format elements, Variables: "_lLoOaAcCa09" + */ + public void setVFormat (String VFormat) + { + set_Value (COLUMNNAME_VFormat, VFormat); + } + + /** Get Value Format. + @return Format of the value; Can contain fixed format elements, Variables: "_lLoOaAcCa09" + */ + public String getVFormat () + { + return (String)get_Value(COLUMNNAME_VFormat); + } + /** Set X Position. @param XPosition Absolute X (horizontal) position in 1/72 of an inch diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_UserDef_Field.java b/org.adempiere.base/src/org/compiere/model/X_AD_UserDef_Field.java index 0824f22336..918d538ed8 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_UserDef_Field.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_UserDef_Field.java @@ -30,7 +30,7 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers /** * */ - private static final long serialVersionUID = 20151030L; + private static final long serialVersionUID = 20160505L; /** Standard Constructor */ public X_AD_UserDef_Field (Properties ctx, int AD_UserDef_Field_ID, String trxName) @@ -639,6 +639,23 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers return ii.intValue(); } + /** Set Value Format. + @param VFormat + Format of the value; Can contain fixed format elements, Variables: "_lLoOaAcCa09" + */ + public void setVFormat (String VFormat) + { + set_Value (COLUMNNAME_VFormat, VFormat); + } + + /** Get Value Format. + @return Format of the value; Can contain fixed format elements, Variables: "_lLoOaAcCa09" + */ + public String getVFormat () + { + return (String)get_Value(COLUMNNAME_VFormat); + } + /** Set X Position. @param XPosition Absolute X (horizontal) position in 1/72 of an inch diff --git a/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml b/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml index 8b26228bbf..996047711b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml +++ b/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml @@ -39,6 +39,7 @@ Copyright (C) 2007 Ashley G Ramdass (ADempiere WebUI). ++ diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WStringEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WStringEditor.java index f2e62e26a0..f24e517be0 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WStringEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WStringEditor.java @@ -71,6 +71,10 @@ public class WStringEditor extends WEditor implements ContextMenuListener { super(gridField.isAutocomplete() ? new Combobox() : new Textbox(), gridField); this.tableEditor = tableEditor; + + if (gridField.getVFormat() != null && !gridField.getVFormat().isEmpty()) + getComponent().setWidgetListener("onBind", "jq(this).mask('" + gridField.getVFormat() + "');"); + init(gridField.getObscureType()); } @@ -82,14 +86,17 @@ public class WStringEditor extends WEditor implements ContextMenuListener * @param isUpdateable * @param displayLength * @param fieldLength - * @param vFormat + * @param wVFormat * @param obscureType */ public WStringEditor(String columnName, boolean mandatory, boolean isReadOnly, boolean isUpdateable, - int displayLength, int fieldLength, String vFormat, String obscureType) + int displayLength, int fieldLength, String wVFormat, String obscureType) { super(new Textbox(), columnName, null, null, mandatory, isReadOnly,isUpdateable); + if (wVFormat != null && !wVFormat.isEmpty()) + getComponent().setWidgetListener("onBind", "jq(this).mask('" + wVFormat + "');"); + init(obscureType); } diff --git a/org.adempiere.ui.zk/js/jquery.maskedinput.js b/org.adempiere.ui.zk/js/jquery.maskedinput.js new file mode 100644 index 0000000000..58c1174ae3 --- /dev/null +++ b/org.adempiere.ui.zk/js/jquery.maskedinput.js @@ -0,0 +1,191 @@ +/* + jQuery Masked Input Plugin + Copyright (c) 2007 - 2015 Josh Bush (digitalbush.com) + Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license) + Version: 1.4.1 +*/ +!function(factory) { + "function" == typeof define && define.amd ? define([ "jquery" ], factory) : factory("object" == typeof exports ? require("jquery") : jQuery); +}(function($) { + var caretTimeoutId, ua = navigator.userAgent, iPhone = /iphone/i.test(ua), chrome = /chrome/i.test(ua), android = /android/i.test(ua); + $.mask = { + definitions: { + /* iDempiere VFormat */ + "0":"[0-9]", + "9":"[ 0-9]", + a:"[A-Za-z0-9]", + A:"[A-Z0-9]", + c:"[ A-Za-z0-9]", + C:"[ A-Z0-9]", + l:"[A-Za-z]", + L:"[A-Z]", + o:"[ A-Za-z]", + O:"[ A-Z]", + U:"[^a-z]" /* adding a new iDempiere format to allow any character except lowercases - useful to force company names in uppercase */ + }, + autoclear: !0, + dataName: "rawMaskFn", + placeholder: " " + }, $.fn.extend({ + caret: function(begin, end) { + var range; + if (0 !== this.length && !this.is(":hidden")) return "number" == typeof begin ? (end = "number" == typeof end ? end : begin, + this.each(function() { + this.setSelectionRange ? this.setSelectionRange(begin, end) : this.createTextRange && (range = this.createTextRange(), + range.collapse(!0), range.moveEnd("character", end), range.moveStart("character", begin), + range.select()); + })) : (this[0].setSelectionRange ? (begin = this[0].selectionStart, end = this[0].selectionEnd) : document.selection && document.selection.createRange && (range = document.selection.createRange(), + begin = 0 - range.duplicate().moveStart("character", -1e5), end = begin + range.text.length), + { + begin: begin, + end: end + }); + }, + unmask: function() { + return this.trigger("unmask"); + }, + mask: function(mask, settings) { + var input, defs, tests, partialPosition, firstNonMaskPos, lastRequiredNonMaskPos, len, oldVal; + if (!mask && this.length > 0) { + input = $(this[0]); + var fn = input.data($.mask.dataName); + return fn ? fn() : void 0; + } + return settings = $.extend({ + autoclear: $.mask.autoclear, + placeholder: $.mask.placeholder, + completed: null + }, settings), defs = $.mask.definitions, tests = [], partialPosition = len = mask.length, + firstNonMaskPos = null, $.each(mask.split(""), function(i, c) { + "?" == c ? (len--, partialPosition = i) : defs[c] ? (tests.push(new RegExp(defs[c])), + null === firstNonMaskPos && (firstNonMaskPos = tests.length - 1), partialPosition > i && (lastRequiredNonMaskPos = tests.length - 1)) : tests.push(null); + }), this.trigger("unmask").each(function() { + function tryFireCompleted() { + if (settings.completed) { + for (var i = firstNonMaskPos; lastRequiredNonMaskPos >= i; i++) if (tests[i] && buffer[i] === getPlaceholder(i)) return; + settings.completed.call(input); + } + } + function getPlaceholder(i) { + return settings.placeholder.charAt(i < settings.placeholder.length ? i : 0); + } + function seekNext(pos) { + for (;++pos < len && !tests[pos]; ) ; + return pos; + } + function seekPrev(pos) { + for (;--pos >= 0 && !tests[pos]; ) ; + return pos; + } + function shiftL(begin, end) { + var i, j; + if (!(0 > begin)) { + for (i = begin, j = seekNext(end); len > i; i++) if (tests[i]) { + if (!(len > j && tests[i].test(buffer[j]))) break; + buffer[i] = buffer[j], buffer[j] = getPlaceholder(j), j = seekNext(j); + } + writeBuffer(), input.caret(Math.max(firstNonMaskPos, begin)); + } + } + function shiftR(pos) { + var i, c, j, t; + for (i = pos, c = getPlaceholder(pos); len > i; i++) if (tests[i]) { + if (j = seekNext(i), t = buffer[i], buffer[i] = c, !(len > j && tests[j].test(t))) break; + c = t; + } + } + function androidInputEvent() { + var curVal = input.val(), pos = input.caret(); + if (oldVal && oldVal.length && oldVal.length > curVal.length) { + for (checkVal(!0); pos.begin > 0 && !tests[pos.begin - 1]; ) pos.begin--; + if (0 === pos.begin) for (;pos.begin < firstNonMaskPos && !tests[pos.begin]; ) pos.begin++; + input.caret(pos.begin, pos.begin); + } else { + for (checkVal(!0); pos.begin < len && !tests[pos.begin]; ) pos.begin++; + input.caret(pos.begin, pos.begin); + } + tryFireCompleted(); + } + function blurEvent() { + checkVal(), input.val() != focusText && input.change(); + } + function keydownEvent(e) { + if (!input.prop("readonly")) { + var pos, begin, end, k = e.which || e.keyCode; + oldVal = input.val(), 8 === k || 46 === k || iPhone && 127 === k ? (pos = input.caret(), + begin = pos.begin, end = pos.end, end - begin === 0 && (begin = 46 !== k ? seekPrev(begin) : end = seekNext(begin - 1), + end = 46 === k ? seekNext(end) : end), clearBuffer(begin, end), shiftL(begin, end - 1), + e.preventDefault()) : 13 === k ? blurEvent.call(this, e) : 27 === k && (input.val(focusText), + input.caret(0, checkVal()), e.preventDefault()); + } + } + function keypressEvent(e) { + if (!input.prop("readonly")) { + var p, c, next, k = e.which || e.keyCode, pos = input.caret(); + if (!(e.ctrlKey || e.altKey || e.metaKey || 32 > k) && k && 13 !== k) { + if (pos.end - pos.begin !== 0 && (clearBuffer(pos.begin, pos.end), shiftL(pos.begin, pos.end - 1)), + p = seekNext(pos.begin - 1), len > p && (c = String.fromCharCode(k), tests[p].test(c))) { + if (shiftR(p), buffer[p] = c, writeBuffer(), next = seekNext(p), android) { + var proxy = function() { + $.proxy($.fn.caret, input, next)(); + }; + setTimeout(proxy, 0); + } else input.caret(next); + pos.begin <= lastRequiredNonMaskPos && tryFireCompleted(); + } + e.preventDefault(); + } + } + } + function clearBuffer(start, end) { + var i; + for (i = start; end > i && len > i; i++) tests[i] && (buffer[i] = getPlaceholder(i)); + } + function writeBuffer() { + input.val(buffer.join("")); + } + function checkVal(allow) { + var i, c, pos, test = input.val(), lastMatch = -1; + for (i = 0, pos = 0; len > i; i++) if (tests[i]) { + for (buffer[i] = getPlaceholder(i); pos++ < test.length; ) if (c = test.charAt(pos - 1), + tests[i].test(c)) { + buffer[i] = c, lastMatch = i; + break; + } + if (pos > test.length) { + clearBuffer(i + 1, len); + break; + } + } else buffer[i] === test.charAt(pos) && pos++, partialPosition > i && (lastMatch = i); + return allow ? writeBuffer() : partialPosition > lastMatch + 1 ? settings.autoclear || buffer.join("") === defaultBuffer ? (input.val() && input.val(""), + clearBuffer(0, len)) : writeBuffer() : (writeBuffer(), input.val(input.val().substring(0, lastMatch + 1))), + partialPosition ? i : firstNonMaskPos; + } + var input = $(this), buffer = $.map(mask.split(""), function(c, i) { + return "?" != c ? defs[c] ? getPlaceholder(i) : c : void 0; + }), defaultBuffer = buffer.join(""), focusText = input.val(); + input.data($.mask.dataName, function() { + return $.map(buffer, function(c, i) { + return tests[i] && c != getPlaceholder(i) ? c : null; + }).join(""); + }), input.one("unmask", function() { + input.off(".mask").removeData($.mask.dataName); + }).on("focus.mask", function() { + if (!input.prop("readonly")) { + clearTimeout(caretTimeoutId); + var pos; + focusText = input.val(), pos = checkVal(), caretTimeoutId = setTimeout(function() { + input.get(0) === document.activeElement && (writeBuffer(), pos == mask.replace("?", "").length ? input.caret(0, pos) : input.caret(pos)); + }, 10); + } + }).on("blur.mask", blurEvent).on("keydown.mask", keydownEvent).on("keypress.mask", keypressEvent).on("input.mask paste.mask", function() { + input.prop("readonly") || setTimeout(function() { + var pos = checkVal(!0); + input.caret(pos), tryFireCompleted(); + }, 0); + }), chrome && android && input.off("input.mask").on("input.mask", androidInputEvent), + checkVal(); + }); + } + }); +});