From b55bcec4df33ac9f7cd8a197d44158ca764f8662 Mon Sep 17 00:00:00 2001 From: Shi Yao Wang Date: Mon, 27 Jun 2022 11:18:05 -0400 Subject: [PATCH] Bug 29922: Make get_search_groups return results sorted by title MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- Koha/Library/Groups.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/Library/Groups.pm b/Koha/Library/Groups.pm index 6b251fdbfa..f8f8e221e6 100644 --- a/Koha/Library/Groups.pm +++ b/Koha/Library/Groups.pm @@ -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' } ); } -- 2.25.1