From c095df4c4459438cc4021cd2135528f97cc748c1 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 19 Jul 2019 07:52:40 -0400 Subject: [PATCH] [Koha v18.11.x] Bug 23057: If checked_in_ok is set and item is not checked out, alert flag is supressed for *any* reason Acknowledgements: Patch also contains original code by David Cook. Patches were squashed for ease of use. This patch fixes a bug from Bug 15221 and hopefully also makes it so that the alert flag is suppressed when checked_in_ok is set and an item is not checked out. To test: 0) Create patron in web interface with a cardnumber and userid of "staff" with a password that matches the account in SIPconfig.xml. Also set their branch to CPL (also matching SIPconfig.xml). 1) Create an item with a barcode of 'test' 2) Choose a patron to check out to and record their borrowernumber In one terminal: 3) cd to your git directory (e.g. /home/koha/koha) 4) perl ./C4/SIP/SIPServer.pm ~/koha-dev/etc/SIPconfig.xml In another terminal: 5) cd to your git directory (e.g. /home/koha/koha) 6) perl ./misc/sip_cli_emulator.pl -l CPL -su staff -sp --port=6001 --address=localhost --item test -m checkin --patron NOTE: You need to replace with the borrowernumber from Step 2, and with the password from Step 0. --- C4/SIP/ILS.pm | 3 +-- C4/SIP/ILS/Transaction/Checkin.pm | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm index 705c0bbb16..38068aef6c 100644 --- a/C4/SIP/ILS.pm +++ b/C4/SIP/ILS.pm @@ -206,7 +206,7 @@ sub checkin { $circ->item( $item = C4::SIP::ILS::Item->new($item_id) ); if ($item) { - $circ->do_checkin( $current_loc, $return_date ); + $circ->do_checkin( $current_loc, $return_date, $checked_in_ok ); } else { $circ->alert(1); @@ -222,7 +222,6 @@ sub checkin { } elsif( !$item->{patron} ) { if( $checked_in_ok ) { # Mark checkin ok although book not checked out $circ->ok( 1 ); - $circ->alert( 0 ); syslog("LOG_DEBUG", "C4::SIP::ILS::Checkin - using checked_in_ok"); } else { $circ->screen_msg("Item not checked out"); diff --git a/C4/SIP/ILS/Transaction/Checkin.pm b/C4/SIP/ILS/Transaction/Checkin.pm index a35009f511..10d14a41c3 100644 --- a/C4/SIP/ILS/Transaction/Checkin.pm +++ b/C4/SIP/ILS/Transaction/Checkin.pm @@ -47,6 +47,8 @@ sub do_checkin { my $self = shift; my $branch = shift; my $return_date = shift; + my $checked_in_ok = shift; + if (!$branch) { $branch = 'SIP2'; } @@ -69,6 +71,12 @@ sub do_checkin { $self->alert(!$return); # ignoring messages: NotIssued, WasLost, WasTransfered + if ( $checked_in_ok ) { + delete $messages->{NotIssued}; + delete $messages->{LocalUse}; + $return = 1 unless keys %$messages; + } + # biblionumber, biblioitemnumber, itemnumber # borrowernumber, reservedate, branchcode # cancellationdate, found, reservenotes, priority, timestamp @@ -81,6 +89,9 @@ sub do_checkin { if ($messages->{withdrawn}) { $self->alert_type('99'); } + if ($messages->{WasLost}) { + $self->alert_type('99') if C4::Context->preference("BlockReturnOfLostItems"); + } if ($messages->{Wrongbranch}) { $self->{item}->destination_loc($messages->{Wrongbranch}->{Rightbranch}); $self->alert_type('04'); # send to other branch @@ -117,7 +128,9 @@ sub do_checkin { $self->{item}->hold_patron_id( $messages->{ResFound}->{borrowernumber} ); $self->{item}->destination_loc( $messages->{ResFound}->{branchcode} ); } - $self->alert(1) if defined $self->alert_type; # alert_type could be "00", hypothetically + + $self->alert( !$return || defined $self->alert_type ); + $self->ok($return); } -- 2.20.1 (Apple Git-117)