Bug 32127 - Sort patron categories by description in templates
Summary: Sort patron categories by description in templates
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Fridolin Somers
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-07 21:40 UTC by Fridolin Somers
Modified: 2023-11-02 16:13 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.05,22.05.13


Attachments
Bug 32127: Sort by description in Koha::Template::Plugin::Categories (1.52 KB, patch)
2022-11-07 21:50 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 32127: Sort by description in Koha::Template::Plugin::Categories (1.57 KB, patch)
2022-11-08 12:09 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 32127: Sort by description in Koha::Template::Plugin::Categories (1.63 KB, patch)
2022-11-13 14:47 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32127: Add unit test (2.14 KB, patch)
2023-03-29 08:53 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 32127: Sort by description in Koha::Template::Plugin::Categories (1.63 KB, patch)
2023-03-29 08:54 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 32127: Add unit test (2.14 KB, patch)
2023-03-29 08:54 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 32127: Sort by description in Koha::Template::Plugin::Categories (1.68 KB, patch)
2023-04-03 14:57 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 32127: Add unit test (2.20 KB, patch)
2023-04-03 14:57 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 32127: Sort by description in Koha::Template::Plugin::Categories (1.74 KB, patch)
2023-04-09 12:24 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32127: Add unit test (2.25 KB, patch)
2023-04-09 12:24 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 Fridolin Somers 2022-11-07 21:40:19 UTC

    
Comment 1 Fridolin Somers 2022-11-07 21:50:57 UTC
Created attachment 143382 [details] [review]
Bug 32127: Sort by description in Koha::Template::Plugin::Categories

Like in Koha::Template::Plugin::Branches, methods in
Koha::Template::Plugin::Categories must return categories sorted by
description.

Test plan :
1) Create a new patron category with code ZZZ and description AAAAAA
2) Go to patron search /cgi-bin/koha/members/members-home.pl
3) Look at filter by category :
=> Without patch the value AAAAAA is last
=> With patch the value AAAAAA is first
4) Click on 'New patron'
=> Without patch the value AAAAAA is last
=> With patch the value AAAAAA is first
Comment 2 Owen Leonard 2022-11-08 12:09:00 UTC
Created attachment 143391 [details] [review]
Bug 32127: Sort by description in Koha::Template::Plugin::Categories

Like in Koha::Template::Plugin::Branches, methods in
Koha::Template::Plugin::Categories must return categories sorted by
description.

Test plan :
1) Create a new patron category with code ZZZ and description AAAAAA
2) Go to patron search /cgi-bin/koha/members/members-home.pl
3) Look at filter by category :
=> Without patch the value AAAAAA is last
=> With patch the value AAAAAA is first
4) Click on 'New patron'
=> Without patch the value AAAAAA is last
=> With patch the value AAAAAA is first

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 3 Katrin Fischer 2022-11-13 14:47:16 UTC
Created attachment 143815 [details] [review]
Bug 32127: Sort by description in Koha::Template::Plugin::Categories

Like in Koha::Template::Plugin::Branches, methods in
Koha::Template::Plugin::Categories must return categories sorted by
description.

Test plan :
1) Create a new patron category with code ZZZ and description AAAAAA
2) Go to patron search /cgi-bin/koha/members/members-home.pl
3) Look at filter by category :
=> Without patch the value AAAAAA is last
=> With patch the value AAAAAA is first
4) Click on 'New patron'
=> Without patch the value AAAAAA is last
=> With patch the value AAAAAA is first

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 4 Katrin Fischer 2022-11-13 14:48:37 UTC
Good catch!
Comment 5 Tomás Cohen Arazi 2022-11-14 12:24:39 UTC
Makes sense, needs regression tests though.
Comment 6 Fridolin Somers 2022-11-17 07:45:07 UTC
Indeed.

I've tried to add in t/db_dependent/Template/Plugin/Categories.t.
But I don't know how to manage the existing categories.

Any help is welcome :D
Comment 7 Fridolin Somers 2023-03-29 08:53:22 UTC
Created attachment 148890 [details] [review]
Bug 32127: Add unit test

Run prove t/db_dependent/Template/Plugin/Categories.t
Comment 8 Fridolin Somers 2023-03-29 08:54:09 UTC
Created attachment 148891 [details] [review]
Bug 32127: Sort by description in Koha::Template::Plugin::Categories

Like in Koha::Template::Plugin::Branches, methods in
Koha::Template::Plugin::Categories must return categories sorted by
description.

Test plan :
1) Create a new patron category with code ZZZ and description AAAAAA
2) Go to patron search /cgi-bin/koha/members/members-home.pl
3) Look at filter by category :
=> Without patch the value AAAAAA is last
=> With patch the value AAAAAA is first
4) Click on 'New patron'
=> Without patch the value AAAAAA is last
=> With patch the value AAAAAA is first

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Fridolin Somers 2023-03-29 08:54:12 UTC
Created attachment 148892 [details] [review]
Bug 32127: Add unit test

Run prove t/db_dependent/Template/Plugin/Categories.t
Comment 10 Lucas Gass 2023-04-03 14:55:38 UTC
This works and tests pass. On /cgi-bin/koha/members/members-home.pl the dropdown sorts by description. 

If you click 'New patron', it sorts by description. 

If you are in '/members/memberentry.pl' and click the dropdown for 'Category:' it still sorts by code. 

I will sign-off here and we can address that in separate bug.
Comment 11 Lucas Gass 2023-04-03 14:57:39 UTC
Created attachment 149099 [details] [review]
Bug 32127: Sort by description in Koha::Template::Plugin::Categories

Like in Koha::Template::Plugin::Branches, methods in
Koha::Template::Plugin::Categories must return categories sorted by
description.

Test plan :
1) Create a new patron category with code ZZZ and description AAAAAA
2) Go to patron search /cgi-bin/koha/members/members-home.pl
3) Look at filter by category :
=> Without patch the value AAAAAA is last
=> With patch the value AAAAAA is first
4) Click on 'New patron'
=> Without patch the value AAAAAA is last
=> With patch the value AAAAAA is first

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 12 Lucas Gass 2023-04-03 14:57:41 UTC
Created attachment 149100 [details] [review]
Bug 32127: Add unit test

Run prove t/db_dependent/Template/Plugin/Categories.t

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 13 Katrin Fischer 2023-04-09 12:24:27 UTC
Created attachment 149364 [details] [review]
Bug 32127: Sort by description in Koha::Template::Plugin::Categories

Like in Koha::Template::Plugin::Branches, methods in
Koha::Template::Plugin::Categories must return categories sorted by
description.

Test plan :
1) Create a new patron category with code ZZZ and description AAAAAA
2) Go to patron search /cgi-bin/koha/members/members-home.pl
3) Look at filter by category :
=> Without patch the value AAAAAA is last
=> With patch the value AAAAAA is first
4) Click on 'New patron'
=> Without patch the value AAAAAA is last
=> With patch the value AAAAAA is first

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 14 Katrin Fischer 2023-04-09 12:24:30 UTC
Created attachment 149365 [details] [review]
Bug 32127: Add unit test

Run prove t/db_dependent/Template/Plugin/Categories.t

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 15 Tomás Cohen Arazi 2023-04-14 14:19:46 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 16 Matt Blenkinsop 2023-04-18 12:06:06 UTC
Nice work everyone!

Pushed to stable for 22.11.x
Comment 17 Lucas Gass 2023-05-05 22:16:54 UTC
Backported to 22.05.x for upcoming 22.05.13
Comment 18 Arthur Suzuki 2023-05-23 11:57:56 UTC
conflicts on 21.11. can't backport.