From 474b3eb7c35014588dd26ad0a011499525b1ee1b Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Sun, 10 Nov 2013 23:26:43 -0500 Subject: [PATCH] [SIGNED-OFF] Bug 11183 - Warnings in opac This may affect staff as well. During testing of Srdjan Jankovic's patch, the following error message was triggered: opac-search.pl: Use of uninitialized value $code_wanted in string eq at /usr/share/perl5/MARC/Field.pm line 314. This was traced to a bad call on subfields in C4::Search. By adding an if check around the call, this warning is no longer triggered. Signed-off-by: Srdjan --- C4/Search.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/C4/Search.pm b/C4/Search.pm index bec1f89..32f7c36 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1835,7 +1835,9 @@ sub searchResults { # populate the items hash foreach my $code ( keys %subfieldstosearch ) { - $item->{$code} = $field->subfield( $subfieldstosearch{$code} ); + if ( defined( $subfieldstosearch{$code} ) ) { + $item->{$code} = $field->subfield( $subfieldstosearch{$code} ); + } } $item->{description} = $itemtypes{ $item->{itype} }{description}; -- 1.8.1.2