@@ -, +, @@ SIP2 command line emulator sip_cli_emulator.pl -a localhost -su -sp -l --item -m checkin --- C4/SIP/ILS.pm | 42 +++++++++++++++++++++++------------------- C4/SIP/Sip/MsgType.pm | 2 +- etc/SIPconfig.xml | 2 +- 3 files changed, 25 insertions(+), 21 deletions(-) --- a/C4/SIP/ILS.pm +++ a/C4/SIP/ILS.pm @@ -172,34 +172,38 @@ sub checkout { } sub checkin { - my ($self, $item_id, $trans_date, $return_date, - $current_loc, $item_props, $cancel) = @_; - my ($patron, $item, $circ); + my ( $self, $item_id, $trans_date, $return_date, $current_loc, $item_props, $cancel, $checked_in_ok ) = @_; + my ( $patron, $item, $circ ); $circ = new ILS::Transaction::Checkin; + # BEGIN TRANSACTION - $circ->item($item = new ILS::Item $item_id); + $circ->item( $item = new ILS::Item $item_id); if ($item) { - $circ->do_checkin($current_loc, $return_date); - } else { + $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}); - - 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}} ]; - } - } + + # It's ok to check it in if it exists, and if it was checked out + $circ->ok( $item && $item->{patron} ); + + if ( !defined( $item->{patron} ) && !$checked_in_ok ) { + $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; --- a/C4/SIP/Sip/MsgType.pm +++ a/C4/SIP/Sip/MsgType.pm @@ -639,7 +639,7 @@ sub handle_checkin { syslog("LOG_WARNING", "received no-block checkin from terminal '%s'", $account->{id}); $status = $ils->checkin_no_block($item_id, $trans_date, $return_date, $item_props, $cancel); } else { - $status = $ils->checkin($item_id, $trans_date, $return_date, $my_branch, $item_props, $cancel); + $status = $ils->checkin($item_id, $trans_date, $return_date, $my_branch, $item_props, $cancel, $account->{checked_in_ok}); } $patron = $status->patron; --- a/etc/SIPconfig.xml +++ a/etc/SIPconfig.xml @@ -36,7 +36,7 @@ - + --