'membership_id'
);
}
-
+
+ $params['skipLineItem'] = TRUE;
+ $params['contribution'] = NULL;
+
//record contribution for this membership
if (!empty($params['contribution_status_id']) && empty($params['relate_contribution_id'])) {
$memInfo = array_merge($params, array('membership_id' => $membership->id));
$params['contribution'] = self::recordMembershipContribution($memInfo, $ids);
}
+
+ if (CRM_Utils_Array::value('lineItems', $params) && empty($params['contributionId'])) {
+ CRM_Price_BAO_LineItem::processPriceSet($membership->id, $params['lineItems'], $params['contribution']);
+ }
//insert payment record for this membership
if (!empty($params['relate_contribution_id'])) {
'contact_id', 'total_amount', 'receive_date', 'financial_type_id',
'payment_instrument_id', 'trxn_id', 'invoice_id', 'is_test',
'contribution_status_id', 'check_number', 'campaign_id', 'is_pay_later',
- 'membership_id',
+ 'membership_id', 'skipLineItem'
);
foreach ($recordContribution as $f) {
$contributionParams[$f] = CRM_Utils_Array::value($f, $params);
$this->setPageTitle(ts('Membership'));
+
parent::preProcess();
}
}
$membershipType = implode(', ', $membershipTypes);
+
+ //do cleanup line items if membership edit the Membership Fee.
+ $params['contributionId'] = CRM_Utils_Array::value('contribution_id', $this->_defaultValues);
+ if (empty($params['contributionId']) && $this->_id) {
+ CRM_Price_BAO_LineItem::deleteLineItems($this->_id, 'civicrm_membership');
+ }
// Retrieve the name and email of the current user - this will be the FROM for the receipt email
list($userName, $userEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($ids['userId']);
}
$membership = CRM_Member_BAO_Membership::create($membershipParams, $ids);
+ unset($params['lineItems']);
$this->_membershipIDs[] = $membership->id;
$createdMemberships[$memType] = $membership;