From 963ad03e6bbad0d0b6fd9ab15ec14cee88b9b812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Rodr=C3=ADguez?= Date: Mon, 6 Jul 2026 13:11:16 +0200 Subject: [PATCH] Bug 42999: Fix $valid_items flag contamination in reserve/request.pl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit $valid_items was set inside the per-item availability check but used as the gate of a separate if block, causing it to carry over across loop iterations. Once any item set it to 1, all subsequent items entered the if ($valid_items) branch and received $item->{available} = 1 regardless of their individual availability. Fix: merge the two consecutive if blocks into one so the pickup-location logic only executes when the current item individually passes all availability conditions. $valid_items continues to serve its correct post-loop role (line 661: none_available_override). Regression introduced by Bug 38412 (commit 1900effc9b). Steps to follow: 1. Create a biblio with at least two items: one with a holdable item type and one with a not-for-loan item type (itemtypes.notforloan=1). The not-for-loan item must have a higher itemnumber than at least one holdable item (i.e. it is processed later in the loop). 2. Open reserve/request.pl?biblionumber=X&borrowernumber=Y 3. Observe that the not-for-loan item shows a radio button and a pickup location dropdown despite the Information column showing "Not for loan (Itemtype not for loan)" — bug confirmed. 4. Apply this patch and restart services. If running under Plack, restarting Plack is required for the change to take effect. 5. Reload the place-hold page. 6. Verify the not-for-loan item now shows "X Not for loan" without a radio button or pickup location dropdown. 7. Verify the holdable items still show radio buttons and pickup location dropdowns correctly. Signed-off-by: Adolfo Rodríguez Signed-off-by: David Nind Signed-off-by: Martin Renvoize Signed-off-by: Lucas Gass --- reserve/request.pl | 3 --- 1 file changed, 3 deletions(-) diff --git a/reserve/request.pl b/reserve/request.pl index 337f19b3c8..81ebca8724 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -578,9 +578,6 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) ) { $valid_items = 1; - } - - if ($valid_items) { # Send the pickup locations count to the UI, the pickup locations will be pulled using the API my $pickup_locations = $item_object->pickup_locations( { patron => $patron } );