|
Lines 499-517
if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold )
Link Here
|
| 499 |
$default_pickup_branch = C4::Context->userenv->{branch}; |
499 |
$default_pickup_branch = C4::Context->userenv->{branch}; |
| 500 |
} |
500 |
} |
| 501 |
|
501 |
|
| 502 |
if ( $can_item_be_reserved eq 'itemAlreadyOnHold' ) { |
502 |
if ( |
| 503 |
# itemAlreadyOnHold cannot be overridden |
503 |
!$item->{cantreserve} |
| 504 |
$num_alreadyheld++ |
504 |
&& !$exceeded_maxreserves |
| 505 |
} |
505 |
&& $can_item_be_reserved eq 'OK' |
| 506 |
elsif ( |
506 |
# items_any_available defined outside of the current loop, |
| 507 |
( |
507 |
# so we avoiding loop inside IsAvailableForItemLevelRequest: |
| 508 |
!$item->{cantreserve} |
508 |
&& IsAvailableForItemLevelRequest($item_object, $patron, undef) |
| 509 |
&& !$exceeded_maxreserves |
|
|
| 510 |
&& $can_item_be_reserved eq 'OK' |
| 511 |
&& IsAvailableForItemLevelRequest($item_object, $patron, undef) |
| 512 |
) || C4::Context->preference('AllowHoldPolicyOverride') |
| 513 |
# If AllowHoldPolicyOverride is set, it overrides EVERY restriction |
| 514 |
# not just branch item rules |
| 515 |
) |
509 |
) |
| 516 |
{ |
510 |
{ |
| 517 |
# Send the pickup locations count to the UI, the pickup locations will be pulled using the API |
511 |
# Send the pickup locations count to the UI, the pickup locations will be pulled using the API |
|
Lines 524-540
if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold )
Link Here
|
| 524 |
my $default_pickup_location = $pickup_locations->search({ branchcode => $default_pickup_branch })->next; |
518 |
my $default_pickup_location = $pickup_locations->search({ branchcode => $default_pickup_branch })->next; |
| 525 |
$item->{default_pickup_location} = $default_pickup_location; |
519 |
$item->{default_pickup_location} = $default_pickup_location; |
| 526 |
} |
520 |
} |
| 527 |
elsif ( C4::Context->preference('AllowHoldPolicyOverride') ){ |
|
|
| 528 |
$num_items_available++; |
| 529 |
$item->{override} = 1; |
| 530 |
my $default_pickup_location = $pickup_locations->search({ branchcode => $default_pickup_branch })->next; |
| 531 |
$item->{default_pickup_location} = $default_pickup_location; |
| 532 |
} |
| 533 |
else { |
521 |
else { |
| 534 |
$item->{available} = 0; |
522 |
$item->{available} = 0; |
| 535 |
$item->{not_holdable} = "no_valid_pickup_location"; |
523 |
$item->{not_holdable} = "no_valid_pickup_location"; |
| 536 |
} |
524 |
} |
| 537 |
|
525 |
|
|
|
526 |
push( @available_itemtypes, $item->{itype} ); |
| 527 |
} |
| 528 |
elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) { |
| 529 |
# If AllowHoldPolicyOverride is set, it should override EVERY restriction, not just branch item rules |
| 530 |
# with the exception of itemAlreadyOnHold because, you know, the item is already on hold |
| 531 |
if ( $can_item_be_reserved ne 'itemAlreadyOnHold' ) { |
| 532 |
# Send the pickup locations count to the UI, the pickup locations will be pulled using the API |
| 533 |
my @pickup_locations = $item_object->pickup_locations({ patron => $patron })->as_list; |
| 534 |
$item->{pickup_locations_count} = scalar @pickup_locations; |
| 535 |
|
| 536 |
if ( @pickup_locations ) { |
| 537 |
$num_items_available++; |
| 538 |
$item->{override} = 1; |
| 539 |
|
| 540 |
my $default_pickup_location; |
| 541 |
|
| 542 |
($default_pickup_location) = grep { $_->branchcode eq $default_pickup_branch } @pickup_locations; |
| 543 |
|
| 544 |
$item->{default_pickup_location} = $default_pickup_location; |
| 545 |
} |
| 546 |
else { |
| 547 |
$item->{available} = 0; |
| 548 |
$item->{not_holdable} = "no_valid_pickup_location"; |
| 549 |
} |
| 550 |
} else { $num_alreadyheld++ } |
| 551 |
|
| 538 |
push( @available_itemtypes, $item->{itype} ); |
552 |
push( @available_itemtypes, $item->{itype} ); |
| 539 |
} else { |
553 |
} else { |
| 540 |
# If none of the conditions hold true, then neither override nor available is set and the item cannot be checked |
554 |
# If none of the conditions hold true, then neither override nor available is set and the item cannot be checked |
| 541 |
- |
|
|