From d7df5ede11615271a67cf5f72f741d01bd79e407 Mon Sep 17 00:00:00 2001 From: Alok Patel Date: Tue, 22 May 2018 17:54:15 +0530 Subject: [PATCH] CIVICRM-832: Removing related memberships if parent membership type is changed which does not have relation type associated. --- CRM/Member/BAO/Membership.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index fbb533bf4dec..ce6df5a60591 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -450,8 +450,8 @@ public static function create(&$params, &$ids, $skipRedirect = FALSE) { /** * Check the membership extended through relationship. * - * @param int $membershipId - * Membership id. + * @param int $membershipTypeID + * Membership type id. * @param int $contactId * Contact id. * @@ -460,9 +460,8 @@ public static function create(&$params, &$ids, $skipRedirect = FALSE) { * @return array * array of contact_id of all related contacts. */ - public static function checkMembershipRelationship($membershipId, $contactId, $action = CRM_Core_Action::ADD) { + public static function checkMembershipRelationship($membershipTypeID, $contactId, $action = CRM_Core_Action::ADD) { $contacts = array(); - $membershipTypeID = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $membershipId, 'membership_type_id'); $membershipType = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($membershipTypeID); $relationships = array(); @@ -1388,7 +1387,7 @@ public static function createRelatedMemberships(&$params, &$dao, $reset = FALSE) $allRelatedContacts = array(); $relatedContacts = array(); if (!is_a($membership, 'CRM_Core_Error')) { - $allRelatedContacts = CRM_Member_BAO_Membership::checkMembershipRelationship($membership->id, + $allRelatedContacts = CRM_Member_BAO_Membership::checkMembershipRelationship($membership->membership_type_id, $membership->contact_id, CRM_Utils_Array::value('action', $params) );