Bug 8887: only display desired result when doing exact syspref search
[koha.git] / admin / preferences.pl
index 2182591..09d648f 100755 (executable)
@@ -21,7 +21,6 @@ use strict;
 use warnings;
 
 use CGI;
-
 use C4::Auth;
 use C4::Context;
 use C4::Koha;
@@ -35,7 +34,6 @@ use File::Spec;
 use IO::File;
 use YAML::Syck qw();
 $YAML::Syck::ImplicitTyping = 1;
-$YAML::Syck::ImplicitUnicode = 1; # force utf-8 for preference encoding
 our $lang;
 
 # use Smart::Comments;
@@ -218,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;
@@ -297,8 +293,7 @@ if ( $op eq 'save' ) {
 my @TABS;
 
 if ( $op eq 'search' ) {
-    my $searchfield = $input->param('searchfield');
-    utf8::decode($searchfield);
+    my $searchfield = $input->param( 'searchfield' );
 
     $searchfield =~ s/\p{IsC}//g;
     $searchfield =~ s/\s+/ /;