From c72088380fca7e6e44e7b457f5246757a592529f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 25 Oct 2013 16:35:44 +0200 Subject: [PATCH] Bug 11141: Filters are not kept on receiving. On receiving orders, the librarian has to filter again the pending orders list. This patch stores the filters in a cookie in order to apply them when the librarian finish a receive and come back on the pending orders list. Test plan: 1/ choose a vendor with several baskets and orders. 2/ start to receive an item. 3/ on the pending orders page, add some relevant filters. 4/ receive an item. 5/ you are back on the pending orders page and filters are directly applied. --- acqui/finishreceive.pl | 2 +- acqui/parcel.pl | 23 +++++++++++++++----- .../intranet-tmpl/prog/en/modules/acqui/parcel.tt | 18 +++++++++++++++ 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl index 4196b52..71ff6b6 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -141,7 +141,7 @@ if ($quantityrec > $origquantityrec ) { update_item( $_ ) foreach GetItemnumbersFromOrder( $ordernumber ); -print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid"); +print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid&sticky_filters=1"); ################################ End of script ################################ diff --git a/acqui/parcel.pl b/acqui/parcel.pl index 028e957..c88fe77 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -70,6 +70,7 @@ use C4::Suggestions; use JSON; my $input=new CGI; +my $sticky_filters = $input->param('sticky_filters') || 0; sub get_value_with_gst_params { my $value = shift; @@ -203,12 +204,21 @@ push @book_foot_loop, map { $_ } values %foot; my @loop_orders = (); if(!defined $invoice->{closedate}) { my $pendingorders; - if($input->param('op') eq "search"){ - my $search = $input->param('summaryfilter') || ''; - my $ean = $input->param('eanfilter') || ''; - my $basketname = $input->param('basketfilter') || ''; - my $orderno = $input->param('orderfilter') || ''; - my $basketgroupname = $input->param('basketgroupnamefilter') || ''; + if ( $op eq "search" or $sticky_filters ) { + my ( $search, $ean, $basketname, $orderno, $basketgroupname ); + if ( $sticky_filters ) { + $search = $input->cookie("filter_parcel_summary"); + $ean = $input->cookie("filter_parcel_ean"); + $basketname = $input->cookie("filter_parcel_basketname"); + $orderno = $input->cookie("filter_parcel_orderno"); + $basketgroupname = $input->cookie("filter_parcel_basketgroupname"); + } else { + $search = $input->param('summaryfilter') || ''; + $ean = $input->param('eanfilter') || ''; + $basketname = $input->param('basketfilter') || ''; + $orderno = $input->param('orderfilter') || ''; + $basketgroupname = $input->param('basketgroupnamefilter') || ''; + } $pendingorders = SearchOrders({ booksellerid => $booksellerid, basketname => $basketname, @@ -313,5 +323,6 @@ $template->param( total_quantity => $total_quantity, total_gste => sprintf( "%.2f", $total_gste ), total_gsti => sprintf( "%.2f", $total_gsti ), + sticky_filters => $sticky_filters, ); output_html_with_http_headers $input, $cookie, $template->output; 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 250cc96..dcb82ba 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt @@ -4,12 +4,15 @@ [% INCLUDE 'doc-head-close.inc' %] [% INCLUDE 'datatables.inc' %] + [% INCLUDE 'greybox.inc' %]