Skip to content

Commit

Permalink
Merge pull request #17087 from eileenmcnaughton/ids
Browse files Browse the repository at this point in the history
[REF] Stop passing ids to membership::create from createRelatedMemberships
  • Loading branch information
mattwire authored Apr 17, 2020
2 parents 4caedd0 + db0cbfd commit e0dba58
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions CRM/Member/BAO/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -1475,15 +1475,13 @@ public static function createRelatedMemberships(&$params, &$dao, $reset = FALSE)
$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 {
Expand All @@ -1502,8 +1500,7 @@ public static function createRelatedMemberships(&$params, &$dao, $reset = FALSE)
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--;
}
}
Expand Down

0 comments on commit e0dba58

Please sign in to comment.