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 <andrew@bywatersolutions.com> Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
9edea9b7a3
commit
e15d90563f
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@
|
|||
<a class="btn btn-default" id="open_sel" href="#reopen_selected" data-table="closedresultst" data-op="reopen" data-referer="referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber | uri %]%26supplier=[% booksellerid | uri %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn | uri %]%26title=[% title | uri %]%26author=[% author | uri %]%26publisher=[% publisher | uri %]%26publicationyear=[% publicationyear | uri %]%26branch=[% branch | uri %]"><i class="fa-solid fa-rotate"></i> Reopen selected invoices</a>
|
||||
[% ELSE %]
|
||||
<a class="btn btn-default merge" id="merge_open" href="#merge_invoices" data-table="openedresultst"><i class="fa fa-compress"></i> Merge selected invoices</a>
|
||||
<a class="btn btn-default" id="close_sel" href="#close_selected" data-table="openedresultst" data-op="close" data-referer="referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber | uri %]%26supplier=[% booksellerid | uri %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn | uri %]%26title=[% title | uri %]%26author=[% author | uri %]%26publisher=[% publisher | uri %]%26publicationyear=[% publicationyear | uri %]%26branch=[% branch | uri %]"><i class="fa fa-times-circle"></i> Close selected invoices</a>
|
||||
<a class="submit-form-link btn btn-default" id="close_sel" data-table="openedresultst" data-op="cud-close" data-action="invoice.pl" data-method="post" data-referer="/cgi-bin/koha/acqui/invoices.pl?op=do_search&invoicenumber=[% invoicenumber | html %]&supplier=[% booksellerid | html %]&shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]&shipmentdateto=[% shipmentdateto | $KohaDates %]&billingdatefrom=[% billingdatefrom | $KohaDates %]&billingdateto=[% billingdateto | $KohaDates %]&isbneanissn=[% isbneanissn | html %]&title=[% title | html %]&author=[% author | html %]&publisher=[% publisher | html %]&publicationyear=[% publicationyear | html %]&branch=[% branch | html %]"><i class="fa fa-times-circle"></i> Close selected invoices</a>
|
||||
[% 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." );
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue