From 6a36d7ba4ad1ae0a268ba939a9f90bc605f8fa30 Mon Sep 17 00:00:00 2001 From: Marc Veron Date: Sun, 7 Oct 2012 19:54:44 +0200 Subject: [PATCH] Bug 8887 Search preferences: Strange behaviour with exact matches (default instead of custom favicon used, displays to much results) Content-Type: text/plain; charset="utf-8" Removed superfluous test on exact match in preferences.pl (with return straight out the loop) Test scenario: a) Make sure you have defined a custom favicon using syspref IntranetFavicon b) In sysprefs, do a search with partioal match (e.g. intranetcolor) -> Result shows one entry: intranetcolorstylesheet, and favicon (in browser tab) displays as expected. d) Do an exact search. e.g. intranetcolorstylesheet -> Result shows all Staff Client preferences. Favicon (in browser tab) falls back to the Koha default icon Apply patch, test again. Now d) behaves like b), favicon displays as expected. --- admin/preferences.pl | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/admin/preferences.pl b/admin/preferences.pl index db91e76..09d648f 100755 --- a/admin/preferences.pl +++ b/admin/preferences.pl @@ -216,12 +216,10 @@ sub SearchPrefs { foreach my $piece ( @$line ) { if ( ref( $piece ) eq 'HASH' ) { - if ( !$piece->{'pref'} ){ next; } - if ( $piece->{'pref'} =~ /^$searchfield$/i ) { - my ( undef, $LINES ) = TransformPrefsToHTML( $data, $searchfield ); - - return { search_jumped => 1, tab => $tab_name, tab_title => $title, LINES => $LINES }; - } elsif ( matches( $piece->{'pref'}, \@terms) ) { + if ( !$piece->{'pref'} ){ + next; + } + if ( matches( $piece->{'pref'}, \@terms) ) { $matched = 1; } elsif ( ref( $piece->{'choices'} ) eq 'HASH' && grep( { $_ && matches( $_, \@terms ) } values( %{ $piece->{'choices'} } ) ) ) { $matched = 1; -- 1.7.2.5