From a4323bda251525a8720eba7180f1b4fa71ed6d6a 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. --- Koha/Account/Line.pm | 4 +- .../prog/en/modules/members/boraccount.tt | 60 +++++++++++++------ members/boraccount.pl | 2 + 3 files changed, 47 insertions(+), 19 deletions(-) diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index 75e6733167..694c2f6a25 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -236,7 +236,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 @@ -301,6 +302,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 ae52b17d71..37e86c531e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt @@ -176,16 +176,7 @@ [% 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') %]
@@ -402,6 +393,39 @@
+ + + + [% MACRO jsinclude BLOCK %] [% INCLUDE 'datatables.inc' %] [% INCLUDE 'format_price.inc' %] @@ -436,14 +460,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'); @@ -486,6 +502,14 @@ $("#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(); diff --git a/members/boraccount.pl b/members/boraccount.pl index ff5ff65047..6e9cd60047 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -73,11 +73,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.2