From e89e5f5b8ef32e53afa41fe05afc87d98201206e Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 15 Nov 2018 10:43:00 -0500 Subject: [PATCH] Bug 21745: Checkin of withdrawn items marked successful via SIP2 when BlockReturnOfWithdrawnItems is enabled --- C4/SIP/ILS.pm | 20 ++++++++++---------- C4/SIP/ILS/Transaction/Checkin.pm | 2 ++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm index 1bd23c6429..7dfc023ffe 100644 --- a/C4/SIP/ILS.pm +++ b/C4/SIP/ILS.pm @@ -219,14 +219,6 @@ 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} ) { - 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"); - } else { - $circ->screen_msg("Item not checked out"); - syslog("LOG_DEBUG", "C4::SIP::ILS::Checkin - item not checked out"); - } } elsif( $circ->ok ) { $circ->patron( $patron = C4::SIP::ILS::Patron->new( $item->{patron} ) ); delete $item->{patron}; @@ -236,8 +228,16 @@ sub checkin { # Checkin failed: Wrongbranch or withdrawn? # Bug 10748 with pref BlockReturnOfLostItems adds another case to come # here: returning a lost item when the pref is set. - $circ->screen_msg("Checkin failed"); - syslog( "LOG_WARNING", "Checkin failed: probably for Wrongbranch or withdrawn" ); + if( $checked_in_ok && $circ->error_messages->{NotIssued} && scalar keys %{ $circ->error_messages } == 1 ) { # Mark checkin ok although book not checked out + $circ->ok( 1 ); + syslog("LOG_DEBUG", "C4::SIP::ILS::Checkin - using checked_in_ok"); + } elsif ( $circ->error_messages->{NotIssued} ) { + $circ->screen_msg("Item not checked out"); + syslog("LOG_DEBUG", "C4::SIP::ILS::Checkin - item not checked out"); + } else { + $circ->screen_msg("Checkin failed"); + syslog( "LOG_WARNING", "Checkin failed: probably for Wrongbranch or withdrawn" ); + } } return $circ; diff --git a/C4/SIP/ILS/Transaction/Checkin.pm b/C4/SIP/ILS/Transaction/Checkin.pm index a35009f511..8c5e810fc7 100644 --- a/C4/SIP/ILS/Transaction/Checkin.pm +++ b/C4/SIP/ILS/Transaction/Checkin.pm @@ -29,6 +29,7 @@ my %fields = ( hold_patron_id => undef, hold_patron_name => "", hold => undef, + error_messages => undef, ); sub new { @@ -66,6 +67,7 @@ sub do_checkin { $debug and warn "do_checkin() calling AddReturn($barcode, $branch)"; my ($return, $messages, $issue, $borrower) = AddReturn($barcode, $branch, undef, undef, $return_date); + $self->error_messages($messages); $self->alert(!$return); # ignoring messages: NotIssued, WasLost, WasTransfered -- 2.17.2 (Apple Git-113)