From c3ac442984e54b7fb35aae7cc54dc2f154ca9e1c Mon Sep 17 00:00:00 2001 From: Diego Ruiz Date: Wed, 3 Feb 2016 20:21:46 +0100 Subject: [PATCH] IDEMPIERE-3004 View Column - View Component require SeqNo --- .../oracle/201601161728_IDEMPIERE-3004.sql | 43 +++++++++++++++++++ .../201601161728_IDEMPIERE-3004.sql | 39 +++++++++++++++++ .../org/compiere/model/I_AD_ViewColumn.java | 15 +++++++ .../org/compiere/model/MViewComponent.java | 2 +- .../org/compiere/model/X_AD_ViewColumn.java | 22 +++++++++- 5 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 migration/i3.1/oracle/201601161728_IDEMPIERE-3004.sql create mode 100644 migration/i3.1/postgresql/201601161728_IDEMPIERE-3004.sql diff --git a/migration/i3.1/oracle/201601161728_IDEMPIERE-3004.sql b/migration/i3.1/oracle/201601161728_IDEMPIERE-3004.sql new file mode 100644 index 0000000000..92021503a8 --- /dev/null +++ b/migration/i3.1/oracle/201601161728_IDEMPIERE-3004.sql @@ -0,0 +1,43 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3004: View Column - View Component require SeqNo +-- Jan 25, 2016 5:22:40 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (212635,0,'Sequence','Method of ordering records; lowest number comes first','The Sequence indicates the order of records',200088,'SeqNo','@SQL=SELECT COALESCE(MAX(SeqNo),0)+10 AS DefaultValue FROM AD_ViewColumn WHERE AD_Table_ID=@AD_Table_ID@',22,'N','N','N','N','N',0,'N',11,0,0,'Y',TO_DATE('2016-01-25 17:22:39','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2016-01-25 17:22:39','YYYY-MM-DD HH24:MI:SS'),100,566,'Y','N','D','N','N','N','Y','cc51c32b-7c4a-49c8-a9d4-94989260e242','Y',0,'N','N') +; + +-- Jan 25, 2016 5:24:53 PM CET +UPDATE AD_Column SET DefaultValue='@SQL=SELECT COALESCE(MAX(SeqNo),0)+10 AS DefaultValue FROM AD_ViewColumn WHERE AD_ViewComponent_ID=@AD_ViewComponent_ID@',Updated=TO_DATE('2016-01-25 17:24:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212635 +; + +-- Jan 25, 2016 5:25:19 PM CET +ALTER TABLE AD_ViewColumn ADD SeqNo NUMBER(10) DEFAULT NULL +; + +-- Jan 25, 2016 5:27:04 PM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (204135,'Sequence','Method of ordering records; lowest number comes first','The Sequence indicates the order of records',200099,212635,'Y',22,110,'N','N','N','N',0,0,'Y',TO_DATE('2016-01-25 17:27:04','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2016-01-25 17:27:04','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','6f955e38-0d37-4410-b8d2-3034ab5edd4a','Y',90,2) +; + +-- Jan 25, 2016 5:27:47 PM CET +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90, XPosition=4,Updated=TO_DATE('2016-01-25 17:27:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204135 +; + +-- Jan 25, 2016 5:27:48 PM CET +UPDATE AD_Field SET SeqNo=100,Updated=TO_DATE('2016-01-25 17:27:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202244 +; + +-- Jan 25, 2016 5:27:48 PM CET +UPDATE AD_Field SET SeqNo=110,Updated=TO_DATE('2016-01-25 17:27:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202248 +; + +-- Jan 25, 2016 5:28:00 PM CET +UPDATE AD_Field SET SortNo=1.0,Updated=TO_DATE('2016-01-25 17:28:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204135 +; + +-- Jan 25, 2016 5:28:00 PM CET +UPDATE AD_ViewColumn SET SeqNo = 0,Updated=TO_DATE('2016-01-25 17:28:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 +; + +SELECT register_migration_script('201601161728_IDEMPIERE-3004.sql') FROM dual +; + diff --git a/migration/i3.1/postgresql/201601161728_IDEMPIERE-3004.sql b/migration/i3.1/postgresql/201601161728_IDEMPIERE-3004.sql new file mode 100644 index 0000000000..3a559d176c --- /dev/null +++ b/migration/i3.1/postgresql/201601161728_IDEMPIERE-3004.sql @@ -0,0 +1,39 @@ +-- IDEMPIERE-3004: View Column - View Component require SeqNo +-- Jan 25, 2016 5:22:40 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (212635,0,'Sequence','Method of ordering records; lowest number comes first','The Sequence indicates the order of records',200088,'SeqNo','@SQL=SELECT COALESCE(MAX(SeqNo),0)+10 AS DefaultValue FROM AD_ViewColumn WHERE AD_Table_ID=@AD_Table_ID@',22,'N','N','N','N','N',0,'N',11,0,0,'Y',TO_TIMESTAMP('2016-01-25 17:22:39','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2016-01-25 17:22:39','YYYY-MM-DD HH24:MI:SS'),100,566,'Y','N','D','N','N','N','Y','cc51c32b-7c4a-49c8-a9d4-94989260e242','Y',0,'N','N') +; + +-- Jan 25, 2016 5:24:53 PM CET +UPDATE AD_Column SET DefaultValue='@SQL=SELECT COALESCE(MAX(SeqNo),0)+10 AS DefaultValue FROM AD_ViewColumn WHERE AD_ViewComponent_ID=@AD_ViewComponent_ID@',Updated=TO_TIMESTAMP('2016-01-25 17:24:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212635 +; + +-- Jan 25, 2016 5:25:19 PM CET +ALTER TABLE AD_ViewColumn ADD COLUMN SeqNo NUMERIC(10) DEFAULT NULL +; + +-- Jan 25, 2016 5:27:04 PM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (204135,'Sequence','Method of ordering records; lowest number comes first','The Sequence indicates the order of records',200099,212635,'Y',22,110,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2016-01-25 17:27:04','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2016-01-25 17:27:04','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','6f955e38-0d37-4410-b8d2-3034ab5edd4a','Y',90,2) +; + +-- Jan 25, 2016 5:27:47 PM CET +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90, XPosition=4,Updated=TO_TIMESTAMP('2016-01-25 17:27:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204135 +; + +-- Jan 25, 2016 5:27:48 PM CET +UPDATE AD_Field SET SeqNo=100,Updated=TO_TIMESTAMP('2016-01-25 17:27:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202244 +; + +-- Jan 25, 2016 5:27:48 PM CET +UPDATE AD_Field SET SeqNo=110,Updated=TO_TIMESTAMP('2016-01-25 17:27:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202248 +; + +-- Jan 25, 2016 5:28:00 PM CET +UPDATE AD_Field SET SortNo=1.0,Updated=TO_TIMESTAMP('2016-01-25 17:28:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204135 +; + +-- Jan 25, 2016 5:28:00 PM CET +UPDATE AD_ViewColumn SET SeqNo = 0,Updated=TO_TIMESTAMP('2016-01-25 17:28:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 +; + +SELECT register_migration_script('201601161728_IDEMPIERE-3004.sql') FROM dual +; diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_ViewColumn.java b/org.adempiere.base/src/org/compiere/model/I_AD_ViewColumn.java index 438ea43627..db7ff728bd 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_ViewColumn.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_ViewColumn.java @@ -196,6 +196,21 @@ public interface I_AD_ViewColumn */ public boolean isActive(); + /** Column name SeqNo */ + public static final String COLUMNNAME_SeqNo = "SeqNo"; + + /** Set Sequence. + * Method of ordering records; + lowest number comes first + */ + public void setSeqNo (int SeqNo); + + /** Get Sequence. + * Method of ordering records; + lowest number comes first + */ + public int getSeqNo(); + /** Column name Updated */ public static final String COLUMNNAME_Updated = "Updated"; diff --git a/org.adempiere.base/src/org/compiere/model/MViewComponent.java b/org.adempiere.base/src/org/compiere/model/MViewComponent.java index 8552919064..97074e6bc3 100644 --- a/org.adempiere.base/src/org/compiere/model/MViewComponent.java +++ b/org.adempiere.base/src/org/compiere/model/MViewComponent.java @@ -76,7 +76,7 @@ public class MViewComponent extends X_AD_ViewComponent { Query query = new Query(getCtx(), MViewColumn.Table_Name, MViewColumn.COLUMNNAME_AD_ViewComponent_ID + "=?", get_TrxName()); query.setParameters(getAD_ViewComponent_ID()); - query.setOrderBy(MViewColumn.COLUMNNAME_AD_ViewColumn_ID); + query.setOrderBy("SeqNo, AD_ViewColumn_ID"); List list = query.list(); m_columns = new MViewColumn[list.size()]; diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_ViewColumn.java b/org.adempiere.base/src/org/compiere/model/X_AD_ViewColumn.java index 7d7413b90b..7bb99fe6fd 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_ViewColumn.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_ViewColumn.java @@ -29,7 +29,7 @@ public class X_AD_ViewColumn extends PO implements I_AD_ViewColumn, I_Persistent /** * */ - private static final long serialVersionUID = 20151030L; + private static final long serialVersionUID = 20160125L; /** Standard Constructor */ public X_AD_ViewColumn (Properties ctx, int AD_ViewColumn_ID, String trxName) @@ -252,4 +252,24 @@ public class X_AD_ViewColumn extends PO implements I_AD_ViewColumn, I_Persistent { return (String)get_Value(COLUMNNAME_Help); } + + /** Set Sequence. + @param SeqNo + Method of ordering records; lowest number comes first + */ + public void setSeqNo (int SeqNo) + { + set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo)); + } + + /** Get Sequence. + @return Method of ordering records; lowest number comes first + */ + public int getSeqNo () + { + Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo); + if (ii == null) + return 0; + return ii.intValue(); + } } \ No newline at end of file