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