Bug 25553

Summary: Edit item date sort does not sort correctly
Product: Koha Reporter: Donna <bwsdonna>
Component: CatalogingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: aleisha, jonathan.druart, kelly, lucas, m.de.rooy, martin.renvoize, nick, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.02, 19.11.08, 19.05.14
Bug Depends on:    
Bug Blocks: 26233    
Attachments: Bug 25553: Make date columns sortable on the edit items table
Bug 25553: Make date columns sortable on the edit items table
Bug 25553: Make date columns sortable on the edit items table
Bug 25553: Make date columns sortable on the edit items table

Description Donna 2020-05-20 13:47:02 UTC
When in the edit items table for a bib record, the date last seen and date accessioned do not sort correctly. 
To test, find a bib record with multiple items attached that have different dates for either accessioned and/or last seen.  Select Edit - items.  On the edit items screen, click on the column header for one of the dates and note that they do not sort in date order.
Comment 1 Jonathan Druart 2020-05-22 09:05:18 UTC
Created attachment 105252 [details] [review]
Bug 25553: Make date columns sortable on the edit items table

When editing items, the table at the top contain several columns that
have date values, but they cannot be sorted by dates correctly.

Test plan:
Have several items with different dates in columns that contain dates,
like items.dateaccessioned, items.datelastseen)
Sort the column and confirm that with this patch the lines are sorted
correctly
Comment 2 Katrin Fischer 2020-05-22 22:32:32 UTC
Not tested?

Template process failed: undef error - : filter not found at /home/vagrant/kohaclone/C4/Templates.pm line 122 ?
Comment 3 Jonathan Druart 2020-05-25 08:12:04 UTC
Created attachment 105322 [details] [review]
Bug 25553: Make date columns sortable on the edit items table

When editing items, the table at the top contain several columns that
have date values, but they cannot be sorted by dates correctly.

Test plan:
Have several items with different dates in columns that contain dates,
like items.dateaccessioned, items.datelastseen)
Sort the column and confirm that with this patch the lines are sorted
correctly
Comment 4 Jonathan Druart 2020-05-25 08:12:20 UTC
Looks like I edited the patch after I tested it.
Comment 5 Katrin Fischer 2020-05-25 21:30:28 UTC
Created attachment 105332 [details] [review]
Bug 25553: Make date columns sortable on the edit items table

When editing items, the table at the top contain several columns that
have date values, but they cannot be sorted by dates correctly.

Test plan:
Have several items with different dates in columns that contain dates,
like items.dateaccessioned, items.datelastseen)
Sort the column and confirm that with this patch the lines are sorted
correctly

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Martin Renvoize 2020-06-19 12:54:50 UTC
Created attachment 106086 [details] [review]
Bug 25553: Make date columns sortable on the edit items table

When editing items, the table at the top contain several columns that
have date values, but they cannot be sorted by dates correctly.

Test plan:
Have several items with different dates in columns that contain dates,
like items.dateaccessioned, items.datelastseen)
Sort the column and confirm that with this patch the lines are sorted
correctly

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Martin Renvoize 2020-06-19 12:56:38 UTC
Works as expected, nice improvement.

Passing QA
Comment 8 Katrin Fischer 2020-06-22 20:33:03 UTC
*** Bug 25844 has been marked as a duplicate of this bug. ***
Comment 9 Katrin Fischer 2020-06-24 11:45:27 UTC
*** Bug 25863 has been marked as a duplicate of this bug. ***
Comment 10 Jonathan Druart 2020-06-24 13:32:47 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 11 Lucas Gass 2020-07-10 15:21:03 UTC
backported to 20.05.x for 20.05.02
Comment 12 Aleisha Amohia 2020-07-12 22:08:39 UTC
backported to 19.11.x for 19.11.08
Comment 13 Victor Grousset/tuxayo 2020-07-23 20:25:01 UTC
Backported to 19.05.x branch for 19.05.14
Comment 14 Lucas Gass 2020-08-14 17:47:13 UTC
This still seems to sort wrong. I have some data like this:

MariaDB [koha_kohadev]> select itemnumber, dateaccessioned from items where biblionumber = '4';
+------------+-----------------+
| itemnumber | dateaccessioned |
+------------+-----------------+
|         12 | 2015-01-28      |
|         13 | 2015-04-08      |
|         14 | 2013-04-08      |
|         18 | 2015-11-28      |
+------------+-----------------+



You can see that the dateaccessioned is still not sorting right (ASC or DESC):

https://snipboard.io/gtScJK.jpg
https://snipboard.io/z7Av8O.jpg
Comment 15 Jonathan Druart 2020-08-18 08:51:33 UTC
Indeed Lucas, it does not work. It seems that I did not test the patch with the correct dates. I was pretty sure adding the title-string class to the th was enough. I am opening a follow-up bug report.
Comment 16 Jonathan Druart 2020-08-18 08:54:03 UTC
See bug 26233.