From ca35cb026b1a26609ad975f5b6a6e58b93311f39 Mon Sep 17 00:00:00 2001 From: Jitendra Purohit Date: Tue, 14 Nov 2017 08:56:32 +0530 Subject: [PATCH 1/2] Fix fatal error on pay later --- CRM/Contribute/Form/ContributionBase.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index adbf82b2ec22..01e5e0d15539 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -329,7 +329,7 @@ public function preProcess() { } if ($isMonetary && - (!$isPayLater || !empty($this->_values['payment_processor'])) + ($isPayLater || !empty($this->_values['payment_processor'])) ) { $this->_paymentProcessorIDs = explode( CRM_Core_DAO::VALUE_SEPARATOR, @@ -580,7 +580,7 @@ public function assignToTemplate() { // The concept of contributeMode is deprecated. // The payment processor object can provide info about the fields it shows. - if ($assignCCInfo) { + if ($assignCCInfo && $this->_paymentProcessor) { /** @var $paymentProcessorObject \CRM_Core_Payment */ $paymentProcessorObject = $this->_paymentProcessor['object']; $paymentFields = $paymentProcessorObject->getPaymentFormFields(); From 1aba6f311a0bcab5cdd6eea100e0618ffd127041 Mon Sep 17 00:00:00 2001 From: Jitendra Purohit Date: Fri, 17 Nov 2017 18:26:28 +0530 Subject: [PATCH 2/2] fix contribution page loading on no processor --- CRM/Contribute/Form/ContributionBase.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index 01e5e0d15539..216c8149e252 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -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); } @@ -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 && $this->_paymentProcessor) { + if ($isMonetary) { /** @var $paymentProcessorObject \CRM_Core_Payment */ $paymentProcessorObject = $this->_paymentProcessor['object']; $paymentFields = $paymentProcessorObject->getPaymentFormFields();