Bug 28007: Replace obsolete title-string sorting: Tools templates

This patch modifies several tools 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:

- Tools -> Access files
  - You must modify koha-conf.xml to uncomment and populate the
    access_dirs section with a path to a directory containing some
    files.
- Tools -> Calendar
  - Test the date sorting in the "Exceptions," "Yearly - Repeating
    holidays," and "Unique holidays" tables.
- Tools -> Inventory (I wasn't able to test this because of Bug 28015).
- Tools -> News
- Tools -> Notices
- Tools -> Batch patron modification
- Tools -> OPAC problem reports
  - You must enable the "OPACReportProblem" system preference and submit
    some problem reports from the OPAC.

Signed-off-by: Amit Gupta <amitddng135@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Owen Leonard 2021-03-22 10:41:33 +00:00 committed by Jonathan Druart
parent 769556b42a
commit 78d504eb06
7 changed files with 36 additions and 31 deletions

View File

@ -42,7 +42,7 @@
<tr>
<th>Name</th>
<th>Size (bytes)</th>
<th class="title-string">Date last modified</th>
<th>Date last modified</th>
</tr>
</thead>
<tbody>
@ -50,7 +50,7 @@
<tr>
<td><a href="/cgi-bin/koha/tools/access_files.pl?id=[% file.id |url %]">[% file.name | html %]</a></td>
<td align="right">[% file.size | html %]</td>
<td><span title="[% file.date | html %]">[% file.date | $KohaDates %]</span></td>
<td data-order="[% file.date | html %]">[% file.date | $KohaDates %]</td>
</tr>
[% END %]
</tbody>

View File

@ -252,7 +252,11 @@
<tbody>
[% FOREACH EXCEPTION_HOLIDAYS_LOO IN EXCEPTION_HOLIDAYS_LOOP %]
<tr>
<td><a href="/cgi-bin/koha/tools/holidays.pl?branch=[% branch | uri %]&amp;calendardate=[% EXCEPTION_HOLIDAYS_LOO.DATE | uri %]"><span title="[% EXCEPTION_HOLIDAYS_LOO.DATE_SORT | html %]">[% EXCEPTION_HOLIDAYS_LOO.DATE | html %]</span></a></td>
<td data-order="[% EXCEPTION_HOLIDAYS_LOO.DATE_SORT | html %]">
<a href="/cgi-bin/koha/tools/holidays.pl?branch=[% branch | uri %]&amp;calendardate=[% EXCEPTION_HOLIDAYS_LOO.DATE | uri %]">
[% EXCEPTION_HOLIDAYS_LOO.DATE | html %]
</a>
</td>
<td>[% EXCEPTION_HOLIDAYS_LOO.TITLE | html %]</td>
<td>[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION | html %]</td>
</tr>
@ -301,7 +305,9 @@
<tbody>
[% FOREACH DAY_MONTH_HOLIDAYS_LOO IN DAY_MONTH_HOLIDAYS_LOOP %]
<tr>
<td><span title="[% DAY_MONTH_HOLIDAYS_LOO.DATE_SORT | html %]">[% DAY_MONTH_HOLIDAYS_LOO.DATE | html %]</span></td>
<td data-order="[% DAY_MONTH_HOLIDAYS_LOO.DATE_SORT | html %]">
[% DAY_MONTH_HOLIDAYS_LOO.DATE | html %]
</td>
<td>[% DAY_MONTH_HOLIDAYS_LOO.TITLE | html %]</td>
<td>[% DAY_MONTH_HOLIDAYS_LOO.DESCRIPTION | html %]</td>
</tr>
@ -323,7 +329,11 @@
<tbody>
[% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %]
<tr>
<td><a href="/cgi-bin/koha/tools/holidays.pl?branch=[% branch | uri %]&amp;calendardate=[% HOLIDAYS_LOO.DATE | uri %]"><span title="[% HOLIDAYS_LOO.DATE_SORT | html %]">[% HOLIDAYS_LOO.DATE | html %]</span></a></td>
<td data-order="[% HOLIDAYS_LOO.DATE_SORT | html %]">
<a href="/cgi-bin/koha/tools/holidays.pl?branch=[% branch | uri %]&amp;calendardate=[% HOLIDAYS_LOO.DATE | uri %]">
[% HOLIDAYS_LOO.DATE | html %]
</a>
</td>
<td>[% HOLIDAYS_LOO.TITLE | html %]</td>
<td>[% HOLIDAYS_LOO.DESCRIPTION.replace('\\\r\\\n', '<br />') | html %]</td>
</tr>
@ -510,9 +520,6 @@
}));
$("#holidayexceptions,#holidaysyearlyrepeatable,#holidaysunique").dataTable($.extend(true, {}, dataTablesDefaults, {
"sDom": 't',
"aoColumns": [
{ "sType": "title-string" },null,null
],
"bPaginate": false
}));
$("a.helptext").click(function(){

View File

@ -239,14 +239,14 @@
<tr>
[% UNLESS uploadedbarcodesflag %]<th>Seen</th>[% END %]
<th>Barcode</th>
<th class="title-string">Call number</th>
<th>Call number</th>
<th>Library</th>
<th class="anti-the">Title</th>
<th>Not for loan</th>
<th>Lost</th>
<th>Damaged</th>
<th>Withdrawn</th>
<th class="title-string">Last seen</th>
<th>Last seen</th>
<th>Problems</th>
</tr>
</thead>
@ -261,8 +261,8 @@
<td>
[% result.barcode | html %]
</td>
<td>
<span title="[% result.cn_sort | html %]">[% result.itemcallnumber | html %]</span>
<td data-order="[% result.cn_sort | html %]">
[% result.itemcallnumber | html %]
</td>
<td>
[% Branches.GetName( result.homebranch ) | html %]
@ -286,8 +286,8 @@
<td>
[% result.withdrawn | html %]
</td>
<td>
<span title="[% result.datelastseen | html %]">[% result.datelastseen | $KohaDates%]</span>
<td data-order="[% result.datelastseen | html %]">
[% result.datelastseen | $KohaDates%]
</td>
<td>
[% FOREACH problem IN result.problems %]
@ -397,8 +397,7 @@
// first column contains checkboxes
"aoColumnDefs": [
{ "sType": "anti-the", "aTargets" : [ "anti-the" ] },
{ "bSortable": false, "bSearchable": false, "aTargets": [ 0 ] },
{ "sType": "title-string", "aTargets" : [ "title-string" ] },
{ "bSortable": false, "bSearchable": false, "aTargets": [ 0 ] }
],
// 3rd column is callnumber
"aaSorting": [[ 2, "asc" ]],

View File

@ -148,8 +148,8 @@
<th>Location</th>
<th>Library</th>
<th>Number</th>
<th class="title-string">Publication date</th>
<th class="title-string">Expiration date</th>
<th>Publication date</th>
<th>Expiration date</th>
<th class="anti-the">Title</th>
<th>Author</th>
<th class="anti-the">News</th>
@ -180,8 +180,8 @@
[% ELSE %][% opac_new.branchname | html %]
[% END %]</td>
<td>[% opac_new.number | html %]</td>
<td><span title="[% opac_new.newdate | html %]">[% opac_new.newdate | $KohaDates %]</span></td>
<td><span title="[% opac_new.expirationdate | html %]">[% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.expired ) %](<span class="expired">expired</span>)[% END %]</span></td>
<td data-order="[% opac_new.newdate | html %]">[% opac_new.newdate | $KohaDates %]</td>
<td data-order="[% opac_new.expirationdate | html %]">[% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.expired ) %](<span class="expired">expired</span>)[% END %]</td>
<td>[% opac_new.title | html %]</td>
<td>[% opac_new.author_title | html %] [% opac_new.author_firstname | html %] [% opac_new.author_surname | html %]</td>
<td>
@ -344,8 +344,7 @@
"order": [[ 4, "desc" ]],
"aoColumnDefs": [
{ "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] },
{ "type": "anti-the", "targets": [ "anti-the" ] },
{ "type": "title-string", "targets" : [ "title-string"] }
{ "type": "anti-the", "targets": [ "anti-the" ] }
],
"sPaginationType": "full_numbers"
}));

View File

@ -179,7 +179,7 @@
<th>Module</th>
<th>Code</th>
<th>Name</th>
<th class="title-string">Last updated</th>
<th>Last updated</th>
<th class="NoSort noExport">Copy notice</th>
<th class="NoSort noExport">Actions</th>
</tr>
@ -214,7 +214,7 @@
</td>
<td>[% lette.code | html %]</td>
<td>[% lette.name | html %]</td>
<td><span title="[% lette.updated_on | $KohaDates with_hours = 1 %]">[% lette.updated_on | $KohaDates with_hours = 1 %]</span></td>
<td data-order="[% lette.updated_on | html %]">[% lette.updated_on | $KohaDates with_hours = 1 %]</td>
<td class="actions">
[% IF !independant_branch || !lette.branchcode %]
<form method="post" action="/cgi-bin/koha/tools/letter.pl">

View File

@ -159,8 +159,8 @@
<th>Primary email</th>
<th>Phone</th>
<th>Mobile</th>
<th class="title-string">Registration date</th>
<th class="title-string">Expiry date</th>
<th>Registration date</th>
<th>Expiry date</th>
<th>Circulation note</th>
<th>OPAC note</th>
<th>Restriction expiration</th>
@ -191,11 +191,11 @@
<td>[% borrower.email | html %]</td>
<td>[% borrower.phone | html %]</td>
<td>[% borrower.mobile | html %]</td>
<td><span title="[% borrower.dateenrolled | html %]">[% borrower.dateenrolled | $KohaDates %]</span></td>
<td><span title="[% borrower.dateexpiry | html %]">[% borrower.dateexpiry | $KohaDates %]</span></td>
<td data-order="[% borrower.dateenrolled | html %]">[% borrower.dateenrolled | $KohaDates %]</td>
<td data-order="[% borrower.dateexpiry | html %]">[% borrower.dateexpiry | $KohaDates %]</td>
<td>[% borrower.borrowernotes | html %]</td>
<td>[% borrower.opacnote | html %]</td>
<td><span title="[% borrower.debarred | html %]">[% borrower.debarred | $KohaDates %]</span></td>
<td data-order="[% borrower.debarred | html %]">[% borrower.debarred | $KohaDates %]</td>
<td>[% borrower.debarredcomment | html %]</td>
[% FOREACH pa IN borrower.patron_attributes %]
[% IF ( pa.code ) %]

View File

@ -76,7 +76,7 @@
<th class="anti-the">Message</th>
<th>Problem page</th>
<th>Sent to</th>
<th class="title-string">Created on</th>
<th>Created on</th>
<th>Set by</th>
<th>Status</th>
<th class="NoSort noExport">Actions</th>
@ -97,7 +97,7 @@
[% CASE 'library' %]A librarian
[% END %]
</td>
<td><span title="[% report.created_on | html %]">[% report.created_on | $KohaDates with_hours => 1 %]</span></td>
<td data-order="[% report.created_on | html %]">[% report.created_on | $KohaDates with_hours => 1 %]</td>
<td>[% INCLUDE 'patron-title.inc' patron => report.patron hide_patron_infos_if_needed=1 %]</td>
<td class="status[% report.status | html %]" name="status">
<span id="status_[% report.reportid | html %]">