From ac3f130839c98bd59c52a2410107baf895c02d0b Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 17 Jun 2020 11:41:21 -0400 Subject: [PATCH] Bug 25783: Holds Queue treating item-level holds as bib-level The holds queue builder does not honor the new item_level_hold flag. Instead, it only item_level_request if in the loop dealing with item level holds. This is incorrect. Item level holds may be trapped in the local holds priority loop as well. It's trivial to just pass though the correct item/biblio level hold flag. I do not know how to write a reproducable test plan for these issues. --- C4/HoldsQueue.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm index 5f2c2c556c..339156a5eb 100755 --- a/C4/HoldsQueue.pm +++ b/C4/HoldsQueue.pm @@ -277,7 +277,7 @@ sub GetPendingHoldRequestsForBib { my $dbh = C4::Context->dbh; my $request_query = "SELECT biblionumber, borrowernumber, itemnumber, priority, reserves.branchcode, - reservedate, reservenotes, borrowers.branchcode AS borrowerbranch, itemtype + reservedate, reservenotes, borrowers.branchcode AS borrowerbranch, itemtype, item_level_hold FROM reserves JOIN borrowers USING (borrowernumber) WHERE biblionumber = ? @@ -409,6 +409,8 @@ sub MapItemsToHoldRequests { || ( $item->{holdallowed} == 1 && $item->{homebranch} ne $request->{borrowerbranch} ); + next if $request->{itemnumber} && $request->{itemnumber} != $item->{itemnumber}; + next unless $item->{_object}->can_be_transferred( { to => $libraries->{ $request->{branchcode} } } ); my $local_holds_priority_item_branchcode = @@ -436,7 +438,7 @@ sub MapItemsToHoldRequests { holdingbranch => $item->{holdingbranch}, pickup_branch => $request->{branchcode} || $request->{borrowerbranch}, - item_level => 0, + item_level => $request->{item_level_hold}, reservedate => $request->{reservedate}, reservenotes => $request->{reservenotes}, }; @@ -475,7 +477,7 @@ sub MapItemsToHoldRequests { biblionumber => $request->{biblionumber}, holdingbranch => $items_by_itemnumber{ $request->{itemnumber} }->{holdingbranch}, pickup_branch => $request->{branchcode} || $request->{borrowerbranch}, - item_level => 1, + item_level => $request->{item_level_hold}, reservedate => $request->{reservedate}, reservenotes => $request->{reservenotes}, }; @@ -650,7 +652,7 @@ sub MapItemsToHoldRequests { biblionumber => $request->{biblionumber}, holdingbranch => $holdingbranch, pickup_branch => $pickup_branch, - item_level => 0, + item_level => $request->{item_level_hold}, reservedate => $request->{reservedate}, reservenotes => $request->{reservenotes}, }; -- 2.24.1 (Apple Git-126)