From eeef00200a2b143caef227828ba1df271d6ec9b1 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 26 Jan 2017 14:31:35 +0000 Subject: [PATCH] Bug 18001 - LocalHoldsPriority can cause multiple holds queue lines for same hold request If LocalHoldsPriority is enabled, and a record level request has more than one item that could fill that hold, there is a possibility that a holds queue row will be generated for the request for each of the available items! Signed-off-by: Kyle M Hall Signed-off-by: Joel Sasse --- C4/HoldsQueue.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm index d0d752b..426fdd1 100755 --- a/C4/HoldsQueue.pm +++ b/C4/HoldsQueue.pm @@ -436,6 +436,7 @@ sub MapItemsToHoldRequests { reservenotes => $request->{reservenotes}, }; $allocated_items{ $item->{itemnumber} }++; + $request->{allocated} = 1; $num_items_remaining--; } } @@ -445,6 +446,7 @@ sub MapItemsToHoldRequests { foreach my $request (@$hold_requests) { last if $num_items_remaining == 0; + next if $request->{allocated}; # is this an item-level request? if (defined($request->{itemnumber})) { @@ -495,6 +497,7 @@ sub MapItemsToHoldRequests { my $pull_branches; foreach my $request (@$hold_requests) { last if $num_items_remaining == 0; + next if $request->{allocated}; next if defined($request->{itemnumber}); # already handled these # look for local match first -- 2.1.4