Lines 337-342
sub is_suspended {
Link Here
|
337 |
return $self->suspend(); |
337 |
return $self->suspend(); |
338 |
} |
338 |
} |
339 |
|
339 |
|
|
|
340 |
=head3 check_if_existing_hold_matches_issuingrules |
341 |
|
342 |
my $checkreserve = Koha::Hold->check_if_existing_hold_matches_issuingrules($res->{'borrowernumber'}, $itemnumber ); |
343 |
|
344 |
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 |
345 |
|
346 |
=cut |
347 |
|
348 |
sub check_if_existing_hold_matches_issuingrules { |
349 |
my ( $self, $borrowernumber, $itemnumber ) = @_; |
350 |
|
351 |
#Get patron and item objects |
352 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
353 |
my $item = Koha::Items->find( $itemnumber ); |
354 |
$item = $item->unblessed(); |
355 |
|
356 |
#Get branchcode |
357 |
my $branchcode; |
358 |
my $controlbranch = C4::Context->preference('ReservesControlBranch'); |
359 |
|
360 |
if ( $controlbranch eq "ItemHomeLibrary" ) { |
361 |
$branchcode = $item->{homebranch}; |
362 |
} |
363 |
elsif ( $controlbranch eq "PatronLibrary" ) { |
364 |
$branchcode = $patron->{branchcode}; |
365 |
} |
366 |
|
367 |
my $issuingrule = Koha::IssuingRules->get_effective_issuing_rule({ |
368 |
branchcode => $branchcode, |
369 |
categorycode => $patron->categorycode, |
370 |
itemtype => $item->{itype}, |
371 |
}); |
372 |
|
373 |
#Check if the patron catgeory/item type combination is valid |
374 |
if ( ($issuingrule->reservesallowed || $issuingrule->holds_per_record) == 0 ) { |
375 |
return 'InvalidHold'; |
376 |
} else { |
377 |
return 'OK'; |
378 |
} |
379 |
} |
340 |
|
380 |
|
341 |
=head3 cancel |
381 |
=head3 cancel |
342 |
|
382 |
|
343 |
- |
|
|