Lines 326-336
sub CanBookBeReserved{
Link Here
|
326 |
} |
326 |
} |
327 |
|
327 |
|
328 |
my $canReserve = { status => '' }; |
328 |
my $canReserve = { status => '' }; |
329 |
my ($rights,$item); |
|
|
330 |
|
331 |
foreach my $itemnumber (@itemnumbers) { |
329 |
foreach my $itemnumber (@itemnumbers) { |
332 |
$canReserve = CanItemBeReserved( $borrowernumber, $itemnumber, $pickup_branchcode, $params ); |
330 |
$canReserve = CanItemBeReserved( $borrowernumber, $itemnumber, $pickup_branchcode, $params ); |
333 |
return { status => 'RecordHoldNotAllowed' } if $canReserve->{rights}->{opacitemholds} eq 'F'; |
331 |
my $opacitemholds = $canReserve->{rights}->{opacitemholds}; |
|
|
332 |
return { status => 'RecordHoldNotAllowed' } if $opacitemholds eq 'F'; |
333 |
return { status => 'OK' } if ( $canReserve->{status} eq 'notReservable' && $opacitemholds eq 'N' ); |
334 |
return { status => 'OK' } if $canReserve->{status} eq 'OK'; |
334 |
return { status => 'OK' } if $canReserve->{status} eq 'OK'; |
335 |
} |
335 |
} |
336 |
return $canReserve; |
336 |
return $canReserve; |
Lines 414-420
sub CanItemBeReserved {
Link Here
|
414 |
} |
414 |
} |
415 |
|
415 |
|
416 |
# we retrieve rights |
416 |
# we retrieve rights |
417 |
if ( my $rights = GetHoldRule( $borrower->{'categorycode'}, $item->effective_itemtype, $branchcode ) ) { |
417 |
my $rights; |
|
|
418 |
if ( $rights = GetHoldRule( $borrower->{'categorycode'}, $item->effective_itemtype, $branchcode ) ) { |
418 |
$ruleitemtype = $rights->{itemtype}; |
419 |
$ruleitemtype = $rights->{itemtype}; |
419 |
$allowedreserves = $rights->{reservesallowed} // $allowedreserves; |
420 |
$allowedreserves = $rights->{reservesallowed} // $allowedreserves; |
420 |
$holds_per_record = $rights->{holds_per_record} // $holds_per_record; |
421 |
$holds_per_record = $rights->{holds_per_record} // $holds_per_record; |
Lines 434-451
sub CanItemBeReserved {
Link Here
|
434 |
my $holds = Koha::Holds->search($search_params); |
435 |
my $holds = Koha::Holds->search($search_params); |
435 |
|
436 |
|
436 |
if ( $opacitemholds eq "N" ) { |
437 |
if ( $opacitemholds eq "N" ) { |
437 |
return { status => "notReservable" }; |
438 |
return { status => "notReservable", rights => $rights }; |
438 |
} |
439 |
} |
439 |
|
440 |
|
440 |
$item = Koha::Items->find( $itemnumber ); |
|
|
441 |
|
442 |
my $holds = Koha::Holds->search( |
443 |
{ |
444 |
borrowernumber => $borrowernumber, |
445 |
biblionumber => $item->biblionumber, |
446 |
} |
447 |
); |
448 |
|
449 |
if ( defined $holds_per_record && $holds_per_record ne '' |
441 |
if ( defined $holds_per_record && $holds_per_record ne '' |
450 |
&& $holds->count() >= $holds_per_record ) { |
442 |
&& $holds->count() >= $holds_per_record ) { |
451 |
return { status => "tooManyHoldsForThisRecord", limit => $holds_per_record }; |
443 |
return { status => "tooManyHoldsForThisRecord", limit => $holds_per_record }; |
Lines 2279-2285
sub GetHoldRule {
Link Here
|
2279 |
); |
2271 |
); |
2280 |
$rules->{holds_per_record} = $holds_per_x_rules->{holds_per_record}; |
2272 |
$rules->{holds_per_record} = $holds_per_x_rules->{holds_per_record}; |
2281 |
$rules->{holds_per_day} = $holds_per_x_rules->{holds_per_day}; |
2273 |
$rules->{holds_per_day} = $holds_per_x_rules->{holds_per_day}; |
2282 |
$rules->{opacitemholds} = $holds_per_x_rules->{opacitemholds}; |
2274 |
$rules->{opacitemholds} = $holds_per_x_rules->{opacitemholds} // 'Y'; |
2283 |
|
2275 |
|
2284 |
return $rules; |
2276 |
return $rules; |
2285 |
} |
2277 |
} |
2286 |
- |
|
|