From 6946fcbf94384b968d71f78ad03fcf4e7822e15e Mon Sep 17 00:00:00 2001 From: atif-shaikh Date: Tue, 31 Mar 2015 18:57:25 +0530 Subject: [PATCH] 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 --- CRM/Contact/BAO/Relationship.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) 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. -- 2.25.1