Bug 26664: Fix sorting for date last seen in inventory tool

This adds the standard datatable sorting for dates to the inventory
table as described here:
https://wiki.koha-community.org/wiki/DataTables_HowTo#Sorting_dates_regardless_of_date_format_preference

To test:
- Go to the inventory tool
- Search for a big sample list of items with different date last seen
- Sort the table now by "date last seen" by clicking on the table header cell
- Try different settings of the DateFormat system preferences
- Verify sorting is incorrect (alphabetic, not by date)
- Apply patch
- Repeat testing and very all is sorting correctly now

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Katrin Fischer 2020-10-05 17:48:45 +00:00 committed by Jonathan Druart
parent c7938f5f86
commit 9adafd6404

View file

@ -200,7 +200,7 @@
<th>Lost</th>
<th>Damaged</th>
<th>Withdrawn</th>
<th>Last seen</th>
<th class="title-string">Last seen</th>
<th>Problems</th>
</tr>
</thead>
@ -239,7 +239,7 @@
[% result.withdrawn | html %]
</td>
<td>
[% result.datelastseen | $KohaDates %]
<span title="[% result.datelastseen %]">[% result.datelastseen | $KohaDates%]</span>
</td>
<td>
[% FOREACH problem IN result.problems %]
@ -350,6 +350,7 @@
"aoColumnDefs": [
{ "sType": "anti-the", "aTargets" : [ "anti-the" ] },
{ "bSortable": false, "bSearchable": false, "aTargets": [ 0 ] },
{ "sType": "title-string", "aTargets" : [ "title-string" ] },
],
// 3rd column is callnumber
"aaSorting": [[ 2, "asc" ]],