|
Lines 421-436
sub CanItemBeReserved {
Link Here
|
| 421 |
WHERE borrowernumber = ? |
421 |
WHERE borrowernumber = ? |
| 422 |
}; |
422 |
}; |
| 423 |
|
423 |
|
| 424 |
my $branchcode = ""; |
424 |
my $reserves_control_branch; |
| 425 |
my $branchfield = "reserves.branchcode"; |
425 |
my $branchfield = "reserves.branchcode"; |
| 426 |
|
426 |
|
| 427 |
if ( $controlbranch eq "ItemHomeLibrary" ) { |
427 |
if ( $controlbranch eq "ItemHomeLibrary" ) { |
| 428 |
$branchfield = "items.homebranch"; |
428 |
$branchfield = "items.homebranch"; |
| 429 |
$branchcode = $item->homebranch; |
429 |
$reserves_control_branch = $item->homebranch; |
| 430 |
} |
430 |
} |
| 431 |
elsif ( $controlbranch eq "PatronLibrary" ) { |
431 |
elsif ( $controlbranch eq "PatronLibrary" ) { |
| 432 |
$branchfield = "borrowers.branchcode"; |
432 |
$branchfield = "borrowers.branchcode"; |
| 433 |
$branchcode = $borrower->{branchcode}; |
433 |
$reserves_control_branch = $borrower->{branchcode}; |
| 434 |
} |
434 |
} |
| 435 |
|
435 |
|
| 436 |
# we retrieve rights |
436 |
# we retrieve rights |
|
Lines 438-444
sub CanItemBeReserved {
Link Here
|
| 438 |
my $reservesallowed = Koha::CirculationRules->get_effective_rule({ |
438 |
my $reservesallowed = Koha::CirculationRules->get_effective_rule({ |
| 439 |
itemtype => $item->effective_itemtype, |
439 |
itemtype => $item->effective_itemtype, |
| 440 |
categorycode => $borrower->{categorycode}, |
440 |
categorycode => $borrower->{categorycode}, |
| 441 |
branchcode => $branchcode, |
441 |
branchcode => $reserves_control_branch, |
| 442 |
rule_name => 'reservesallowed', |
442 |
rule_name => 'reservesallowed', |
| 443 |
}) |
443 |
}) |
| 444 |
) { |
444 |
) { |
|
Lines 452-458
sub CanItemBeReserved {
Link Here
|
| 452 |
my $rights = Koha::CirculationRules->get_effective_rules({ |
452 |
my $rights = Koha::CirculationRules->get_effective_rules({ |
| 453 |
categorycode => $borrower->{'categorycode'}, |
453 |
categorycode => $borrower->{'categorycode'}, |
| 454 |
itemtype => $item->effective_itemtype, |
454 |
itemtype => $item->effective_itemtype, |
| 455 |
branchcode => $branchcode, |
455 |
branchcode => $reserves_control_branch, |
| 456 |
rules => ['holds_per_record','holds_per_day'] |
456 |
rules => ['holds_per_record','holds_per_day'] |
| 457 |
}); |
457 |
}); |
| 458 |
my $holds_per_record = $rights->{holds_per_record} // 1; |
458 |
my $holds_per_record = $rights->{holds_per_record} // 1; |
|
Lines 497-506
sub CanItemBeReserved {
Link Here
|
| 497 |
my $sthcount = $dbh->prepare($querycount); |
497 |
my $sthcount = $dbh->prepare($querycount); |
| 498 |
|
498 |
|
| 499 |
if ( defined $ruleitemtype ) { |
499 |
if ( defined $ruleitemtype ) { |
| 500 |
$sthcount->execute( $patron->borrowernumber, $branchcode, $ruleitemtype ); |
500 |
$sthcount->execute( $patron->borrowernumber, $reserves_control_branch, $ruleitemtype ); |
| 501 |
} |
501 |
} |
| 502 |
else { |
502 |
else { |
| 503 |
$sthcount->execute( $patron->borrowernumber, $branchcode ); |
503 |
$sthcount->execute( $patron->borrowernumber, $reserves_control_branch ); |
| 504 |
} |
504 |
} |
| 505 |
|
505 |
|
| 506 |
my $reservecount = "0"; |
506 |
my $reservecount = "0"; |
|
Lines 522-528
sub CanItemBeReserved {
Link Here
|
| 522 |
my $rule = Koha::CirculationRules->get_effective_rule( |
522 |
my $rule = Koha::CirculationRules->get_effective_rule( |
| 523 |
{ |
523 |
{ |
| 524 |
categorycode => $patron->categorycode, |
524 |
categorycode => $patron->categorycode, |
| 525 |
branchcode => $branchcode, |
525 |
branchcode => $reserves_control_branch, |
| 526 |
rule_name => 'max_holds', |
526 |
rule_name => 'max_holds', |
| 527 |
} |
527 |
} |
| 528 |
); |
528 |
); |
|
Lines 536-543
sub CanItemBeReserved {
Link Here
|
| 536 |
return { status => 'tooManyReserves', limit => $rule->rule_value} if $total_holds_count >= $rule->rule_value; |
536 |
return { status => 'tooManyReserves', limit => $rule->rule_value} if $total_holds_count >= $rule->rule_value; |
| 537 |
} |
537 |
} |
| 538 |
|
538 |
|
| 539 |
my $reserves_control_branch = |
|
|
| 540 |
GetReservesControlBranch( $item->unblessed(), $patron->unblessed ); |
| 541 |
my $branchitemrule = |
539 |
my $branchitemrule = |
| 542 |
C4::Circulation::GetBranchItemRule( $reserves_control_branch, $item->effective_itemtype ); |
540 |
C4::Circulation::GetBranchItemRule( $reserves_control_branch, $item->effective_itemtype ); |
| 543 |
|
541 |
|
| 544 |
- |
|
|