From c27e61636f3ceb6b4b8085c24a919c202b34e628 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Fri, 22 Mar 2024 21:57:14 +0000 Subject: [PATCH] Bug 24597: Add Void payment modal and ability to add a Void payment note --- Koha/Account/Line.pm | 1 + .../prog/en/includes/modals/void_payment.inc | 35 +++++++++++++++++++ .../prog/en/modules/members/boraccount.tt | 28 ++++++--------- members/boraccount.pl | 2 ++ 4 files changed, 48 insertions(+), 18 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/modals/void_payment.inc diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index 7496f17677..bdb8988fce 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -301,6 +301,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/includes/modals/void_payment.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/modals/void_payment.inc new file mode 100644 index 0000000000..e2f565c8da --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/modals/void_payment.inc @@ -0,0 +1,35 @@ + + 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 16aceab48f..9e2d6a5294 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') %]
@@ -245,6 +236,7 @@ [% INCLUDE 'modals/issue_payout.inc' %] [% INCLUDE 'modals/issue_refund.inc' %] [% INCLUDE 'modals/issue_refund.inc' %] + [% INCLUDE 'modals/void_payment.inc' %] [% MACRO jsinclude BLOCK %] [% INCLUDE 'datatables.inc' %] @@ -280,14 +272,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'); @@ -330,6 +314,14 @@ $("#discount").focus(); }); + $("#voidPaymentModal").on("shown.bs.modal", function(e){ + var button = $(e.relatedTarget); + var accountline = button.data('accountline'); + $('#voidline').val(accountline); + var amount = button.data('amount'); + $('#void_amount').text(amount); + }); + $(".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 707dc4b279..733f49dca3 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -72,12 +72,14 @@ my $registerid = $input->param('registerid'); 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 $void_note = scalar $input->param('void_note'); my $payment = Koha::Account::Lines->find( $payment_id ); $payment->void( { branch => $library_id, staff_id => $logged_in_user->id, interface => 'intranet', + note => $void_note, } ); } -- 2.30.2