Skip to content

Commit

Permalink
dev/financial#86 Make 'Record Payment' & 'Record Refund' visible rega…
Browse files Browse the repository at this point in the history
…rdless of whether the balance 'requires' one

This was agreed about a year ago - might as well do it
  • Loading branch information
eileenmcnaughton committed Sep 9, 2020
1 parent f47e98c commit 4cbe461
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -5201,35 +5201,27 @@ protected static function getContributionPaymentLinks($id, $balance, $contributi
'title' => ts('Record Payment'),
];

if ((int) $balance > 0) {
// @todo - this should be possible even if not > 0 - test & remove this if.
// it is possible to 'overpay' in the real world & we honor that.
if (CRM_Core_Config::isEnabledBackOfficeCreditCardPayments()) {
$actionLinks[] = [
'url' => CRM_Utils_System::url('civicrm/payment', [
'action' => 'add',
'reset' => 1,
'is_refund' => 0,
'id' => $id,
'mode' => 'live',
]),
'title' => ts('Submit Credit Card payment'),
];
}
}
elseif ((int) $balance < 0) {
// @todo - in the future remove this IF - OK to refund money even when not due since
// ... life.
if (CRM_Core_Config::isEnabledBackOfficeCreditCardPayments()) {
$actionLinks[] = [
'url' => CRM_Utils_System::url('civicrm/payment', [
'action' => 'add',
'reset' => 1,
'is_refund' => 0,
'id' => $id,
'is_refund' => 1,
'mode' => 'live',
]),
'title' => ts('Record Refund'),
'title' => ts('Submit Credit Card payment'),
];
}
$actionLinks[] = [
'url' => CRM_Utils_System::url('civicrm/payment', [
'action' => 'add',
'reset' => 1,
'id' => $id,
'is_refund' => 1,
]),
'title' => ts('Record Refund'),
];
return $actionLinks;
}

Expand Down

0 comments on commit 4cbe461

Please sign in to comment.