From da2d583591b0896367b81374725cefa4e1719d7d Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 22 Mar 2021 18:08:49 +0000 Subject: [PATCH] Bug 28018: Replace obsolete title-string sorting: OPAC templates This patch modifies OPAC 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: - As a logged-in user, (proper testing will depend on having the relevant data associated with your user, e.g. holds, searches, ill requests, etc.): - Your summary - Checkouts - Overdues - Holds - Your charges - Your search history - Your checkout history - Your holds history - Your interlibrary loan requests - Your tags - Bibliographic detail page - With a non-serial record: Holdings - With a serial record: Latest issues - More details -> Full history: Test multiple years if possible - Course reserves -> Course details - Self checkout -> Check out to a patron with checkouts Signed-off-by: Amit Gupta Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- .../bootstrap/en/includes/account-table.inc | 8 +-- .../en/includes/columns_settings.inc | 3 +- .../bootstrap/en/includes/holds-table.inc | 34 ++++++------ .../bootstrap/en/modules/opac-account.tt | 3 -- .../en/modules/opac-course-details.tt | 4 +- .../bootstrap/en/modules/opac-detail.tt | 10 ++-- .../en/modules/opac-full-serial-issues.tt | 38 +++++-------- .../bootstrap/en/modules/opac-holdshistory.tt | 54 +++++++++---------- .../bootstrap/en/modules/opac-illrequests.tt | 11 ++-- .../en/modules/opac-readingrecord.tt | 15 +++--- .../en/modules/opac-search-history.tt | 19 ++++--- .../bootstrap/en/modules/opac-tags.tt | 26 ++++----- .../bootstrap/en/modules/opac-user.tt | 31 +++++------ .../bootstrap/en/modules/sco/sco-main.tt | 14 +++-- .../opac-tmpl/bootstrap/js/datatables.js | 28 ---------- 15 files changed, 124 insertions(+), 174 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc index a3b6b935d5..6c3b5b9c5c 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc @@ -6,7 +6,7 @@ [% IF ENABLE_OPAC_PAYMENTS %] [% END %] - Date + Date Type Description Amount @@ -26,7 +26,7 @@ [% END %] [% END %] - [% ACCOUNT_LINE.date | $KohaDates %] + [% ACCOUNT_LINE.date | $KohaDates %] [% PROCESS account_type_description account=ACCOUNT_LINE %] @@ -89,7 +89,7 @@ [% IF ENABLE_OPAC_PAYMENTS %] [% END %] - Date + Date Description Fine amount Amount outstanding @@ -110,7 +110,7 @@ [% END %] [% END %] - [% a.date | $KohaDates %] + [% a.date | $KohaDates %] [% PROCESS account_type_description account=a %] [%- IF a.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', a.payment_type, 1) | html %][% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc index 6b7971ff53..78935a9d5c 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc @@ -99,10 +99,9 @@ function KohaTable(selector, dt_parameters, columns_settings) { var new_parameters = {} $.extend(true, new_parameters, dataTablesDefaults, dt_parameters); var default_column_defs = [ - { "aTargets": ["title-string"], "sType": "title-string" }, { "aTargets": ["string-sort"], "sType": "string" }, { "aTargets": ["anti-the"], "sType": "anti-the" }, - { "aTargets": ["NoSort"], "bSortable": false, "bSearchable": false }, + { "aTargets": ["NoSort"], "bSortable": false, "bSearchable": false } ]; if (new_parameters["aoColumnDefs"] === undefined) { new_parameters["aoColumnDefs"] = default_column_defs; diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc index 78735ba4a0..c50958346d 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc @@ -12,11 +12,11 @@ Title [% IF ( showpriority ) %] - Placed on + Placed on [% ELSE %] - Placed on + Placed on [% END %] - Expires on + Expires on [% UNLESS( singleBranchMode) %] Pick up location [% END %] @@ -62,28 +62,24 @@

Item on hold: [% HOLD.item.barcode | html %]

[% END %] - - - Hold date: + + Hold date: [% HOLD.reservedate | $KohaDates %] - - [% IF ! HOLD.found %] + [% IF ! HOLD.found %] + [% IF ( HOLD.expirationdate ) %] - - Expiration: - [% HOLD.expirationdate | $KohaDates %] - + Expiration: + [% HOLD.expirationdate | $KohaDates %] [% ELSE %] - - Expiration: - Never expires - + Expiration: + Never expires [% END %] - [% ELSE %] - - - [% END %] + [% ELSE %] + + - + [% END %] [% UNLESS( singleBranchMode) %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt index ad44f5c011..ac97a887b0 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt @@ -94,9 +94,6 @@ $( document ).ready(function() { var txtInactivefilter = _("Show all transactions"); var fines_table = $("#finestable").dataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { "type": "title-string", "targets" : [ "title-string" ] } - ], [% IF ENABLE_OPAC_PAYMENTS %] "order": [[ 1, "desc" ]], [% ELSE %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt index be31b09bfa..9b17b5075a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt @@ -69,7 +69,7 @@ Call number Copy number Status - Date due + Date due Notes Link @@ -86,7 +86,7 @@ [% cr.item.itemcallnumber | html %] [% cr.item.copynumber | html %] [% INCLUDE 'item-status.inc' item=cr.item issue=cr.issue %] - [% cr.issue.date_due | $KohaDates as_due_date => 1 %] + [% cr.issue.date_due | $KohaDates as_due_date => 1 %] [% IF ( cr.public_note ) %] [% cr.public_note | $raw %] [% ELSIF ( cr.item.itemnotes ) %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index c94940603f..224bab3f71 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -823,8 +823,8 @@ Issue # - Publication date - Received date + Publication date + Received date Status Note @@ -833,8 +833,8 @@ [% FOREACH latestserial IN subscription.latestserials %] [% latestserial.serialseq | html %] - [% latestserial.publisheddate | $KohaDates %] - [% latestserial.planneddate | $KohaDates %] + [% latestserial.publisheddate | $KohaDates %] + [% latestserial.planneddate | $KohaDates %] [% IF (latestserial.status1 ) %]Expected[% END %] [% IF (latestserial.status2 ) %]Arrived[% END %] @@ -1398,7 +1398,7 @@ [% IF ( itemdata_copynumber ) %][% ITEM_RESULT.copynumber | html %][% END %] [% INCLUDE 'item-status-schema-org.inc' item = ITEM_RESULT %][% INCLUDE 'item-status.inc' item = ITEM_RESULT %] [% IF ( itemdata_itemnotes ) %][% ITEM_RESULT.itemnotes | $raw %][% END %] - [% ITEM_RESULT.datedue | $KohaDates as_due_date => 1 %] + [% ITEM_RESULT.datedue | $KohaDates as_due_date => 1 %] [% ITEM_RESULT.barcode | html %] [% IF holds_count.defined || show_priority %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-full-serial-issues.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-full-serial-issues.tt index 75212e1c45..304745af6c 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-full-serial-issues.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-full-serial-issues.tt @@ -136,27 +136,26 @@ [% FOREACH serial IN year.serials %] - + [% IF ( serial.publisheddate ) %] - - [% IF serial.publisheddatetext %] - [% serial.publisheddatetext | html %] - [% ELSE %] - [% serial.publisheddate | $KohaDates %] - [% END %] - + [% IF serial.publisheddatetext %] + [% serial.publisheddatetext | html %] + [% ELSE %] + [% serial.publisheddate | $KohaDates %] + [% END %] [% ELSE %]   [% END %] [% Branches.GetName( serial.branchcode ) | html %] [% serial.notes | html %] - - [% IF ( serial.status2 && serial.planneddate ) %] - [% serial.planneddate | $KohaDates %] - [% ELSE %] -   - [% END %] + [% IF ( serial.status2 && serial.planneddate ) %] + + [% serial.planneddate | $KohaDates %] + [% ELSE %] + +   + [% END %] [% serial.serialseq | html %] @@ -211,16 +210,7 @@ $(this).addClass("currentsubtab"); }); $(".subscriptionstclass").dataTable($.extend(true, {}, dataTablesDefaults, { - "order": [[ 0, "desc" ]], - "columns": [ - { "type": "title-string" }, - null, - null, - { "type": "title-string" }, - null, - null, - null - ] + "order": [[ 0, "desc" ]] })); }); diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt index 32a43729c3..26b9676fa7 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt @@ -2,6 +2,7 @@ [% USE Koha %] [% USE Branches %] [% USE KohaDates %] +[% USE TablesSettings %] [% INCLUDE 'doc-head-open.inc' %] Your holds history › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog [% INCLUDE 'doc-head-close.inc' %] @@ -58,7 +59,7 @@ You have never placed a hold from this library. [% ELSE %]
-
+
@@ -89,10 +90,10 @@ Author Barcode Library - Hold date - Expiration date - Waiting date - Cancellation date + Hold date + Expiration date + Waiting date + Cancellation date [% IF show_itemtype_column %] Requested item type [% END %] @@ -106,26 +107,20 @@ [% hold.biblio.author | html %] [% hold.item.barcode | html %] [% Branches.GetName( hold.branchcode ) | html %] - [% hold.reservedate | $KohaDates %] - + [% hold.reservedate | $KohaDates %] + [% IF hold.expirationdate %] - [% hold.expirationdate | $KohaDates %] - [% ELSE %] - + [% hold.expirationdate | $KohaDates %] [% END %] - + [% IF hold.waitingdate %] - [% hold.waitingdate | $KohaDates %] - [% ELSE %] - + [% hold.waitingdate | $KohaDates %] [% END %] - + [% IF hold.cancellationdate %] - [% hold.cancellationdate | $KohaDates %] - [% ELSE %] - + [% hold.cancellationdate | $KohaDates %] [% END %] [% IF show_itemtype_column %] @@ -166,20 +161,25 @@ [% INCLUDE 'opac-bottom.inc' %] [% BLOCK jsinclude %] [% INCLUDE 'datatables.inc' %] +[% INCLUDE 'columns_settings.inc' %] [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt index 97b361bd40..af19fcbefa 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt @@ -134,8 +134,8 @@ Requested from Request type Status - Request placed - Last updated + Request placed + Last updated @@ -156,8 +156,8 @@ [% IF type %][% type | html %][% ELSE %]N/A[% END %] [% request.status_alias ? request.statusalias.lib_opac : request.capabilities.$status.name | html %] - [% request.placed | $KohaDates %] - [% request.updated | $KohaDates %] + [% request.placed | $KohaDates %] + [% request.updated | $KohaDates %] View @@ -285,8 +285,7 @@