|
Lines 335-343
sub CanBookBeReserved{
Link Here
|
| 335 |
} |
335 |
} |
| 336 |
|
336 |
|
| 337 |
my $canReserve = { status => '' }; |
337 |
my $canReserve = { status => '' }; |
|
|
338 |
my ($rights,$item); |
| 339 |
|
| 338 |
foreach my $itemnumber (@itemnumbers) { |
340 |
foreach my $itemnumber (@itemnumbers) { |
| 339 |
$canReserve = CanItemBeReserved( $borrowernumber, $itemnumber, $pickup_branchcode, $params ); |
341 |
$canReserve = CanItemBeReserved( $borrowernumber, $itemnumber, $pickup_branchcode, $params ); |
|
|
342 |
my $opacitemholds = $canReserve->{rights}->{opacitemholds} // 'Y'; |
| 343 |
return { status => 'recordHoldNotAllowed' } if $opacitemholds eq 'F'; |
| 340 |
return { status => 'OK' } if $canReserve->{status} eq 'OK'; |
344 |
return { status => 'OK' } if $canReserve->{status} eq 'OK'; |
|
|
345 |
return { status => 'OK' } if $canReserve->{status} eq 'recordHoldsOnly'; |
| 341 |
} |
346 |
} |
| 342 |
return $canReserve; |
347 |
return $canReserve; |
| 343 |
} |
348 |
} |
|
Lines 381-386
sub CanItemBeReserved {
Link Here
|
| 381 |
my $biblio = $item->biblio; |
386 |
my $biblio = $item->biblio; |
| 382 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
387 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
| 383 |
my $borrower = $patron->unblessed; |
388 |
my $borrower = $patron->unblessed; |
|
|
389 |
my $context = $params->{context} // ''; |
| 384 |
|
390 |
|
| 385 |
# If an item is damaged and we don't allow holds on damaged items, we can stop right here |
391 |
# If an item is damaged and we don't allow holds on damaged items, we can stop right here |
| 386 |
return { status =>'damaged' } |
392 |
return { status =>'damaged' } |
|
Lines 445-454
sub CanItemBeReserved {
Link Here
|
| 445 |
categorycode => $borrower->{'categorycode'}, |
451 |
categorycode => $borrower->{'categorycode'}, |
| 446 |
itemtype => $item->effective_itemtype, |
452 |
itemtype => $item->effective_itemtype, |
| 447 |
branchcode => $branchcode, |
453 |
branchcode => $branchcode, |
| 448 |
rules => ['holds_per_record','holds_per_day'] |
454 |
rules => ['holds_per_record','holds_per_day','opacitemholds'] |
| 449 |
}); |
455 |
}); |
| 450 |
my $holds_per_record = $rights->{holds_per_record} // 1; |
456 |
my $holds_per_record = $rights->{holds_per_record} // 1; |
| 451 |
my $holds_per_day = $rights->{holds_per_day}; |
457 |
my $holds_per_day = $rights->{holds_per_day}; |
|
|
458 |
my $opacitemholds = $rights->{opacitemholds} // 'Y'; |
| 452 |
|
459 |
|
| 453 |
my $search_params = { |
460 |
my $search_params = { |
| 454 |
borrowernumber => $borrowernumber, |
461 |
borrowernumber => $borrowernumber, |
|
Lines 466-471
sub CanItemBeReserved {
Link Here
|
| 466 |
} |
473 |
} |
| 467 |
} |
474 |
} |
| 468 |
|
475 |
|
|
|
476 |
$item = Koha::Items->find( $itemnumber ); |
| 477 |
|
| 478 |
$holds = Koha::Holds->search( |
| 479 |
{ |
| 480 |
borrowernumber => $borrowernumber, |
| 481 |
biblionumber => $item->biblionumber, |
| 482 |
} |
| 483 |
); |
| 484 |
|
| 469 |
my $today_holds = Koha::Holds->search({ |
485 |
my $today_holds = Koha::Holds->search({ |
| 470 |
borrowernumber => $borrowernumber, |
486 |
borrowernumber => $borrowernumber, |
| 471 |
reservedate => dt_from_string->date |
487 |
reservedate => dt_from_string->date |
|
Lines 585-591
sub CanItemBeReserved {
Link Here
|
| 585 |
} |
601 |
} |
| 586 |
} |
602 |
} |
| 587 |
|
603 |
|
| 588 |
return { status => 'OK' }; |
604 |
if ( $opacitemholds eq "N" && $context ne 'staff') { |
|
|
605 |
return { status => "recordHoldsOnly", right => $rights }; |
| 606 |
} |
| 607 |
|
| 608 |
return { status => 'OK', rights => $rights }; |
| 589 |
} |
609 |
} |
| 590 |
|
610 |
|
| 591 |
=head2 CanReserveBeCanceledFromOpac |
611 |
=head2 CanReserveBeCanceledFromOpac |