From 9769c0c9d8eeaf19e0d597177b8e8b44f57ccb70 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 7 Jan 2019 12:46:29 -0500 Subject: [PATCH] Bug 22076 - SIP checkin for withdrawn item returns ok in checkin response If an item that is withdrawn is checked in via SIP2, Koha does not process the checkin, but still indicates the checkin succeeded via the ok flag in the checkin response message. To recreate: 1 - Mark an item withdrawn 2 - Set up sip server: https://wiki.koha-community.org/wiki/Koha_SIP2_server_setup 3 - Set 'BlockReturnOfWithdrawnItems' to block 4 - Use the sip_cli_emulator to checkin the withdrawn item 5 - There is no error in the checkin Test Plan: 1) Mark an item withdrawn 2) Set BlockReturnOfWithdrawnItems to block 3) Use the sip cli emulator to checkin the withdrawn item 4) Note the response begins with 101 5) Apply this patch 6) Restart all the things ( including SIP server ) 7) Repeat checkin with sip cli emulator 8) Note the checkin now beings with 100 --- C4/SIP/ILS.pm | 5 +++-- C4/SIP/ILS/Transaction/Checkin.pm | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm index 1bd23c6429..7ef67b3610 100644 --- a/C4/SIP/ILS.pm +++ b/C4/SIP/ILS.pm @@ -205,8 +205,9 @@ sub checkin { # BEGIN TRANSACTION $circ->item( $item = C4::SIP::ILS::Item->new($item_id) ); + my $data; if ($item) { - $circ->do_checkin( $current_loc, $return_date ); + $data = $circ->do_checkin( $current_loc, $return_date ); } else { $circ->alert(1); @@ -219,7 +220,7 @@ sub checkin { if( !$circ->ok && $circ->alert_type && $circ->alert_type == 98 ) { # data corruption $circ->screen_msg("Checkin failed: data problem"); syslog( "LOG_WARNING", "Problem with issue_id in issues and old_issues; check the about page" ); - } elsif( !$item->{patron} ) { + } elsif( !$item->{patron} && !$data->{messages}->{withdrawn} ) { if( $checked_in_ok ) { # Mark checkin ok although book not checked out $circ->ok( 1 ); syslog("LOG_DEBUG", "C4::SIP::ILS::Checkin - using checked_in_ok"); diff --git a/C4/SIP/ILS/Transaction/Checkin.pm b/C4/SIP/ILS/Transaction/Checkin.pm index a35009f511..7655ae4255 100644 --- a/C4/SIP/ILS/Transaction/Checkin.pm +++ b/C4/SIP/ILS/Transaction/Checkin.pm @@ -119,6 +119,8 @@ sub do_checkin { } $self->alert(1) if defined $self->alert_type; # alert_type could be "00", hypothetically $self->ok($return); + + return { messages => $messages }; } sub resensitize { -- 2.17.2 (Apple Git-113)