From: eileen Date: Thu, 12 Nov 2015 23:12:55 +0000 (-0800) Subject: CRM-17539 membership payments not completing AND sending emails X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c51070b537e799836508401335f8a7ba77055978;p=civicrm-core.git CRM-17539 membership payments not completing AND sending emails --- diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 22e70789d7..62e4414fd3 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -108,7 +108,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $contributionParams['contribution_recur_id'] = $recurringContributionID; } - $contributionParams['contribution_status_id'] = ($pending && $contributionParams['total_amount'] != 0) ? 2 : 1; + $contributionParams['contribution_status_id'] = $pending ? 2 : 1; if (isset($contributionParams['invoice_id'])) { $contributionParams['id'] = CRM_Core_DAO::getFieldValue( 'CRM_Contribute_DAO_Contribution', diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index d0667b038c..2fc18e2f0d 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -916,6 +916,15 @@ abstract class CRM_Core_Payment { public function doPayment(&$params, $component = 'contribute') { $this->_component = $component; $statuses = CRM_Contribute_BAO_Contribution::buildOptions('contribution_status_id'); + + // If we have a $0 amount, skip call to processor and set payment_status to Completed. + // Conceivably a processor might override this - perhaps for setting up a token - but we don't + // have an example of that at the mome. + if ($params['amount'] == 0) { + $result['payment_status_id'] = array_search('Completed', $statuses); + return $result; + } + if ($this->_paymentProcessor['billing_mode'] == 4) { $result = $this->doTransferCheckout($params, $component); if (is_array($result) && !isset($result['payment_status_id'])) {