Lines 425-430
sub CanBookBeReserved{
Link Here
|
425 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
425 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
426 |
while ( my $item = $items->next ) { |
426 |
while ( my $item = $items->next ) { |
427 |
$canReserve = CanItemBeReserved( $patron, $item, $pickup_branchcode, $params ); |
427 |
$canReserve = CanItemBeReserved( $patron, $item, $pickup_branchcode, $params ); |
|
|
428 |
if ( C4::Context->interface eq 'opac' ) { |
429 |
my $opacitemholds = Koha::CirculationRules->get_opacitemholds_policy({ item => $item, |
430 |
patron => $patron }) // 'Y'; |
431 |
return { status => 'recordHoldNotAllowed' } if $opacitemholds eq 'F'; |
432 |
return { status => 'OK' } if $canReserve->{status} eq 'recordHoldsOnly'; |
433 |
} |
428 |
return { status => 'OK' } if $canReserve->{status} eq 'OK'; |
434 |
return { status => 'OK' } if $canReserve->{status} eq 'OK'; |
429 |
} |
435 |
} |
430 |
return $canReserve; |
436 |
return $canReserve; |
Lines 466-472
sub CanItemBeReserved {
Link Here
|
466 |
my ( $patron, $item, $pickup_branchcode, $params ) = @_; |
472 |
my ( $patron, $item, $pickup_branchcode, $params ) = @_; |
467 |
|
473 |
|
468 |
my $memory_cache = Koha::Cache::Memory::Lite->get_instance(); |
474 |
my $memory_cache = Koha::Cache::Memory::Lite->get_instance(); |
469 |
$CanItemBeReserved_cache_key = sprintf "Hold_CanItemBeReserved:%s:%s:%s", $patron->borrowernumber, $item->itemnumber, $pickup_branchcode || ""; |
475 |
$CanItemBeReserved_cache_key = sprintf "Hold_CanItemBeReserved:%s:%s:%s", $patron->id, $item->itemnumber, $pickup_branchcode || ""; |
470 |
if ( $params->{get_from_cache} ) { |
476 |
if ( $params->{get_from_cache} ) { |
471 |
my $cached = $memory_cache->get_from_cache($CanItemBeReserved_cache_key); |
477 |
my $cached = $memory_cache->get_from_cache($CanItemBeReserved_cache_key); |
472 |
return $cached if $cached; |
478 |
return $cached if $cached; |
Lines 551-560
sub CanItemBeReserved {
Link Here
|
551 |
categorycode => $borrower->{'categorycode'}, |
557 |
categorycode => $borrower->{'categorycode'}, |
552 |
itemtype => $item->effective_itemtype, |
558 |
itemtype => $item->effective_itemtype, |
553 |
branchcode => $reserves_control_branch, |
559 |
branchcode => $reserves_control_branch, |
554 |
rules => ['holds_per_record','holds_per_day'] |
560 |
rules => ['holds_per_record','holds_per_day','opacitemholds'] |
555 |
}); |
561 |
}); |
556 |
my $holds_per_record = $rights->{holds_per_record} // 1; |
562 |
my $holds_per_record = $rights->{holds_per_record} // 1; |
557 |
my $holds_per_day = $rights->{holds_per_day}; |
563 |
my $holds_per_day = $rights->{holds_per_day}; |
|
|
564 |
my $opacitemholds = $rights->{opacitemholds} // 'Y'; |
558 |
|
565 |
|
559 |
if ( defined $holds_per_record && $holds_per_record ne '' ){ |
566 |
if ( defined $holds_per_record && $holds_per_record ne '' ){ |
560 |
if ( $holds_per_record == 0 ) { |
567 |
if ( $holds_per_record == 0 ) { |
Lines 691-696
sub CanItemBeReserved {
Link Here
|
691 |
} |
698 |
} |
692 |
} |
699 |
} |
693 |
|
700 |
|
|
|
701 |
if ( $opacitemholds eq "N" && C4::Context->interface eq 'opac') { |
702 |
return _cache { status => "recordHoldsOnly" }; |
703 |
} |
704 |
|
694 |
return _cache { status => 'OK' }; |
705 |
return _cache { status => 'OK' }; |
695 |
} |
706 |
} |
696 |
|
707 |
|
Lines 2021-2027
sub _ShiftPriority {
Link Here
|
2021 |
$sth = $dbh->prepare( $query ); |
2032 |
$sth = $dbh->prepare( $query ); |
2022 |
$sth->execute( $new_priority, $biblio ); |
2033 |
$sth->execute( $new_priority, $biblio ); |
2023 |
while ( my $row = $sth->fetchrow_hashref ) { |
2034 |
while ( my $row = $sth->fetchrow_hashref ) { |
2024 |
$sth_update->execute( $biblio, $row->{borrowernumber}, $row->{reservedate} ); |
2035 |
$sth_update->execute( $biblio, $row->{borrowernumber}, $row->{reservedate} ); |
2025 |
} |
2036 |
} |
2026 |
|
2037 |
|
2027 |
return $new_priority; # so the caller knows what priority they wind up receiving |
2038 |
return $new_priority; # so the caller knows what priority they wind up receiving |