Bug 28202

Summary: Pickup libraries not sorted by name when placing hold
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: CirculationAssignee: Fridolin Somers <fridolin.somers>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: andrewfh, david, gmcharlt, jonathan.druart, kyle.m.hall, martin.renvoize, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This corrects the sort order for library names for the pickup list when placing a hold. The list of libraries now sorts by library name, instead of the library code.
Version(s) released in:
21.05.00,20.11.06,20.05.12
Attachments: Bug 28202: Pickup libraries must be sorted by name when placing hold
Bug 28202: Unit test
Bug 28202: Pickup libraries must be sorted by name when placing hold
Bug 28202: Unit test
Bug 28202: Pickup libraries must be sorted by name when placing hold
Bug 28202: Unit test
Bug 28202: Pickup libraries must be sorted by name when placing hold

Description Fridolin Somers 2021-04-23 09:09:20 UTC
When placing hold, the pickup libraries are not sorted by name but by code.
Comment 1 Fridolin Somers 2021-04-23 09:16:03 UTC
Created attachment 120039 [details] [review]
Bug 28202: Pickup libraries must be sorted by name when placing hold

When placing hold, the pickup libraries are not sorted by name but by code.

You can see in other places : pickup_locations() calls
Koha::Libraries->search with { order_by => ['branchname'] }

Test plan :
1) Go to staff interface
2) Create a new libary with code 'AAA' and name 'ZZZ'.
2) Select a record
3) Begin placing hold
4) Look at list in "Pickup at:"
=> Without patch library 'ZZZ' is first
=> With patch library 'ZZZ' is last
Comment 2 Jonathan Druart 2021-04-23 09:23:11 UTC
Test coverage is missing.
Comment 3 Fridolin Somers 2021-04-23 10:52:13 UTC
Created attachment 120049 [details] [review]
Bug 28202: Unit test

Run prove t/db_dependent/Koha/Biblio.t

Note that sort must be case insensitive.
Comment 4 Fridolin Somers 2021-04-23 10:52:32 UTC
Created attachment 120050 [details] [review]
Bug 28202: Pickup libraries must be sorted by name when placing hold

When placing hold, the pickup libraries are not sorted by name but by code.

You can see in other places : pickup_locations() calls
Koha::Libraries->search with { order_by => ['branchname'] }

Test plan :
1) Go to staff interface
2) Create a new libary with code 'AAA' and name 'ZZZ'.
2) Select a record
3) Begin placing hold
4) Look at list in "Pickup at:"
=> Without patch library 'ZZZ' is first
=> With patch library 'ZZZ' is last
Comment 5 David Nind 2021-04-23 21:33:35 UTC
Created attachment 120142 [details] [review]
Bug 28202: Unit test

Run prove t/db_dependent/Koha/Biblio.t

Note that sort must be case insensitive.

Signed-off-by: David Nind <david@davidnind.com>
Comment 6 David Nind 2021-04-23 21:33:40 UTC
Created attachment 120143 [details] [review]
Bug 28202: Pickup libraries must be sorted by name when placing hold

When placing hold, the pickup libraries are not sorted by name but by code.

You can see in other places : pickup_locations() calls
Koha::Libraries->search with { order_by => ['branchname'] }

Test plan :
1) Go to staff interface
2) Create a new libary with code 'AAA' and name 'ZZZ'.
2) Select a record
3) Begin placing hold
4) Look at list in "Pickup at:"
=> Without patch library 'ZZZ' is first
=> With patch library 'ZZZ' is last

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 David Nind 2021-04-23 21:40:23 UTC
Testing notes (koha-testing-docker):
- I initially thought the sort order was working correctly before apply the patch
- However, koha-testing-docker sample data is nice and orderly and library codes and library names will display in the correct alphabetical order by either code or library name
- For testing I created libraries using code AAA for a library called 'Z Library', for code ZZZ for a library called "A Library"
- Then you can see that it is sorting by the library code rather than the library name before the patch is applied
Comment 8 Martin Renvoize 2021-04-27 14:10:14 UTC
Created attachment 120236 [details] [review]
Bug 28202: Unit test

Run prove t/db_dependent/Koha/Biblio.t

Note that sort must be case insensitive.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Martin Renvoize 2021-04-27 14:10:18 UTC
Created attachment 120237 [details] [review]
Bug 28202: Pickup libraries must be sorted by name when placing hold

When placing hold, the pickup libraries are not sorted by name but by code.

You can see in other places : pickup_locations() calls
Koha::Libraries->search with { order_by => ['branchname'] }

Test plan :
1) Go to staff interface
2) Create a new libary with code 'AAA' and name 'ZZZ'.
2) Select a record
3) Begin placing hold
4) Look at list in "Pickup at:"
=> Without patch library 'ZZZ' is first
=> With patch library 'ZZZ' is last

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 10 Martin Renvoize 2021-04-27 14:10:55 UTC
Nice improvement, thanks Fridolin..

Passing QA
Comment 11 Jonathan Druart 2021-04-28 09:17:13 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 12 Fridolin Somers 2021-04-30 12:14:14 UTC
Pushed to 20.11.x for 20.11.06
Comment 13 Nick Clemens 2021-05-05 18:55:01 UTC
*** Bug 26925 has been marked as a duplicate of this bug. ***
Comment 14 Andrew Fuerste-Henry 2021-05-25 11:04:45 UTC
Pushed to 20.05.x for 20.05.12
Comment 15 Victor Grousset/tuxayo 2021-05-25 13:56:35 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.