Bug 8761 Dont inadvertantly use slices
authorColin Campbell <colin.campbell@ptfs-europe.com>
Tue, 11 Sep 2012 17:49:35 +0000 (18:49 +0100)
committerPaul Poulain <paul.poulain@biblibre.com>
Thu, 13 Sep 2012 15:56:38 +0000 (17:56 +0200)
Assignment to a single element slice is better written
as a scalar - This generates a compile time warning as it
can lead to odd behaviour see perldiag for details
This corrects some cases which were added in a recent
commit

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
C4/Circulation.pm

index 48b7b4a..7bb00d5 100644 (file)
@@ -982,16 +982,16 @@ sub CanBookBeIssued {
         # Index points to the next value
         my $restrictionyear = 0;
         if (($take <= $#values) && ($take >= 0)){
-            $restrictionyear += @values[$take];
+            $restrictionyear += $values[$take];
         }
 
         if ($restrictionyear > 0) {
             if ( $borrower->{'dateofbirth'}  ) {
                 my @alloweddate =  split /-/,$borrower->{'dateofbirth'} ;
-                @alloweddate[0] += $restrictionyear;
+                $alloweddate[0] += $restrictionyear;
                 #Prevent runime eror on leap year (invalid date)
-                if ((@alloweddate[1] == 2) && (@alloweddate[2] == 29)) {
-                    @alloweddate[2] = 28;
+                if (($alloweddate[1] == 2) && ($alloweddate[2] == 29)) {
+                    $alloweddate[2] = 28;
                 }
 
                 if ( Date_to_Days(Today) <  Date_to_Days(@alloweddate) -1  ) {