X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FBAO%2FAddress.php;h=090bde61b3464a8fbc739b8f1b00d64900cf67d7;hb=e0fb9216d8bc79248af4f66623f8654f1d2e27a1;hp=2ff74bbb3740a2ed0726826795635103670f18b9;hpb=3291b804470947bc3e3d1f580ffbd057d26e7898;p=civicrm-core.git diff --git a/CRM/Core/BAO/Address.php b/CRM/Core/BAO/Address.php index 2ff74bbb37..090bde61b3 100644 --- a/CRM/Core/BAO/Address.php +++ b/CRM/Core/BAO/Address.php @@ -1047,11 +1047,16 @@ SELECT is_primary, $query = 'SELECT id, contact_id FROM civicrm_address WHERE master_id = %1'; $dao = CRM_Core_DAO::executeQuery($query, array(1 => array($addressId, 'Integer'))); + // Default to TRUE if not set to maintain api backward compatibility. + $createRelationship = isset($params['update_current_employer']) ? $params['update_current_employer'] : TRUE; + // unset contact id $skipFields = array('is_primary', 'location_type_id', 'is_billing', 'contact_id'); if (isset($params['master_id']) && !CRM_Utils_System::isNull($params['master_id'])) { - // call the function to create a relationship for the new shared address - self::processSharedAddressRelationship($params['master_id'], $params['contact_id']); + if ($createRelationship) { + // call the function to create a relationship for the new shared address + self::processSharedAddressRelationship($params['master_id'], $params['contact_id']); + } } else { // else no new shares will be created, only update shared addresses @@ -1064,7 +1069,7 @@ SELECT is_primary, $addressDAO = new CRM_Core_DAO_Address(); while ($dao->fetch()) { // call the function to update the relationship - if (isset($params['master_id']) && !CRM_Utils_System::isNull($params['master_id'])) { + if ($createRelationship && isset($params['master_id']) && !CRM_Utils_System::isNull($params['master_id'])) { self::processSharedAddressRelationship($params['master_id'], $dao->contact_id); } $addressDAO->copyValues($params);