From 78c11c51c0683aba727fe6bfd34bca1b45b51e6b Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 6 Jun 2019 12:42:46 -0400 Subject: [PATCH] Bug 23057: Update do_checkin Signed-off-by: Kyle M Hall Signed-off-by: Matha Fuerst Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize (cherry picked from commit 17f5547b3492bbf31a5e63ce0568c4bc31100421) Signed-off-by: Fridolin Somers --- C4/Circulation.pm | 1 + C4/SIP/ILS/Transaction/Checkin.pm | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 84349d98cf..b82879dbb5 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1945,6 +1945,7 @@ sub AddReturn { } if ( $item->itemlost and C4::Context->preference("BlockReturnOfLostItems") ) { + $messages->{'ReturnOfLostItemBlocked'}; $doreturn = 0; } diff --git a/C4/SIP/ILS/Transaction/Checkin.pm b/C4/SIP/ILS/Transaction/Checkin.pm index 67d0b1d792..eed26c1544 100644 --- a/C4/SIP/ILS/Transaction/Checkin.pm +++ b/C4/SIP/ILS/Transaction/Checkin.pm @@ -70,13 +70,12 @@ sub do_checkin { $debug and warn "do_checkin() calling AddReturn($barcode, $branch)"; my ($return, $messages, $issue, $borrower) = AddReturn($barcode, $branch, undef, dt_from_string($return_date)); - if ($checked_in_ok){ - $debug and warn 'not raising alert when AddReturn() does not return a value for $return due to $checked_in_ok being set to true'; - } - else { - $self->alert(!$return); + + if ( $checked_in_ok ) { + delete $messages->{NotIssued}; + delete $messages->{LocalUse}; + $return = 1 unless keys %$messages; } - # ignoring messages: NotIssued, WasLost, WasTransfered # biblionumber, biblioitemnumber, itemnumber # borrowernumber, reservedate, branchcode @@ -90,6 +89,9 @@ sub do_checkin { if ($messages->{withdrawn}) { $self->alert_type('99'); } + if ($messages->{ReturnOfLostItemBlocked}) { + $self->alert_type('99'); + } if ($messages->{Wrongbranch}) { $self->{item}->destination_loc($messages->{Wrongbranch}->{Rightbranch}); $self->alert_type('04'); # send to other branch @@ -126,12 +128,13 @@ sub do_checkin { $self->{item}->hold_patron_id( $messages->{ResFound}->{borrowernumber} ); $self->{item}->destination_loc( $messages->{ResFound}->{branchcode} ); } + # ignoring messages: NotIssued, WasLost, WasTransfered - my $alert = defined $self->alert_type; - if ( $cv_triggers_alert ) { - $self->alert($alert); # Overwrites existing alert value, should set to 0 if there is no alert type - } else { - $self->alert($alert) if $alert; # Doesn't affect alert value unless an alert type is set + if ($cv_triggers_alert) { + $self->alert( defined $self->alert_type ); # Overwrites existing alert value, should set to 0 if there is no alert type + } + else { + $self->alert( !$return || defined $self->alert_type ); } $self->ok($return); -- 2.39.5