From 482386b73af449256e3fd4aca1e9059ebead66bd Mon Sep 17 00:00:00 2001 From: Sam Lau Date: Wed, 26 Jun 2024 20:17:04 +0000 Subject: [PATCH] Bug 23674: Add ability to add note to void payment To test: 1) From patron accounting page -> Create manual credit. Put in some amount and press add credit. 2) Under the actions column, select "Void" 3) Notice no option for a note. Press cancel 4) Apply patch, restart_all 5) Press void again. This time, you should see a modal that gives you the option to type in a note. 6) Type something in and select submit. 7) Ensure the note shows up in the note column. Signed-off-by: Roman Dolny Signed-off-by: Martin Renvoize --- Koha/Account/Line.pm | 4 +- .../prog/en/modules/members/boraccount.tt | 79 ++++++++++++++----- members/boraccount.pl | 2 + 3 files changed, 66 insertions(+), 19 deletions(-) diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index bb8da9e197d..a2b008acbdd 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -231,7 +231,8 @@ sub debits { $payment_accountline->void({ interface => $interface, - [ staff_id => $staff_id, branch => $branchcode ] + [ staff_id => $staff_id, branch => $branchcode ], + note => $note }); Used to 'void' (or reverse) a payment/credit. It will roll back any offsets @@ -290,6 +291,7 @@ sub void { manager_id => $params->{staff_id}, interface => $params->{interface}, branchcode => $params->{branch}, + note => $params->{note} } )->store(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt index 97622375b46..5e3bc45d149 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt @@ -182,16 +182,15 @@ [% END %] [% IF account.is_credit && account.status != 'VOID' %] -
- [% INCLUDE 'csrf-token.inc' %] - - - - -
+ [% END %] [% IF account.is_debit && account.amount == account.amountoutstanding && account.status != 'CANCELLED' && !(account.debit_type_code == 'PAYOUT') %]
@@ -435,6 +434,45 @@ + +
+ + [% MACRO jsinclude BLOCK %] [% INCLUDE 'datatables.inc' %] [% INCLUDE 'format_price.inc' %] @@ -471,14 +509,6 @@ $(this).toggleClass('filtered'); }); - $(".void-action").on("click",function(e){ - if( confirm( _("Are you sure you want to void this credit?") ) ) { - return true; - } else { - e.preventDefault(); - } - }); - $("#issuePayoutModal").on("shown.bs.modal", function(e){ var button = $(e.relatedTarget); var accountline = button.data('accountline'); @@ -520,6 +550,19 @@ $("#discount").attr({ "value": (0).format_price(), "max": amountoutstanding, "min": 0 }); $("#discount").focus(); }); + + $("#voidPaymentModal").on("shown.bs.modal", function(e){ + var button = $(e.relatedTarget); + var item = button.data('item'); + $("#item + span").replaceWith(item); + var accountline = button.data('accountline'); + $('#voidline').val(accountline); + }); + + $(".receipt-email-action").on("click", function(e){ + e.preventDefault(); + return $(this).siblings('form').submit(); + }); }); [% END %] diff --git a/members/boraccount.pl b/members/boraccount.pl index c248d2ba05c..b237e437c08 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -75,11 +75,13 @@ if ( $op eq 'cud-void' ) { output_and_exit_if_error( $input, $cookie, $template, { check => 'csrf_token' } ); my $payment_id = scalar $input->param('accountlines_id'); my $payment = Koha::Account::Lines->find($payment_id); + my $note = scalar $input->param('void_note'); $payment->void( { branch => $library_id, staff_id => $logged_in_user->id, interface => 'intranet', + note => $note } ); } -- 2.39.5