From 6b7a8967a21606e3e3c61eae04d15699d72eb161 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 --- .../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 55f13b75d8..a6004b9cde 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -296,16 +296,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 %] @@ -374,8 +370,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 %] @@ -482,9 +477,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 %] @@ -679,8 +674,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 %] @@ -717,8 +712,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 @@ -762,8 +757,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 26220fee75..8a55373cf8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt @@ -41,9 +41,9 @@ Checked out by [% END %] Renewed - Checkout on - Due date - Checkin on + Checkout on + Due date + Checkin on [% FOREACH checkout IN checkouts %] @@ -79,21 +79,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 bb50498ae4..9235d199a5 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 @@ -139,7 +139,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 %] @@ -180,7 +180,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 %] @@ -207,8 +207,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.20.1