From 860ea0ed77df29cbfad9389fae5fc2d914f35f65 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 --- C4/SIP/ILS.pm | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm index 9e20845..f61f5ba 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; -- 1.7.0.4