From b00dbec4e7592dda1862bc25407a93da1e7e7dcd Mon Sep 17 00:00:00 2001 From: Brendan Lawlor Date: Wed, 18 Dec 2024 21:03:11 +0000 Subject: [PATCH] Bug 38155: Fix Acquisitions 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 Signed-off-by: Emily Lamancusa Signed-off-by: Katrin Fischer (cherry picked from commit e15d90563fd8a50a3e8c13d80a68fa7464e21dd6) Signed-off-by: Paul Derscheid Signed-off-by: wainuiwitikapark --- 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 2c88908086..f822ee4480 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 6f9901bf71..d2fb83ce06 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 %] @@ -461,16 +461,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." ); }