Bugzilla – Attachment 75224 Details for
Bug 20696
Remove a few ugly "eq undef" comparisons
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20696: Fix a few ugly "eq undef" comparisons in Search.pm
Bug-20696-Fix-a-few-ugly-eq-undef-comparisons-in-S.patch (text/plain), 2.12 KB, created by
Owen Leonard
on 2018-05-10 14:43:26 UTC
(
hide
)
Description:
Bug 20696: Fix a few ugly "eq undef" comparisons in Search.pm
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2018-05-10 14:43:26 UTC
Size:
2.12 KB
patch
obsolete
>From 5dbab0a48f6e7e51e9efeae9c844f8b287795a33 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 2 May 2018 16:13:20 +0200 >Subject: [PATCH] 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. >--- > C4/Search.pm | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index f474271..10973e3 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -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; > } > } > } >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20696
:
74982
|
75224
|
75402