Bug 21629 - List sort on call number does not use cn_sort
Summary: List sort on call number does not use cn_sort
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Lists (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-22 15:31 UTC by Myka Kennedy Stephens
Modified: 2020-01-06 20:15 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
With this patch lists sorted on call number will now use the machine sortable form of the callnumber from items.cn_sort for better results.
Version(s) released in:


Attachments
Bug 21629: Use cn_sort instead of itemcallnumber when displaying a list (1.86 KB, patch)
2018-10-22 20:05 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21629: Use cn_sort instead of itemcallnumber when displaying a list (1.92 KB, patch)
2018-10-23 01:08 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 21629: Use cn_sort instead of itemcallnumber when displaying a list (1.99 KB, patch)
2018-10-26 13:58 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Myka Kennedy Stephens 2018-10-22 15:31:07 UTC
When viewing a list in the staff client, one can click on the "Call Number" column to have the list sort to call number order. I am noticing that the order does not sort correctly by cn_sort value.

For example, we use LC Classification in our library. When clicking the "Call Number" column to sort in ascending order, Koha put these call numbers in this (incorrect) order:
- BV4011.3 .W55 2016
- BV5 .W54 1980
- BV811.2 .W44 1980
- BV825.2 .W54 1981

This problem also appears when a list's settings are set to order by call number.
Comment 1 Jonathan Druart 2018-10-22 19:10:23 UTC
This sounds more like an enhancement request.

The sort is done by the DBMS (MySQL/MariaDB) and it will not be trivial to make it sort the results according to the cn_sort.
Comment 2 Katrin Fischer 2018-10-22 19:33:36 UTC
Why would it not be trivial? It would be just a different column to use? (it's also a sort with SQL)
Comment 3 Jonathan Druart 2018-10-22 20:05:37 UTC
Created attachment 80990 [details] [review]
Bug 21629: Use cn_sort instead of itemcallnumber when displaying a list

DBMS can sort callnumbers correctly using cn_sort. We should use it
showing a list's content.

Test plan:
- Add items with callnumber to a list
- Display the list
- List the content by callnumbers
=> Confirm that the records are correctly sorted by callnumber
Comment 4 Jonathan Druart 2018-10-22 20:06:29 UTC
(In reply to Katrin Fischer from comment #2)
> Why would it not be trivial? It would be just a different column to use?
> (it's also a sort with SQL)

Indeed, I was thinking about something else!
Comment 5 Biblibre Sandboxes 2018-10-23 01:08:13 UTC
Patch tested with a sandbox, by Myka Kennedy Stephens <mkstephens@lancasterseminary.edu>
Comment 6 Biblibre Sandboxes 2018-10-23 01:08:37 UTC
Created attachment 81000 [details] [review]
Bug 21629: Use cn_sort instead of itemcallnumber when displaying a list

DBMS can sort callnumbers correctly using cn_sort. We should use it
showing a list's content.

Test plan:
- Add items with callnumber to a list
- Display the list
- List the content by callnumbers
=> Confirm that the records are correctly sorted by callnumber

Signed-off-by: Myka Kennedy Stephens <mkstephens@lancasterseminary.edu>
Comment 7 Myka Kennedy Stephens 2018-10-23 01:10:54 UTC
I can confirm that the patch applied to a sandbox sorted a list by call number correctly. I imported some MARC records from my library's catalog into the sandbox that are not sorting correctly in 18.05. They did sort correctly in the sandbox. Yay! 

Thank you for writing the patch so quickly!!
Myka
Comment 8 Katrin Fischer 2018-10-23 05:34:36 UTC
Thank you Myka for testing!
Comment 9 Katrin Fischer 2018-10-26 13:58:09 UTC
Created attachment 81292 [details] [review]
Bug 21629: Use cn_sort instead of itemcallnumber when displaying a list

DBMS can sort callnumbers correctly using cn_sort. We should use it
showing a list's content.

Test plan:
- Add items with callnumber to a list
- Display the list
- List the content by callnumbers
=> Confirm that the records are correctly sorted by callnumber

Signed-off-by: Myka Kennedy Stephens <mkstephens@lancasterseminary.edu>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 10 Nick Clemens 2018-10-26 17:24:00 UTC
Awesome work all!

Pushed to master for 18.11
Comment 11 Martin Renvoize 2018-11-06 13:36:10 UTC
Pushed to 18.05.x for 18.05.06.
Comment 12 Fridolin Somers 2018-11-28 10:06:41 UTC
I prefer to not push to 17.11.x.
In case cn_sort calculation is not well configured.
I bet it will be better validated during a major version upgrade.