Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak layout on contribution view screen to make payments clearer #11863

Merged
merged 1 commit into from
Mar 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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