$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>