diff --git a/migration/i2.0z/oracle/201407161014_IDEMPIERE-1851.sql b/migration/i2.0z/oracle/201407161014_IDEMPIERE-1851.sql new file mode 100644 index 0000000000..9d89b4b759 --- /dev/null +++ b/migration/i2.0z/oracle/201407161014_IDEMPIERE-1851.sql @@ -0,0 +1,21 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Mar 24, 2014 2:07:01 PM CET +-- https://idempiere.atlassian.net/browse/IDEMPIERE-1851 +INSERT INTO AD_Process_Para (IsRange,AD_Element_ID,AD_Process_Para_ID,AD_Process_Para_UU,Help,AD_Reference_ID,IsMandatory,EntityType,Name,ColumnName,Description,FieldLength,IsCentrallyMaintained,SeqNo,IsActive,UpdatedBy,Updated,CreatedBy,Created,AD_Org_ID,IsEncrypted,AD_Client_ID,AD_Process_ID,AD_Reference_Value_ID) VALUES ('N',1682,200076,'e9ad57d5-86b3-45a1-bd01-6b4079b31a10','The Entity Types "Dictionary", "iDempiere" and "Application" might be automatically synchronized and customizations deleted or overwritten. + +For customizations, copy the entity and select "User"!',18,'N','D','Entity Type','EntityType','Dictionary Entity Type; Determines ownership and synchronization',0,'Y',10,'Y',100,TO_DATE('2014-03-24 14:07:00','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2014-03-24 14:07:00','YYYY-MM-DD HH24:MI:SS'),0,'N',0,174,389) +; + +-- Mar 24, 2014 2:08:12 PM CET +INSERT INTO AD_Process_Para (IsRange,AD_Process_Para_ID,AD_Process_Para_UU,AD_Reference_ID,IsMandatory,EntityType,Name,ColumnName,FieldLength,IsCentrallyMaintained,SeqNo,IsActive,UpdatedBy,Updated,CreatedBy,Created,AD_Org_ID,IsEncrypted,AD_Client_ID,AD_Process_ID) VALUES ('N',200077,'5cc8670c-0715-4351-9c5e-760f902f6ef6',16,'N','D','CreatedSince','CreatedSince',7,'N',20,'Y',100,TO_DATE('2014-03-24 14:08:11','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2014-03-24 14:08:11','YYYY-MM-DD HH24:MI:SS'),0,'N',0,174) +; + +-- Mar 24, 2014 2:08:24 PM CET +UPDATE AD_Process_Para SET Name='Created Since',Updated=TO_DATE('2014-03-24 14:08:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200077 +; + +SELECT register_migration_script('201407161014_IDEMPIERE-1851.sql') FROM dual +; + diff --git a/migration/i2.0z/postgresql/201407161014_IDEMPIERE-1851.sql b/migration/i2.0z/postgresql/201407161014_IDEMPIERE-1851.sql new file mode 100644 index 0000000000..d412fefcda --- /dev/null +++ b/migration/i2.0z/postgresql/201407161014_IDEMPIERE-1851.sql @@ -0,0 +1,18 @@ +-- Mar 24, 2014 2:07:01 PM CET +-- https://idempiere.atlassian.net/browse/IDEMPIERE-1851 +INSERT INTO AD_Process_Para (IsRange,AD_Element_ID,AD_Process_Para_ID,AD_Process_Para_UU,Help,AD_Reference_ID,IsMandatory,EntityType,Name,ColumnName,Description,FieldLength,IsCentrallyMaintained,SeqNo,IsActive,UpdatedBy,Updated,CreatedBy,Created,AD_Org_ID,IsEncrypted,AD_Client_ID,AD_Process_ID,AD_Reference_Value_ID) VALUES ('N',1682,200076,'e9ad57d5-86b3-45a1-bd01-6b4079b31a10','The Entity Types "Dictionary", "iDempiere" and "Application" might be automatically synchronized and customizations deleted or overwritten. + +For customizations, copy the entity and select "User"!',18,'N','D','Entity Type','EntityType','Dictionary Entity Type; Determines ownership and synchronization',0,'Y',10,'Y',100,TO_TIMESTAMP('2014-03-24 14:07:00','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2014-03-24 14:07:00','YYYY-MM-DD HH24:MI:SS'),0,'N',0,174,389) +; + +-- Mar 24, 2014 2:08:12 PM CET +INSERT INTO AD_Process_Para (IsRange,AD_Process_Para_ID,AD_Process_Para_UU,AD_Reference_ID,IsMandatory,EntityType,Name,ColumnName,FieldLength,IsCentrallyMaintained,SeqNo,IsActive,UpdatedBy,Updated,CreatedBy,Created,AD_Org_ID,IsEncrypted,AD_Client_ID,AD_Process_ID) VALUES ('N',200077,'5cc8670c-0715-4351-9c5e-760f902f6ef6',16,'N','D','CreatedSince','CreatedSince',7,'N',20,'Y',100,TO_TIMESTAMP('2014-03-24 14:08:11','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2014-03-24 14:08:11','YYYY-MM-DD HH24:MI:SS'),0,'N',0,174) +; + +-- Mar 24, 2014 2:08:24 PM CET +UPDATE AD_Process_Para SET Name='Created Since',Updated=TO_TIMESTAMP('2014-03-24 14:08:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200077 +; + +SELECT register_migration_script('201407161014_IDEMPIERE-1851.sql') FROM dual +; + diff --git a/org.adempiere.base.process/src/org/compiere/process/TabCreateFields.java b/org.adempiere.base.process/src/org/compiere/process/TabCreateFields.java index e5bc1ff033..e4d7239cf4 100644 --- a/org.adempiere.base.process/src/org/compiere/process/TabCreateFields.java +++ b/org.adempiere.base.process/src/org/compiere/process/TabCreateFields.java @@ -18,6 +18,7 @@ package org.compiere.process; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.sql.Timestamp; import java.util.logging.Level; import org.compiere.model.MColumn; @@ -28,6 +29,7 @@ import org.compiere.model.PO; import org.compiere.util.AdempiereSystemError; import org.compiere.util.DB; import org.compiere.util.DisplayType; +import org.compiere.util.Util; /** @@ -47,14 +49,29 @@ import org.compiere.util.DisplayType; */ public class TabCreateFields extends SvrProcess { - /** Tab NUmber */ + /** Tab Number */ private int p_AD_Tab_ID= 0; + private String p_EntityType = null; + private Timestamp p_CreatedSince = null; /** * prepare */ protected void prepare () { + ProcessInfoParameter[] para = getParameter(); + for (int i = 0; i < para.length; i++) + { + String name = para[i].getParameterName(); + if (para[i].getParameter() == null) + ; + else if (name.equals("EntityType")) + p_EntityType = (String)para[i].getParameter(); + else if (name.equals("CreatedSince")) + p_CreatedSince = para[i].getParameterAsTimestamp(); + else + log.log(Level.SEVERE, "Unknown Parameter: " + name); + } p_AD_Tab_ID = getRecord_ID(); } // prepare @@ -78,8 +95,14 @@ public class TabCreateFields extends SvrProcess + " AND f.AD_Tab_ID=?)" // #2 + " AND AD_Table_ID=?" // #3 + " AND NOT (Name LIKE 'Created%' OR Name LIKE 'Updated%')" - + " AND IsActive='Y' " - + "ORDER BY CASE " + + " AND IsActive='Y' "; + + if(!Util.isEmpty(p_EntityType)) + sql += " AND c.entitytype = ?"; + if(p_CreatedSince != null) + sql += " AND c.created >= ? "; + + sql += "ORDER BY CASE " + " WHEN c.ColumnName = 'AD_Client_ID' THEN -100 " + " WHEN c.ColumnName = 'AD_Org_ID' THEN -90 " + " WHEN c.ColumnName = 'Value' THEN -80 " @@ -101,6 +124,11 @@ public class TabCreateFields extends SvrProcess pstmt.setInt (1, tab.getAD_Table_ID()); pstmt.setInt (2, tab.getAD_Tab_ID()); pstmt.setInt (3, tab.getAD_Table_ID()); + int i = 4; + if(!Util.isEmpty(p_EntityType)) + pstmt.setString(i++, p_EntityType); + if(p_CreatedSince != null) + pstmt.setTimestamp(i++, p_CreatedSince); rs = pstmt.executeQuery (); String uuidcolname = PO.getUUIDColumnName(tab.getAD_Table().getTableName()); while (rs.next ())