use File::Spec;
use IO::File;
use YAML::Syck qw();
+use List::MoreUtils qw(any);
$YAML::Syck::ImplicitTyping = 1;
our $lang;
my $tab = $data->{ $title };
$tab = { '' => $tab } if ( ref( $tab ) eq 'ARRAY' );
+ my @override_syspref_names = split( /,/, $ENV{"OVERRIDE_SYSPREF_NAMES"} );
+
foreach my $group ( sort keys %$tab ) {
if ( $group ) {
push @lines, { is_group_title => 1, title => $group };
$name_entry->{'highlighted'} = 1;
}
}
+ $name_entry->{'overridden'} = 1 if ( any { $name eq $_ } @override_syspref_names );
push @names, $name_entry;
} else {
push @chunks, $piece;
push @chunks, { type_text => 1, contents => $piece };
}
}
-
push @lines, { CHUNKS => \@chunks, NAMES => \@names, is_group_title => 0 };
}
}
foreach my $piece ( @$line ) {
if ( ref( $piece ) eq 'HASH' ) {
- 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;
sub matches {
my ( $text, $terms ) = @_;
- return !grep( { $text !~ /$_/i } @$terms );
+ if ( $text ) { return !grep( { $text !~ /$_/i } @$terms ); }
}
my $dbh = C4::Context->dbh;
query => $input,
type => "intranet",
authnotrequired => 0,
- flagsrequired => { parameters => 1 },
+ flagsrequired => { parameters => 'parameters_remaining_permissions' },
debug => 1,
}
);
if ( $op eq 'search' ) {
my $searchfield = $input->param( 'searchfield' );
- $searchfield =~ s/[^a-zA-Z0-9_ -]//g;
+ $searchfield =~ s/\p{IsC}//g;
+ $searchfield =~ s/\s+/ /;
+ $searchfield =~ s/^\s+//;
+ $searchfield =~ s/\s+$//;
$template->param( searchfield => $searchfield );