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 <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 18:08:49 +00:00 committed by Jonathan Druart
parent 565591f649
commit da2d583591
15 changed files with 124 additions and 174 deletions

View File

@ -6,7 +6,7 @@
<thead>
<tr>
[% IF ENABLE_OPAC_PAYMENTS %]<th>&nbsp;</th>[% END %]
<th class="title-string">Date</th>
<th>Date</th>
<th>Type</th>
<th>Description</th>
<th>Amount</th>
@ -26,7 +26,7 @@
[% END %]
</td>
[% END %]
<td><span title="[% ACCOUNT_LINE.date | html %]">[% ACCOUNT_LINE.date | $KohaDates %]</span></td>
<td data-order="[% ACCOUNT_LINE.date | html %]">[% ACCOUNT_LINE.date | $KohaDates %]</td>
<td>
[% PROCESS account_type_description account=ACCOUNT_LINE %]
</td>
@ -89,7 +89,7 @@
<thead>
<tr>
[% IF ENABLE_OPAC_PAYMENTS %]<th>&nbsp;</th>[% END %]
<th class="title-string">Date</th>
<th>Date</th>
<th>Description</th>
<th>Fine amount</th>
<th>Amount outstanding</th>
@ -110,7 +110,7 @@
[% END %]
</td>
[% END %]
<td><span title="[% a.date | html %]">[% a.date | $KohaDates %]</span></td>
<td data-order="[% a.date | html %]">[% a.date | $KohaDates %]</td>
<td>
[% PROCESS account_type_description account=a %]
[%- IF a.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', a.payment_type, 1) | html %][% END %]

View File

@ -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;

View File

@ -12,11 +12,11 @@
<tr>
<th class="anti-the">Title</th>
[% IF ( showpriority ) %]
<th class="title-string">Placed on</th>
<th>Placed on</th>
[% ELSE %]
<th class="psort title-string">Placed on</th>
<th class="psort">Placed on</th>
[% END %]
<th class="title-string">Expires on</th>
<th>Expires on</th>
[% UNLESS( singleBranchMode) %]
<th>Pick up location</th>
[% END %]
@ -62,28 +62,24 @@
<p class="hint">Item on hold: [% HOLD.item.barcode | html %]</p>
[% END %]
</td>
<td class="reservedate">
<span title="[% HOLD.reservedate | html %]">
<span class="tdlabel">Hold date:</span>
<td class="reservedate" data-order="[% HOLD.reservedate | html %]">
<span class="tdlabel">Hold date:</span>
[% HOLD.reservedate | $KohaDates %]
</span>
</td>
<td class="expirationdate">
[% IF ! HOLD.found %]
[% IF ! HOLD.found %]
<td class="expirationdate" data-order="[% HOLD.expirationdate | html %]">
[% IF ( HOLD.expirationdate ) %]
<span title="[% HOLD.expirationdate | html %]">
<span class="tdlabel">Expiration:</span>
[% HOLD.expirationdate | $KohaDates %]
</span>
<span class="tdlabel">Expiration:</span>
[% HOLD.expirationdate | $KohaDates %]
[% ELSE %]
<span title="0000-00-00">
<span class="tdlabel">Expiration:</span>
Never expires
</span>
<span class="tdlabel">Expiration:</span>
Never expires
[% END %]
[% ELSE %]
<span title="0000-00-00">-</span>
[% END %]
[% ELSE %]
<td class="expirationdate" data-order="0000-00-00">
-
[% END %]
</td>
[% UNLESS( singleBranchMode) %]
<td class="branch">

View File

@ -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 %]

View File

@ -69,7 +69,7 @@
<th>Call number</th>
<th>Copy number</th>
<th>Status</th>
<th class="title-string">Date due</th>
<th>Date due</th>
<th>Notes</th>
<th>Link</th>
</tr>
@ -86,7 +86,7 @@
<td>[% cr.item.itemcallnumber | html %]</td>
<td>[% cr.item.copynumber | html %]</td>
<td>[% INCLUDE 'item-status.inc' item=cr.item issue=cr.issue %]</td>
<td><span title="[% cr.issue.date_due | html %]">[% cr.issue.date_due | $KohaDates as_due_date => 1 %]</span></td>
<td data-order="[% cr.issue.date_due | html %]">[% cr.issue.date_due | $KohaDates as_due_date => 1 %]</td>
<td>[% IF ( cr.public_note ) %]
[% cr.public_note | $raw %]
[% ELSIF ( cr.item.itemnotes ) %]

View File

@ -823,8 +823,8 @@
<thead>
<tr>
<th id="serial_serialseq" data-colname="serial_serialseq">Issue #</th>
<th id="serial_publisheddate" data-colname="serial_publisheddate" class="title-string">Publication date</th>
<th id="serial_planneddate" data-colname="serial_planneddate" class="title-string">Received date</th>
<th id="serial_publisheddate" data-colname="serial_publisheddate">Publication date</th>
<th id="serial_planneddate" data-colname="serial_planneddate">Received date</th>
<th id="serial_status" data-colname="serial_status">Status</th>
<th id="serial_notes" data-colname="serial_notes">Note</th>
</tr>
@ -833,8 +833,8 @@
[% FOREACH latestserial IN subscription.latestserials %]
<tr>
<td class="serialseq">[% latestserial.serialseq | html %]</td>
<td class="publisheddate"><span title="[% latestserial.publisheddate | html %]">[% latestserial.publisheddate | $KohaDates %]</span></td>
<td class="planneddate"><span title="[% latestserial.planneddate | html %]">[% latestserial.planneddate | $KohaDates %]</span></td>
<td class="publisheddate" data-order="[% latestserial.publisheddate | html %]">[% latestserial.publisheddate | $KohaDates %]</td>
<td class="planneddate" data-order="[% latestserial.planneddate | html %]">[% latestserial.planneddate | $KohaDates %]</td>
<td class="serial_status">
[% IF (latestserial.status1 ) %]<span>Expected</span>[% END %]
[% IF (latestserial.status2 ) %]<span>Arrived</span>[% END %]
@ -1398,7 +1398,7 @@
[% IF ( itemdata_copynumber ) %]<td class="copynumber">[% ITEM_RESULT.copynumber | html %]</td>[% END %]
<td class="status">[% INCLUDE 'item-status-schema-org.inc' item = ITEM_RESULT %][% INCLUDE 'item-status.inc' item = ITEM_RESULT %]</td>
[% IF ( itemdata_itemnotes ) %]<td class="notes" property="description">[% ITEM_RESULT.itemnotes | $raw %]</td>[% END %]
<td class="date_due"><span title="[% ITEM_RESULT.datedue | html %]">[% ITEM_RESULT.datedue | $KohaDates as_due_date => 1 %]</span></td>
<td class="date_due" data-order="[% ITEM_RESULT.datedue | html %]">[% ITEM_RESULT.datedue | $KohaDates as_due_date => 1 %]</td>
<td class="barcode" property="serialNumber">[% ITEM_RESULT.barcode | html %]</td>
[% IF holds_count.defined || show_priority %]
<td class="holds_count">

View File

@ -136,27 +136,26 @@
<tbody>
[% FOREACH serial IN year.serials %]
<tr>
<td>
<td data-order="[% serial.publisheddate | html %]">
[% IF ( serial.publisheddate ) %]
<span title="[% serial.publisheddate | html %]">
[% IF serial.publisheddatetext %]
[% serial.publisheddatetext | html %]
[% ELSE %]
[% serial.publisheddate | $KohaDates %]
[% END %]
</span>
[% IF serial.publisheddatetext %]
[% serial.publisheddatetext | html %]
[% ELSE %]
[% serial.publisheddate | $KohaDates %]
[% END %]
[% ELSE %]
&nbsp;
[% END %]
</td>
<td class="libraryfilterclass">[% Branches.GetName( serial.branchcode ) | html %]</td>
<td>[% serial.notes | html %]</td>
<td>
[% IF ( serial.status2 && serial.planneddate ) %]
<span title="[% serial.planneddate | html %]">[% serial.planneddate | $KohaDates %]</span>
[% ELSE %]
<span title="9999-12-31">&nbsp;</span>
[% END %]
[% IF ( serial.status2 && serial.planneddate ) %]
<td data-order="[% serial.planneddate | html %]">
[% serial.planneddate | $KohaDates %]
[% ELSE %]
<td data-order="9999-12-31">
&nbsp;
[% END %]
</td>
<td>[% serial.serialseq | html %]</td>
<td>
@ -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" ]]
}));
});

View File

@ -2,6 +2,7 @@
[% USE Koha %]
[% USE Branches %]
[% USE KohaDates %]
[% USE TablesSettings %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Your holds history &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
[% INCLUDE 'doc-head-close.inc' %]
@ -58,7 +59,7 @@
You have never placed a hold from this library.
[% ELSE %]
<div id="opac-user-holdsrec">
<div id="tabs-container" style="overflow:auto">
<div id="tabs-container">
<div class="controls">
<div class="resultscontrol resort">
<form id="sortform" action="/cgi-bin/koha/opac-holdshistory.pl" method="get">
@ -89,10 +90,10 @@
<th>Author</th>
<th>Barcode</th>
<th>Library</th>
<th class="title-string">Hold date</th>
<th class="title-string">Expiration date</th>
<th class="title-string">Waiting date</th>
<th class="title-string">Cancellation date</th>
<th>Hold date</th>
<th>Expiration date</th>
<th>Waiting date</th>
<th>Cancellation date</th>
[% IF show_itemtype_column %]
<th>Requested item type</th>
[% END %]
@ -106,26 +107,20 @@
<td>[% hold.biblio.author | html %]</td>
<td>[% hold.item.barcode | html %]</td>
<td>[% Branches.GetName( hold.branchcode ) | html %]</td>
<td><span title="[% hold.reservedate | html %]">[% hold.reservedate | $KohaDates %]</span></td>
<td>
<td data-order="[% hold.reservedate | html %]">[% hold.reservedate | $KohaDates %]</td>
<td data-order="[% hold.expirationdate | html %]">
[% IF hold.expirationdate %]
<span title="[% hold.expirationdate | html %]">[% hold.expirationdate | $KohaDates %]</span>
[% ELSE %]
<span title="0000-00-00"></span>
[% hold.expirationdate | $KohaDates %]
[% END %]
</td>
<td>
<td data-order="[% hold.waitingdate | html %]">
[% IF hold.waitingdate %]
<span title="[% hold.waitingdate | html %]">[% hold.waitingdate | $KohaDates %]</span>
[% ELSE %]
<span title="0000-00-00"></span>
[% hold.waitingdate | $KohaDates %]
[% END %]
</td>
<td>
<td data-order="[% hold.cancellationdate | html %]">
[% IF hold.cancellationdate %]
<span title="[% hold.cancellationdate | html %]">[% hold.cancellationdate | $KohaDates %]</span>
[% ELSE %]
<span title="0000-00-00"></span>
[% hold.cancellationdate | $KohaDates %]
[% END %]
</td>
[% IF show_itemtype_column %]
@ -166,20 +161,25 @@
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK jsinclude %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'columns_settings.inc' %]
<script>
$(document).ready(function() {
$('#sort').change(function() {
$('#sortform').submit();
});
var table = $("table_holdshistory").dataTable($.extend(true, {}, dataTablesDefaults, {
"sPaginationType": "four_button",
"aaSorting": [[4, 'desc']],
"sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
"aoColumnDefs": [
{ "sType": "anti-the", "aTargets" : [ "anti-the" ] },
{ "sType": "title-string", "aTargets" : [ "title-string" ] }
]
}));
var columns_settings = []; // Empty because there are no columns we want to be configurable
var table = KohaTable("#table_holdshistory", {
"dom": '<"top"<"table_entries"i><"table_controls"fB>>t',
"autoWidth": false,
"sorting": [[4, 'desc']],
"columnDefs": [
{ "sType": "anti-the", "aTargets" : [ "anti-the" ] }
],
"language": {
"search": "_INPUT_",
"searchPlaceholder": _("Search")
}
}, columns_settings);
});
</script>
[% END %]

View File

@ -134,8 +134,8 @@
<th>Requested from</th>
<th>Request type</th>
<th>Status</th>
<th class="title-string">Request placed</th>
<th class="title-string">Last updated</th>
<th>Request placed</th>
<th>Last updated</th>
<th></th>
</tr>
</thead>
@ -156,8 +156,8 @@
[% IF type %][% type | html %][% ELSE %]<span>N/A</span>[% END %]
</td>
<td>[% request.status_alias ? request.statusalias.lib_opac : request.capabilities.$status.name | html %]</td>
<td><span title="[% request.placed | html %]">[% request.placed | $KohaDates %]</span></td>
<td><span title="[% request.updated | html %]">[% request.updated | $KohaDates %]</span></td>
<td data-order="[% request.placed | html %]">[% request.placed | $KohaDates %]</td>
<td data-order="[% request.updated | html %]">[% request.updated | $KohaDates %]</td>
<td>
<a href="/cgi-bin/koha/opac-illrequests.pl?method=view&amp;illrequest_id=[% request.id | uri %]" class="btn btn-primary btn-sm pull-right">View</a>
</td>
@ -285,8 +285,7 @@
<script>
$("#illrequestlist").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "targets": [ -1 ], "sortable": false, "searchable": false },
{ "type": "title-string", "targets" : [ "title-string" ] }
{ "targets": [ -1 ], "sortable": false, "searchable": false }
],
"order": [[ 3, "desc" ]],
"deferRender": true

View File

@ -91,7 +91,7 @@
<th class="anti-the">Title</th>
<th>Item type</th>
<th>Call no.</th>
<th class="title-string">Date</th>
<th>Date</th>
[% IF ( OPACMySummaryHTML ) %]
<th class="NoSort noExport">Links</th>
[% END %]
@ -173,13 +173,14 @@
<span class="tdlabel">Call number:</span>
[% issue.itemcallnumber | html %]
</td>
<td>
[% IF issue.returndate %]
[% IF issue.returndate %]
<td data-order="[% issue.returndate | html %]">
<span class="tdlabel">Check-in date:</span>
<span title="[% issue.returndate | html %]">[% issue.returndate | $KohaDates %]</span>
[% ELSE %]
<span title="Checked out"><em>(Checked out)</em></span>
[% END %]
[% issue.returndate | $KohaDates %]
[% ELSE %]
<td data-order="Checked out">
<em>(Checked out)</em>
[% END %]
</td>
[% IF OPACMySummaryHTML %]
<td>[% issue.MySummaryHTML | $raw %]</td>

View File

@ -76,9 +76,9 @@
<td class="selectcol">
<input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
</td>
<td>
<td data-order="[% s.time | html %]">
<label for="result[% s.id | html %]">
<span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</span>
[% s.time |$KohaDates with_hours => 1 %]
</label>
</td>
<td>
@ -119,9 +119,9 @@
<td class="selectcol">
<input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
</td>
<td>
<td data-order="[% s.time | html %]">
<label for="result[% s.id | html %]">
<span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</span>
[% s.time |$KohaDates with_hours => 1 %]
</label>
</td>
<td>
@ -169,9 +169,9 @@
<td class="selectcol">
<input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
</td>
<td>
<td data-order="[% s.time | html %]">
<label for="result[% s.id | html %]">
<span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</span>
[% s.time |$KohaDates with_hours => 1 %]
</label>
</td>
<td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
@ -204,9 +204,9 @@
<td class="selectcol">
<input type="checkbox" name="id" value="[% s.id | html %]" id="result[% s.id | html %]" />
</td>
<td>
<td data-order="[% s.time | html %]">
<label for="result[% s.id | html %]">
<span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</span>
[% s.time |$KohaDates with_hours => 1 %]
</label>
</td>
<td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
@ -259,8 +259,7 @@
"order": [[ 1, "desc" ]],
"dom": '<"top"<"table_entries"><"table_controls"fB>>t',
"columnDefs": [
{ "targets": [ 0 ], "sortable": false, "searchable": false },
{ "targets": [ 1 ], "type": "title-string" },
{ "targets": [ 0 ], "sortable": false, "searchable": false }
],
"language": {
"search": "_INPUT_",

View File

@ -133,7 +133,14 @@
<form id="deletetags" method="post" action="opac-tags.pl">
<h2>Your tags</h2>
<table id="mytagst" class="table table-bordered table-striped">
<thead><tr><th>&nbsp;</th><th>Term</th><th>Title</th><th>Date added</th></tr></thead>
<thead>
<tr>
<th>&nbsp;</th>
<th>Term</th>
<th class="anti-the">Title</th>
<th>Date added</th>
</tr>
</thead>
<tbody>
[% FOREACH MY_TAG IN MY_TAGS %]
[% IF MY_TAG.visible %]
@ -164,11 +171,9 @@
[% INCLUDE 'title-actions-menu.inc' items=MY_TAG %]
</td>
<td>
<span title="[% MY_TAG.date_created | html %]">
<span class="tdlabel">Date added:</span>
[% MY_TAG.date_created | $KohaDates %]
</span>
<td data-order="[% MY_TAG.date_created | html %]">
<span class="tdlabel">Date added:</span>
[% MY_TAG.date_created | $KohaDates %]
</td>
</tr>
[% END %]
@ -211,13 +216,8 @@
$("#mytagst").dataTable($.extend(true, {}, dataTablesDefaults, {
"sorting": [[ 2, "asc" ]],
"columnDefs": [
{ "targets": [ 0 ], "sortable": false, "searchable": false }
],
"columns": [
null,
{ "type": "anti-the" },
{ "type": "title-string" },
null
{ "targets": [ 0 ], "sortable": false, "searchable": false },
{ "sType": "anti-the", "aTargets" : [ "anti-the" ] }
]
}));
});

View File

@ -240,7 +240,7 @@
[% IF ( JacketImages || AdlibrisEnabled ) %]<th class="nosort">&nbsp;</th>[% END %]
<th class="anti-the">Title</th>
<th>Author</th>
<th class="title-string psort">Due</th>
<th class="psort">Due</th>
[% UNLESS ( item_level_itypes ) %]
<th>Item type</th>
[% END %]
@ -320,18 +320,14 @@
<td class="author">[% ISSUE.author | html %]</td>
[% IF ( ISSUE.overdue ) %]
<td class="date_due overdue">
<span title="[% ISSUE.date_due | html %]">
<span class="tdlabel">Date due:</span>
[% ISSUE.date_due | $KohaDates as_due_date => 1 %]
</span>
<td class="date_due overdue" data-order="[% ISSUE.date_due | html %]">
<span class="tdlabel">Date due:</span>
[% ISSUE.date_due | $KohaDates as_due_date => 1 %]
</td>
[% ELSE %]
<td class="date_due">
<span title="[% ISSUE.date_due | html %]">
<span class="tdlabel">Date due:</span>
[% ISSUE.date_due | $KohaDates as_due_date => 1 %]
</span>
<td class="date_due" data-order="[% ISSUE.date_due | html %]">
<span class="tdlabel">Date due:</span>
[% ISSUE.date_due | $KohaDates as_due_date => 1 %]
</td>
[% END %]
[% UNLESS ( item_level_itypes ) %]
@ -591,7 +587,7 @@
[% UNLESS ( item_level_itypes ) %]<th>Item type</th> [% END %]
[% IF ( show_barcode ) %]<th>Barcode</th>[% END %]
<th>Call no.</th>
<th class="title-string psort">Due</th>
<th class="psort">Due</th>
[% IF ( OpacRenewalAllowed ) %]
<th class="nosort">Renew</th>
[% END %]
@ -661,11 +657,9 @@
<span class="tdlabel">Call no.:</span>
[% OVERDUE.itemcallnumber | html %]
</td>
<td>
<span title="[% OVERDUE.date_due | html %]">
<span class="tdlabel">Date due:</span>
[% OVERDUE.date_due | $KohaDates as_due_date => 1 %]
</span>
<td data-order="[% OVERDUE.date_due | html %]">
<span class="tdlabel">Date due:</span>
[% OVERDUE.date_due | $KohaDates as_due_date => 1 %]
</td>
[% IF ( OpacRenewalAllowed ) %]
<td>
@ -908,8 +902,7 @@
"dom": '<"top"<"table_entries"><"table_controls"fB>>t',
"columnDefs": [
{ "targets": [ "nosort" ],"sortable": false,"searchable": false },
{ "type": "anti-the", "targets" : [ "anti-the" ] },
{ "type": "title-string", "targets" : [ "title-string" ] }
{ "type": "anti-the", "targets" : [ "anti-the" ] }
],
"language": {
"search": "_INPUT_",

View File

@ -294,7 +294,7 @@
<th class="noshow">Checked out on</th>
<th class="anti-the">Title</th>
<th>Call no.</th>
<th class="title-string">Due</th>
<th>Due</th>
<th class="nosort">Renew</th>
[% UNLESS ( nofines ) %]
<th>Fines</th>
@ -319,9 +319,13 @@
</td>
<td>[% ISSUE.itemcallnumber | html %]</td>
[% IF ( ISSUE.overdue ) %]
<td class="overdue"><span title="[% ISSUE.date_due | html %]">[% ISSUE.date_due | $KohaDates as_due_date => 1 %]</span></td>
<td class="overdue" data-order="[% ISSUE.date_due | html %]">
[% ISSUE.date_due | $KohaDates as_due_date => 1 %]
</td>
[% ELSE %]
<td><span title="[% ISSUE.date_due | html %]">[% ISSUE.date_due | $KohaDates as_due_date => 1 %]</span></td>
<td data-order="[% ISSUE.date_due | html %]">
[% ISSUE.date_due | $KohaDates as_due_date => 1 %]
</td>
[% END %]
<td>
<form action="/cgi-bin/koha/sco/sco-main.pl" method="post">
@ -483,12 +487,12 @@
dofocus();
[% IF ( patronid ) %]sco_init();[% END %]
$("#loanTable").dataTable($.extend(true, {}, dataTablesDefaults, {
"dom": "t",
"order": [ 0 ],
"columnDefs": [
{ "targets": [ "nosort" ], "sortable": false, "searchable": false },
{ "targets": [ "noshow" ], "visible": false, "searchable": false },
{ "type": "anti-the", "targets" : [ "anti-the" ] },
{ "type": "title-string", "targets" : [ "title-string" ] }
{ "type": "anti-the", "targets" : [ "anti-the" ] }
]
}));

View File

@ -70,34 +70,6 @@ $.fn.dataTable.ext.buttons.clearFilter = {
}
};
/* Plugin to allow sorting on data stored in a span's title attribute
*
* Ex: <td><span title="[% ISO_date %]">[% formatted_date %]</span></td>
*
* In DataTables config:
* "aoColumns": [
* { "sType": "title-string" },
* ]
* http://datatables.net/plug-ins/sorting#hidden_title_string
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"title-string-pre": function ( a ) {
var m = a.match(/title="(.*?)"/);
if ( null !== m && m.length ) {
return m[1].toLowerCase();
}
return "";
},
"title-string-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"title-string-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
/* Plugin to allow sorting on numeric data stored in a span's title attribute
*
* Ex: <td><span title="[% decimal_number_that_JS_parseFloat_accepts %]">