}
$params['skipLineItem'] = TRUE;
- $params['contribution'] = NULL;
//record contribution for this membership
if (!empty($params['contribution_status_id']) && empty($params['relate_contribution_id'])) {
}
if (CRM_Utils_Array::value('lineItems', $params) && empty($params['contributionId'])) {
- CRM_Price_BAO_LineItem::processPriceSet($membership->id, $params['lineItems'], $params['contribution']);
+ CRM_Price_BAO_LineItem::processPriceSet($membership->id, $params['lineItems'], CRM_Utils_Array::value('contribution', $params));
}
//insert payment record for this membership
$formValues['financial_type_id']
);
}
-
+ $membershipLineItems = array();
+ foreach ($lineItem[$this->_priceSetId] as $key => $value) {
+ if (!empty($value['membership_type_id'])) {
+ $membershipLineItems[$value['membership_type_id']] = $value;
+ unset($lineItem[$this->_priceSetId][$key]);
+ }
+ }
// process line items, until no previous line items.
if (!empty($lineItem)) {
$params['lineItems'] = $lineItem;
}
$membershipParams = array_merge($membershipTypeValues[$memType], $params);
+ $membershipParams['lineItems'][$this->_priceSetId][] = $membershipLineItems[$memType];
$membership = CRM_Member_BAO_Membership::create($membershipParams, $ids);
-
+ $params['contribution'] = CRM_Utils_Array::value('contribution', $membershipParams);
+ unset($params['lineItems']);
$this->_membershipIDs[] = $membership->id;
$createdMemberships[$memType] = $membership;
$count++;
if (!empty($softParams)) {
$membershipParams['soft_credit'] = $softParams;
}
-
+
+ $membershipParams['lineItems'][$this->_priceSetId][] = $membershipLineItems[$memType];
$membership = CRM_Member_BAO_Membership::create($membershipParams, $ids);
+ $params['contribution'] = CRM_Utils_Array::value('contribution', $membershipParams);
unset($params['lineItems']);
$this->_membershipIDs[] = $membership->id;
if (!empty($priceFieldOp['membership_type_id'])) {
$priceFieldOp['start_date'] = $membershipTypeValues[$priceFieldOp['membership_type_id']]['start_date'] ? CRM_Utils_Date::customFormat($membershipTypeValues[$priceFieldOp['membership_type_id']]['start_date'], '%d%f %b, %Y') : '-';
+
$priceFieldOp['end_date'] = $membershipTypeValues[$priceFieldOp['membership_type_id']]['end_date'] ? CRM_Utils_Date::customFormat($membershipTypeValues[$priceFieldOp['membership_type_id']]['end_date'], '%d%f %b, %Y') : '-';
}
else {