From 8376edf24b2394760ec85dcf4204f832154762e0 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Mon, 1 Jul 2024 16:45:36 +0000 Subject: [PATCH] Bug 23674: Add ability to add note to canceled charge To test, with this patchset applied: 1) From patron accounting page -> Add a manual invoice 2) Under the transaction tab click 'Cancel charge' 3) You should see a modal that gives you the option to type in a note. 4) Type something in and select submit. 5) Ensure the note shows up in the note column. Signed-off-by: Roman Dolny --- Koha/Account/Line.pm | 1 + .../prog/en/modules/members/boraccount.tt | 47 +++++++++++++++---- members/cancel-charge.pl | 5 +- 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index aee9ea3f8a3..249f50023e5 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -436,6 +436,7 @@ sub cancel { borrowernumber => $self->borrowernumber, interface => 'intranet', 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 e2aead031af..6bddcd90c16 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt @@ -179,15 +179,7 @@ [% END %] [% IF account.is_debit && account.amount == account.amountoutstanding && account.status != 'CANCELLED' && !(account.debit_type_code == 'PAYOUT') %] -
- [% INCLUDE 'csrf-token.inc' %] - - - -
+ [% END %] [% IF CAN_user_updatecharges_payout && account.is_credit && ( account.amountoutstanding < 0 ) %] @@ -425,6 +417,37 @@ + + + [% MACRO jsinclude BLOCK %] [% INCLUDE 'datatables.inc' %] @@ -510,6 +533,12 @@ $('#voidline').val(accountline); }); + $("#cancelChargeModal").on("shown.bs.modal", function(e){ + var button = $(e.relatedTarget); + var item = button.data('accountlines_id'); + $('#accountlines_id').val(item); + }); + $(".receipt-email-action").on("click", function(e){ e.preventDefault(); return $(this).siblings('form').submit(); diff --git a/members/cancel-charge.pl b/members/cancel-charge.pl index 0b6d756cd03..5b96b0711b3 100755 --- a/members/cancel-charge.pl +++ b/members/cancel-charge.pl @@ -36,13 +36,14 @@ my $op = $cgi->param('op') // q{}; if ( $op eq "cud-cancel" ) { my $accountlines_id = $cgi->param('accountlines_id'); - + my $cancel_charge_note = $cgi->param('cancel_charge_note'); my $charge = Koha::Account::Lines->find($accountlines_id); my $borrowernumber = $charge->patron->borrowernumber; $charge->cancel( { branch => C4::Context->userenv->{'branch'}, - staff_id => C4::Context->userenv->{'number'} + staff_id => C4::Context->userenv->{'number'}, + note => $cancel_charge_note, } ); print $cgi->redirect( '/cgi-bin/koha/members/boraccount.pl?borrowernumber=' . $borrowernumber ); -- 2.39.2