diff --git a/migration/i2.0z/oracle/201405291604_IDEMPIERE-1792.sql b/migration/i2.0z/oracle/201405291604_IDEMPIERE-1792.sql new file mode 100644 index 0000000000..958fb4831d --- /dev/null +++ b/migration/i2.0z/oracle/201405291604_IDEMPIERE-1792.sql @@ -0,0 +1,45 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- May 29, 2014 2:05:43 PM ICT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,AD_Element_ID,AD_Reference_ID,AD_Table_ID) VALUES (0,'N',0,211272,'N','N','N',0,'N',2000,'N','N','N','Y','1a19bfbb-e413-4e31-b635-a40068f21a0d','Y','DefaultValue','Default value hierarchy, separated by ;','The defaults are evaluated in the order of definition, the first not null value becomes the default value of the column. The values are separated by comma or semicolon. a) Literals:. ''Text'' or 123 b) Variables - in format @Variable@ - Login e.g. #Date, #AD_Org_ID, #AD_Client_ID - Accounting Schema: e.g. $C_AcctSchema_ID, $C_Calendar_ID - Global defaults: e.g. DateFormat - Window values (all Picks, CheckBoxes, RadioButtons, and DateDoc/DateAcct) c) SQL code with the tag: @SQL=SELECT something AS DefaultValue FROM ... The SQL statement can contain variables. There can be no other value other than the SQL statement. The default is only evaluated, if no user preference is defined. Default definitions are ignored for record columns as Key, Parent, Client as well as Buttons.','Default Logic','Y',TO_DATE('2014-05-29 14:05:37','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_DATE('2014-05-29 14:05:37','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N',272,10,897) +; + +-- May 29, 2014 2:05:50 PM ICT +ALTER TABLE AD_InfoColumn ADD DefaultValue VARCHAR2(2000) DEFAULT NULL +; + +-- May 29, 2014 2:07:35 PM ICT +INSERT INTO AD_Field (SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,AD_Column_ID,EntityType,Created) VALUES (0,'N',844,0,'N','N',240,'Y',203048,'N','The defaults are evaluated in the order of definition, the first not null value becomes the default value of the column. The values are separated by comma or semicolon. a) Literals:. ''Text'' or 123 b) Variables - in format @Variable@ - Login e.g. #Date, #AD_Org_ID, #AD_Client_ID - Accounting Schema: e.g. $C_AcctSchema_ID, $C_Calendar_ID - Global defaults: e.g. DateFormat - Window values (all Picks, CheckBoxes, RadioButtons, and DateDoc/DateAcct) c) SQL code with the tag: @SQL=SELECT something AS DefaultValue FROM ... The SQL statement can contain variables. There can be no other value other than the SQL statement. The default is only evaluated, if no user preference is defined. Default definitions are ignored for record columns as Key, Parent, Client as well as Buttons.','Default value hierarchy, separated by ;','Default Logic','df17ed00-801b-4e24-892c-5b15760ef9f6','Y','N',100,0,100,TO_DATE('2014-05-29 14:07:29','YYYY-MM-DD HH24:MI:SS'),'Y','Y',150,1,'N',0,1,1,'N','N',211272,'D',TO_DATE('2014-05-29 14:07:29','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 29, 2014 2:08:42 PM ICT +UPDATE AD_Field SET SeqNo=180, IsDisplayed='Y', XPosition=1, ColumnSpan=5,Updated=TO_DATE('2014-05-29 14:08:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203048 +; + +-- May 29, 2014 2:08:42 PM ICT +UPDATE AD_Field SET SeqNo=190,Updated=TO_DATE('2014-05-29 14:08:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201635 +; + +-- May 29, 2014 2:08:42 PM ICT +UPDATE AD_Field SET SeqNo=200,Updated=TO_DATE('2014-05-29 14:08:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201636 +; + +-- May 29, 2014 2:08:42 PM ICT +UPDATE AD_Field SET SeqNo=210,Updated=TO_DATE('2014-05-29 14:08:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13603 +; + +-- May 29, 2014 2:08:42 PM ICT +UPDATE AD_Field SET SeqNo=220,Updated=TO_DATE('2014-05-29 14:08:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201622 +; + +-- May 29, 2014 2:08:42 PM ICT +UPDATE AD_Field SET SeqNo=230,Updated=TO_DATE('2014-05-29 14:08:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201623 +; + +-- May 29, 2014 2:08:42 PM ICT +UPDATE AD_Field SET SeqNo=240,Updated=TO_DATE('2014-05-29 14:08:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13597 +; +SELECT register_migration_script('201405291604_IDEMPIERE-1792.sql') FROM dual +; diff --git a/migration/i2.0z/postgresql/201405291604_IDEMPIERE-1792.sql b/migration/i2.0z/postgresql/201405291604_IDEMPIERE-1792.sql new file mode 100644 index 0000000000..d5164926f6 --- /dev/null +++ b/migration/i2.0z/postgresql/201405291604_IDEMPIERE-1792.sql @@ -0,0 +1,42 @@ +-- May 29, 2014 2:05:43 PM ICT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,AD_Element_ID,AD_Reference_ID,AD_Table_ID) VALUES (0,'N',0,211272,'N','N','N',0,'N',2000,'N','N','N','Y','1a19bfbb-e413-4e31-b635-a40068f21a0d','Y','DefaultValue','Default value hierarchy, separated by ;','The defaults are evaluated in the order of definition, the first not null value becomes the default value of the column. The values are separated by comma or semicolon. a) Literals:. ''Text'' or 123 b) Variables - in format @Variable@ - Login e.g. #Date, #AD_Org_ID, #AD_Client_ID - Accounting Schema: e.g. $C_AcctSchema_ID, $C_Calendar_ID - Global defaults: e.g. DateFormat - Window values (all Picks, CheckBoxes, RadioButtons, and DateDoc/DateAcct) c) SQL code with the tag: @SQL=SELECT something AS DefaultValue FROM ... The SQL statement can contain variables. There can be no other value other than the SQL statement. The default is only evaluated, if no user preference is defined. Default definitions are ignored for record columns as Key, Parent, Client as well as Buttons.','Default Logic','Y',TO_TIMESTAMP('2014-05-29 14:05:37','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_TIMESTAMP('2014-05-29 14:05:37','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N',272,10,897) +; + +-- May 29, 2014 2:05:50 PM ICT +ALTER TABLE AD_InfoColumn ADD COLUMN DefaultValue VARCHAR(2000) DEFAULT NULL +; + +-- May 29, 2014 2:07:35 PM ICT +INSERT INTO AD_Field (SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,AD_Column_ID,EntityType,Created) VALUES (0,'N',844,0,'N','N',240,'Y',203048,'N','The defaults are evaluated in the order of definition, the first not null value becomes the default value of the column. The values are separated by comma or semicolon. a) Literals:. ''Text'' or 123 b) Variables - in format @Variable@ - Login e.g. #Date, #AD_Org_ID, #AD_Client_ID - Accounting Schema: e.g. $C_AcctSchema_ID, $C_Calendar_ID - Global defaults: e.g. DateFormat - Window values (all Picks, CheckBoxes, RadioButtons, and DateDoc/DateAcct) c) SQL code with the tag: @SQL=SELECT something AS DefaultValue FROM ... The SQL statement can contain variables. There can be no other value other than the SQL statement. The default is only evaluated, if no user preference is defined. Default definitions are ignored for record columns as Key, Parent, Client as well as Buttons.','Default value hierarchy, separated by ;','Default Logic','df17ed00-801b-4e24-892c-5b15760ef9f6','Y','N',100,0,100,TO_TIMESTAMP('2014-05-29 14:07:29','YYYY-MM-DD HH24:MI:SS'),'Y','Y',150,1,'N',0,1,1,'N','N',211272,'D',TO_TIMESTAMP('2014-05-29 14:07:29','YYYY-MM-DD HH24:MI:SS')) +; + +-- May 29, 2014 2:08:42 PM ICT +UPDATE AD_Field SET SeqNo=180, IsDisplayed='Y', XPosition=1, ColumnSpan=5,Updated=TO_TIMESTAMP('2014-05-29 14:08:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203048 +; + +-- May 29, 2014 2:08:42 PM ICT +UPDATE AD_Field SET SeqNo=190,Updated=TO_TIMESTAMP('2014-05-29 14:08:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201635 +; + +-- May 29, 2014 2:08:42 PM ICT +UPDATE AD_Field SET SeqNo=200,Updated=TO_TIMESTAMP('2014-05-29 14:08:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201636 +; + +-- May 29, 2014 2:08:42 PM ICT +UPDATE AD_Field SET SeqNo=210,Updated=TO_TIMESTAMP('2014-05-29 14:08:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13603 +; + +-- May 29, 2014 2:08:42 PM ICT +UPDATE AD_Field SET SeqNo=220,Updated=TO_TIMESTAMP('2014-05-29 14:08:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201622 +; + +-- May 29, 2014 2:08:42 PM ICT +UPDATE AD_Field SET SeqNo=230,Updated=TO_TIMESTAMP('2014-05-29 14:08:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201623 +; + +-- May 29, 2014 2:08:42 PM ICT +UPDATE AD_Field SET SeqNo=240,Updated=TO_TIMESTAMP('2014-05-29 14:08:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13597 +; +SELECT register_migration_script('201405291604_IDEMPIERE-1792.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 2752b9014c..ca8d7ca42f 100644 --- a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java +++ b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java @@ -519,9 +519,9 @@ public class GridFieldVO implements Serializable public int SeqNo = 0; /** Grid Display sequence */ public int SeqNoGrid = 0; - /** Dislay Logic */ + /** Dislay Logic, never set null for it */ public String DisplayLogic = ""; - /** Default Value */ + /** Default Value, never set null for it */ public String DefaultValue = ""; /** Mandatory */ public boolean IsMandatory = false; diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_InfoColumn.java b/org.adempiere.base/src/org/compiere/model/I_AD_InfoColumn.java index 0909620672..d403f0196f 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_InfoColumn.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_InfoColumn.java @@ -188,6 +188,21 @@ public interface I_AD_InfoColumn */ public int getCreatedBy(); + /** Column name DefaultValue */ + public static final String COLUMNNAME_DefaultValue = "DefaultValue"; + + /** Set Default Logic. + * Default value hierarchy, separated by ; + + */ + public void setDefaultValue (String DefaultValue); + + /** Get Default Logic. + * Default value hierarchy, separated by ; + + */ + public String getDefaultValue(); + /** Column name Description */ public static final String COLUMNNAME_Description = "Description"; diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_InfoColumn.java b/org.adempiere.base/src/org/compiere/model/X_AD_InfoColumn.java index a38fdddb2b..377beb4d7d 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_InfoColumn.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_InfoColumn.java @@ -30,7 +30,7 @@ public class X_AD_InfoColumn extends PO implements I_AD_InfoColumn, I_Persistent /** * */ - private static final long serialVersionUID = 20131031L; + private static final long serialVersionUID = 20140529L; /** Standard Constructor */ public X_AD_InfoColumn (Properties ctx, int AD_InfoColumn_ID, String trxName) @@ -280,6 +280,23 @@ public class X_AD_InfoColumn extends PO implements I_AD_InfoColumn, I_Persistent return (String)get_Value(COLUMNNAME_ColumnName); } + /** Set Default Logic. + @param DefaultValue + Default value hierarchy, separated by ; + */ + public void setDefaultValue (String DefaultValue) + { + set_Value (COLUMNNAME_DefaultValue, DefaultValue); + } + + /** Get Default Logic. + @return Default value hierarchy, separated by ; + */ + public String getDefaultValue () + { + return (String)get_Value(COLUMNNAME_DefaultValue); + } + /** Set Description. @param Description Optional short description of the record diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java index 073e580d83..7806409070 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java @@ -379,7 +379,10 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL vo.lookupInfo.IsValidated = false; } } - vo.DisplayLogic = infoColumn.getDisplayLogic() != null ? infoColumn.getDisplayLogic() : ""; + if (infoColumn.getDisplayLogic() != null) + vo.DisplayLogic = infoColumn.getDisplayLogic(); + if (infoColumn.isQueryCriteria() && infoColumn.getDefaultValue() != null) + vo.DefaultValue = infoColumn.getDefaultValue(); String desc = infoColumn.get_Translation("Description"); vo.Description = desc != null ? desc : ""; String help = infoColumn.get_Translation("Help"); @@ -1001,6 +1004,10 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL } fieldEditor.addEventListener(Events.ON_OK, this); + + // set default value + mField.addPropertyChangeListener(editor); + mField.setValue(mField.getDefault(), true); } // addSelectionColumn protected void addSearchParameter(Label label, Component fieldEditor) {