From 02fc97b3aaef672cc3279fd4bee3c8ae7cbf1bbd Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 23 Mar 2018 01:52:39 +1300 Subject: [PATCH] Tweak layout on contribution view screen to make payments clearer --- CRM/Contribute/Form/ContributionView.php | 24 +++++++++++++++++++ .../CRM/Contribute/Form/ContributionView.tpl | 11 +++++---- templates/CRM/Contribute/Page/PaymentInfo.tpl | 2 +- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/CRM/Contribute/Form/ContributionView.php b/CRM/Contribute/Form/ContributionView.php index feb6f0c8e5a3..50752ca04863 100644 --- a/CRM/Contribute/Form/ContributionView.php +++ b/CRM/Contribute/Form/ContributionView.php @@ -249,6 +249,7 @@ public function preProcess() { $this->assign('componentId', $id); $this->assign('component', 'contribution'); } + $this->assignPaymentInfoBlock($id); } /** @@ -266,4 +267,27 @@ public function buildQuickForm() { )); } + /** + * Assign the values to build the payment info block. + * + * @todo - this is a bit too much copy & paste from AbstractEditPayment + * (justifying on the basis it's 'pretty short' and in a different inheritance + * tree. I feel like traits are probably the longer term answer). + * + * @param int $id + * + * @return string $title + * Block title. + */ + protected function assignPaymentInfoBlock($id) { + // component is used in getPaymentInfo primarily to retrieve the contribution id, we + // already have that. + $paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($id, 'contribution', TRUE); + $title = ts('View Payment'); + $this->assign('transaction', TRUE); + $this->assign('payments', $paymentInfo['transaction']); + $this->assign('paymentLinks', $paymentInfo['payment_links']); + return $title; + } + } diff --git a/templates/CRM/Contribute/Form/ContributionView.tpl b/templates/CRM/Contribute/Form/ContributionView.tpl index 305cbeaff8ee..d3b4b42f188d 100644 --- a/templates/CRM/Contribute/Form/ContributionView.tpl +++ b/templates/CRM/Contribute/Form/ContributionView.tpl @@ -90,10 +90,7 @@ {else} {ts}Total Amount{/ts} - -   {$total_amount|crmMoney:$currency} -   + {$total_amount|crmMoney:$currency} {if $contribution_recur_id} {ts}Recurring Contribution{/ts} @@ -239,9 +236,13 @@ {$thankyou_date|crmDate} {/if} + + {ts}Payment Details{/ts} + {include file="CRM/Contribute/Form/PaymentInfoBlock.tpl"} + {if $addRecordPayment} - {ts}Fees{/ts} + {ts}Payment Summary{/ts} {/if} diff --git a/templates/CRM/Contribute/Page/PaymentInfo.tpl b/templates/CRM/Contribute/Page/PaymentInfo.tpl index b27cad046c8f..039eacaa9d3d 100644 --- a/templates/CRM/Contribute/Page/PaymentInfo.tpl +++ b/templates/CRM/Contribute/Page/PaymentInfo.tpl @@ -55,7 +55,7 @@ CRM.$(function($) { {if $component eq "event"} {ts}Total Fee(s){/ts} {else} - {ts}Contribution Amount(s){/ts} + {ts}Contribution Total{/ts} {/if} {ts}Total Paid{/ts} {ts}Balance{/ts}