From 99f08dbdeee509d70a22aaaea9035cac510cbf63 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Wed, 17 Jun 2015 08:12:03 -0500 Subject: [PATCH 1/5] IDEMPIERE-2685 Jasper process field should be visible only for Advanced roles --- .../i2.1/oracle/201506162003_IDEMPIERE-2685.sql | 14 ++++++++++++++ .../postgresql/201506162003_IDEMPIERE-2685.sql | 11 +++++++++++ 2 files changed, 25 insertions(+) create mode 100644 migration/i2.1/oracle/201506162003_IDEMPIERE-2685.sql create mode 100644 migration/i2.1/postgresql/201506162003_IDEMPIERE-2685.sql diff --git a/migration/i2.1/oracle/201506162003_IDEMPIERE-2685.sql b/migration/i2.1/oracle/201506162003_IDEMPIERE-2685.sql new file mode 100644 index 0000000000..7b43fe2c12 --- /dev/null +++ b/migration/i2.1/oracle/201506162003_IDEMPIERE-2685.sql @@ -0,0 +1,14 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Jun 16, 2015 7:11:44 PM CEST +-- IDEMPIERE - 2685 +UPDATE AD_Column SET ReadOnlyLogic='@#ShowAdvanced@ = N',Updated=TO_DATE('2015-06-16 19:11:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=50209 +; + +-- Jun 16, 2015 7:11:49 PM CEST +UPDATE AD_Column SET ReadOnlyLogic='@#ShowAdvanced@ = N',Updated=TO_DATE('2015-06-16 19:11:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=54091 +; + +SELECT register_migration_script('201506162003_IDEMPIERE-2685.sql') FROM dual +; \ No newline at end of file diff --git a/migration/i2.1/postgresql/201506162003_IDEMPIERE-2685.sql b/migration/i2.1/postgresql/201506162003_IDEMPIERE-2685.sql new file mode 100644 index 0000000000..6cc8b950e5 --- /dev/null +++ b/migration/i2.1/postgresql/201506162003_IDEMPIERE-2685.sql @@ -0,0 +1,11 @@ +-- Jun 16, 2015 7:11:44 PM CEST +-- IDEMPIERE - 2685 +UPDATE AD_Column SET ReadOnlyLogic='@#ShowAdvanced@ = N',Updated=TO_TIMESTAMP('2015-06-16 19:11:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=50209 +; + +-- Jun 16, 2015 7:11:49 PM CEST +UPDATE AD_Column SET ReadOnlyLogic='@#ShowAdvanced@ = N',Updated=TO_TIMESTAMP('2015-06-16 19:11:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=54091 +; + +SELECT register_migration_script('201506162003_IDEMPIERE-2685.sql') FROM dual +; \ No newline at end of file From 7ae9056c5bb2d1ffc9e7f681905c96c1f7ef174a Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Wed, 17 Jun 2015 08:36:30 -0500 Subject: [PATCH 2/5] IDEMPIERE-2678 Allow to set explicit NULL value for fields --- org.adempiere.base/src/org/compiere/model/GridField.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/model/GridField.java b/org.adempiere.base/src/org/compiere/model/GridField.java index 258040e85d..7af71ebc59 100644 --- a/org.adempiere.base/src/org/compiere/model/GridField.java +++ b/org.adempiere.base/src/org/compiere/model/GridField.java @@ -745,7 +745,7 @@ public class GridField private Object createDefault (String value) { // true NULL - if (value == null || value.toString().length() == 0) + if (value == null || value.toString().length() == 0 || value.toUpperCase().equals("NULL")) return null; // see also MTable.readData try From 30f76d2c74dc79ad05b853d6e76093912e7f1395 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Jun 2015 12:32:06 -0500 Subject: [PATCH 3/5] IDEMPIERE-2664 DB Extensibility issues / calling convert for direct prepareStatement --- db/ddlutils/oracle/ant.sh | 2 +- .../compiere/process/ColumnEncryption.java | 14 +++++------ .../compiere/process/ReplicationLocal.java | 1 + .../src/org/compiere/model/MSequence.java | 23 +++++++++++++++---- .../src/org/compiere/model/PO_LOB.java | 2 ++ .../webui/panel/InfoGeneralPanel.java | 4 ++-- 6 files changed, 31 insertions(+), 15 deletions(-) diff --git a/db/ddlutils/oracle/ant.sh b/db/ddlutils/oracle/ant.sh index 19b9410a1b..9e1db41a64 100644 --- a/db/ddlutils/oracle/ant.sh +++ b/db/ddlutils/oracle/ant.sh @@ -1 +1 @@ -java -Xms128m -Xmx512m -classpath "../../../tools/lib/ant.jar;../../../tools/lib/ant-launcher.jar;../../../tools/lib/ant-swing.jar;../../../tools/lib/ant-commons-net.jar;../../../tools/lib/commons-net.jar" -Dant.home="." org.apache.tools.ant.Main $* +java -Xms128m -Xmx512m -classpath "../../../targetPlatform/plugins/org.apache.ant_1.7.1.v20100518-1145/lib/ant.jar:../../../targetPlatform/plugins/org.apache.ant_1.7.1.v20100518-1145/lib/ant-launcher.jar:../../../targetPlatform/plugins/org.apache.ant_1.7.1.v20100518-1145/lib/ant-swing.jar:../../../targetPlatform/plugins/org.apache.ant_1.7.1.v20100518-1145/lib/ant-commons-net.jar" -Dant.home="." org.apache.tools.ant.Main $* diff --git a/org.adempiere.base.process/src/org/compiere/process/ColumnEncryption.java b/org.adempiere.base.process/src/org/compiere/process/ColumnEncryption.java index b09a709829..10a1d733db 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ColumnEncryption.java +++ b/org.adempiere.base.process/src/org/compiere/process/ColumnEncryption.java @@ -320,7 +320,8 @@ public class ColumnEncryption extends SvrProcess { ResultSet rs = null; try { - selectStmt = m_conn.prepareStatement(selectSql.toString(), + String selectSqlStr = DB.getDatabase().convertStatement(selectSql.toString()); + selectStmt = m_conn.prepareStatement(selectSqlStr, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); updateStmt = m_conn.prepareStatement(updateSql.toString()); @@ -397,7 +398,8 @@ public class ColumnEncryption extends SvrProcess { ResultSet rs = null; try { - selectStmt = m_conn.prepareStatement(selectSql.toString(), + String selectSqlStr = DB.getDatabase().convertStatement(selectSql.toString()); + selectStmt = m_conn.prepareStatement(selectSqlStr, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); updateStmt = m_conn.prepareStatement(updateSql.toString()); @@ -460,10 +462,7 @@ public class ColumnEncryption extends SvrProcess { int rowsEffected = -1; // Select SQL - StringBuilder selectSql = new StringBuilder(); - selectSql.append("SELECT FieldLength"); - selectSql.append(" FROM AD_Column"); - selectSql.append(" WHERE AD_Column_ID=?"); + String selectSql = "SELECT FieldLength FROM AD_Column WHERE AD_Column_ID=?"; // Alter SQL StringBuilder alterSql = new StringBuilder(); @@ -482,7 +481,8 @@ public class ColumnEncryption extends SvrProcess { ResultSet rs = null; try { - selectStmt = m_conn.prepareStatement(selectSql.toString(), + selectSql = DB.getDatabase().convertStatement(selectSql); + selectStmt = m_conn.prepareStatement(selectSql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); selectStmt.setInt(1, columnID); diff --git a/org.adempiere.base.process/src/org/compiere/process/ReplicationLocal.java b/org.adempiere.base.process/src/org/compiere/process/ReplicationLocal.java index 7e76fa705e..0ae55bbb6b 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ReplicationLocal.java +++ b/org.adempiere.base.process/src/org/compiere/process/ReplicationLocal.java @@ -541,6 +541,7 @@ public class ReplicationLocal extends SvrProcess // try { + sql = DB.getDatabase().convertStatement(sql); pstmt = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); // Set Parameters diff --git a/org.adempiere.base/src/org/compiere/model/MSequence.java b/org.adempiere.base/src/org/compiere/model/MSequence.java index d0859d301d..a16fc8fbe9 100644 --- a/org.adempiere.base/src/org/compiere/model/MSequence.java +++ b/org.adempiere.base/src/org/compiere/model/MSequence.java @@ -125,6 +125,8 @@ public class MSequence extends X_AD_Sequence + " AND IsActive='Y' AND IsTableID='Y' AND IsAutoSequence='Y' "; } + if (!DB.isOracle() && !DB.isPostgreSQL()) + selectSQL = DB.getDatabase().convertStatement(selectSQL); Connection conn = null; PreparedStatement pstmt = null; @@ -221,12 +223,16 @@ public class MSequence extends X_AD_Sequence { int incrementNo = rs.getInt(3); if (adempiereSys) { - updateSQL = conn - .prepareStatement("UPDATE AD_Sequence SET CurrentNextSys = CurrentNextSys + ? WHERE AD_Sequence_ID = ?"); + String updateCmd = "UPDATE AD_Sequence SET CurrentNextSys=CurrentNextSys+? WHERE AD_Sequence_ID=?"; + if (!DB.isOracle() && !DB.isPostgreSQL()) + updateCmd = DB.getDatabase().convertStatement(updateCmd); + updateSQL = conn.prepareStatement(updateCmd); retValue = rs.getInt(2); } else { - updateSQL = conn - .prepareStatement("UPDATE AD_Sequence SET CurrentNext = CurrentNext + ? WHERE AD_Sequence_ID = ?"); + String updateCmd = "UPDATE AD_Sequence SET CurrentNext=CurrentNext+? WHERE AD_Sequence_ID=?"; + if (!DB.isOracle() && !DB.isPostgreSQL()) + updateCmd = DB.getDatabase().convertStatement(updateCmd); + updateSQL = conn.prepareStatement(updateCmd); retValue = rs.getInt(1); } updateSQL.setInt(1, incrementNo); @@ -367,6 +373,8 @@ public class MSequence extends X_AD_Sequence selectSQL = selectSQL + " FOR UPDATE OF s"; } } + if (!DB.isOracle() && !DB.isPostgreSQL()) + selectSQL = DB.getDatabase().convertStatement(selectSQL); Connection conn = null; Trx trx = trxName == null ? null : Trx.get(trxName, true); // @@ -439,7 +447,10 @@ public class MSequence extends X_AD_Sequence try { if (adempiereSys) { - updateSQL = conn.prepareStatement("UPDATE AD_Sequence SET CurrentNextSys = CurrentNextSys + ? WHERE AD_Sequence_ID = ?"); + String updateCmd = "UPDATE AD_Sequence SET CurrentNextSys = CurrentNextSys + ? WHERE AD_Sequence_ID = ?"; + if (!DB.isOracle() && !DB.isPostgreSQL()) + updateCmd = DB.getDatabase().convertStatement(updateCmd); + updateSQL = conn.prepareStatement(updateCmd); next = rs.getInt(2); } else { String sql; @@ -447,6 +458,8 @@ public class MSequence extends X_AD_Sequence sql = "UPDATE AD_Sequence_No SET CurrentNext = CurrentNext + ? WHERE AD_Sequence_ID=? AND CalendarYearMonth=? AND AD_Org_ID=?"; else sql = "UPDATE AD_Sequence SET CurrentNext = CurrentNext + ? WHERE AD_Sequence_ID=?"; + if (!DB.isOracle() && !DB.isPostgreSQL()) + sql = DB.getDatabase().convertStatement(sql); updateSQL = conn.prepareStatement(sql); next = rs.getInt(1); } diff --git a/org.adempiere.base/src/org/compiere/model/PO_LOB.java b/org.adempiere.base/src/org/compiere/model/PO_LOB.java index fec006f834..508ef57729 100644 --- a/org.adempiere.base/src/org/compiere/model/PO_LOB.java +++ b/org.adempiere.base/src/org/compiere/model/PO_LOB.java @@ -115,6 +115,8 @@ public class PO_LOB implements Serializable .append(m_tableName) .append(" SET ").append(m_columnName) .append("=? WHERE ").append(m_whereClause); + if (!DB.isPostgreSQL() && !DB.isOracle()) + sql = new StringBuffer(DB.getDatabase().convertStatement(sql.toString())); // if (log.isLoggable(Level.FINE)) log.fine("[" + trxName + "] - Local - " + m_value); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java index ac4ba38e7b..fa3fa9a672 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java @@ -409,12 +409,12 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener { if (Env.isBaseLanguage(Env.getCtx(), "AD_Ref_List")) colSql = new StringBuffer("(SELECT l.Name FROM AD_Ref_List l WHERE l.AD_Reference_ID=") - .append(AD_Reference_Value_ID).append(" AND l.Value=").append(columnSql) + .append(AD_Reference_Value_ID).append(" AND l.Value=").append(tableName).append(".").append(columnSql) .append(") AS ").append(columnName); else colSql = new StringBuffer("(SELECT t.Name FROM AD_Ref_List l, AD_Ref_List_Trl t " + "WHERE l.AD_Ref_List_ID=t.AD_Ref_List_ID AND l.AD_Reference_ID=") - .append(AD_Reference_Value_ID).append(" AND l.Value=").append(columnSql) + .append(AD_Reference_Value_ID).append(" AND l.Value=").append(tableName).append(".").append(columnSql) .append(" AND t.AD_Language='").append(Env.getAD_Language(Env.getCtx())) .append("') AS ").append(columnName); colClass = String.class; From ca658eed4200722d98b4e273e56eb90c405106a6 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Jun 2015 15:55:09 -0500 Subject: [PATCH 4/5] IDEMPIERE-2664 DB Extensibility issues --- .../src/org/compiere/process/ColumnEncryption.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org.adempiere.base.process/src/org/compiere/process/ColumnEncryption.java b/org.adempiere.base.process/src/org/compiere/process/ColumnEncryption.java index 10a1d733db..fefb3c228b 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ColumnEncryption.java +++ b/org.adempiere.base.process/src/org/compiere/process/ColumnEncryption.java @@ -490,6 +490,7 @@ public class ColumnEncryption extends SvrProcess { if (rs.next()) { // Change the column size physically. + alterSql = new StringBuilder(DB.getDatabase().convertStatement(alterSql.toString())); if (DB.executeUpdate(alterSql.toString(), false, m_trx .getTrxName()) == -1) { log.severe("EncryptError [ChangeFieldLength]: ColumnID=" @@ -498,6 +499,7 @@ public class ColumnEncryption extends SvrProcess { } // Change the column size in AD. + updateSql = new StringBuilder(DB.getDatabase().convertStatement(updateSql.toString())); if (DB.executeUpdate(updateSql.toString(), false, m_trx .getTrxName()) == -1) { log.severe("EncryptError [ChangeFieldLength]: ColumnID=" From c4e93a15f74ad18e3205b1590c6c215228ba3ff5 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Jun 2015 18:17:54 -0500 Subject: [PATCH 5/5] IDEMPIERE-2673 Custom status line message not updating in different records --- .../adempiere/webui/adwindow/AbstractADWindowContent.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java index d4579dde66..25198d1235 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java @@ -1564,10 +1564,9 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements { GridTab gt = adTabbox.getSelectedGridTab(); String trxInfo = gt.getStatusLine(); - if (trxInfo != null) - { - statusBar.setInfo(trxInfo); - } + if (trxInfo == null) + trxInfo = ""; + statusBar.setInfo(trxInfo); SessionManager.getAppDesktop().updateHelpQuickInfo(gt); }