Bug 43448: Remove meaningless conditional

We are in a conditional based on AllowHoldPolicyOverride being enabled,
a second conditional with an OR on the value will always be true

To test:
 1 - Do not apply patch
 2 - Disable AllowHoldPolicyOverride
 3 - Create a biblio B with an item I at library A.
 4 - Configure this library A to not be a pickup location
 5 - Add a "Default holds policy by item type" for item I type where "Hold
    pickup library match" is "item's home library"
 6 - Try to place a hold on biblio B
    You should not be able to place a hold because there is no valid
    pickup locations
 7 - Enable AllowHoldPolicyOverride
 8 - Try to place a hold on biblio B
    You should now see all valid pickup locations in a dropdown list
    (with an exclamation mark in front of each option) with none selected
    by default
 9 - Verify you can place a title-level hold and an item-level hold
10 - Apply patch, repeat test plan, verify nothing has changed

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Nick Clemens 2026-09-02 12:25:20 +00:00 committed by Pedro Amorim
parent 6b0dcc83d9
commit b37d6989e5
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 7 additions and 12 deletions

View File

@ -607,21 +607,16 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold )
my @pickup_locations = $item_object->pickup_locations( { patron => $patron } )->as_list;
$item->{pickup_locations_count} = scalar @pickup_locations;
if ( @pickup_locations || C4::Context->preference('AllowHoldPolicyOverride') ) {
$num_items_available++;
$item->{override} = 1;
$num_override++;
$num_items_available++;
$item->{override} = 1;
$num_override++;
my $default_pickup_location;
my $default_pickup_location;
($default_pickup_location) =
grep { $_->branchcode eq $default_pickup_branch } @pickup_locations;
($default_pickup_location) =
grep { $_->branchcode eq $default_pickup_branch } @pickup_locations;
$item->{default_pickup_location} = $default_pickup_location;
} else {
$item->{available} = 0;
$item->{not_holdable} = "no_valid_pickup_location";
}
$item->{default_pickup_location} = $default_pickup_location;
} else {
$num_alreadyheld++;
}