From 6c25ede21e4a3aec30aec6fd2de9f63a4ef227db Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Fri, 27 Feb 2015 18:33:19 +0530 Subject: [PATCH] alter related membership if the is_active param is changed --- CRM/Contact/BAO/Relationship.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CRM/Contact/BAO/Relationship.php b/CRM/Contact/BAO/Relationship.php index 62f2ae86a5..58b05f78ee 100644 --- a/CRM/Contact/BAO/Relationship.php +++ b/CRM/Contact/BAO/Relationship.php @@ -64,6 +64,15 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship { $ids = array('contactTarget' => $relationship->contact_id_b, 'contact' => $params['contact_id_a']); CRM_Contact_BAO_Relationship::relatedMemberships($params['contact_id_a'], $values, $ids, (empty($params['id']) ? CRM_Core_Action::ADD : CRM_Core_Action::UPDATE)); } + + //alter related membership if the is_active param is changed + if (!empty($params['id'])) { + $action = CRM_Core_Action::DISABLE; + if (!empty($params['is_active'])) { + $action = CRM_Core_Action::ENABLE; + } + CRM_Contact_BAO_Relationship::disableEnableRelationship($params['id'], $action); + } self::addRecent($params, $relationship); return $relationship; } -- 2.25.1