From 2b8a93db9c4929042874dc4a9e45c00c1f19179e 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 --- .../bootstrap/en/includes/account-table.inc | 8 ++-- .../bootstrap/en/includes/columns_settings.inc | 3 +- .../bootstrap/en/includes/holds-table.inc | 34 ++++++-------- .../opac-tmpl/bootstrap/en/modules/opac-account.tt | 3 -- .../bootstrap/en/modules/opac-course-details.tt | 4 +- .../opac-tmpl/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 ++--- .../bootstrap/en/modules/opac-readingrecord.tt | 15 +++--- .../bootstrap/en/modules/opac-search-history.tt | 19 ++++---- .../opac-tmpl/bootstrap/en/modules/opac-tags.tt | 26 +++++------ .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 31 +++++-------- .../opac-tmpl/bootstrap/en/modules/sco/sco-main.tt | 14 ++++-- koha-tmpl/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 a3b6b93..6c3b5b9 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 6b7971f..78935a9 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 78735ba..c509583 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 97c6281..d70bf5a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt @@ -93,9 +93,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 d90c1fa..12d9ebf 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 a14c1e3..812d8d6 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 6ad30b0..2972d53 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 @@ -135,27 +135,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 %] @@ -210,16 +209,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 a684a30..cabd3ed 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' %] [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog › Your holds history [% 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 ab03b84..45e6741 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt @@ -133,8 +133,8 @@ Requested from Request type Status - Request placed - Last updated + Request placed + Last updated @@ -155,8 +155,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 @@ -284,8 +284,7 @@