From 7a6668022768ff5479057a27b33bc087bf98c1c1 Mon Sep 17 00:00:00 2001 From: eileen <emcnaughton@wikimedia.org> Date: Mon, 13 Mar 2017 21:40:33 +1300 Subject: [PATCH] CRM-20252 Improve text when processing possibly-delayed-payments --- CRM/Contribute/Form/Contribution/ThankYou.php | 25 +++++++++++++++++-- .../Contribute/Form/Contribution/ThankYou.tpl | 2 +- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/ThankYou.php b/CRM/Contribute/Form/Contribution/ThankYou.php index c211ce0d10fc..62dee7c0509b 100644 --- a/CRM/Contribute/Form/Contribution/ThankYou.php +++ b/CRM/Contribute/Form/Contribution/ThankYou.php @@ -117,7 +117,7 @@ public function buildQuickForm() { if ($invoicing) { $getTaxDetails = FALSE; $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); - foreach ($this->_lineItem as $key => $value) { + foreach ($this->_lineItem as $value) { foreach ($value as $v) { if (isset($v['tax_rate'])) { if ($v['tax_rate'] != '') { @@ -131,7 +131,6 @@ public function buildQuickForm() { $this->assign('totalTaxAmount', $params['tax_amount']); } if (!empty($this->_values['honoree_profile_id']) && !empty($params['soft_credit_type_id'])) { - $honorName = NULL; $softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE); $this->assign('soft_credit_type', $softCreditTypes[$params['soft_credit_type_id']]); @@ -284,6 +283,28 @@ public function buildQuickForm() { $this->assign('friendURL', $url); } + $isPendingOutcome = TRUE; + try { + // A payment notification update could have come in at any time. Check at the last minute. + $contributionStatusID = civicrm_api3('Contribution', 'getvalue', array( + 'id' => CRM_Utils_Array::value('contributionID', $params), + 'return' => 'contribution_status_id', + 'invoice_id' => CRM_Utils_Array::value('invoiceID', $params), + )); + if (CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $contributionStatusID) === 'Pending' + && !empty($params['payment_processor_id']) + ) { + $isPendingOutcome = TRUE; + } + else { + $isPendingOutcome = FALSE; + } + } + catch (CiviCRM_API3_Exception $e) { + + } + $this->assign('isPendingOutcome', $isPendingOutcome); + $this->freeze(); // can we blow away the session now to prevent hackery diff --git a/templates/CRM/Contribute/Form/Contribution/ThankYou.tpl b/templates/CRM/Contribute/Form/Contribution/ThankYou.tpl index a03341619a8b..2a09fe159fe8 100644 --- a/templates/CRM/Contribute/Form/Contribution/ThankYou.tpl +++ b/templates/CRM/Contribute/Form/Contribution/ThankYou.tpl @@ -62,7 +62,7 @@ {/if} </div> {/if} - {elseif $contributeMode EQ 'notify' OR ($contributeMode EQ 'direct' && $is_recur) } + {elseif $isPendingOutcome} <div>{ts 1=$paymentProcessor.name}Your contribution has been submitted to %1 for processing. Please print this page for your records.{/ts}</div> {if $is_email_receipt} <div>