Dates in the waiting reserves page are not sorting correctly when UK dates are used. When you view the waiting reserves page with a large number of resereves, and you sort them by 'Waiting since' or 'Date hold placed', if the system uses UK date format (DD/MM/YYYY) the sorting doesn't working correctly - for example, you might see: 02/02/2017 03/03/2017 08/02/2017 10/01/2017 16/12/2016 instead of the correct order, which would be: 16/12/2016 10/01/2017 02/02/2017 08/02/2017 03/03/2017
Created attachment 144884 [details] [review] Bug 32503: Fix date sorting for holds awaiting pickup tables This patch is a little experimental, but seems to do the trick.
Usually this works: https://wiki.koha-community.org/wiki/DataTables_HowTo#Sorting_dates_regardless_of_date_format_preference But this was already implemented here: <td><span data-order="[% reserveloo.waitingdate | html %]">[% reserveloo.waitingdate | $KohaDates %]</span></td> <td><span data-order="[% reserveloo.reservedate | html %]">[% reserveloo.reservedate | $KohaDates %]</span></td> <td><span data-order="[% reserveloo.expirationdate | html %]">[% reserveloo.expirationdate | $KohaDates %]</span></td> And the source shows, it looks like we want it to: <td><span data-order="2022-12-28">28/12/2022</span></td> <td><span data-order="2022-12-28">28/12/2022</span></td> <td><span data-order="2023-03-03">03/03/2023</span></td> But... the sorting doesn't work. So I googled.... and came up with this: <th data-type="@data-sort"></th> which seems to do the trick. But as we use data-order a lot and this might affect other pages where this worked before, it definitely needs more investigation/someone more knowledgeable about datatables to have a look here. Tested 3 holds with the following dates: 02/02/2017 03/03/2017 08/02/2017
Created attachment 144885 [details] [review] Bug 32503: Fix date sorting for holds awaiting pickup tables This patch is a little experimental, but seems to do the trick. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 144886 [details] [review] Bug 32503: (follow-up) Move data-order attributes It looks like the data-order attributes were at the wrong level to me, i.e. not part of the 'td' but instead part of the cell content. This patch moves those data-order attributes where possible and drops the data-type definitions on the headers. However, for the cancellation case, this isn't as clear cut as we may well display more than one cancellation request date in the same cell. For this case I've left Katrins data-type="@data-order" trick.
My Google foo is weak today.. where did you find the suggestion to use `data-type="@data-sort"` Katrin? I think I spotted the issue with most of the sorting and have removed the data-type definition stuff.. but the cancellation date is more challenging.
Created attachment 144980 [details] [review] Bug 32503: Fix date sorting for holds awaiting pickup tables This patch is a little experimental, but seems to do the trick. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 144981 [details] [review] Bug 32503: (follow-up) Move data-order attributes It looks like the data-order attributes were at the wrong level to me, i.e. not part of the 'td' but instead part of the cell content. This patch moves those data-order attributes where possible and drops the data-type definitions on the headers. However, for the cancellation case, this isn't as clear cut as we may well display more than one cancellation request date in the same cell. For this case I've left Katrins data-type="@data-order" trick.
Created attachment 144982 [details] [review] Bug 32503: Use first cancellation for date ordering
Created attachment 145051 [details] [review] Bug 32503: Fix date sorting for holds awaiting pickup tables This patch is a little experimental, but seems to do the trick. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 145052 [details] [review] Bug 32503: (follow-up) Move data-order attributes It looks like the data-order attributes were at the wrong level to me, i.e. not part of the 'td' but instead part of the cell content. This patch moves those data-order attributes where possible and drops the data-type definitions on the headers. However, for the cancellation case, this isn't as clear cut as we may well display more than one cancellation request date in the same cell. For this case I've left Katrins data-type="@data-order" trick. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 145053 [details] [review] Bug 32503: Use first cancellation for date ordering Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 147142 [details] [review] Bug 32503: Fix date sorting for holds awaiting pickup tables This patch is a little experimental, but seems to do the trick. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 147143 [details] [review] Bug 32503: (follow-up) Move data-order attributes It looks like the data-order attributes were at the wrong level to me, i.e. not part of the 'td' but instead part of the cell content. This patch moves those data-order attributes where possible and drops the data-type definitions on the headers. However, for the cancellation case, this isn't as clear cut as we may well display more than one cancellation request date in the same cell. For this case I've left Katrins data-type="@data-order" trick. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 147144 [details] [review] Bug 32503: Use first cancellation for date ordering Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Pushed to master for 23.05. Nice work everyone, thanks!
Nice work everyone! Pushed to stable for 22.11.x
Merge conflicts with 22.05.x, no backport.