|
Lines 476-481
sub is_suspended {
Link Here
|
| 476 |
return $self->suspend(); |
476 |
return $self->suspend(); |
| 477 |
} |
477 |
} |
| 478 |
|
478 |
|
|
|
479 |
=head3 check_if_existing_hold_matches_issuingrules |
| 480 |
|
| 481 |
my $checkreserve = Koha::Hold->check_if_existing_hold_matches_issuingrules($res->{'borrowernumber'}, $itemnumber ); |
| 482 |
|
| 483 |
Upon checking in an item of a bibliographic record with a biblio-level hold on it, check if a bib-level hold can be allocated to a patron based on the current values in the issuingrules table |
| 484 |
|
| 485 |
=cut |
| 486 |
|
| 487 |
sub check_if_existing_hold_matches_issuingrules { |
| 488 |
my ( $self, $borrowernumber, $itemnumber ) = @_; |
| 489 |
|
| 490 |
#Get patron and item objects |
| 491 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
| 492 |
my $item = Koha::Items->find( $itemnumber ); |
| 493 |
$item = $item->unblessed(); |
| 494 |
|
| 495 |
#Get branchcode |
| 496 |
my $branchcode; |
| 497 |
my $controlbranch = C4::Context->preference('ReservesControlBranch'); |
| 498 |
|
| 499 |
if ( $controlbranch eq "ItemHomeLibrary" ) { |
| 500 |
$branchcode = $item->{homebranch}; |
| 501 |
} |
| 502 |
elsif ( $controlbranch eq "PatronLibrary" ) { |
| 503 |
$branchcode = $patron->{branchcode}; |
| 504 |
} |
| 505 |
|
| 506 |
my $issuingrule = Koha::IssuingRules->get_effective_issuing_rule({ |
| 507 |
branchcode => $branchcode, |
| 508 |
categorycode => $patron->categorycode, |
| 509 |
itemtype => $item->{itype}, |
| 510 |
}); |
| 511 |
|
| 512 |
#Check if the patron catgeory/item type combination is valid |
| 513 |
if ( ($issuingrule->reservesallowed || $issuingrule->holds_per_record) == 0 ) { |
| 514 |
return 'InvalidHold'; |
| 515 |
} else { |
| 516 |
return 'OK'; |
| 517 |
} |
| 518 |
} |
| 479 |
|
519 |
|
| 480 |
=head3 cancel |
520 |
=head3 cancel |
| 481 |
|
521 |
|
| 482 |
- |
|
|