From a9364f6af611c34bb7382bd40585ab04647c1263 Mon Sep 17 00:00:00 2001 From: Elaine Tan Date: Thu, 5 Dec 2013 18:04:46 +0800 Subject: [PATCH] IDEMPIERE-337 zkwebui - Improve Info Product window - enforce only one current vendor per product rule, execute the update statement if current record is active and is current vendor --- .../src/org/compiere/model/MProductPO.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MProductPO.java b/org.adempiere.base/src/org/compiere/model/MProductPO.java index 1c7746732b..b04471a1c9 100644 --- a/org.adempiere.base/src/org/compiere/model/MProductPO.java +++ b/org.adempiere.base/src/org/compiere/model/MProductPO.java @@ -105,9 +105,12 @@ public class MProductPO extends X_M_Product_PO ) ) { - String sql = "UPDATE M_Product_PO SET IsCurrentVendor='N' WHERE IsActive='Y' AND IsCurrentVendor='Y' AND C_BPartner_ID!=? AND M_Product_ID=?"; - int no = DB.executeUpdate(sql, new Object[] {getC_BPartner_ID(), getM_Product_ID()}, false, get_TrxName()); - if (log.isLoggable(Level.FINEST)) log.finest("Updated M_Product_PO.IsCurrentVendor #" + no); + if (isActive() && isCurrentVendor()) + { + String sql = "UPDATE M_Product_PO SET IsCurrentVendor='N' WHERE IsActive='Y' AND IsCurrentVendor='Y' AND C_BPartner_ID!=? AND M_Product_ID=?"; + int no = DB.executeUpdate(sql, new Object[] {getC_BPartner_ID(), getM_Product_ID()}, false, get_TrxName()); + if (log.isLoggable(Level.FINEST)) log.finest("Updated M_Product_PO.IsCurrentVendor #" + no); + } } return true;