diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index 9fa86bf085..c796b92275 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -420,6 +420,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 6741a9130a..58312636a7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt @@ -193,15 +193,15 @@ > [% 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 ) %] + + + + + + + + + + + + + + + [% MACRO jsinclude BLOCK %] [% INCLUDE 'datatables.inc' %] [% INCLUDE 'format_price.inc' %] @@ -563,6 +601,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 bc7ab8160f..54c3fd84e9 100755 --- a/members/cancel-charge.pl +++ b/members/cancel-charge.pl @@ -35,14 +35,15 @@ my ( $user, $cookie ) = C4::Auth::checkauth( $cgi, $authnotrequired, $flags, $ty my $op = $cgi->param('op') // q{}; if ( $op eq "cud-cancel" ) { - my $accountlines_id = $cgi->param('accountlines_id'); - - my $charge = Koha::Account::Lines->find($accountlines_id); - my $borrowernumber = $charge->patron->borrowernumber; + 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 );