$membershipTypeIDs = (array) $membershipParams['selectMembership'];
$membershipTypes = CRM_Member_BAO_Membership::buildMembershipTypeValues($this, $membershipTypeIDs);
$membershipType = empty($membershipTypes) ? [] : reset($membershipTypes);
- $isPending = $this->getIsPending();
$this->assign('membership_name', CRM_Utils_Array::value('name', $membershipType));
$this->_values['membership_name'] = CRM_Utils_Array::value('name', $membershipType);
$this->postProcessMembership($membershipParams, $contactID,
$this, $premiumParams, $customFieldsFormatted, $fieldTypes, $membershipType, $membershipTypeIDs, $isPaidMembership, $this->_membershipId, $isProcessSeparateMembershipTransaction, $financialTypeID,
- $membershipLineItems, $isPending);
+ $membershipLineItems);
$this->assign('membership_assign', TRUE);
$this->set('membershipTypeID', $membershipParams['selectMembership']);
* @param int $financialTypeID
* @param array $unprocessedLineItems
* Line items for payment options chosen on the form.
- * @param bool $isPending
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
+ * @throws \Civi\Payment\Exception\PaymentProcessorException
*/
protected function postProcessMembership(
$membershipParams, $contactID, &$form, $premiumParams,
$customFieldsFormatted = NULL, $includeFieldTypes = NULL, $membershipDetails, $membershipTypeIDs, $isPaidMembership, $membershipID,
- $isProcessSeparateMembershipTransaction, $financialTypeID, $unprocessedLineItems, $isPending) {
+ $isProcessSeparateMembershipTransaction, $financialTypeID, $unprocessedLineItems) {
$membershipContribution = NULL;
$isTest = CRM_Utils_Array::value('is_test', $membershipParams, FALSE);
}
$i++;
$numTerms = CRM_Utils_Array::value($memType, $typesTerms, 1);
- if (!empty($membershipContribution)) {
- $pendingStatus = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Pending');
- $pending = ($membershipContribution->contribution_status_id == $pendingStatus) ? TRUE : FALSE;
- }
- else {
- $pending = $isPending;
- }
$contributionRecurID = isset($form->_params['contributionRecurID']) ? $form->_params['contributionRecurID'] : NULL;
$membershipSource = NULL;
}
}
+ // @todo Move this into CRM_Member_BAO_Membership::processMembership
+ if (!empty($membershipContribution)) {
+ $pending = ($membershipContribution->contribution_status_id == array_search('Pending', CRM_Contribute_PseudoConstant::contributionStatus())) ? TRUE : FALSE;
+ }
+ else {
+ $pending = $this->getIsPending();
+ }
list($membership, $renewalMode, $dates) = CRM_Member_BAO_Membership::processMembership(
$contactID, $memType, $isTest,
date('YmdHis'), CRM_Utils_Array::value('cms_contactID', $membershipParams),
$membershipSource = $this->_params['membership_source'];
}
- $isPending = ($this->_params['contribution_status_id'] == 2) ? TRUE : FALSE;
-
+ // @todo Move this into CRM_Member_BAO_Membership::processMembership
+ $pending = ($this->_params['contribution_status_id'] == array_search('Pending', CRM_Contribute_PseudoConstant::contributionStatus())) ? TRUE : FALSE;
list($membership) = CRM_Member_BAO_Membership::processMembership(
$this->_contactID, $this->_params['membership_type_id'][1], $isTestMembership,
$renewalDate, NULL, $customFieldsFormatted, $numRenewTerms, $this->_membershipId,
- $isPending,
+ $pending,
$contributionRecurID, $membershipSource, $this->_params['is_pay_later'], CRM_Utils_Array::value('campaign_id',
$this->_params)
);