Skip to content

Commit

Permalink
Merge pull request civicrm#11286 from jitendrapurohit/pay-later-fix
Browse files Browse the repository at this point in the history
CRM-21436 - Fix fatal error on pay later
  • Loading branch information
eileenmcnaughton authored and sluc23 committed Jan 10, 2018
2 parents 5c6d5dc + 1aba6f3 commit 6b3cf1b
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions CRM/Contribute/Form/ContributionBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,11 @@ public function preProcess() {
}
}

if ($isMonetary &&
(!$isPayLater || !empty($this->_values['payment_processor']))
) {
$this->_paymentProcessorIDs = explode(
if ($isMonetary) {
$this->_paymentProcessorIDs = array_filter(explode(
CRM_Core_DAO::VALUE_SEPARATOR,
CRM_Utils_Array::value('payment_processor', $this->_values)
);
));

$this->assignPaymentProcessor($isPayLater);
}
Expand Down Expand Up @@ -567,20 +565,20 @@ public function assignToTemplate() {
}

//fix for CRM-3767
$assignCCInfo = FALSE;
$isMonetary = FALSE;
if ($this->_amount > 0.0) {
$assignCCInfo = TRUE;
$isMonetary = TRUE;
}
elseif (!empty($this->_params['selectMembership'])) {
$memFee = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_params['selectMembership'], 'minimum_fee');
if ($memFee > 0.0) {
$assignCCInfo = TRUE;
$isMonetary = TRUE;
}
}

// The concept of contributeMode is deprecated.
// The payment processor object can provide info about the fields it shows.
if ($assignCCInfo) {
if ($isMonetary) {
/** @var $paymentProcessorObject \CRM_Core_Payment */
$paymentProcessorObject = $this->_paymentProcessor['object'];
$paymentFields = $paymentProcessorObject->getPaymentFormFields();
Expand Down

0 comments on commit 6b3cf1b

Please sign in to comment.