Bug 18958: Make hold_fill_targets specific to reserves
authorNick Clemens <nick@bywatersolutions.com>
Fri, 14 Aug 2020 11:06:40 +0000 (11:06 +0000)
committerLucas Gass <lucas@bywatersolutions.com>
Fri, 16 Oct 2020 16:45:33 +0000 (16:45 +0000)
commita120656eca586ecd2005421e37fbf8485131ea45
tree5221227c2625eaf0e7b1757cef19c9d142bbcc70
parente4b60c41566b0e602bde1301d88f3d8803ff75bc
Bug 18958: Make hold_fill_targets specific to reserves

After looking at Marcel's comments, the problem is in our matching
to hold_fill_targets - rather than adjusting to find filled/waiting holds we
could ensure that hold_fill_targets only refers to the specific hold it
is intended to

This patch is clearer, if slightly less performant than last (we now return all
the reserves and have to find the 'highest')

Test Plan:
 1 - Create and use a patron that can place multiple record level holds per record
 2 - Create a record with X items, each at a different library
 3 - Place X 'Next available' holds on the record for the patron using the 'Holds to place' box
 4 - perl misc/cronjobs/holds/build_holdsqueue.pl
 5 - Check in LibraryA's copy as LibraryA and confirm the hold
 6 - Revisit request.pl for the record, notice the next hold in line is now item-specific
 7 - Checkout the item to the patron, notice the remaining hold is marked waiting
 8 - Attempt to place another hold for your patron, notice that it requires an item-specific hold
 8 - Apply this patch
 9 - Repeat steps 1-5
10 - Revisit request.pl for the record, notice the next hold in line has *not* become item-specific
11 - Checkout the item to the patron, ensure the first hold is filled and the second remains record level
12 - Repeat whole test plan without building holds queue to confirm holds are still treated correctly

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0bfe336c7b0a8993411bd45b9e7c66228730f86d)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
C4/HoldsQueue.pm
C4/Reserves.pm
installer/data/mysql/atomicupdate/bug_18958_add_reserve_id_to_hold_fill_targets.perl [new file with mode: 0644]
installer/data/mysql/kohastructure.sql
t/db_dependent/Reserves.t