Lines 25-31
use Modern::Perl;
Link Here
|
25 |
|
25 |
|
26 |
use C4::Accounts; |
26 |
use C4::Accounts; |
27 |
use C4::Biblio qw( GetMarcFromKohaField ); |
27 |
use C4::Biblio qw( GetMarcFromKohaField ); |
28 |
use C4::Circulation qw( CheckIfIssuedToPatron GetAgeRestriction GetBranchItemRule ); |
28 |
use C4::Circulation qw( GetAgeRestriction GetBranchItemRule ); |
29 |
use C4::Context; |
29 |
use C4::Context; |
30 |
use C4::Items qw( CartToShelf get_hostitemnumbers_of ); |
30 |
use C4::Items qw( CartToShelf get_hostitemnumbers_of ); |
31 |
use C4::Letters; |
31 |
use C4::Letters; |
Lines 335-346
See CanItemBeReserved() for possible return values.
Link Here
|
335 |
sub CanBookBeReserved{ |
335 |
sub CanBookBeReserved{ |
336 |
my ($borrowernumber, $biblionumber, $pickup_branchcode, $params) = @_; |
336 |
my ($borrowernumber, $biblionumber, $pickup_branchcode, $params) = @_; |
337 |
|
337 |
|
338 |
# Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set) |
|
|
339 |
if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions') |
340 |
&& C4::Circulation::CheckIfIssuedToPatron( $borrowernumber, $biblionumber ) ) { |
341 |
return { status =>'alreadypossession' }; |
342 |
} |
343 |
|
344 |
if ( $params->{itemtype} ) { |
338 |
if ( $params->{itemtype} ) { |
345 |
|
339 |
|
346 |
# biblio-level, item type-contrained |
340 |
# biblio-level, item type-contrained |
Lines 472-483
sub CanItemBeReserved {
Link Here
|
472 |
return _cache { status =>'itemAlreadyOnHold' } |
466 |
return _cache { status =>'itemAlreadyOnHold' } |
473 |
if ( !$params->{ignore_hold_counts} && Koha::Holds->search( { borrowernumber => $patron->borrowernumber, itemnumber => $item->itemnumber } )->count() ); |
467 |
if ( !$params->{ignore_hold_counts} && Koha::Holds->search( { borrowernumber => $patron->borrowernumber, itemnumber => $item->itemnumber } )->count() ); |
474 |
|
468 |
|
475 |
# Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set) |
|
|
476 |
if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions') |
477 |
&& C4::Circulation::CheckIfIssuedToPatron( $patron->borrowernumber, $item->biblionumber ) ) { |
478 |
return _cache { status =>'alreadypossession' }; |
479 |
} |
480 |
|
481 |
# check if a recall exists on this item from this borrower |
469 |
# check if a recall exists on this item from this borrower |
482 |
return _cache { status => 'recall' } |
470 |
return _cache { status => 'recall' } |
483 |
if $patron->recalls->filter_by_current->search({ item_id => $item->itemnumber })->count; |
471 |
if $patron->recalls->filter_by_current->search({ item_id => $item->itemnumber })->count; |
Lines 532-537
sub CanItemBeReserved {
Link Here
|
532 |
}; |
520 |
}; |
533 |
my $holds = Koha::Holds->search($search_params); |
521 |
my $holds = Koha::Holds->search($search_params); |
534 |
return _cache { status => "tooManyHoldsForThisRecord", limit => $holds_per_record } if $holds->count() >= $holds_per_record; |
522 |
return _cache { status => "tooManyHoldsForThisRecord", limit => $holds_per_record } if $holds->count() >= $holds_per_record; |
|
|
523 |
|
524 |
# Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set) |
525 |
if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions') |
526 |
&& $patron->checkouts->find( { itemnumber => $item->itemnumber } ) ) |
527 |
{ |
528 |
return _cache { status => 'alreadypossession' }; |
529 |
} |
535 |
} |
530 |
} |
536 |
} |
531 |
} |
537 |
|
532 |
|