Bug 27934: Remove title-string to order by dates
We must now use data-order to order dates, not title-string. This patch adjusts the few occurrences that were using it and remove the function from datatables.js to prevent new occurrences. Test plan: Create some recalls, go to the "Recalls to pull" and "Recalls awaiting pickup" pages and confirm that the dates are ordered correctly when you sort by dates. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
e225b8b3b5
commit
1b2ee04e74
|
|
@ -53,7 +53,7 @@
|
|||
<th class="recall-enumeration">Available enumeration</th>
|
||||
<th class="recall-itemtypes">Available item types</th>
|
||||
<th class="recall-locations">Available locations</th>
|
||||
<th class="recall-date title-string">Earliest recall date</th>
|
||||
<th class="recall-date">Earliest recall date</th>
|
||||
<th class="recall-action no-sort"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -117,7 +117,7 @@
|
|||
</ul>
|
||||
</td>
|
||||
<td class="recall-date">
|
||||
<span title="[% recall.first_recall.created_date | html %]">[% recall.first_recall.created_date | $KohaDates %] in [% recall.first_recall.library.branchname | html %]</span>
|
||||
<span data-order="[% recall.first_recall.created_date | html %]">[% recall.first_recall.created_date | $KohaDates %] in [% recall.first_recall.library.branchname | html %]</span>
|
||||
</td>
|
||||
<td class="recall-action">
|
||||
<form action="/cgi-bin/koha/recalls/recalls_to_pull.pl" method="post">
|
||||
|
|
@ -152,7 +152,6 @@
|
|||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#recalls-table").kohaTable({
|
||||
columnDefs: [{ type: "title-string", targets: ["title-string"] }],
|
||||
pagingType: "full_numbers",
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
<table id="recallswaiting-table">
|
||||
<thead
|
||||
><tr>
|
||||
<th class="recall-waitingdate title-string">Available since</th>
|
||||
<th class="recall-waitingdate">Available since</th>
|
||||
<th class="recall-title anti-the">Title</th>
|
||||
<th class="recall-patron">Requested by</th>
|
||||
<th class="recall-library">Pickup location</th>
|
||||
|
|
@ -57,7 +57,7 @@
|
|||
<tbody>
|
||||
[% FOREACH recall IN recalls %]
|
||||
<tr>
|
||||
<td class="recall-waitingdate">[% recall.waiting_date | $KohaDates %]</td>
|
||||
<td data-order="[% recall.waiting_date | html %]" class="recall-waitingdate">[% recall.waiting_date | $KohaDates %]</td>
|
||||
<td class="recall-title">
|
||||
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% recall.biblio_id | uri %]">
|
||||
[% recall.biblio.title | html %]
|
||||
|
|
@ -100,7 +100,7 @@
|
|||
<table id="recallsover-table">
|
||||
<thead
|
||||
><tr>
|
||||
<th class="recall-waitingdate title-string">Available since</th>
|
||||
<th class="recall-waitingdate">Available since</th>
|
||||
<th class="recall-title anti-the">Title</th>
|
||||
<th class="recall-patron">Requested by</th>
|
||||
<th class="recall-library">Pickup location</th>
|
||||
|
|
@ -110,7 +110,7 @@
|
|||
<tbody>
|
||||
[% FOREACH recall IN over %]
|
||||
<tr>
|
||||
<td class="recall-waitingdate">[% recall.waiting_date | $KohaDates %]</td>
|
||||
<td data-order="[% recall.waiting_date | html %]" class="recall-waitingdate">[% recall.waiting_date | $KohaDates %]</td>
|
||||
<td class="recall-title">
|
||||
[% INCLUDE 'biblio-title.inc' biblio=recall.biblio link = 1 %]
|
||||
[% IF recall.biblio.author %]by [% recall.biblio.author | html %][% END %]
|
||||
|
|
|
|||
|
|
@ -222,34 +222,6 @@ $.fn.dataTableExt.oSort["num-html-desc"] = function (a, b) {
|
|||
});
|
||||
})();
|
||||
|
||||
/* 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:
|
||||
* "data": [
|
||||
* { "type": "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;
|
||||
},
|
||||
});
|
||||
|
||||
(function () {
|
||||
/* Plugin to allow text sorting to ignore articles
|
||||
*
|
||||
|
|
|
|||
|
|
@ -128,7 +128,6 @@ $(document).ready(function () {
|
|||
});
|
||||
|
||||
$("#recalls-table").kohaTable({
|
||||
columnDefs: [{ type: "title-string", targets: ["title-string"] }],
|
||||
order: [[1, "asc"]],
|
||||
pagingType: "full_numbers",
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue