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

(-)a/C4/Circulation.pm (-15 / +26 lines)
Lines 541-546 sub TooMany { Link Here
541
            max_checkouts_allowed        => $maxissueqty_rule ? $maxissueqty_rule->rule_value : undef,
541
            max_checkouts_allowed        => $maxissueqty_rule ? $maxissueqty_rule->rule_value : undef,
542
            max_onsite_checkouts_allowed => $maxonsiteissueqty_rule ? $maxonsiteissueqty_rule->rule_value : undef,
542
            max_onsite_checkouts_allowed => $maxonsiteissueqty_rule ? $maxonsiteissueqty_rule->rule_value : undef,
543
            switch_onsite_checkout       => $switch_onsite_checkout,
543
            switch_onsite_checkout       => $switch_onsite_checkout,
544
            circulation_rule             => $maxissueqty_rule,
545
            onsite_circulation_rule      => $maxonsiteissueqty_rule,
544
        };
546
        };
545
        # If parent rules exists
547
        # If parent rules exists
546
        if ( defined($parent_maxissueqty_rule) and defined($parent_maxissueqty_rule->rule_value) ){
548
        if ( defined($parent_maxissueqty_rule) and defined($parent_maxissueqty_rule->rule_value) ){
Lines 589-595 sub TooMany { Link Here
589
                onsite_checkout              => $onsite_checkout,
591
                onsite_checkout              => $onsite_checkout,
590
                max_checkouts_allowed        => $max_checkouts_allowed,
592
                max_checkouts_allowed        => $max_checkouts_allowed,
591
                max_onsite_checkouts_allowed => $max_onsite_checkouts_allowed,
593
                max_onsite_checkouts_allowed => $max_onsite_checkouts_allowed,
592
                switch_onsite_checkout       => $switch_onsite_checkout
594
                switch_onsite_checkout       => $switch_onsite_checkout,
595
                circulation_rule             => $branch_borrower_circ_rule,
593
            }
596
            }
594
        );
597
        );
595
        return $qty_over if defined $qty_over;
598
        return $qty_over if defined $qty_over;
Lines 611-624 sub _check_max_qty { Link Here
611
    my $max_checkouts_allowed        = $params->{max_checkouts_allowed};
614
    my $max_checkouts_allowed        = $params->{max_checkouts_allowed};
612
    my $max_onsite_checkouts_allowed = $params->{max_onsite_checkouts_allowed};
615
    my $max_onsite_checkouts_allowed = $params->{max_onsite_checkouts_allowed};
613
    my $switch_onsite_checkout       = $params->{switch_onsite_checkout};
616
    my $switch_onsite_checkout       = $params->{switch_onsite_checkout};
617
    my $circulation_rule             = $params->{circulation_rule};
618
    my $onsite_circulation_rule      = $params->{onsite_circulation_rule};
614
619
615
    if ( $onsite_checkout and defined $max_onsite_checkouts_allowed ) {
620
    if ( $onsite_checkout and defined $max_onsite_checkouts_allowed ) {
616
        if ( $max_onsite_checkouts_allowed eq '' ) { return; }
621
        if ( $max_onsite_checkouts_allowed eq '' ) { return; }
617
        if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed ) {
622
        if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed ) {
618
            return {
623
            return {
619
                reason      => 'TOO_MANY_ONSITE_CHECKOUTS',
624
                reason           => 'TOO_MANY_ONSITE_CHECKOUTS',
620
                count       => $onsite_checkout_count,
625
                count            => $onsite_checkout_count,
621
                max_allowed => $max_onsite_checkouts_allowed,
626
                max_allowed      => $max_onsite_checkouts_allowed,
627
                circulation_rule => $onsite_circulation_rule,
622
            };
628
            };
623
        }
629
        }
624
    }
630
    }
Lines 627-635 sub _check_max_qty { Link Here
627
        my $delta = $switch_onsite_checkout ? 1 : 0;
633
        my $delta = $switch_onsite_checkout ? 1 : 0;
628
        if ( $checkout_count >= $max_checkouts_allowed + $delta ) {
634
        if ( $checkout_count >= $max_checkouts_allowed + $delta ) {
629
            return {
635
            return {
630
                reason      => 'TOO_MANY_CHECKOUTS',
636
                reason           => 'TOO_MANY_CHECKOUTS',
631
                count       => $checkout_count,
637
                count            => $checkout_count,
632
                max_allowed => $max_checkouts_allowed,
638
                max_allowed      => $max_checkouts_allowed,
639
                circulation_rule => $circulation_rule,
633
            };
640
            };
634
        }
641
        }
635
    }
642
    }
Lines 639-647 sub _check_max_qty { Link Here
639
            $checkout_count - $onsite_checkout_count >= $max_checkouts_allowed )
646
            $checkout_count - $onsite_checkout_count >= $max_checkouts_allowed )
640
        {
647
        {
641
            return {
648
            return {
642
                reason      => 'TOO_MANY_CHECKOUTS',
649
                reason           => 'TOO_MANY_CHECKOUTS',
643
                count       => $checkout_count - $onsite_checkout_count,
650
                count            => $checkout_count - $onsite_checkout_count,
644
                max_allowed => $max_checkouts_allowed,
651
                max_allowed      => $max_checkouts_allowed,
652
                circulation_rule => $circulation_rule,
645
            };
653
            };
646
        }
654
        }
647
    }
655
    }
Lines 1019-1034 sub CanBookBeIssued { Link Here
1019
    # if TooMany max_allowed returns 0 the user doesn't have permission to check out this book
1027
    # if TooMany max_allowed returns 0 the user doesn't have permission to check out this book
1020
    if ( $toomany && not exists $needsconfirmation{RENEW_ISSUE} ) {
1028
    if ( $toomany && not exists $needsconfirmation{RENEW_ISSUE} ) {
1021
        if ( $toomany->{max_allowed} == 0 ) {
1029
        if ( $toomany->{max_allowed} == 0 ) {
1022
            $needsconfirmation{PATRON_CANT} = 1;
1030
            $needsconfirmation{PATRON_CANT}      = 1;
1031
            $needsconfirmation{circulation_rule_PATRON_CANT} = $toomany->{circulation_rule};
1023
        }
1032
        }
1024
        if ( C4::Context->preference("AllowTooManyOverride") ) {
1033
        if ( C4::Context->preference("AllowTooManyOverride") ) {
1025
            $needsconfirmation{TOO_MANY} = $toomany->{reason};
1034
            $needsconfirmation{TOO_MANY}           = $toomany->{reason};
1026
            $needsconfirmation{current_loan_count} = $toomany->{count};
1035
            $needsconfirmation{current_loan_count} = $toomany->{count};
1027
            $needsconfirmation{max_loans_allowed} = $toomany->{max_allowed};
1036
            $needsconfirmation{max_loans_allowed}  = $toomany->{max_allowed};
1037
            $needsconfirmation{circulation_rule_TOO_MANY}   = $toomany->{circulation_rule};
1028
        } else {
1038
        } else {
1029
            $issuingimpossible{TOO_MANY} = $toomany->{reason};
1039
            $issuingimpossible{TOO_MANY}           = $toomany->{reason};
1030
            $issuingimpossible{current_loan_count} = $toomany->{count};
1040
            $issuingimpossible{current_loan_count} = $toomany->{count};
1031
            $issuingimpossible{max_loans_allowed} = $toomany->{max_allowed};
1041
            $issuingimpossible{max_loans_allowed}  = $toomany->{max_allowed};
1042
            $needsconfirmation{circulation_rule_TOO_MANY}   = $toomany->{circulation_rule};
1032
        }
1043
        }
1033
    }
1044
    }
1034
1045
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-1 / +41 lines)
Lines 171-180 Link Here
171
171
172
                                [% IF TOO_MANY and TOO_MANY == 'TOO_MANY_CHECKOUTS' %]
172
                                [% IF TOO_MANY and TOO_MANY == 'TOO_MANY_CHECKOUTS' %]
173
                                    <li>Too many checked out. [% current_loan_count | html %] checked out, only [% max_loans_allowed | html %] are allowed.</li>
173
                                    <li>Too many checked out. [% current_loan_count | html %] checked out, only [% max_loans_allowed | html %] are allowed.</li>
174
                                    <li>
175
                                        Maximum checkouts calculated from the circulation rule for
176
                                        [% INCLUDE circulation_rule_criteria rule=circulation_rule_TOO_MANY %]
177
                                    </li>
174
                                [% END %]
178
                                [% END %]
175
179
176
                                [% IF TOO_MANY and TOO_MANY == 'TOO_MANY_ONSITE_CHECKOUTS' %]
180
                                [% IF TOO_MANY and TOO_MANY == 'TOO_MANY_ONSITE_CHECKOUTS' %]
177
                                    <li>Too many on-site checked out. [% current_loan_count | html %] on-site checked out, only [% max_loans_allowed | html %] are allowed.</li>
181
                                    <li>Too many on-site checked out. [% current_loan_count | html %] on-site checked out, only [% max_loans_allowed | html %] are allowed.</li>
182
                                    <li>
183
                                        Maximum checkouts calculated from the circulation rule for
184
                                        [% INCLUDE circulation_rule_criteria rule=circulation_rule_TOO_MANY %]
185
                                    </li>
178
                                [% END %]
186
                                [% END %]
179
187
180
                                [% IF ( BORRNOTSAMEBRANCH ) %]
188
                                [% IF ( BORRNOTSAMEBRANCH ) %]
Lines 557-562 Link Here
557
565
558
                                [% IF ( TOO_MANY ) %]
566
                                [% IF ( TOO_MANY ) %]
559
                                    <li>Too many checked out. [% current_loan_count | html %] checked out, only [% max_loans_allowed | html %] are allowed.</li>
567
                                    <li>Too many checked out. [% current_loan_count | html %] checked out, only [% max_loans_allowed | html %] are allowed.</li>
568
                                    <li>
569
                                        Maximum checkouts calculated from the circulation rule for
570
                                        [% INCLUDE circulation_rule_criteria rule=circulation_rule_TOO_MANY %]
571
                                    </li>
560
                                [% END %]
572
                                [% END %]
561
573
562
                                [% IF ( ITEMNOTSAMEBRANCH ) %]
574
                                [% IF ( ITEMNOTSAMEBRANCH ) %]
Lines 1055-1057 Link Here
1055
[% END %]
1067
[% END %]
1056
1068
1057
[% INCLUDE 'intranet-bottom.inc' %]
1069
[% INCLUDE 'intranet-bottom.inc' %]
1058
- 
1070
1071
[% BLOCK circulation_rule_criteria %]
1072
    <ul>
1073
        <li>
1074
            Item type:
1075
            [% IF rule.itemtype %]
1076
                [% ItemTypes.GetDescription( rule.itemtype ) | html %]
1077
            [% ELSE %]
1078
                <i>All</i>
1079
            [% END %]
1080
        </li>
1081
        <li>
1082
            Patron category:
1083
            [% IF rule.categorycode %]
1084
                [% Categories.GetName( rule.categorycode ) | html %]
1085
            [% ELSE %]
1086
                <i>All</i>
1087
            [% END %]
1088
        </li>
1089
        <li>
1090
            Library:
1091
            [% IF rule.branchcode %]
1092
                [% Branches.GetName( rule.branchcode ) | html %]
1093
            [% ELSE %]
1094
                <i>All libraries</i>
1095
            [% END %]
1096
        </li>
1097
    </ul>
1098
[% END %]

Return to bug 18139