From 328346a1ca43e22f2c62d5e900d0460fd668bfea Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Tue, 23 Sep 2025 13:48:05 +0000 Subject: [PATCH] Bug 40529: (QA follow-up): Add skip logic to GetPendingHoldRequestsForBib This fixes the issue reported by Andrew on comment 23. Following the scenario he describes, the hold should now still appear, but attached to the correct patron (Patron B). This was an oversight as I wasn't aware of GetPendingHoldRequestsForBib and had only added the skip logic to GetBibsWithPendingHoldRequests. Signed-off-by: Andrew Fuerste Henry --- C4/HoldsQueue.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm index 49e3827d802..bcb00e81c11 100644 --- a/C4/HoldsQueue.pm +++ b/C4/HoldsQueue.pm @@ -267,7 +267,6 @@ sub GetBibsWithPendingHoldRequests { $sth->execute(); my $biblionumbers = $sth->fetchall_arrayref(); - return [ map { $_->[0] } @$biblionumbers ]; } @@ -299,6 +298,9 @@ sub GetPendingHoldRequestsForBib { my $dbh = C4::Context->dbh; + my $skip_non_target_holds_query = Koha::HoldGroup::skip_non_target_holds_query('sql'); + my $skip_non_target_holds_query_sql = $skip_non_target_holds_query ? " $skip_non_target_holds_query" : ''; + my $request_query = "SELECT biblionumber, borrowernumber, itemnumber, priority, reserve_id, reserves.branchcode, reservedate, reservenotes, borrowers.branchcode AS borrowerbranch, itemtype, item_level_hold, item_group_id FROM reserves @@ -309,6 +311,7 @@ sub GetPendingHoldRequestsForBib { AND reservedate <= CURRENT_DATE() AND suspend = 0 "; $request_query .= "AND reserve_id NOT IN (SELECT reserve_id FROM hold_fill_targets) " if $unallocated; + $request_query .= $skip_non_target_holds_query_sql; $request_query .= "ORDER BY priority"; my $sth = $dbh->prepare($request_query); $sth->execute($biblionumber); -- 2.39.5