From 6180725e61796252e3f9f735b0af2e91876acf86 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 11 Jan 2021 15:42:18 +0100 Subject: [PATCH] Bug 20212: Use the DT column filtering provided by the wrapper Bug 27402 is adding it, we do not longer need the query_from_filters JS function. This patch also remove the filters on the left. As we have DT remembering the filter on the table we don't need them anymore. Technical note: Prior to this patch, the search on biblio.author, biblio.title and biblio.isbn was done by adding hidden columns. Now we are using: "data": "biblio.author:biblio.title:biblio.isbn" to tell the wrapper we are going to build a search on these 3 attributes. Another trick is to pass a default_filters parameters to the wrapper, to tell it we want to filter on the orders of a given vendor (this is a bugfix, the original implementation was returning all the orders). However We should not use /acq/orders?vendor_id=42 but /acq/vendor/42/orders instead (which does not exist yet), otherwise (with bug 27353 ) we are going to display the wrong number of non-filtering rows. The change in Orders.pm is only formatting to match what's done in Bug 27353: Set X-Base-Total-Count header for REST API Signed-off-by: Tomas Cohen Arazi Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart --- Koha/REST/V1/Acquisitions/Orders.pm | 20 +- acqui/finishreceive.pl | 2 +- acqui/parcel.pl | 20 -- .../prog/en/modules/acqui/orderreceive.tt | 2 +- .../prog/en/modules/acqui/parcel.tt | 251 ++---------------- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 46 +++- 6 files changed, 68 insertions(+), 273 deletions(-) diff --git a/Koha/REST/V1/Acquisitions/Orders.pm b/Koha/REST/V1/Acquisitions/Orders.pm index 4cb0fe982f..5419ce5c45 100644 --- a/Koha/REST/V1/Acquisitions/Orders.pm +++ b/Koha/REST/V1/Acquisitions/Orders.pm @@ -143,19 +143,15 @@ sub list { # Perform search my $orders = $orders_rs->search( $filtered_params, $attributes ); + my $total = $orders_rs->search->count; - if ($orders->is_paged) { - $c->add_pagination_headers({ - total => $orders->pager->total_entries, - params => $args, - }); - } - else { - $c->add_pagination_headers({ - total => $orders->count, - params => $args, - }); - } + $c->add_pagination_headers( + { + total => ($orders->is_paged ? $orders->pager->total_entries : $orders->count), + base_total => $total, + params => $args, + } + ); return $c->render( status => 200, diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl index 0ed88506c7..961e3d566f 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -190,4 +190,4 @@ if ($suggestion_id) { $suggestion->update( { reason => $reason } ) if $suggestion; } -print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid&sticky_filters=1"); +print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid"); diff --git a/acqui/parcel.pl b/acqui/parcel.pl index 9e4974ba90..1e42ed9174 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -109,25 +109,6 @@ unless( $invoiceid and $invoice->{invoiceid} ) { exit; } -my $sticky_filters = $input->param('sticky_filters') || 0; - -if ($sticky_filters) { - my $search = $input->cookie("filter_parcel_summary"); - my $ean = $input->cookie("filter_parcel_ean"); - my $basketname = $input->cookie("filter_parcel_basketname"); - my $orderno = $input->cookie("filter_parcel_orderno"); - my $basketgroupname = $input->cookie("filter_parcel_basketgroupname"); - - $template->param( - summaryfilter => $search, - eanfilter => $ean, - basketfilter => $basketname, - orderfilter => $orderno, - basketgroupnamefilter => $basketgroupname, - ); -} - - my $booksellerid = $invoice->{booksellerid}; my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid ); @@ -211,6 +192,5 @@ $template->param( total_tax_excluded => $total_tax_excluded, total_tax_included => $total_tax_included, subtotal_for_funds => $subtotal_for_funds, - sticky_filters => $sticky_filters, ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt index 578a08ae65..61468aff99 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -370,7 +370,7 @@ [% ELSE %] This ordernumber does not exist. diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt index b1ba6bffb9..fbb354134c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt @@ -105,9 +105,6 @@ Basket Basket group Order line - Title - Author - ISBN Summary More Replacement price @@ -118,24 +115,6 @@     - -
-
-
-   -   -   -
-   -
-
-
-   - -
-   -   - @@ -340,41 +319,6 @@
@@ -388,86 +332,8 @@