Bug 3704: SIP Checkin of not checked out item returns error without reason
authorKatrin Fischer <katrin.fischer@bsz-bw.de>
Fri, 2 Sep 2011 14:21:23 +0000 (16:21 +0200)
committerChris Cormack <chrisc@catalyst.net.nz>
Thu, 22 Sep 2011 07:39:29 +0000 (19:39 +1200)
Checking in an available item returns an error (which is correct) without
giving a reason for the failure as screen_msg (aka AF field in SIP2 is empty).

Based on code suggested by Patrick Langer <patrick.langer@easycheck.org>

Signed-off-by: Ulrich Kleiber <ulrich.kleiber@bsz-bw.de>
Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
C4/SIP/ILS.pm

index 7dc29a7..432e4f1 100644 (file)
@@ -190,12 +190,16 @@ sub checkin {
        # It's ok to check it in if it exists, and if it was checked out
        $circ->ok($item && $item->{patron});
 
-    if ($circ->ok) {
-               $circ->patron($patron = new ILS::Patron $item->{patron});
-               delete $item->{patron};
-               delete $item->{due_date};
-               $patron->{items} = [ grep {$_ ne $item_id} @{$patron->{items}} ];
-    }
+       if (!defined($item->{patron})) {
+               $circ->screen_msg("Item not checked out");
+       } else {
+               if ($circ->ok) {
+                       $circ->patron($patron = new ILS::Patron $item->{patron});
+                       delete $item->{patron};
+                       delete $item->{due_date};
+                       $patron->{items} = [ grep {$_ ne $item_id} @{$patron->{items}} ];
+               }
+       }
     # END TRANSACTION
 
     return $circ;