From 2f6f6d2b0c4d4e8a4ed5ab17fbbf66393f8a2c69 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 18 Nov 2013 19:04:56 -0300 Subject: [PATCH] Bug 11269: fix incorrect use of MARC::Field->subfield() MARC::Record 2.0.6+ enables the warnings pragma, and as a consequence, started logging cases where a routine in C4::Search was calling MARC::Field->subfield() with an undef subfield label. This patch removes the log noise. To test: - Run prove -v t/db_dependent/Search.t - There will be warnings about "Use of uninitialized value $code_wanted in string" in MARC::Field. - Apply the patch. - Those warnings are gone. Signed-off-by: Liz Rea Tests now pass Signed-off-by: Galen Charlton --- C4/Search.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/C4/Search.pm b/C4/Search.pm index bec1f89cd9..cd43ea4f56 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1681,7 +1681,9 @@ sub searchResults { while ( ( my $column ) = $sth2->fetchrow ) { my ( $tagfield, $tagsubfield ) = &GetMarcFromKohaField( "items." . $column, "" ); - $subfieldstosearch{$column} = $tagsubfield; + if ( defined $tagsubfield ) { + $subfieldstosearch{$column} = $tagsubfield; + } } # handle which records to actually retrieve -- 2.39.5