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

(-)a/C4/Circulation.pm (-9 / +51 lines)
Lines 397-403 sub TooMany { Link Here
397
 
397
 
398
    # given branch, patron category, and item type, determine
398
    # given branch, patron category, and item type, determine
399
    # applicable issuing rule
399
    # applicable issuing rule
400
    my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule({ categorycode => $cat_borrower, itemtype => $type, branchcode => $branch });
400
    my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule(
401
        {   categorycode => $cat_borrower,
402
            itemtype     => $type,
403
            branchcode   => $branch
404
        }
405
    );
406
401
407
402
    # if a rule is found and has a loan limit set, count
408
    # if a rule is found and has a loan limit set, count
403
    # how many loans the patron already has that meet that
409
    # how many loans the patron already has that meet that
Lines 1333-1339 sub AddIssue { Link Here
1333
1339
1334
            # If automatic renewal wasn't selected while issuing, set the value according to the issuing rule.
1340
            # If automatic renewal wasn't selected while issuing, set the value according to the issuing rule.
1335
            unless ($auto_renew) {
1341
            unless ($auto_renew) {
1336
                my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule({ categorycode => $borrower->{categorycode}, itemtype => $item->{itype}, branchcode => $branch });
1342
                my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule(
1343
                    {   categorycode => $borrower->{categorycode},
1344
                        itemtype     => $item->{itype},
1345
                        branchcode   => $branch
1346
                    }
1347
                );
1348
1337
                $auto_renew = $issuing_rule->auto_renew if $issuing_rule;
1349
                $auto_renew = $issuing_rule->auto_renew if $issuing_rule;
1338
            }
1350
            }
1339
1351
Lines 1533-1539 Get the Hard Due Date and it's comparison for an itemtype, a borrower type and a Link Here
1533
sub GetHardDueDate {
1545
sub GetHardDueDate {
1534
    my ( $borrowertype, $itemtype, $branchcode ) = @_;
1546
    my ( $borrowertype, $itemtype, $branchcode ) = @_;
1535
1547
1536
    my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule({ categorycode => $borrowertype, itemtype => $itemtype, branchcode => $branchcode });
1548
    my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule(
1549
        {   categorycode => $borrowertype,
1550
            itemtype     => $itemtype,
1551
            branchcode   => $branchcode
1552
        }
1553
    );
1554
1537
1555
1538
    if ( defined( $issuing_rule ) ) {
1556
    if ( defined( $issuing_rule ) ) {
1539
        if ( $issuing_rule->hardduedate ) {
1557
        if ( $issuing_rule->hardduedate ) {
Lines 2185-2191 sub _debar_user_on_return { Link Here
2185
    my $branchcode = _GetCircControlBranch( $item, $borrower );
2203
    my $branchcode = _GetCircControlBranch( $item, $borrower );
2186
2204
2187
    my $circcontrol = C4::Context->preference('CircControl');
2205
    my $circcontrol = C4::Context->preference('CircControl');
2188
    my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule({ categorycode => $borrower->{categorycode}, itemtype => $item->{itype}, branchcode => $branchcode });
2206
    my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule(
2207
        {   categorycode => $borrower->{categorycode},
2208
            itemtype     => $item->{itype},
2209
            branchcode   => $branchcode
2210
        }
2211
    );
2189
    my $finedays = $issuing_rule ? $issuing_rule->finedays : undef;
2212
    my $finedays = $issuing_rule ? $issuing_rule->finedays : undef;
2190
    my $unit     = $issuing_rule ? $issuing_rule->lengthunit : undef;
2213
    my $unit     = $issuing_rule ? $issuing_rule->lengthunit : undef;
2191
    my $chargeable_units = C4::Overdues::get_chargeable_units($unit, $dt_due, $dt_today, $branchcode);
2214
    my $chargeable_units = C4::Overdues::get_chargeable_units($unit, $dt_due, $dt_today, $branchcode);
Lines 2780-2786 sub CanBookBeRenewed { Link Here
2780
    return ( 1, undef ) if $override_limit;
2803
    return ( 1, undef ) if $override_limit;
2781
2804
2782
    my $branchcode = _GetCircControlBranch( $item, $borrower );
2805
    my $branchcode = _GetCircControlBranch( $item, $borrower );
2783
    my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule({ categorycode => $borrower->{categorycode}, itemtype => $item->{itype}, branchcode => $branchcode });
2806
    my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule(
2807
        {   categorycode => $borrower->{categorycode},
2808
            itemtype     => $item->{itype},
2809
            branchcode   => $branchcode
2810
        }
2811
    );
2784
2812
2785
    return ( 0, "too_many" )
2813
    return ( 0, "too_many" )
2786
      if not $issuing_rule or $issuing_rule->renewalsallowed <= $itemissue->{renewals};
2814
      if not $issuing_rule or $issuing_rule->renewalsallowed <= $itemissue->{renewals};
Lines 3022-3028 sub GetRenewCount { Link Here
3022
    # $item and $borrower should be calculated
3050
    # $item and $borrower should be calculated
3023
    my $branchcode = _GetCircControlBranch($item, $borrower);
3051
    my $branchcode = _GetCircControlBranch($item, $borrower);
3024
3052
3025
    my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule({ categorycode => $borrower->{categorycode}, itemtype => $item->{itype}, branchcode => $branchcode });
3053
    my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule(
3054
        {   categorycode => $borrower->{categorycode},
3055
            itemtype     => $item->{itype},
3056
            branchcode   => $branchcode
3057
        }
3058
    );
3026
3059
3027
    $renewsallowed = $issuing_rule ? $issuing_rule->renewalsallowed : undef; # FIXME Just replace undef with 0 to get what we expected. But what about the side-effects? TODO LATER
3060
    $renewsallowed = $issuing_rule ? $issuing_rule->renewalsallowed : undef; # FIXME Just replace undef with 0 to get what we expected. But what about the side-effects? TODO LATER
3028
    $renewsleft    = $renewsallowed - $renewcount;
3061
    $renewsleft    = $renewsallowed - $renewcount;
Lines 3062-3068 sub GetSoonestRenewDate { Link Here
3062
      or return;
3095
      or return;
3063
3096
3064
    my $branchcode = _GetCircControlBranch( $item, $borrower );
3097
    my $branchcode = _GetCircControlBranch( $item, $borrower );
3065
    my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule({ categorycode => $borrower->{categorycode}, itemtype => $item->{itype}, branchcode => $branchcode });
3098
    my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule(
3099
        {   categorycode => $borrower->{categorycode},
3100
            itemtype     => $item->{itype},
3101
            branchcode   => $branchcode
3102
        }
3103
    );
3066
3104
3067
    my $now = dt_from_string;
3105
    my $now = dt_from_string;
3068
    return $now unless $issuing_rule;
3106
    return $now unless $issuing_rule;
Lines 3117-3123 sub GetLatestAutoRenewDate { Link Here
3117
      or return;
3155
      or return;
3118
3156
3119
    my $branchcode = _GetCircControlBranch( $item, $borrower );
3157
    my $branchcode = _GetCircControlBranch( $item, $borrower );
3120
    my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule({ categorycode => $borrower->{categorycode}, itemtype => $item->{itype}, branchcode => $branchcode });
3158
    my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule(
3159
        {   categorycode => $borrower->{categorycode},
3160
            itemtype     => $item->{itype},
3161
            branchcode   => $branchcode
3162
        }
3163
    );
3121
3164
3122
    return unless $issuing_rule;
3165
    return unless $issuing_rule;
3123
    return if not $issuing_rule->no_auto_renewal_after
3166
    return if not $issuing_rule->no_auto_renewal_after
3124
- 

Return to bug 17599