Bug 25897

Summary: Inventory table call number sort should use cn_sort value
Product: Koha Reporter: Nick Clemens <nick>
Component: ToolsAssignee: Katrin Fischer <katrin.fischer>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: ephetteplace, martin.renvoize
Version: MainKeywords: Academy
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19915
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26866
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26867
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00
Bug Depends on: 26664    
Bug Blocks:    
Attachments: Bug 25897: Use cn_sort for sorting callnumbers in inventory table
Bug 25897: Use cn_sort for sorting callnumbers in inventory table
Bug 25897: Use cn_sort for sorting callnumbers in inventory table
Bug 25897: (QA follow-up) Add filters

Description Nick Clemens 2020-06-29 21:48:50 UTC
Given items with barcodes like: 
B 29 V55 1998
B29 .C55 2008
B29 .L24 1983
B29 .L264 1998
B29 .P666 2004

The correct sort order should be:
B29 .C55 2008
B29 .L24 1983
B29 .L264 1998
B29 .P666 2004
B 29 V55 1998

But instead it sorts in the order supplied first
Comment 1 Katrin Fischer 2020-07-18 17:58:00 UTC
Hm I thought that had been fixed by bug 19915 :(

nick, do you intend to work on this?
Comment 2 Katrin Fischer 2020-10-19 00:31:20 UTC
Can someone tell me which schema these are? Trying a fix and want to test.
Comment 3 Katrin Fischer 2020-10-19 00:39:44 UTC
I used LOC and they are sorting now as described in the example, will upload a patch.
Comment 4 Katrin Fischer 2020-10-19 00:44:31 UTC Comment hidden (obsolete)
Comment 5 Andrew Fuerste-Henry 2020-10-29 22:36:04 UTC
Created attachment 112684 [details] [review]
Bug 25897: Use cn_sort for sorting callnumbers in inventory table

Instead of using the machine sortable form of the callnumber from
cn_sort the table was only sorting on the callnumber. This tries
to fix it using the same technique as for sorting the differently
formatted dates.

To test:
- If your database has items with suitably cataloged items, use
  these. Otherwise you could use the examples from the bug report:

- Catalog items with the following barcodes:
   B 29 V55 1998
   B29 .C55 2008
   B29 .L24 1983
   B29 .L264 1998
   B29 .P666 2004
  Make sure the LOC is selected in $2 as source of classification
  This makes sure the sortable form of the callnumber is calculated
  correctly.
- Go to inventory
- Search for your items
- Before patch, they should sort on callnumber as above, after the
  patch the correct sort order should be:
   B29 .C55 2008
   B29 .L24 1983
   B29 .L264 1998
   B29 .P666 2004
   B 29 V55 1998

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 6 Martin Renvoize 2020-11-03 08:13:45 UTC
Created attachment 112892 [details] [review]
Bug 25897: Use cn_sort for sorting callnumbers in inventory table

Instead of using the machine sortable form of the callnumber from
cn_sort the table was only sorting on the callnumber. This tries
to fix it using the same technique as for sorting the differently
formatted dates.

To test:
- If your database has items with suitably cataloged items, use
  these. Otherwise you could use the examples from the bug report:

- Catalog items with the following barcodes:
   B 29 V55 1998
   B29 .C55 2008
   B29 .L24 1983
   B29 .L264 1998
   B29 .P666 2004
  Make sure the LOC is selected in $2 as source of classification
  This makes sure the sortable form of the callnumber is calculated
  correctly.
- Go to inventory
- Search for your items
- Before patch, they should sort on callnumber as above, after the
  patch the correct sort order should be:
   B29 .C55 2008
   B29 .L24 1983
   B29 .L264 1998
   B29 .P666 2004
   B 29 V55 1998

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Martin Renvoize 2020-11-03 08:13:48 UTC
Created attachment 112893 [details] [review]
Bug 25897: (QA follow-up) Add filters

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Martin Renvoize 2020-11-03 08:14:06 UTC
Works as expected, Passing QA
Comment 9 Jonathan Druart 2020-11-04 12:03:24 UTC
Pushed to master for 20.11, thanks to everybody involved!