+ 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
+ # or it was not checked out but the checked_in_ok flag was set
+ $circ->ok( ( $checked_in_ok && $item ) || ( $item && $item->{patron} ) );
+ syslog("LOG_DEBUG", "C4::SIP::ILS::checkin - using checked_in_ok") if $checked_in_ok;
+
+ if ( !defined( $item->{patron} ) ) {
+ $circ->screen_msg("Item not checked out") unless $checked_in_ok;
+ syslog("LOG_DEBUG", "C4::SIP::ILS::checkin - item not checked out");
+ }
+ else {
+ if ( $circ->ok ) {
+ $circ->patron( $patron = C4::SIP::ILS::Patron->new( $item->{patron} ) );
+ delete $item->{patron};
+ delete $item->{due_date};
+ $patron->{items} = [ grep { $_ ne $item_id } @{ $patron->{items} } ];
+ }
+ }
+