From 8302af7b017b7554ef1ceb27966e4c1e39fdfc18 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 29 May 2018 16:59:05 -0300 Subject: [PATCH] Bug 20726: Add show/hide already received orders links MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Sponsored-by: BULAC - http://www.bulac.fr/ Signed-off-by: Séverine QUEUNE Signed-off-by: Josef Moravec Signed-off-by: Nick Clemens --- .../en/modules/serials/subscription-detail.tt | 23 ++++++++++++++++--- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 6 ++++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt index 2dcee5d053..8593e414f2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt @@ -335,6 +335,12 @@

Acquisition details

+ + @@ -367,8 +373,8 @@ [% order.basket.basketname | html %] ([% order.basketno | html %]) [% END %] - - + +
+ + Hide already received orders + | Show all orders +
Invoice [% order.ordernumber | html %][% order.basket.creationdate | $KohaDates %][% order.datereceived | $KohaDates %][% order.basket.creationdate | $KohaDates%][% IF order.datereceived %][% order.datereceived | $KohaDates %][% END %] [% SWITCH order.orderstatus %] [% CASE 'new' %]New @@ -425,7 +431,7 @@ return false; }) - $("#orders").dataTable($.extend(true, {}, dataTablesDefaults, { + var table = $("#orders").dataTable($.extend(true, {}, dataTablesDefaults, { 'bPaginate': false, 'bAutoWidth': false, "aaSorting": [[ 4, "desc" ]], @@ -434,6 +440,17 @@ ] })); + $("#hide_received_orders").click(function(e){ + e.preventDefault(); + table.fnFilter( '.', 4, true ); // Not empty "Receive date" columns + }); + $("#show_all_orders").click(function(e){ + e.preventDefault(); + table.fnFilter( '', 4 ); // Not filter, display all columns + }); + $("#show_all_orders").click(); + + }); [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index 9c3caf1703..f8d23b97b4 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -371,7 +371,11 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, { */ jQuery.extend( jQuery.fn.dataTableExt.oSort, { "title-string-pre": function ( a ) { - return a.match(/title="(.*?)"/)[1].toLowerCase(); + var m = a.match(/title="(.*?)"/); + if ( null !== m && m.length ) { + return m[1].toLowerCase(); + } + return ""; }, "title-string-asc": function ( a, b ) { -- 2.39.5