From 68bad5a1766569e4101fac709c2d95ebd66cd78e Mon Sep 17 00:00:00 2001 From: trifonnt Date: Sat, 7 Feb 2009 10:00:10 +0000 Subject: [PATCH] BF: [ 2576434 ] C_BPartner_Location Name should not be overwritten by system https://sourceforge.net/tracker/index.php?func=detail&aid=2576434&group_id=176962&atid=879332 When user create C_BPartner_Location record and provide value of Name column Adempiere overwrite Name column and generates new one. This behavior is wrong. System must create new Name only if provided by user Name is not unique. --- .../org/compiere/model/MBPartnerLocation.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/base/src/org/compiere/model/MBPartnerLocation.java b/base/src/org/compiere/model/MBPartnerLocation.java index e83c48ea72..d0c91e75c3 100644 --- a/base/src/org/compiere/model/MBPartnerLocation.java +++ b/base/src/org/compiere/model/MBPartnerLocation.java @@ -166,10 +166,12 @@ public class MBPartnerLocation extends X_C_BPartner_Location return true; MLocation address = getLocation(true); m_uniqueName = getName(); - if (m_uniqueName != null && m_uniqueName.equals(".")) // default - m_uniqueName = null; m_unique = 0; - makeUnique(address); + if (m_uniqueName != null && m_uniqueName.equals(".")) { + // default + m_uniqueName = null; + makeUnique(address); + } // Check uniqueness MBPartnerLocation[] locations = getForBPartner(getCtx(), getC_BPartner_ID()); @@ -184,6 +186,7 @@ public class MBPartnerLocation extends X_C_BPartner_Location continue; if (m_uniqueName.equals(location.getName())) { + //m_uniqueName = null; makeUnique(address); unique = false; break; @@ -200,8 +203,6 @@ public class MBPartnerLocation extends X_C_BPartner_Location */ private void makeUnique (MLocation address) { - // m_uniqueName = address.toString(); - // return; if (m_uniqueName == null) m_uniqueName = ""; @@ -216,7 +217,7 @@ public class MBPartnerLocation extends X_C_BPartner_Location m_unique = 0; } // 1 + Address1 - if (m_unique == 1 || m_uniqueName.length() == 0) + if (m_unique == 1 || m_uniqueName.length() == 0) { String xx = address.getAddress1(); if (xx != null && xx.length() > 0) @@ -228,7 +229,7 @@ public class MBPartnerLocation extends X_C_BPartner_Location m_unique = 1; } // 2 + Address2 - if (m_unique == 2 || m_uniqueName.length() == 0) + if (m_unique == 2 || m_uniqueName.length() == 0) { String xx = address.getAddress2(); if (xx != null && xx.length() > 0) @@ -240,7 +241,7 @@ public class MBPartnerLocation extends X_C_BPartner_Location m_unique = 2; } // 3 - Region - if (m_unique == 3 || m_uniqueName.length() == 0) + if (m_unique == 3 || m_uniqueName.length() == 0) { String xx = address.getRegionName(true); { @@ -251,7 +252,7 @@ public class MBPartnerLocation extends X_C_BPartner_Location m_unique = 3; } // 4 - ID - if (m_unique == 4 || m_uniqueName.length() == 0) + if (m_unique == 4 || m_uniqueName.length() == 0) { int id = get_ID(); if (id == 0)