'address_id' => $addressID,
//setting to make available to hook - although seems wrong to set on form for BAO hook availability
'soft_credit_to' => $softCreditToID,
- 'line_item' => $lineItems
+ 'line_item' => $lineItems,
+ 'skipLineItem' => CRM_Utils_Array::value('skipLineItem', $params, 0)
);
if (!$online && isset($params['thankyou_date'])) {
$contributionParam['thankyou_date'] = $params['thankyou_date'];
$result = $membershipContribution = NULL;
$isTest = CRM_Utils_Array::value('is_test', $membershipParams, FALSE);
$errors = $createdMemberships = array();
-
+
+ $membershipLineItem = array();
+ if (is_array($membershipTypeID)) {
+ foreach ($form->_lineItem[$form->_priceSetId] as $key => $line) {
+ if (!empty($line['membership_type_id'])) {
+ $membershipLineItem[$line['membership_type_id']] = $line;
+ unset($form->_lineItem[$form->_priceSetId][$key]);
+ }
+ }
+ if (empty($form->_lineItem[$form->_priceSetId])) {
+ $membershipParams['skipLineItem'] = TRUE;
+ }
+ }
+
if ($isPaidMembership) {
$result = CRM_Contribute_BAO_Contribution_Utils::processConfirm($form, $membershipParams,
$premiumParams, $contactID,
foreach ($membershipTypeID as $memType) {
$numTerms = CRM_Utils_Array::value($memType, $typesTerms, 1);
$createdMemberships[$memType] = self::createOrRenewMembership($membershipParams, $contactID, $customFieldsFormatted, $membershipID, $memType, $isTest, $numTerms, $membershipContribution, $form);
+ if (CRM_Utils_Array::value($memType, $membershipLineItem)) {
+ CRM_Price_BAO_LineItem::processPriceSet($createdMemberships[$memType]->id, array($form->_priceSetId => array($membershipLineItem[$memType])), $membershipContribution);
+ $form->_lineItem[$form->_priceSetId][] = $membershipLineItem[$memType];
+ }
}
if ($form->_priceSetId && !empty($form->_useForMember) && !empty($form->_lineItem)) {
foreach ($form->_lineItem[$form->_priceSetId] as & $priceFieldOp) {