Lines 481-499
foreach my $biblioNum (@biblionumbers) {
Link Here
|
481 |
|
481 |
|
482 |
my $branch = Koha::Policy::Holds->holds_control_library( $item, $patron ); |
482 |
my $branch = Koha::Policy::Holds->holds_control_library( $item, $patron ); |
483 |
|
483 |
|
484 |
my $policy_holdallowed = |
484 |
my $item_status = CanItemBeReserved( $patron, $item, undef, { get_from_cache => 1 } )->{status}; |
485 |
CanItemBeReserved( $patron, $item, undef, { get_from_cache => 1 } )->{status} eq 'OK' && |
485 |
|
486 |
IsAvailableForItemLevelRequest($item, $patron, undef); |
486 |
if ( $item_status eq 'recordHoldsOnly' ) { |
|
|
487 |
$biblioLoopIter{force_hold} = 1; |
488 |
$biblioLoopIter{itemholdable} = 0; |
489 |
$biblioLoopIter{forced_hold_level} = 'record'; |
490 |
} |
491 |
|
492 |
my $policy_holdallowed = IsAvailableForItemLevelRequest( $item, $patron, undef ) |
493 |
&& ( $item_status eq 'OK' or $item_status eq 'recordHoldsOnly' ); |
487 |
|
494 |
|
488 |
if ($policy_holdallowed) { |
495 |
if ($policy_holdallowed) { |
489 |
my $opac_hold_policy = Koha::CirculationRules->get_opacitemholds_policy( { item => $item, patron => $patron } ); |
496 |
$numCopiesAvailable++; |
490 |
if ( $opac_hold_policy ne 'N' ) { # If Y or F |
497 |
if ( $item_status ne 'recordHoldsOnly' ) { |
491 |
$item_info->{available} = 1; |
|
|
492 |
$numCopiesOPACAvailable++; |
498 |
$numCopiesOPACAvailable++; |
493 |
$biblioLoopIter{force_hold} = 1 if $opac_hold_policy eq 'F'; |
499 |
$item_info->{available} = 1; |
494 |
} |
500 |
} |
495 |
$numCopiesAvailable++; |
|
|
496 |
|
497 |
unless ( $can_place_hold_if_available_at_pickup ) { |
501 |
unless ( $can_place_hold_if_available_at_pickup ) { |
498 |
my $items_in_this_library = Koha::Items->search({ biblionumber => $item->biblionumber, holdingbranch => $item->holdingbranch, notforloan => 0 }); |
502 |
my $items_in_this_library = Koha::Items->search({ biblionumber => $item->biblionumber, holdingbranch => $item->holdingbranch, notforloan => 0 }); |
499 |
my $nb_of_items_issued = $items_in_this_library->search({ 'issue.itemnumber' => { not => undef }}, { join => 'issue' })->count; |
503 |
my $nb_of_items_issued = $items_in_this_library->search({ 'issue.itemnumber' => { not => undef }}, { join => 'issue' })->count; |
Lines 543-551
foreach my $biblioNum (@biblionumbers) {
Link Here
|
543 |
} |
547 |
} |
544 |
} |
548 |
} |
545 |
|
549 |
|
546 |
my $status = CanBookBeReserved( $borrowernumber, $biblioNum )->{status}; |
550 |
my $record_status = CanBookBeReserved( $borrowernumber, $biblioNum )->{status}; |
547 |
$biblioLoopIter{holdable} &&= $status eq 'OK'; |
551 |
if ($record_status eq 'recordHoldNotAllowed') { |
548 |
$biblioLoopIter{$status} = 1; |
552 |
$biblioLoopIter{force_hold} = 1; |
|
|
553 |
$biblioLoopIter{itemholdable} = 1; |
554 |
$biblioLoopIter{forced_hold_level} = 'item'; |
555 |
$biblioLoopIter{holdable} &&= 1; |
556 |
} |
557 |
else { |
558 |
$biblioLoopIter{holdable} &&= $record_status eq 'OK'; |
559 |
} |
549 |
|
560 |
|
550 |
if ( $biblioLoopIter{holdable} and C4::Context->preference('AllowHoldItemTypeSelection') ) { |
561 |
if ( $biblioLoopIter{holdable} and C4::Context->preference('AllowHoldItemTypeSelection') ) { |
551 |
# build the allowed item types loop |
562 |
# build the allowed item types loop |
Lines 563-569
foreach my $biblioNum (@biblionumbers) {
Link Here
|
563 |
$biblioLoopIter{allowed_item_types} = \@item_types; |
574 |
$biblioLoopIter{allowed_item_types} = \@item_types; |
564 |
} |
575 |
} |
565 |
|
576 |
|
566 |
if ( $status eq 'recall' ) { |
577 |
if ( $record_status eq 'recall' ) { |
567 |
$biblioLoopIter{recall} = 1; |
578 |
$biblioLoopIter{recall} = 1; |
568 |
} |
579 |
} |
569 |
|
580 |
|
Lines 623-629
if (
Link Here
|
623 |
C4::Context->preference( 'OPACAllowHoldDateInFuture' ) |
634 |
C4::Context->preference( 'OPACAllowHoldDateInFuture' ) |
624 |
) { |
635 |
) { |
625 |
$template->param( |
636 |
$template->param( |
626 |
reserve_in_future => 1, |
637 |
reserve_in_future => 1, |
627 |
); |
638 |
); |
628 |
} |
639 |
} |
629 |
|
640 |
|
630 |
- |
|
|