Bug 38126: Skip allocated holds when filling from transport cost matrix

This patch simply weeds out allocated holds before filling from the matrix

To test:
 1 - Enable RealTimeHoldsQueue
 2 - Enable UseTransportCostMatrix
 3 - Enable LocalHoldsPriority Give/Home/Home
 4 - Administration - Transport cost matrix - enable transfers to/from Centreville and other libraries, add a cost, and save
 5 - Find a bib with a Centerville item
 6 - Place a hold for a centerville patron
 7 - Circulation - Holds queue - All libraries
 8 - Note hold is entered twice
 9 - On command line:
    perl misc/cronjobs/holds/build_holds_queue.pl --force
10 - Run holds queue again, still there twice
11 - Apply patch
12 - On command line:
    perl misc/cronjobs/holds/build_holds_queue.pl --force
    Confirm allocated only once
13 - Delete hold, place again from bib record (to test real time allocation)
14 - Confirm allocated only once

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4ed5e6c248)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2024-10-08 18:10:46 +00:00 committed by Lucas Gass
parent 1c2e7237e3
commit 86e453d05d
1 changed files with 1 additions and 1 deletions

View File

@ -421,7 +421,7 @@ sub _allocateWithTransportCostMatrix {
my @remaining_items = grep { !exists $allocated_items->{ $_->{itemnumber} } && $_->{holdallowed} ne 'not_allowed'; }
@$available_items;
my @requests = grep { !defined $_->{itemnumber} } @$hold_requests;
my @requests = grep { !defined $_->{itemnumber} && !defined $_->{allocated} } @$hold_requests;
my @remaining = ();
my $num_agents = scalar(@remaining_items);