Adding a check for an empty value in a couple of places
which seem to always get one.
As far as I can tell these places in the script are looping
over ALL the data in the pref files, and sometimes an empty
value comes through. I wonder if this is because of a minor
syntax error in the pref file?
My correction is a stab in the dark since I haven't determined
where the empty value is actually coming from. This change
quiets the errors in the log and doesn't seem to affect
preference search results.
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
No more messages in the logs. Yay!
Ran unit tests on this (t, xt/author, xt, t/db_dependent)- nothing out of the ordinary in any.
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
foreach my $piece ( @$line ) {
if ( ref( $piece ) eq 'HASH' ) {
+ if ( !$piece->{'pref'} ){ next; }
if ( $piece->{'pref'} =~ /^$searchfield$/i ) {
my ( undef, $LINES ) = TransformPrefsToHTML( $data, $searchfield );
sub matches {
my ( $text, $terms ) = @_;
- return !grep( { $text !~ /$_/i } @$terms );
+ if ( $text ) { return !grep( { $text !~ /$_/i } @$terms ); }
}
my $dbh = C4::Context->dbh;