Bug 20696: Fix a few ugly "eq undef" comparisons in Search.pm

Comparisons like $a eq undef should normally raise a warning like:
    Use of uninitialized value in string eq at ...
But unfortunately we still suppress warnings here and there.

Test plan:
[1] Just read this patch and confirm the small changes.
[2] Git grep on "eq undef" and do not find other occurrences.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Passes test plan and QA tools. Searching works correctly.

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Marcel de Rooy 2018-05-02 16:13:20 +02:00 committed by Nick Clemens
parent da6fde55dd
commit 69f74104d5
1 changed files with 3 additions and 4 deletions

View File

@ -2007,19 +2007,18 @@ sub searchResults {
foreach my $hostfield ( $marcrecord->field($analyticsfield)) {
my $hostbiblionumber = $hostfield->subfield("0");
my $linkeditemnumber = $hostfield->subfield("9");
if(!$hostbiblionumber eq undef){
if( $hostbiblionumber ) {
my $hostbiblio = GetMarcBiblio({
biblionumber => $hostbiblionumber,
embed_items => 1 });
my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostbiblionumber) );
if(!$hostbiblio eq undef){
if( $hostbiblio ) {
my @hostitems = $hostbiblio->field($itemfield);
foreach my $hostitem (@hostitems){
if ($hostitem->subfield("9") eq $linkeditemnumber){
my $linkeditem =$hostitem;
# append linked items if they exist
if (!$linkeditem eq undef){
push (@fields, $linkeditem);}
push @fields, $linkeditem if $linkeditem;
}
}
}