Koha-clms/reserve
Adolfo Rodríguez f81ec88697
Bug 42999: Fix $valid_items flag contamination in reserve/request.pl
$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 <adolfo.rodriguez@xercode.es>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-07-16 17:05:21 +00:00
..
hold-group.pl Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
modrequest.pl Bug 41416: Add skip_fix_priority option to ModReserve 2026-01-16 14:07:18 -07:00
modrequest_suspendall.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
placerequest.pl Bug 37762: Circulation: Hook to holds 2026-05-08 12:25:43 -06:00
request.pl Bug 42999: Fix $valid_items flag contamination in reserve/request.pl 2026-07-16 17:05:21 +00:00