[Koha-patches] [PATCH] [SIGNED-OFF] Bug 11183 - Warnings in opac

Srdjan srdjan at catalyst.net.nz
Tue Nov 12 01:23:38 CET 2013


From: Mark Tompsett <mtompset at hotmail.com>

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 <srdjan at catalyst.net.nz>
---
 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


More information about the Koha-patches mailing list