From 0b5514528cf521facc367035a9acfb950029ea03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joonas=20Kylm=C3=A4l=C3=A4?= Date: Wed, 17 Oct 2018 12:45:55 +0000 Subject: [PATCH] Bug 21572: Remove unnecessary SIP checkout code regarding holds The loop that checks whether "Item is on hold shelf for another patron" is already done in C4::Circulation::CanBookBeIssued() so we don't have to do it again but just trust it to tell us the confirmation message "RESERVE_WAITING" when it is someone else's hold that the patron tries to checkout. This removes also the message "Item was reserved for you." since it could have have never appeared since RESERVED confirmation message comes only when the item is reserved to another patron. To test: 1. Apply patch 2. Have a biblio record with one item A 3. Make a hold on item A for patron Y (bib level or item, doesn't matter) 4. Check in item A in intranet so that it goes to Waiting status 5. Try to checkout item A for patron X with the SIP server 6. Checkout should fail with message "Item is on hold shelf for another patron." 1. Apply patch 2. Have a biblio record with two items A and B 3. Make a hold on item A for patron Y (bib level or item, doesn't matter) 4. Check in item A in intranet so that it goes to Waiting status 5. Try to checkout item B for patron X with the SIP server 6. Checkout should succeed 1. Apply patch 2. Make sure AllowItemsOnHoldCheckout is set "Don't allow" 3. Have a biblio record with one item A 4. Make a hold on item A for patron Y (bib level or item, doesn't matter) 5. Try to checkout item A for patron X with the SIP server 6. Checkout should fail with message "Item is reserved for another patron upon return." --- C4/SIP/ILS/Transaction/Checkout.pm | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/C4/SIP/ILS/Transaction/Checkout.pm b/C4/SIP/ILS/Transaction/Checkout.pm index e05166a1a8..1fa988ac43 100644 --- a/C4/SIP/ILS/Transaction/Checkout.pm +++ b/C4/SIP/ILS/Transaction/Checkout.pm @@ -71,14 +71,14 @@ sub do_checkout { foreach my $confirmation (keys %{$needsconfirmation}) { if ($confirmation eq 'RENEW_ISSUE'){ $self->screen_msg("Item already checked out to you: renewing item."); - } elsif ($confirmation eq 'RESERVED' or $confirmation eq 'RESERVE_WAITING') { - my $x = $self->{item}->available($patron_barcode); - if ($x) { - $self->screen_msg("Item was reserved for you."); - } else { - $self->screen_msg("Item is reserved for another patron upon return."); - $noerror = 0; - } + } elsif ($confirmation eq 'RESERVED') { + $self->screen_msg("Item is reserved for another patron upon return."); + $noerror = 0; + last; + } elsif ($confirmation eq 'RESERVE_WAITING') { + $self->screen_msg("Item is on hold shelf for another patron."); + $noerror = 0; + last; } elsif ($confirmation eq 'ISSUED_TO_ANOTHER') { $self->screen_msg("Item already checked out to another patron. Please return item for check-in."); $noerror = 0; @@ -105,15 +105,6 @@ sub do_checkout { } } my $itemnumber = $self->{item}->{itemnumber}; - foreach (@$shelf) { - $debug and warn "shelf has ($_->{itemnumber} for $_->{borrowernumber}). this is ($itemnumber, $self->{patron}->{borrowernumber})"; - ($_->{itemnumber} eq $itemnumber) or next; # skip it if not this item - ($_->{borrowernumber} == $self->{patron}->{borrowernumber}) and last; - # if item was waiting for this patron, we're done. AddIssue takes care of the "W" hold. - $debug and warn "Item is on hold shelf for another patron."; - $self->screen_msg("Item is on hold shelf for another patron."); - $noerror = 0; - } my ($fee, undef) = GetIssuingCharges($itemnumber, $self->{patron}->{borrowernumber}); if ( $fee > 0 ) { $self->{sip_fee_type} = '06'; -- 2.17.1