From: atif-shaikh Date: Tue, 31 Mar 2015 13:27:25 +0000 (+0530) Subject: CRM-16087 Failing test fix X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6946fcbf94384b968d71f78ad03fcf4e7822e15e;p=civicrm-core.git CRM-16087 Failing test fix ---------------------------------------- * CRM-16087: Changes in relationship status are not invoking updates to membership status https://issues.civicrm.org/jira/browse/CRM-16087 --- diff --git a/CRM/Contact/BAO/Relationship.php b/CRM/Contact/BAO/Relationship.php index efa0dfd758..973e870841 100644 --- a/CRM/Contact/BAO/Relationship.php +++ b/CRM/Contact/BAO/Relationship.php @@ -67,7 +67,15 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship { //CRM-16087 removed additional call to function relatedMemberships which is already called by disableEnableRelationship //resulting in memership being created twice - self::disableEnableRelationship($params['id'], $action, $params, $ids); + if (array_key_exists('is_active', $params) && empty($params['is_active'])) { + $action = CRM_Core_Action::DISABLE; + $active = FALSE; + } + else { + $action = CRM_Core_Action::ENABLE; + $active = TRUE; + } + self::disableEnableRelationship($params['id'], $action, $params, $ids, $active); } self::addRecent($params, $relationship); @@ -685,15 +693,6 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship { 'contact_check' => array($relationship->contact_id_b => 1), ); } - else { - if (array_key_exists('is_active', $params) && empty($params['is_active'])) { - $action = CRM_Core_Action::DISABLE; - } - else { - $action = CRM_Core_Action::ENABLE; - $active = TRUE; - } - } $contact_id_a = empty($params['contact_id_a']) ? $relationship->contact_id_a : $params['contact_id_a']; // calling relatedMemberships to delete/add the memberships of // related contacts.