From 2b3f71e48c778080eb835d477299c959b267eb5f Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 18 Jan 2013 11:34:42 -0800 Subject: [PATCH 1/3] IDEMPIERE-568 Review proper closing of JDBC statements and resultsetsHG: Enter commit message. Lines beginning with 'HG:' are removed. --- .../src/org/compiere/model/MCost.java | 34 ++++++------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MCost.java b/org.adempiere.base/src/org/compiere/model/MCost.java index e44bd238bc..bc56987df0 100644 --- a/org.adempiere.base/src/org/compiere/model/MCost.java +++ b/org.adempiere.base/src/org/compiere/model/MCost.java @@ -476,6 +476,7 @@ public class MCost extends X_M_Cost sql.append(" ORDER BY i.DateInvoiced DESC, il.Line DESC"); // PreparedStatement pstmt = null; + ResultSet rs = null; try { pstmt = DB.prepareStatement (sql.toString(), product.get_TrxName()); @@ -485,26 +486,18 @@ public class MCost extends X_M_Cost pstmt.setInt (3, AD_Org_ID); else if (M_ASI_ID != 0) pstmt.setInt(3, M_ASI_ID); - ResultSet rs = pstmt.executeQuery (); + rs = pstmt.executeQuery (); if (rs.next ()) retValue = rs.getBigDecimal(1); - rs.close (); - pstmt.close (); - pstmt = null; } catch (Exception e) { s_log.log (Level.SEVERE, sql.toString(), e); } - try + finally { - if (pstmt != null) - pstmt.close (); - pstmt = null; - } - catch (Exception e) - { - pstmt = null; + DB.close(rs, pstmt); + rs = null; pstmt = null; } if (retValue != null) @@ -653,11 +646,12 @@ public class MCost extends X_M_Cost + " AND EXISTS (SELECT * FROM M_CostDetail cd " + "WHERE p.M_Product_ID=cd.M_Product_ID AND Processed='N')"; PreparedStatement pstmt = null; + ResultSet rs = null; try { pstmt = DB.prepareStatement (sql, trxNameUsed); pstmt.setInt (1, client.getAD_Client_ID()); - ResultSet rs = pstmt.executeQuery (); + rs = pstmt.executeQuery (); while (rs.next ()) { MProduct product = new MProduct (client.getCtx(), rs, trxNameUsed); @@ -668,24 +662,16 @@ public class MCost extends X_M_Cost s_log.info(product.getName() + " = " + cost); } } - rs.close (); - pstmt.close (); - pstmt = null; } catch (Exception e) { s_log.log (Level.SEVERE, sql, e); success = false; } - try + finally { - if (pstmt != null) - pstmt.close (); - pstmt = null; - } - catch (Exception e) - { - pstmt = null; + DB.close(rs, pstmt); + rs = null; pstmt = null; } // Transaction if (trx != null) From 9001929ae1fd0af18668535962de59bc3f18fc54 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 18 Jan 2013 11:38:44 -0800 Subject: [PATCH 2/3] IDEMPIERE-567 Move ProductUOMConversionRateValidate sysconfig key to be client configurable --- .../oracle/201301181138_IDEMPIERE-567.sql | 13 +++++++++++++ .../postgresql/201301181138_IDEMPIERE-567.sql | 13 +++++++++++++ .../src/org/compiere/model/MUOMConversion.java | 4 ++-- 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 migration/i1.0a-release/oracle/201301181138_IDEMPIERE-567.sql create mode 100644 migration/i1.0a-release/postgresql/201301181138_IDEMPIERE-567.sql diff --git a/migration/i1.0a-release/oracle/201301181138_IDEMPIERE-567.sql b/migration/i1.0a-release/oracle/201301181138_IDEMPIERE-567.sql new file mode 100644 index 0000000000..56af0fc7b4 --- /dev/null +++ b/migration/i1.0a-release/oracle/201301181138_IDEMPIERE-567.sql @@ -0,0 +1,13 @@ +-- Jan 18, 2013 11:37:40 AM PST +-- IDEMPIERE-567 Move ProductUOMConversionRateValidate sysconfig key to be client configurable +UPDATE AD_SysConfig SET ConfigurationLevel='C',Updated=TO_DATE('2013-01-18 11:37:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=50023 +; + +-- Jan 18, 2013 11:37:44 AM PST +-- IDEMPIERE-567 Move ProductUOMConversionRateValidate sysconfig key to be client configurable +UPDATE AD_SysConfig SET ConfigurationLevel='C',Updated=TO_DATE('2013-01-18 11:37:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=50022 +; + +SELECT register_migration_script('201301181138_IDEMPIERE-567.sql') FROM dual +; + diff --git a/migration/i1.0a-release/postgresql/201301181138_IDEMPIERE-567.sql b/migration/i1.0a-release/postgresql/201301181138_IDEMPIERE-567.sql new file mode 100644 index 0000000000..ac7905ebe9 --- /dev/null +++ b/migration/i1.0a-release/postgresql/201301181138_IDEMPIERE-567.sql @@ -0,0 +1,13 @@ +-- Jan 18, 2013 11:37:40 AM PST +-- IDEMPIERE-567 Move ProductUOMConversionRateValidate sysconfig key to be client configurable +UPDATE AD_SysConfig SET ConfigurationLevel='C',Updated=TO_TIMESTAMP('2013-01-18 11:37:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=50023 +; + +-- Jan 18, 2013 11:37:44 AM PST +-- IDEMPIERE-567 Move ProductUOMConversionRateValidate sysconfig key to be client configurable +UPDATE AD_SysConfig SET ConfigurationLevel='C',Updated=TO_TIMESTAMP('2013-01-18 11:37:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=50022 +; + +SELECT register_migration_script('201301181138_IDEMPIERE-567.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/model/MUOMConversion.java b/org.adempiere.base/src/org/compiere/model/MUOMConversion.java index 58ad43206e..0daa34a608 100644 --- a/org.adempiere.base/src/org/compiere/model/MUOMConversion.java +++ b/org.adempiere.base/src/org/compiere/model/MUOMConversion.java @@ -702,7 +702,7 @@ public class MUOMConversion extends X_C_UOM_Conversion return false; } // Enforce Product UOM - if (MSysConfig.getBooleanValue(MSysConfig.ProductUOMConversionUOMValidate, true)) + if (MSysConfig.getBooleanValue(MSysConfig.ProductUOMConversionUOMValidate, true, getAD_Client_ID())) { if (getM_Product_ID() != 0 && (newRecord || is_ValueChanged("M_Product_ID"))) @@ -718,7 +718,7 @@ public class MUOMConversion extends X_C_UOM_Conversion } // The Product UoM needs to be the smallest UoM - Multiplier must be < 0; Divider must be > 0 - if (MSysConfig.getBooleanValue(MSysConfig.ProductUOMConversionRateValidate, true)) + if (MSysConfig.getBooleanValue(MSysConfig.ProductUOMConversionRateValidate, true, getAD_Client_ID())) { if (getM_Product_ID() != 0 && getDivideRate().compareTo(Env.ONE) < 0) { From 7f1a78011188f150d438f232db0cff74771fcbc6 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 18 Jan 2013 11:55:17 -0800 Subject: [PATCH 3/3] IDEMPIERE-442 Unable to highlight and delete text in "Lookup" box - remove draggable setting in the "Lookup" search box --- .../webui/dashboard/DPFavourites.java | 25 +++---------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPFavourites.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPFavourites.java index 75e9ef60a7..462ef6ab09 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPFavourites.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPFavourites.java @@ -13,12 +13,13 @@ *****************************************************************************/ package org.adempiere.webui.dashboard; +import static org.compiere.model.SystemIDs.TREE_MENUPRIMARY; + import java.util.Enumeration; import org.adempiere.util.Callback; import org.adempiere.webui.adwindow.ADWindow; import org.adempiere.webui.exception.ApplicationException; -import org.adempiere.webui.panel.TreeSearchPanel; import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.window.FDialog; import org.compiere.model.GridTab; @@ -26,7 +27,6 @@ import org.compiere.model.MMenu; import org.compiere.model.MQuery; import org.compiere.model.MTree; import org.compiere.model.MTreeNode; -import static org.compiere.model.SystemIDs.*; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; @@ -38,7 +38,6 @@ import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; import org.zkoss.zul.A; import org.zkoss.zul.Box; -import org.zkoss.zul.Combobox; import org.zkoss.zul.Hbox; import org.zkoss.zul.Image; import org.zkoss.zul.Label; @@ -217,24 +216,6 @@ public class DPFavourites extends DashboardPanel implements EventListener addItem(treeitem); } - else if(dragged instanceof Combobox) - { - TreeSearchPanel tsp = null; - Component parent = dragged.getParent(); - while(tsp == null && parent != null) { - if (parent instanceof TreeSearchPanel) { - tsp = (TreeSearchPanel) parent; - } else { - parent = parent.getParent(); - } - } - if (tsp != null) { - Treeitem treeitem = tsp.getSelectedItem(); - if (treeitem != null) { - addItem(treeitem); - } - } - } } else if(comp instanceof Image) { @@ -243,7 +224,7 @@ public class DPFavourites extends DashboardPanel implements EventListener A btn = (A) dragged; removeLink(btn); } - } + } } // }