Lines 422-430
sub CanBookBeReserved{
Link Here
|
422 |
} |
422 |
} |
423 |
|
423 |
|
424 |
my $canReserve = { status => '' }; |
424 |
my $canReserve = { status => '' }; |
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( |
430 |
{ |
431 |
item => $item, |
432 |
patron => $patron |
433 |
} |
434 |
) // 'Y'; |
435 |
return { status => 'recordHoldNotAllowed' } if $opacitemholds eq 'F'; |
436 |
return { status => 'OK' } if $canReserve->{status} eq 'recordHoldsOnly'; |
437 |
} |
428 |
return { status => 'OK' } if $canReserve->{status} eq 'OK'; |
438 |
return { status => 'OK' } if $canReserve->{status} eq 'OK'; |
429 |
} |
439 |
} |
430 |
return $canReserve; |
440 |
return $canReserve; |
Lines 466-472
sub CanItemBeReserved {
Link Here
|
466 |
my ( $patron, $item, $pickup_branchcode, $params ) = @_; |
476 |
my ( $patron, $item, $pickup_branchcode, $params ) = @_; |
467 |
|
477 |
|
468 |
my $memory_cache = Koha::Cache::Memory::Lite->get_instance(); |
478 |
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 || ""; |
479 |
$CanItemBeReserved_cache_key = sprintf "Hold_CanItemBeReserved:%s:%s:%s", $patron->id, $item->itemnumber, $pickup_branchcode || ""; |
470 |
if ( $params->{get_from_cache} ) { |
480 |
if ( $params->{get_from_cache} ) { |
471 |
my $cached = $memory_cache->get_from_cache($CanItemBeReserved_cache_key); |
481 |
my $cached = $memory_cache->get_from_cache($CanItemBeReserved_cache_key); |
472 |
return $cached if $cached; |
482 |
return $cached if $cached; |
Lines 551-560
sub CanItemBeReserved {
Link Here
|
551 |
categorycode => $borrower->{'categorycode'}, |
561 |
categorycode => $borrower->{'categorycode'}, |
552 |
itemtype => $item->effective_itemtype, |
562 |
itemtype => $item->effective_itemtype, |
553 |
branchcode => $reserves_control_branch, |
563 |
branchcode => $reserves_control_branch, |
554 |
rules => ['holds_per_record','holds_per_day'] |
564 |
rules => ['holds_per_record','holds_per_day','opacitemholds'] |
555 |
}); |
565 |
}); |
556 |
my $holds_per_record = $rights->{holds_per_record} // 1; |
566 |
my $holds_per_record = $rights->{holds_per_record} // 1; |
557 |
my $holds_per_day = $rights->{holds_per_day}; |
567 |
my $holds_per_day = $rights->{holds_per_day}; |
|
|
568 |
my $opacitemholds = $rights->{opacitemholds} // 'Y'; |
558 |
|
569 |
|
559 |
if ( defined $holds_per_record && $holds_per_record ne '' ){ |
570 |
if ( defined $holds_per_record && $holds_per_record ne '' ){ |
560 |
if ( $holds_per_record == 0 ) { |
571 |
if ( $holds_per_record == 0 ) { |
Lines 691-696
sub CanItemBeReserved {
Link Here
|
691 |
} |
702 |
} |
692 |
} |
703 |
} |
693 |
|
704 |
|
|
|
705 |
if ( $opacitemholds eq "N" && C4::Context->interface eq 'opac' ) { |
706 |
return _cache { status => "recordHoldsOnly" }; |
707 |
} |
708 |
|
694 |
return _cache { status => 'OK' }; |
709 |
return _cache { status => 'OK' }; |
695 |
} |
710 |
} |
696 |
|
711 |
|
Lines 2021-2027
sub _ShiftPriority {
Link Here
|
2021 |
$sth = $dbh->prepare( $query ); |
2036 |
$sth = $dbh->prepare( $query ); |
2022 |
$sth->execute( $new_priority, $biblio ); |
2037 |
$sth->execute( $new_priority, $biblio ); |
2023 |
while ( my $row = $sth->fetchrow_hashref ) { |
2038 |
while ( my $row = $sth->fetchrow_hashref ) { |
2024 |
$sth_update->execute( $biblio, $row->{borrowernumber}, $row->{reservedate} ); |
2039 |
$sth_update->execute( $biblio, $row->{borrowernumber}, $row->{reservedate} ); |
2025 |
} |
2040 |
} |
2026 |
|
2041 |
|
2027 |
return $new_priority; # so the caller knows what priority they wind up receiving |
2042 |
return $new_priority; # so the caller knows what priority they wind up receiving |