From 646d1991a7edc7bf62bde70ac7e30dd7527233e2 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 25 Apr 2013 16:57:07 +0200 Subject: [PATCH] Bug 10124: Add filters on the pending orders table Since the parcel.pl script get *all* pending orders, there is no reason not to display all of them. Like that, DataTable manages pagination and sorting correctly (on all data). This patch adds filters on the table header (using columnFilter). Test plan: Try filters on the left of the screen and filters on the table header. --- acqui/parcel.pl | 2 +- .../intranet-tmpl/prog/en/modules/acqui/parcel.tt | 66 ++++++++++++++------ 2 files changed, 47 insertions(+), 21 deletions(-) diff --git a/acqui/parcel.pl b/acqui/parcel.pl index 6c699ba..6435211 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -208,7 +208,7 @@ for my $item ( @parcelitems ) { push @book_foot_loop, map { $_ } values %foot; my @loop_orders = (); -if(!defined $invoice->{closedate}) { +unless( defined $invoice->{closedate} ) { my $pendingorders; if($input->param('op') eq "search"){ my $search = $input->param('summaryfilter') || ''; 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 331d571..bf557ef 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt @@ -4,6 +4,7 @@ [% INCLUDE 'doc-head-close.inc' %] + [% INCLUDE 'datatables-strings.inc' %] [% INCLUDE 'greybox.inc' %] @@ -14,10 +15,11 @@ dt_overwrite_html_sorting_localeCompare(); $(document).ready(function(){ + var pendingt = $("#pendingt").dataTable($.extend(true, {}, dataTablesDefaults, { "bStateSave": true, "iCookieDuration": 60*60*24*1000, // 1000 days - "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]], + "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]], "aoColumnDefs": [ { "aTargets": [ 3, 8, 9 ], "bSortable": false, "bSearchable": false }, ], @@ -33,12 +35,29 @@ null, null, ], + 'bAutoWidth': false, "sPaginationType": "four_button" - } ) ); + } ) + ).columnFilter({ + sPlaceHolder: "head:after", + aoColumns: [ + { type: "text" }, + { type: "text" }, + { type: "text" }, + null, + { type: "text" }, + { type: "text" }, + { type: "text" }, + { type: "text" }, + null, + null + ] + }); + var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, { "bStateSave": true, "iCookieDuration": 60*60*24*1000, // 1000 days - "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]], + "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]], "aoColumnDefs": [ { "aTargets": [ 3, -1 ], "bSortable": false, "bSearchable": false }, ], @@ -55,12 +74,6 @@ ], "sPaginationType": "four_button" } ) ); -/* - $("#pendingt").tablesorter({ - headers: { 2: { sorter: 'articles' },3: { sorter: false },8:{sorter:false}} - }); -*/ - }); // Case-insensitive version of jquery's contains function @@ -165,12 +178,25 @@

Invoice number: [% invoice %] Received by: [% loggedinusername %] On: [% formatteddatereceived %]

[% UNLESS (invoiceclosedate) %] - [% ELSE %]

Invoice is closed, so you can't receive orders anymore. -- 1.7.10.4