From db0cbfd05928357ca0e4460cb41a4afc0b4cedfe Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 16 Apr 2020 17:54:24 +1200 Subject: [PATCH] Stop passing ids to membership::create from createRelatedMemberships We are passing in an empty array. Per the code comments there was concern that the array might NOT be empty after calling create & that needed to be checked out. However, I just went through it & concluded that values in the ids var would only ever be set if ids['membership'] was passed in - so if it goes in empty it will come out empty --- CRM/Member/BAO/Membership.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index 52b15d6a3a..ecfed40d57 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -1480,15 +1480,13 @@ WHERE civicrm_membership.contact_id = civicrm_contact.id $ids = []; if (($params['status_id'] == $deceasedStatusId) || ($params['status_id'] == $expiredStatusId)) { // related membership is not active so does not count towards maximum - // @todo stop passing empty $ids - CRM_Member_BAO_Membership::create($params, $ids); + CRM_Member_BAO_Membership::create($params); } else { // related membership already exists, so this is just an update if (isset($params['id'])) { if ($numRelatedAvailable > 0) { - // @todo stop passing empty $ids - CRM_Member_BAO_Membership::create($params, $ids); + CRM_Member_BAO_Membership::create($params); $numRelatedAvailable--; } else { @@ -1507,8 +1505,7 @@ WHERE civicrm_membership.contact_id = civicrm_contact.id if ($numRelatedAvailable <= 0) { break; } - // @todo stop passing $ids - at this point it may be set by reference from earlier calls to CRM_Member_BAO_Membership::create - CRM_Member_BAO_Membership::create($params, $ids); + CRM_Member_BAO_Membership::create($params); $numRelatedAvailable--; } } -- 2.25.1