From b18c70b3fdf996fdf3b3da500e87d4d60487a468 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Dani=C3=ABl?= <9696905+DanielvV@users.noreply.github.com> Date: Wed, 27 Sep 2017 14:21:30 +0200 Subject: [PATCH] CRM-21214 - Fix address sharing 2 - small change --- CRM/Core/BAO/Address.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CRM/Core/BAO/Address.php b/CRM/Core/BAO/Address.php index 2d48a9bc77..627c66ad00 100644 --- a/CRM/Core/BAO/Address.php +++ b/CRM/Core/BAO/Address.php @@ -1011,9 +1011,11 @@ SELECT is_primary, // unset contact id $skipFields = array('is_primary', 'location_type_id', 'is_billing', 'contact_id'); - if (!CRM_Utils_System::isNull($params['master_id'])) { + // call the function to create a relationship + If (!empty($params['master_id']) && $params['master_id'] > 0) { self::processSharedAddressRelationship($params['master_id'], $params['contact_id']); } + // else no new shares will be created, only update shared addresses else { $skipFields[] = 'master_id'; } @@ -1023,7 +1025,8 @@ SELECT is_primary, $addressDAO = new CRM_Core_DAO_Address(); while ($dao->fetch()) { - if (!CRM_Utils_System::isNull($params['master_id'])) { + // call the function to update the relationship + If (!empty($params['master_id']) && $params['master_id'] > 0) { self::processSharedAddressRelationship($params['master_id'], $dao->contact_id); } $addressDAO->copyValues($params); -- 2.25.1