From a2ee6443b9643ad0780ad62ef63d0a06d5c674f0 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Fri, 2 Sep 2011 16:21:23 +0200 Subject: [PATCH] Bug 3704: SIP Checkin of not checked out item returns error without reason 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 Signed-off-by: Ulrich Kleiber Signed-off-by: Ian Walls Signed-off-by: Chris Cormack --- C4/SIP/ILS.pm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm index 7dc29a7511..432e4f1892 100644 --- a/C4/SIP/ILS.pm +++ b/C4/SIP/ILS.pm @@ -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; -- 2.39.5