From 54e828f3eb7dce905912c04d8ac12e573ec6f180 Mon Sep 17 00:00:00 2001 From: Brendan Lawlor Date: Wed, 18 Dec 2024 21:03:11 +0000 Subject: [PATCH] Bug 38155: Fix Acquistions close selected invoices button This patch updates the closed selected invoices link button to use the form-submit.js method from bug 36246. The link needs to have a single data-invoiceid parameter, so the js on invoices.tt creates a comma separated list from the checkboxes. The list of invoiceid is split into an array in invoice.pl To test: 1. Add some invoices for a vendor using the 'receive shipments' button 2. Go to Acquisitions->Invoices 3. Select multiple invoices using the checkbox 4. Click the 'Close selected invoices' button 5. Confirm it works 6. Confirm closing individual invoices from the Actions button still works Signed-off-by: Andrew Fuerste Henry --- acqui/invoice.pl | 2 +- .../intranet-tmpl/prog/en/modules/acqui/invoices.tt | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/acqui/invoice.pl b/acqui/invoice.pl index bed7a6440e..ec07d05428 100755 --- a/acqui/invoice.pl +++ b/acqui/invoice.pl @@ -74,7 +74,7 @@ if ( C4::Context->preference('AcqEnableFiles') ) { if ( $op && $op eq 'cud-close' ) { output_and_exit( $input, $cookie, $template, 'insufficient_permission' ) unless $logged_in_patron->has_permission( { acquisition => 'edit_invoices' } ); - my @invoiceid = $input->multi_param('invoiceid'); + my @invoiceid = split( ',', $input->param('invoiceid') ); foreach my $invoiceid ( @invoiceid ) { CloseInvoice($invoiceid); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt index 6c46799d2a..6b17d01cf7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt @@ -128,7 +128,7 @@ Reopen selected invoices [% ELSE %] Merge selected invoices - Close selected invoices + Close selected invoices [% END # /IF tab == 'closed' %] [% END # /IF CAN_user_acquisition_merge_invoices %] [% END # /BLOCK invoices_table %] @@ -462,16 +462,14 @@ }); $('#open_sel,#close_sel').click(function () { - var referer = $(this).attr("data-referer"); - var op = $(this).attr("data-op"); var table = $(this).data('table'); - var invoice_link = "invoice.pl?op="+op; + var invoice_ids = ""; if ($('#' + table + ' .select-invoice:checked').length) { $('#' + table + ' .select-invoice:checked').each(function () { var row = $(this).parents('tr'); - invoice_link = invoice_link + "&invoiceid="+$(row).attr('data-invoiceid'); + invoice_ids = invoice_ids + ","+$(row).attr('data-invoiceid'); }); - window.location.href =invoice_link +"&"+referer; + $(this).attr('data-invoiceid', invoice_ids); } else { alert ("Please select at least one invoice." ); } -- 2.39.5