From 1ace1fc3015bb1d8e0c844f7c80529a2150ccaa2 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Thu, 9 Dec 2021 13:50:41 +0000 Subject: [PATCH] Bug 29750: Reserves.pm should check if a patron is eligible to reserve and item before confirming the reserve Test plan: 1. Create two patrons, with the following patron categories: - Patron A -> Patron - Patron B -> Student 2. Create two items attached to a single biblio record: - Book - Continuing resource 3. Create the following circ rules: Patron category, item type, Holds allowed (total), Holds allowed (daily), Holds per record (count) - Patron, Book, 0, 0, 0 - Student, Book, 1, 1, 1 - All, Continuing resources, 1, 1, 1 4. Place a title level hold on the biblio for patron A 5. Place a title level hold on the biblio for patron B 6. Checkin the Book and notice you are prompted to confirm the hold by Patron A - even though according to circ rules they cannot reserve Books 7. Apply patch and restart services 9. Checkin the Book, and notice you're prompted to confirm the hold by Patron B Sponsored-By: Catalyst IT --- C4/Reserves.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 69f81df6e1b..fc00b4b191a 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -950,6 +950,7 @@ sub CheckReserves { next if ( ($hold_fulfillment_policy eq 'homebranch') && ($res->{branchcode} ne $item->$hold_fulfillment_policy) ); next if ( ($hold_fulfillment_policy eq 'holdingbranch') && ($res->{branchcode} ne $item->$hold_fulfillment_policy) ); next unless $item->can_be_transferred( { to => Koha::Libraries->find( $res->{branchcode} ) } ); + next if (CanItemBeReserved( $patron, $item, $res->{branchcode}, { ignore_hold_counts => 1 } )->{status} ne 'OK'); $priority = $res->{'priority'}; $highest = $res; last if $local_hold_match; -- 2.20.1