@@ -, +, @@
forced when override is allowed
pickup library match" is "item's home library"
You should not be able to place a hold because there is no valid
pickup locations
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
---
.../prog/en/modules/reserve/request.tt | 4 +-
reserve/request.pl | 54 ++++++++-----------
2 files changed, 23 insertions(+), 35 deletions(-)
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
@@ -799,7 +799,7 @@
[% END # /IF force_hold_level %]
- [% IF (itemloo.pickup_locations_count > 0) %]
+ [% IF (itemloo.pickup_locations_count > 0) || itemloo.override %]
userenv->{branch};
}
- if (
- !$item->{cantreserve}
- && !$exceeded_maxreserves
- && $can_item_be_reserved eq 'OK'
- # items_any_available defined outside of the current loop,
- # so we avoiding loop inside IsAvailableForItemLevelRequest:
- && IsAvailableForItemLevelRequest($item_object, $patron, undef, $items_any_available)
+ if ( $can_item_be_reserved eq 'itemAlreadyOnHold' ) {
+ # itemAlreadyOnHold cannot be overridden
+ $num_alreadyheld++
+ }
+ elsif (
+ (
+ !$item->{cantreserve}
+ && !$exceeded_maxreserves
+ && $can_item_be_reserved eq 'OK'
+ # items_any_available defined outside of the current loop,
+ # so we avoiding loop inside IsAvailableForItemLevelRequest:
+ && IsAvailableForItemLevelRequest($item_object, $patron, undef, $items_any_available)
+ ) || C4::Context->preference('AllowHoldPolicyOverride')
+ # If AllowHoldPolicyOverride is set, it overrides EVERY restriction
+ # not just branch item rules
)
{
# Send the pickup locations count to the UI, the pickup locations will be pulled using the API
@@ -522,37 +530,17 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold )
my $default_pickup_location = $pickup_locations->search({ branchcode => $default_pickup_branch })->next;
$item->{default_pickup_location} = $default_pickup_location;
}
+ elsif ( C4::Context->preference('AllowHoldPolicyOverride') ){
+ $num_items_available++;
+ $item->{override} = 1;
+ my $default_pickup_location = $pickup_locations->search({ branchcode => $default_pickup_branch })->next;
+ $item->{default_pickup_location} = $default_pickup_location;
+ }
else {
$item->{available} = 0;
$item->{not_holdable} = "no_valid_pickup_location";
}
- push( @available_itemtypes, $item->{itype} );
- }
- elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) {
- # If AllowHoldPolicyOverride is set, it should override EVERY restriction, not just branch item rules
- # with the exception of itemAlreadyOnHold because, you know, the item is already on hold
- if ( $can_item_be_reserved ne 'itemAlreadyOnHold' ) {
- # 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 })->as_list;
- $item->{pickup_locations_count} = scalar @pickup_locations;
-
- if ( @pickup_locations ) {
- $num_items_available++;
- $item->{override} = 1;
-
- my $default_pickup_location;
-
- ($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";
- }
- } else { $num_alreadyheld++ }
-
push( @available_itemtypes, $item->{itype} );
} else {
# If none of the conditions hold true, then neither override nor available is set and the item cannot be checked
--