From ce2f1625897eb9c6f101cc359b49d71bf6e93916 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 18 Mar 2021 12:47:15 +0000 Subject: [PATCH] Bug 27980: Replace obsolete title-string sorting: Catalog templates This patch modifies several catalog templates to replace the use of the "title-string" DataTables sorting method with the newer "data-order" attribute. To test, apply the patch and view the following pages to confirm that columns containing dates sort correctly when using any setting of the "dateformat" system preference: - Catalog -> Search -> Bibliographic detail page - Catalog -> Search -> Bibliograhpic detail page -> Checkout history - Search history - Current and previous catalog search sessions - Current and previous authority search sessions Signed-off-by: Amit Gupta Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart --- .../prog/en/modules/catalogue/detail.tt | 33 ++++++++----------- .../prog/en/modules/catalogue/issuehistory.tt | 30 +++++++---------- .../en/modules/catalogue/search-history.tt | 7 ++-- 3 files changed, 29 insertions(+), 41 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index dfc9411a03..89d61d8cfd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -316,16 +316,12 @@ [% IF ( itemdata_ccode ) %]Collection[% END %] Call number [% IF volinfo %] - [% IF itemdata_publisheddate #If there is at least one published date, use it for sorting%] - Serial enumeration / chronology - [% ELSE %] - Serial enumeration / chronology - [% END %] + Serial enumeration / chronology [% END %] Status - Last seen - Date accessioned - Date last borrowed + Last seen + Date accessioned + Date last borrowed Barcode [% IF ( itemdata_uri ) %]URL[% END %] [% IF ( itemdata_copynumber ) %]Copy number[% END %] @@ -394,8 +390,7 @@ Note that permanent location is a code, and location may be an authval. [% IF ( itemdata_ccode ) %][% item.ccode | html %][% END %] [% IF ( item.itemcallnumber ) %] [% item.itemcallnumber | html %][% END %] [% IF ( volinfo ) %] - - [% IF itemdata_publisheddate %][% END %] + [% IF ( itemdata_enumchron ) %] [% IF item.enumchron && item.serialseq %] [% item.enumchron | html %] @@ -502,9 +497,9 @@ Note that permanent location is a code, and location may be an authval. [% END %] - [% item.datelastseen | $KohaDates %] - [% item.dateaccessioned | $KohaDates %] - [% item.datelastborrowed | $KohaDates %] + [% item.datelastseen | $KohaDates %] + [% item.dateaccessioned | $KohaDates %] + [% item.datelastborrowed | $KohaDates %] [% item.barcode | html %] [% IF ( itemdata_uri ) %] [% IF item.uri.split(' \| ').size > 1 %] @@ -699,8 +694,8 @@ Note that permanent location is a code, and location may be an authval. [% FOREACH latestserial IN subscription.latestserials %] [% latestserial.serialseq | html %] - [% latestserial.planneddate | $KohaDates %] - [% latestserial.publisheddate | $KohaDates %] + [% latestserial.planneddate | $KohaDates %] + [% latestserial.publisheddate | $KohaDates %] [% IF ( latestserial.status1 ) %]Expected[% END %] [% IF ( latestserial.status2 ) %]Arrived[% END %] @@ -737,8 +732,8 @@ Note that permanent location is a code, and location may be an authval. Basket group Basket Order number - Creation date - Receive date + Creation date + Receive date Status Quantity Price @@ -782,8 +777,8 @@ Note that permanent location is a code, and location may be an authval. [% basket.basketname | html %] ([% basket.basketno | html %]) [% END %] [% order.ordernumber | html %] - [% basket.creationdate | $KohaDates%] - [% order.datereceived | $KohaDates%] + [% basket.creationdate | $KohaDates%] + [% order.datereceived | $KohaDates%] [% SWITCH order.orderstatus %] [% CASE 'new' %]New diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt index 656fb2cfe4..4b6de9fd1b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt @@ -58,9 +58,9 @@ Checked out by [% END %] Renewed - Checkout on - Due date - Checkin on + Checkout on + Due date + Checkin on [% FOREACH checkout IN checkouts %] @@ -96,21 +96,15 @@ [% ELSE %] No [% END %] - [% IF checkout.issuedate %] - [% checkout.issuedate |$KohaDates with_hours => 1 %] - [% ELSE %] - - [% END %] - [% IF checkout.date_due %] - [% checkout.date_due |$KohaDates with_hours => 1 %] - [% ELSE %] - - [% END %] - [% IF checkout.returndate %] - [% checkout.returndate |$KohaDates with_hours => 1 %] - [% ELSE %] - Checked out - [% END %] + + [% checkout.issuedate |$KohaDates with_hours => 1 %] + + + [% checkout.date_due |$KohaDates with_hours => 1 %] + + + [% checkout.returndate |$KohaDates with_hours => 1 %] + [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/search-history.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/search-history.tt index 352287a1b1..77281c4427 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/search-history.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/search-history.tt @@ -151,7 +151,7 @@ [% FOREACH s IN current_authority_searches %] - [% s.time |$KohaDates with_hours => 1 %] + [% s.time |$KohaDates with_hours => 1 %] [% s.query_desc | html %] [% s.total | html %] @@ -192,7 +192,7 @@ [% FOREACH s IN previous_authority_searches %] - [% s.time |$KohaDates with_hours => 1 %] + [% s.time |$KohaDates with_hours => 1 %] [% s.query_desc | html %] [% s.total | html %] @@ -219,8 +219,7 @@ $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, { "aaSorting": [[ 1, "desc" ]], "aoColumnDefs": [ - { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }, - { "aTargets": [ 1 ], "sType": "title-string" }, + { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false } ], "sPaginationType": "full_numbers" })); -- 2.39.5