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 <liz@catalyst.net.nz>
Tests now pass

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 2f6f6d2b0c)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Tomas Cohen Arazi 2013-11-18 19:04:56 -03:00
parent f4ae9bad32
commit acfcf68d8e
1 changed files with 3 additions and 1 deletions

View File

@ -1680,7 +1680,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