View | Details | Raw Unified | Return to bug 26132
Collapse All | Expand All

(-)a/C4/Circulation.pm (-7 / +11 lines)
Lines 433-446 sub TooMany { Link Here
433
    # rule
433
    # rule
434
    if (defined($maxissueqty_rule) and $maxissueqty_rule->rule_value ne "") {
434
    if (defined($maxissueqty_rule) and $maxissueqty_rule->rule_value ne "") {
435
435
436
        my $checkouts = $patron->checkouts->search( {}, { prefetch => 'item' } );
436
        my $checkouts;
437
        if ( $maxissueqty_rule->branchcode ) {
437
        if ( $maxissueqty_rule->branchcode ) {
438
            if ( C4::Context->preference('CircControl') eq 'PickupLibrary' ) {
438
            if ( C4::Context->preference('CircControl') eq 'PickupLibrary' ) {
439
                $checkouts = $checkouts->search({ 'me.branchcode' => $maxissueqty_rule->branchcode });
439
                $checkouts = $patron->checkouts->search(
440
                    { 'me.branchcode' => $maxissueqty_rule->branchcode } );
440
            } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') {
441
            } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') {
441
                ; # if branch is the patron's home branch, then count all loans by patron
442
                ; # if branch is the patron's home branch, then count all loans by patron
442
            } else {
443
            } else {
443
                $checkouts = $checkouts->search({ 'item.homebranch' => $maxissueqty_rule->branchcode });
444
                $checkouts = $patron->checkouts->search(
445
                    { 'item.homebranch' => $maxissueqty_rule->branchcode },
446
                    { prefetch          => 'item' } );
444
            }
447
            }
445
        }
448
        }
446
        my $sum_checkouts;
449
        my $sum_checkouts;
Lines 517-529 sub TooMany { Link Here
517
    # Now count total loans against the limit for the branch
520
    # Now count total loans against the limit for the branch
518
    my $branch_borrower_circ_rule = GetBranchBorrowerCircRule($branch, $cat_borrower);
521
    my $branch_borrower_circ_rule = GetBranchBorrowerCircRule($branch, $cat_borrower);
519
    if (defined($branch_borrower_circ_rule->{patron_maxissueqty}) and $branch_borrower_circ_rule->{patron_maxissueqty} ne '') {
522
    if (defined($branch_borrower_circ_rule->{patron_maxissueqty}) and $branch_borrower_circ_rule->{patron_maxissueqty} ne '') {
520
        my $checkouts = $patron->checkouts->search({}, { prefetch => 'item' });
523
        my $checkouts;
521
        if ( C4::Context->preference('CircControl') eq 'PickupLibrary' ) {
524
        if ( C4::Context->preference('CircControl') eq 'PickupLibrary' ) {
522
            $checkouts = $checkouts->search({ 'me.branchcode' => $branch });
525
            $checkouts = $patron->checkouts->search(
526
                { 'me.branchcode' => $branch} );
523
        } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') {
527
        } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') {
524
            ; # if branch is the patron's home branch, then count all loans by patron
528
            ; # if branch is the patron's home branch, then count all loans by patron
525
        } else {
529
        } else {
526
            $checkouts = $checkouts->search({ 'item.homebranch' => $branch });
530
            $checkouts = $patron->checkouts->search(
531
                { 'item.homebranch' => $branch} );
527
        }
532
        }
528
533
529
        my $checkout_count = $checkouts->count;
534
        my $checkout_count = $checkouts->count;
530
- 

Return to bug 26132