Browse Source

Bug 13411: Koha's SIP server returns not ok for checking in items that are not checked out

If an item is not checked out when a checkin via SIP2 is attempted,
Koha's SIP server sends back an "ok" of 0, and the AF message "Item
not checked out". I am not entirely sure this is good and correct
behavior by the SIP2 protocol.

In particular, this will cause SIP2 book sorting devices to fail on
all items that are not checked out, causing them all to be put into
the "special handling" been that should be reserved for things like
items checked in at the wrong library and items on hold.

Test Plan:
1) Apply the patch for bug 13159 so you can use the new enhanced
   SIP2 command line emulator
2) Use a command similar to the following to check in an item:
   sip_cli_emulator.pl -a localhost -su <sip user> -sp <sip password> -l <instituation id> --item <barcode> -m checkin
3) Note the 3rd character is 0, and there is an AF field saying the item is not checked out
4) Apply this patch
5) Restart the SIP server
6) Repeat steps 2-3, note that nothing has changed
7) In the SIP config file, Add the parameter checked_in_ok="1" to the SIP account you are using.
8) Restart the SIP server
9) Repeat steps 2-3, note that this time the 3rd character is 1, and you do not recieve the item not checked out message.

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
3.22.x
Kyle Hall 7 years ago
committed by Tomas Cohen Arazi
parent
commit
181d3aa56d
  1. 43
      C4/SIP/ILS.pm
  2. 2
      C4/SIP/Sip/MsgType.pm
  3. 2
      etc/SIPconfig.xml

43
C4/SIP/ILS.pm

@ -175,34 +175,39 @@ 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 = C4::SIP::ILS::Transaction::Checkin->new();
# BEGIN TRANSACTION
$circ->item($item = C4::SIP::ILS::Item->new( $item_id));
$circ->item( $item = C4::SIP::ILS::Item->new($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 = C4::SIP::ILS::Patron->new( $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
# or it was not checked out but the checked_in_ok flag was set
$circ->ok( ( $checked_in_ok && $item ) || ( $item && $item->{patron} ) );
if ( !defined( $item->{patron} ) ) {
$circ->screen_msg("Item not checked out") unless $checked_in_ok;
}
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} } ];
}
}
# END TRANSACTION
return $circ;

2
C4/SIP/Sip/MsgType.pm

@ -643,7 +643,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;

2
etc/SIPconfig.xml

@ -36,7 +36,7 @@
</listeners>
<accounts>
<login id="term1" password="term1" delimiter="|" error-detect="enabled" institution="CPL" encoding="ascii" />
<login id="term1" password="term1" delimiter="|" error-detect="enabled" institution="CPL" encoding="ascii" checked_in_ok="1" />
<login id="koha" password="koha" delimiter="|" error-detect="enabled" institution="kohalibrary" encoding="utf8" />
<login id="koha2" password="koha" institution="kohalibrary2" terminator="CR" />
<login id="lpl-sc" password="1234" institution="LPL" />

Loading…
Cancel
Save