Bug 23403: Catch other cases of ->{patron}
authorNick Clemens <nick@bywatersolutions.com>
Mon, 13 Apr 2020 15:51:36 +0000 (15:51 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 15 May 2020 08:48:35 +0000 (09:48 +0100)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

C4/SIP/ILS.pm

index 05938d6..7cff9c0 100644 (file)
@@ -147,8 +147,8 @@ sub checkout {
     elsif ( !$item ) {
         $circ->screen_msg("Invalid Item");
     }
-    elsif ( $item->{patron}
-        && !_ci_cardnumber_cmp( $item->{patron}, $patron_id ) )
+    elsif ( $item->{borrowernumber}
+        && !_ci_cardnumber_cmp( $item->{borrowernumber}, $patron_id ) )
     {
         $circ->screen_msg("Item checked out to another patron");
     }
@@ -159,10 +159,10 @@ sub checkout {
 
             # If the item is already associated with this patron, then
             # we're renewing it.
-            $circ->renew_ok( $item->{patron}
-                  && _ci_cardnumber_cmp( $item->{patron}, $patron_id ) );
+            $circ->renew_ok( $item->{borrowernumber}
+                  && _ci_cardnumber_cmp( $item->{borrowernumber}, $patron_id ) );
 
-            $item->{patron}   = $patron_id;
+            $item->{borrowernumber}   = $patron_id;
             $item->{due_date} = $circ->{due};
             push( @{ $patron->{items} }, { barcode => $item_id } );
             $circ->desensitize( !$item->magnetic_media );
@@ -226,7 +226,7 @@ sub checkin {
     } elsif ( $data->{messages}->{WasLost} && !$circ->ok && C4::Context->preference("BlockReturnOfLostItems") ) {
             $circ->screen_msg("Item lost, return not allowed");
             siplog("LOG_DEBUG", "C4::SIP::ILS::Checkin - item lost");
-    } elsif ( !$item->{patron} ) {
+    } elsif ( !$item->{borrowernumber} ) {
         if ( $checked_in_ok ) { # Mark checkin ok although book not checked out
             $circ->ok( 1 );
             siplog("LOG_DEBUG", "C4::SIP::ILS::Checkin - using checked_in_ok");
@@ -235,8 +235,8 @@ sub checkin {
             siplog("LOG_DEBUG", "C4::SIP::ILS::Checkin - item not checked out");
         }
     } elsif ( $circ->ok ) {
-        $circ->patron( $patron = C4::SIP::ILS::Patron->new( $item->{patron} ) );
-        delete $item->{patron};
+        $circ->patron( $patron = C4::SIP::ILS::Patron->new( $item->{borrowernumber} ) );
+        delete $item->{borrowernumber};
         delete $item->{due_date};
         $patron->{items} = [ grep { $_ ne $item_id } @{ $patron->{items} } ];
     } else {