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

UserDashboard: Pay now buttons & balance for partial payments #20388

Closed
Closed
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
5 changes: 4 additions & 1 deletion CRM/Contribute/Page/UserDashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ public function listContribution() {
// This is required for tpl logic. We should move away from hard-code this to adding an array of actions to the row
// which the tpl can iterate through - this should allow us to cope with competing attempts to add new buttons
// and allow extensions to assign new ones through the pageRun hook
if ('Pending' === CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $row['contribution_status_id'])) {
$row['balance_amount'] = CRM_Contribute_BAO_Contribution::getContributionBalance($row['contribution_id']);
$contributionStatus = CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $row['contribution_status_id']);

if (in_array($contributionStatus, ['Pending', 'Partially paid'])) {
$row['buttons']['pay'] = [
'class' => 'button',
'label' => ts('Pay Now'),
Expand Down
10 changes: 6 additions & 4 deletions templates/CRM/Contribute/Page/UserDashboard.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@
<th>{ts}Financial Type{/ts}</th>
<th>{ts}Received date{/ts}</th>
<th>{ts}Receipt Sent{/ts}</th>
<th>{ts}Balance{/ts}</th>
<th>{ts}Status{/ts}</th>
{if $isIncludeInvoiceLinks}
<th></th>
{/if}
{foreach from=$row.buttons item=button}
<th></th>
{/foreach}
<th></th>
</tr>

{foreach from=$contribute_rows item=row}
Expand All @@ -39,6 +38,7 @@
<td>{$row.financial_type}</td>
<td>{$row.receive_date|truncate:10:''|crmDate}</td>
<td>{$row.receipt_date|truncate:10:''|crmDate}</td>
<td>{$row.balance_amount|crmMoney:$row.currency}</td>
<td>{$row.contribution_status}</td>
{if $isIncludeInvoiceLinks}
<td>
Expand All @@ -59,9 +59,11 @@
{/if}
</td>
{/if}
<td>
{foreach from=$row.buttons item=button}
<td><a class="{$button.class}" href="{$button.url}"><span class='nowrap'>{$button.label}</span></a></td>
<a class="{$button.class}" href="{$button.url}"><span class='nowrap'>{$button.label}</span></a>
{/foreach}
</td>
</tr>
{/foreach}
</table>
Expand Down