From ba551c55de447d2e8107b24a60c5936839719226 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 26 Jul 2019 18:53:03 +0000 Subject: [PATCH] Bug 23388: Sort the tab results when searching Before this patch we can get the matching tabs back in any order To test: 1 - Search system preferences for 'field' 2 - Refresh the page a few times 3 - Note results are reordered 4 - Apply patch 5 - Refresh the page several times again 6 - Results are consistent --- admin/preferences.pl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/admin/preferences.pl b/admin/preferences.pl index 92c5bbee72..1bce61ba5b 100755 --- a/admin/preferences.pl +++ b/admin/preferences.pl @@ -229,7 +229,7 @@ sub SearchPrefs { my %tab_files = _get_pref_files( $input ); our @terms = split( /\s+/, $searchfield ); - foreach my $tab_name ( keys %tab_files ) { + foreach my $tab_name ( sort keys %tab_files ) { # Force list context to remove 'uninitialized value in goto' warn coming from YAML::Syck; note that the other GetTab call is in list context too. The actual cause however is the null value for the pref OpacRenewalBranch in opac.pref my ($data) = GetTab( $input, $tab_name ); my $title = ( keys( %$data ) )[0]; @@ -237,7 +237,6 @@ sub SearchPrefs { $tab = { '' => $tab } if ( ref( $tab ) eq 'ARRAY' ); my $matched_groups; - while ( my ( $group_title, $contents ) = each %$tab ) { if ( matches( $group_title, \@terms ) ) { $matched_groups->{$group_title} = $contents; -- 2.11.0