Bug 6679 - [SIGNED-OFF] fix 3 perlcritic violations in C4/Items.pm
authorMason James <mtj@kohaaloha.com>
Tue, 26 Jun 2012 14:50:50 +0000 (02:50 +1200)
committerPaul Poulain <paul.poulain@biblibre.com>
Thu, 20 Sep 2012 10:01:39 +0000 (12:01 +0200)
"return" statement with explicit "undef" at line 508, column 44.  See page 199 of PBP.  (Severity: 5)
"return" statement with explicit "undef" at line 2267, column 5.  See page 199 of PBP.  (Severity: 5)
Variable declared in conditional statement at line 2642, column 21.  Declare variables outside of the condition.  (Severity: 5)

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
C4/Items.pm

index e9af3dd..c114e63 100644 (file)
@@ -530,7 +530,7 @@ sub ModItem {
         $item->{'more_subfields_xml'} = _get_unlinked_subfields_xml($unlinked_item_subfields);
     };
 
-    $item->{'itemnumber'} = $itemnumber or return undef;
+    $item->{'itemnumber'} = $itemnumber or return;
 
     $item->{onloan} = undef if $item->{itemlost};
 
@@ -2293,7 +2293,7 @@ sub _koha_delete_item {
     # delete from items table
     $sth = $dbh->prepare("DELETE FROM items WHERE itemnumber=?");
     $sth->execute($itemnum);
-    return undef;
+    return;
 }
 
 =head2 _marc_from_item_hash
@@ -2668,7 +2668,10 @@ sub PrepareItemrecordDisplay {
                 if (   ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.location' )
                     && $defaultvalues
                     && $defaultvalues->{'location'} ) {
-                    my $temp = $itemrecord->field($subfield) if ($itemrecord);
+
+                    my $temp; # make perlcritic happy :)
+                    $temp = $itemrecord->field($subfield) if ($itemrecord);
+
                     unless ($temp) {
                         $defaultvalue = $defaultvalues->{location} if $defaultvalues;
                     }