[Koha-patches] [PATCH] (Bug 3767 - Return error if checkin passed an invalid item

Colin Campbell colin.campbell at ptfs-europe.com
Wed Nov 4 22:15:55 CET 2009


If an invalid item barcode is passed to checkin
the sip2 connection dies. This is because although
no item object is created its mehods are called in Checkin
To maintain the connection properly catch the condition
and return the correct response to the unit
(should also fix Bug #3696 )
---
 C4/SIP/ILS.pm |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm
index f57bbd0..9e20845 100644
--- a/C4/SIP/ILS.pm
+++ b/C4/SIP/ILS.pm
@@ -180,7 +180,13 @@ sub checkin {
     # BEGIN TRANSACTION
     $circ->item($item = new ILS::Item $item_id);
 
-    $circ->do_checkin($current_loc, $return_date);
+    if ($item) {
+        $circ->do_checkin($current_loc, $return_date);
+    } else {
+        $circ->alert(1);
+        $circ->alert_type(99);
+        $circ->screen_msg('Invalid Item');
+    }
 	# It's ok to check it in if it exists, and if it was checked out
 	$circ->ok($item && $item->{patron});
 
-- 
1.6.2.5




More information about the Koha-patches mailing list