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

(-)a/C4/Circulation.pm (-39 / +18 lines)
Lines 508-558 sub TooMany { Link Here
508
508
509
        my ( $checkout_count_type, $checkout_count, $onsite_checkout_count ) = $dbh->selectrow_array( $count_query, {}, @bind_params );
509
        my ( $checkout_count_type, $checkout_count, $onsite_checkout_count ) = $dbh->selectrow_array( $count_query, {}, @bind_params );
510
510
511
        my $max_onsite_checkouts_allowed = $maxonsiteissueqty_rule ? $maxonsiteissueqty_rule->rule_value : undef;
511
        my $checkout_rules = {
512
512
            checkout_count               => $checkout_count,
513
            onsite_checkout_count        => $onsite_checkout_count,
514
            onsite_checkout              => $onsite_checkout,
515
            max_checkouts_allowed        => $maxissueqty_rule ? $maxissueqty_rule->rule_value : undef,
516
            max_onsite_checkouts_allowed => $maxonsiteissueqty_rule ? $maxonsiteissueqty_rule->rule_value : undef,
517
            switch_onsite_checkout       => $switch_onsite_checkout,
518
        };
513
        # If parent rules exists
519
        # If parent rules exists
514
        if ( defined($parent_maxissueqty_rule) and defined($parent_maxissueqty_rule->rule_value) ){
520
        if ( defined($parent_maxissueqty_rule) and defined($parent_maxissueqty_rule->rule_value) ){
515
            my $max_checkouts_allowed = $parent_maxissueqty_rule->rule_value;
521
            $checkout_rules->{max_checkouts_allowed} = $parent_maxissueqty_rule ? $parent_maxissueqty_rule->rule_value : undef;
516
522
            my $qty_over = _check_max_qty($checkout_rules);
517
            my $qty_over = _check_max_qty({
518
                checkout_count => $checkout_count,
519
                onsite_checkout_count => $onsite_checkout_count,
520
                onsite_checkout => $onsite_checkout,
521
                max_checkouts_allowed => $max_checkouts_allowed,
522
                max_onsite_checkouts_allowed => $max_onsite_checkouts_allowed,
523
                switch_onsite_checkout       => $switch_onsite_checkout
524
            });
525
            return $qty_over if defined $qty_over;
523
            return $qty_over if defined $qty_over;
526
524
527
525
            # If the parent rule is less than or equal to the child, we only need check the parent
528
           # If the parent rule is less than or equal to the child, we only need check the parent
526
            if( $maxissueqty_rule->rule_value < $parent_maxissueqty_rule->rule_value && defined($maxissueqty_rule->itemtype) ) {
529
           if( $maxissueqty_rule->rule_value < $parent_maxissueqty_rule->rule_value && defined($maxissueqty_rule->itemtype) ) {
527
                $checkout_rules->{checkout_count} = $checkout_count_type;
530
               my $max_checkouts_allowed = $maxissueqty_rule->rule_value;
528
                $checkout_rules->{max_checkouts_allowed} = $maxissueqty_rule ? $maxissueqty_rule->rule_value : undef;
531
               my $qty_over = _check_max_qty({
529
                my $qty_over = _check_max_qty($checkout_rules);
532
                   checkout_count => $checkout_count_type,
530
                return $qty_over if defined $qty_over;
533
                   onsite_checkout_count => $onsite_checkout_count,
531
            }
534
                   onsite_checkout => $onsite_checkout,
535
                   max_checkouts_allowed => $max_checkouts_allowed,
536
                   max_onsite_checkouts_allowed => $max_onsite_checkouts_allowed,
537
                   switch_onsite_checkout       => $switch_onsite_checkout
538
               });
539
               return $qty_over if defined $qty_over;
540
           }
541
542
        } else {
532
        } else {
543
            my $max_checkouts_allowed = $maxissueqty_rule->rule_value;
533
            my $qty_over = _check_max_qty($checkout_rules);
544
            my $qty_over = _check_max_qty({
545
                checkout_count => $checkout_count,
546
                onsite_checkout_count => $onsite_checkout_count,
547
                onsite_checkout => $onsite_checkout,
548
                max_checkouts_allowed => $max_checkouts_allowed,
549
                max_onsite_checkouts_allowed => $max_onsite_checkouts_allowed,
550
                switch_onsite_checkout       => $switch_onsite_checkout
551
            });
552
            return $qty_over if defined $qty_over;
534
            return $qty_over if defined $qty_over;
553
        }
535
        }
554
555
556
    }
536
    }
557
537
558
    # Now count total loans against the limit for the branch
538
    # Now count total loans against the limit for the branch
559
- 

Return to bug 26132