Lines 328-338
sub CanBookBeReserved{
Link Here
|
328 |
} |
328 |
} |
329 |
|
329 |
|
330 |
my $canReserve = { status => '' }; |
330 |
my $canReserve = { status => '' }; |
331 |
my ($rights,$item); |
|
|
332 |
|
333 |
foreach my $itemnumber (@itemnumbers) { |
331 |
foreach my $itemnumber (@itemnumbers) { |
334 |
$canReserve = CanItemBeReserved( $borrowernumber, $itemnumber, $pickup_branchcode, $params ); |
332 |
$canReserve = CanItemBeReserved( $borrowernumber, $itemnumber, $pickup_branchcode, $params ); |
335 |
return { status => 'RecordHoldNotAllowed' } if $canReserve->{rights}->{opacitemholds} eq 'F'; |
333 |
my $opacitemholds = $canReserve->{rights}->{opacitemholds}; |
|
|
334 |
return { status => 'RecordHoldNotAllowed' } if $opacitemholds eq 'F'; |
335 |
return { status => 'OK' } if ( $canReserve->{status} eq 'notReservable' && $opacitemholds eq 'N' ); |
336 |
return { status => 'OK' } if $canReserve->{status} eq 'OK'; |
336 |
return { status => 'OK' } if $canReserve->{status} eq 'OK'; |
337 |
} |
337 |
} |
338 |
return $canReserve; |
338 |
return $canReserve; |
Lines 416-422
sub CanItemBeReserved {
Link Here
|
416 |
} |
416 |
} |
417 |
|
417 |
|
418 |
# we retrieve rights |
418 |
# we retrieve rights |
419 |
if ( my $rights = GetHoldRule( $borrower->{'categorycode'}, $item->effective_itemtype, $branchcode ) ) { |
419 |
my $rights; |
|
|
420 |
if ( $rights = GetHoldRule( $borrower->{'categorycode'}, $item->effective_itemtype, $branchcode ) ) { |
420 |
$ruleitemtype = $rights->{itemtype}; |
421 |
$ruleitemtype = $rights->{itemtype}; |
421 |
$allowedreserves = $rights->{reservesallowed} // $allowedreserves; |
422 |
$allowedreserves = $rights->{reservesallowed} // $allowedreserves; |
422 |
$holds_per_record = $rights->{holds_per_record} // $holds_per_record; |
423 |
$holds_per_record = $rights->{holds_per_record} // $holds_per_record; |
Lines 436-453
sub CanItemBeReserved {
Link Here
|
436 |
my $holds = Koha::Holds->search($search_params); |
437 |
my $holds = Koha::Holds->search($search_params); |
437 |
|
438 |
|
438 |
if ( $opacitemholds eq "N" ) { |
439 |
if ( $opacitemholds eq "N" ) { |
439 |
return { status => "notReservable" }; |
440 |
return { status => "notReservable", rights => $rights }; |
440 |
} |
441 |
} |
441 |
|
442 |
|
442 |
$item = Koha::Items->find( $itemnumber ); |
|
|
443 |
|
444 |
my $holds = Koha::Holds->search( |
445 |
{ |
446 |
borrowernumber => $borrowernumber, |
447 |
biblionumber => $item->biblionumber, |
448 |
} |
449 |
); |
450 |
|
451 |
if ( defined $holds_per_record && $holds_per_record ne '' |
443 |
if ( defined $holds_per_record && $holds_per_record ne '' |
452 |
&& $holds->count() >= $holds_per_record ) { |
444 |
&& $holds->count() >= $holds_per_record ) { |
453 |
return { status => "tooManyHoldsForThisRecord", limit => $holds_per_record }; |
445 |
return { status => "tooManyHoldsForThisRecord", limit => $holds_per_record }; |
Lines 2299-2305
sub GetHoldRule {
Link Here
|
2299 |
); |
2291 |
); |
2300 |
$rules->{holds_per_record} = $holds_per_x_rules->{holds_per_record}; |
2292 |
$rules->{holds_per_record} = $holds_per_x_rules->{holds_per_record}; |
2301 |
$rules->{holds_per_day} = $holds_per_x_rules->{holds_per_day}; |
2293 |
$rules->{holds_per_day} = $holds_per_x_rules->{holds_per_day}; |
2302 |
$rules->{opacitemholds} = $holds_per_x_rules->{opacitemholds}; |
2294 |
$rules->{opacitemholds} = $holds_per_x_rules->{opacitemholds} // 'Y'; |
2303 |
|
2295 |
|
2304 |
return $rules; |
2296 |
return $rules; |
2305 |
} |
2297 |
} |
2306 |
- |
|
|