Bug 29922: Make get_search_groups return results sorted by title
authorShi Yao Wang <shi-yao.wang@inlibro.com>
Mon, 27 Jun 2022 15:18:05 +0000 (11:18 -0400)
committerTomas Cohen Arazi <tomascohen@theke.io>
Mon, 18 Jul 2022 18:11:35 +0000 (15:11 -0300)
get_search_groups from Koha/Library/Groups.pm returns library groups sorted by title.

Test plan:
1- Go to administration > library groups and create multiple library groups with different names (e.g. AGroup, BGroup, ÄGroup, etc.). Make sure to tick "Use for OPAC search groups" checkbox.
2- Go to advanced search in OPAC.
3- Under "Groups of librairies" , click the select button.
4- Notice that the library groups are not in alphabetical order.
5- Apply the patch.
6- Notice that the library groups are in alphabetical order.
7- Run `prove t/db_dependent/LibraryGroups.t` and all test should pass.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Koha/Library/Groups.pm

index 6b251fd..f8f8e22 100644 (file)
@@ -61,7 +61,7 @@ sub get_search_groups {
 
     my $field = $interface eq 'staff' ? 'ft_search_groups_staff' : 'ft_search_groups_opac';
 
-    return $self->search( { $field => 1 } );
+    return $self->search( { $field => 1 }, { order_by => 'title' } );
 }