Skip to content

Commit

Permalink
Merge pull request #11863 from eileenmcnaughton/payment_view
Browse files Browse the repository at this point in the history
Tweak layout on contribution view screen to make payments clearer
  • Loading branch information
colemanw authored Mar 27, 2018
2 parents 671e1ad + 02fc97b commit 78d568f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
24 changes: 24 additions & 0 deletions CRM/Contribute/Form/ContributionView.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ public function preProcess() {
$this->assign('componentId', $id);
$this->assign('component', 'contribution');
}
$this->assignPaymentInfoBlock($id);
}

/**
Expand All @@ -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;
}

}
11 changes: 6 additions & 5 deletions templates/CRM/Contribute/Form/ContributionView.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@
{else}
<tr>
<td class="label">{ts}Total Amount{/ts}</td>
<td><strong><a class="nowrap bold crm-expand-row" title="{ts}view payments{/ts}"
href="{crmURL p='civicrm/payment' q="view=transaction&component=contribution&action=browse&cid=`$contact_id`&id=`$contribution_id`&selector=1"}">
&nbsp; {$total_amount|crmMoney:$currency}
</strong></a>&nbsp;
<td><strong>{$total_amount|crmMoney:$currency}</strong>
{if $contribution_recur_id}
<a class="crm-hover-button" href='{crmURL p="civicrm/contact/view/contributionrecur" q="reset=1&id=`$contribution_recur_id`&cid=`$contact_id`&context=contribution"}'>
<strong>{ts}Recurring Contribution{/ts}</strong>
Expand Down Expand Up @@ -239,9 +236,13 @@
<td>{$thankyou_date|crmDate}</td>
</tr>
{/if}
<tr>
<td class="label">{ts}Payment Details{/ts}</td>
<td>{include file="CRM/Contribute/Form/PaymentInfoBlock.tpl"}</td>
</tr>
{if $addRecordPayment}
<tr>
<td class='label'>{ts}Fees{/ts}</td>
<td class='label'>{ts}Payment Summary{/ts}</td>
<td id='payment-info'></td>
</tr>
{/if}
Expand Down
2 changes: 1 addition & 1 deletion templates/CRM/Contribute/Page/PaymentInfo.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ CRM.$(function($) {
{if $component eq "event"}
<th>{ts}Total Fee(s){/ts}</th>
{else}
<th>{ts}Contribution Amount(s){/ts}</th>
<th>{ts}Contribution Total{/ts}</th>
{/if}
<th class="right">{ts}Total Paid{/ts}</th>
<th class="right">{ts}Balance{/ts}</th>
Expand Down

0 comments on commit 78d568f

Please sign in to comment.