From 924d377c4b9f43b9a572307a0b3e307853baba45 Mon Sep 17 00:00:00 2001 From: Owen Leonard <oleonard@myacpl.org> 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 --- .../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 ) %]<th id="[% tab | html %]_ccode" data-colname="[% tab | html %]_ccode">Collection</th>[% END %] <th id="[% tab | html %]_itemcallnumber" data-colname="[% tab | html %]_itemcallnumber">Call number</th> [% IF volinfo %] - [% IF itemdata_publisheddate #If there is at least one published date, use it for sorting%] - <th id="[% tab | html %]_enumchron" data-colname="[% tab | html %]_enumchron" class="title-string">Serial enumeration / chronology</th> - [% ELSE %] - <th id="[% tab | html %]_enumchron" data-colname="[% tab | html %]_enumchron">Serial enumeration / chronology</th> - [% END %] + <th id="[% tab | html %]_enumchron" data-colname="[% tab | html %]_enumchron">Serial enumeration / chronology</th> [% END %] <th id="[% tab | html %]_status" data-colname="[% tab | html %]_status">Status</th> - <th id="[% tab | html %]_lastseen" data-colname="[% tab | html %]_lastseen" class="title-string">Last seen</th> - <th id="[% tab | html %]_dateaccessioned" data-colname="[% tab | html %]_dateaccessioned" class="title-string">Date accessioned</th> - <th id="[% tab | html %]_datelastborrowed" data-colname="[% tab | html %]_datelastborrowed" class="title-string">Date last borrowed</th> + <th id="[% tab | html %]_lastseen" data-colname="[% tab | html %]_lastseen">Last seen</th> + <th id="[% tab | html %]_dateaccessioned" data-colname="[% tab | html %]_dateaccessioned">Date accessioned</th> + <th id="[% tab | html %]_datelastborrowed" data-colname="[% tab | html %]_datelastborrowed">Date last borrowed</th> <th id="[% tab | html %]_barcode" data-colname="[% tab | html %]_barcode">Barcode</th> [% IF ( itemdata_uri ) %]<th id="[% tab | html %]_uri" data-colname="[% tab | html %]_uri">URL</th>[% END %] [% IF ( itemdata_copynumber ) %]<th id="[% tab | html %]_copynumber" data-colname="[% tab | html %]_copynumber">Copy number</th>[% END %] @@ -374,8 +370,7 @@ Note that permanent location is a code, and location may be an authval. [% IF ( itemdata_ccode ) %]<td>[% item.ccode | html %]</td>[% END %] <td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber | html %][% END %]</td> [% IF ( volinfo ) %] - <td class="enumchron"> - [% IF itemdata_publisheddate %]<span title="[% item.publisheddate | html %]">[% END %] + <td class="enumchron" data-order="[% item.publisheddate | html %]"> [% IF ( itemdata_enumchron ) %] [% IF item.enumchron && item.serialseq %] <span class="enum">[% item.enumchron | html %]</span> @@ -482,9 +477,9 @@ Note that permanent location is a code, and location may be an authval. [% END %] </td> - <td class="datelastseen"><span title="[% item.datelastseen | html %]">[% item.datelastseen | $KohaDates %]</span></td> - <td class="dateaccessioned"><span title="[% item.dateaccessioned | html %]">[% item.dateaccessioned | $KohaDates %]</span></td> - <td class="datelastborrowed"><span title="[% item.datelastborrowed | html %]">[% item.datelastborrowed | $KohaDates %]</span></td> + <td class="datelastseen" data-order="[% item.datelastseen | html %]">[% item.datelastseen | $KohaDates %]</td> + <td class="dateaccessioned" data-order="[% item.dateaccessioned | html %]">[% item.dateaccessioned | $KohaDates %]</td> + <td class="datelastborrowed" data-order="[% item.datelastborrowed | html %]">[% item.datelastborrowed | $KohaDates %]</td> <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?type=[% item.type | uri %]&itemnumber=[% item.itemnumber | uri %]&biblionumber=[% item.biblionumber | uri %]&bi=[% item.biblioitemnumber | uri %]#item[% item.itemnumber | uri %]">[% item.barcode | html %]</a></td> [% 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 %] <tr> <td>[% latestserial.serialseq | html %]</td> - <td><span title="[% latestserial.planneddate | html %]">[% latestserial.planneddate | $KohaDates %]</span></td> - <td><span title="[% latestserial.publisheddate | html %]">[% latestserial.publisheddate | $KohaDates %]</span></td> + <td data-order="[% latestserial.planneddate | html %]">[% latestserial.planneddate | $KohaDates %]</td> + <td data-order="[% latestserial.publisheddate | html %]">[% latestserial.publisheddate | $KohaDates %]</td> <td> [% 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. <th>Basket group</th> <th>Basket</th> <th>Order number</th> - <th class="title-string">Creation date</th> - <th class="title-string">Receive date</th> + <th>Creation date</th> + <th>Receive date</th> <th>Status</th> <th>Quantity</th> <th title="Estimated cost tax incl. while pending, actual cost tax incl. once received">Price</th> @@ -762,8 +757,8 @@ Note that permanent location is a code, and location may be an authval. [% basket.basketname | html %] ([% basket.basketno | html %]) [% END %]</td> <td>[% order.ordernumber | html %]</td> - <td><span title="[% basket.creationdate | uri %]">[% basket.creationdate | $KohaDates%]</span></td> - <td><span title="[% order.datereceived | uri %]">[% order.datereceived | $KohaDates%]</span></td> + <td data-order="[% basket.creationdate | uri %]">[% basket.creationdate | $KohaDates%]</td> + <td data-order="[% order.datereceived | uri %]">[% order.datereceived | $KohaDates%]</td> <td> [% 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 @@ <th>Checked out by</th> [% END %] <th>Renewed</th> - <th class='title-string'>Checkout on</th> - <th class='title-string'>Due date</th> - <th class='title-string'>Checkin on</th> + <th>Checkout on</th> + <th>Due date</th> + <th>Checkin on</th> </tr></thead> <tbody> [% FOREACH checkout IN checkouts %] @@ -79,21 +79,15 @@ [% ELSE %] No [% END %]</td> - <td>[% IF checkout.issuedate %] - <span title="[% checkout.issuedate | html %]">[% checkout.issuedate |$KohaDates with_hours => 1 %]</span> - [% ELSE %] - <span title="0000-00-00"></span> - [% END %]</td> - <td>[% IF checkout.date_due %] - <span title="[% checkout.date_due | html %]">[% checkout.date_due |$KohaDates with_hours => 1 %]</span> - [% ELSE %] - <span title="0000-00-00"></span> - [% END %]</td> - <td>[% IF checkout.returndate %] - <span title="[% checkout.returndate | html %]">[% checkout.returndate |$KohaDates with_hours => 1 %]</span> - [% ELSE %] - <span title="Checked out"><small>Checked out</small></span> - [% END %]</td> + <td data-order="[% checkout.issuedate | html %]"> + [% checkout.issuedate |$KohaDates with_hours => 1 %] + </td> + <td data-order="[% checkout.date_due | html %]"> + [% checkout.date_due |$KohaDates with_hours => 1 %] + </td> + <td data-order="[% checkout.returndate | html %]"> + [% checkout.returndate |$KohaDates with_hours => 1 %] + </td> </tr> [% END %] </tbody> 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 %] <tr> <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td> - <td><span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</span></td> + <td data-order="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</td> <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td> <td>[% s.total | html %]</td> </tr> @@ -180,7 +180,7 @@ [% FOREACH s IN previous_authority_searches %] <tr> <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td> - <td><span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</span></td> + <td data-order="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</td> <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td> <td>[% s.total | html %]</td> </tr> @@ -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