}
else {
// This is an existing membership, calculate the membership dates after renewal
+ // num_terms is treated as a 'special sauce' for is_renewal but this
+ // isn't really helpful for completing pendings.
$calcDates = CRM_Member_BAO_MembershipType::getRenewalDatesForMembershipType(
$params['id'],
NULL,
}
// Fixme: This code belongs in the BAO
+ $ids = [];
if (empty($params['id'])) {
$params['action'] = CRM_Core_Action::ADD;
// we need user id during add mode
- $ids = [];
if (!empty($params['contact_id'])) {
$ids['userId'] = $params['contact_id'];
}
else {
// edit mode
$params['action'] = CRM_Core_Action::UPDATE;
- // $ids['membership'] is required in CRM_Price_BAO_LineItem::processPriceSet
+ // @todo remove $ids['membership'] is required in CRM_Price_BAO_LineItem::processPriceSet
$ids['membership'] = $params['id'];
}
+ // @todo stop passing $ids (membership and userId may be set above)
$membershipBAO = CRM_Member_BAO_Membership::create($params, $ids, TRUE);
if (array_key_exists('is_error', $membershipBAO)) {
return $membershipValues;
}
-
/**
* Non-standard behaviour inherited from v2.
*