Lines 433-455
sub TooMany {
Link Here
|
433 |
# Now count total loans against the limit for the branch |
433 |
# Now count total loans against the limit for the branch |
434 |
my $branch_borrower_circ_rule = GetBranchBorrowerCircRule($branch, $cat_borrower); |
434 |
my $branch_borrower_circ_rule = GetBranchBorrowerCircRule($branch, $cat_borrower); |
435 |
if (defined($branch_borrower_circ_rule->{maxissueqty})) { |
435 |
if (defined($branch_borrower_circ_rule->{maxissueqty})) { |
436 |
my @bind_params = (); |
436 |
my $branch_count_query = " |
437 |
my $branch_count_query = "SELECT COUNT(*) FROM issues |
437 |
SELECT COUNT(*) FROM issues |
438 |
JOIN items USING (itemnumber) |
438 |
WHERE borrowernumber = ? |
439 |
WHERE borrowernumber = ? "; |
439 |
"; |
440 |
push @bind_params, $borrower->{borrowernumber}; |
440 |
|
441 |
|
|
|
442 |
if (C4::Context->preference('CircControl') eq 'PickupLibrary') { |
443 |
$branch_count_query .= " AND issues.branchcode = ? "; |
444 |
push @bind_params, $branch; |
445 |
} elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') { |
446 |
; # if branch is the patron's home branch, then count all loans by patron |
447 |
} else { |
448 |
$branch_count_query .= " AND items.homebranch = ? "; |
449 |
push @bind_params, $branch; |
450 |
} |
451 |
my $branch_count_sth = $dbh->prepare($branch_count_query); |
441 |
my $branch_count_sth = $dbh->prepare($branch_count_query); |
452 |
$branch_count_sth->execute(@bind_params); |
442 |
$branch_count_sth->execute( $borrower->{borrowernumber} ); |
453 |
my ($current_loan_count) = $branch_count_sth->fetchrow_array; |
443 |
my ($current_loan_count) = $branch_count_sth->fetchrow_array; |
454 |
|
444 |
|
455 |
my $max_loans_allowed = $branch_borrower_circ_rule->{maxissueqty}; |
445 |
my $max_loans_allowed = $branch_borrower_circ_rule->{maxissueqty}; |
456 |
- |
|
|