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

(-)a/C4/Circulation.pm (-12 / +12 lines)
Lines 3372-3390 sub GetIssuingCharges { Link Here
3372
    if ( my $item_data = $sth->fetchrow_hashref ) {
3372
    if ( my $item_data = $sth->fetchrow_hashref ) {
3373
        $item_type = $item_data->{itemtype};
3373
        $item_type = $item_data->{itemtype};
3374
        $charge    = $item_data->{rentalcharge};
3374
        $charge    = $item_data->{rentalcharge};
3375
        # FIXME This should follow CircControl
3376
        my $branch = C4::Context::mybranch();
3377
        my $patron = Koha::Patrons->find( $borrowernumber );
3378
        my $discount = Koha::CirculationRules->get_effective_rule({
3379
            categorycode => $patron->categorycode,
3380
            branchcode   => $branch,
3381
            itemtype     => $item_type,
3382
            rule_name    => 'rentaldiscount'
3383
        });
3384
        if ($discount) {
3385
            $charge = ( $charge * ( 100 - $discount->rule_value ) ) / 100;
3386
        }
3387
        if ($charge) {
3375
        if ($charge) {
3376
            # FIXME This should follow CircControl
3377
            my $branch = C4::Context::mybranch();
3378
            my $patron = Koha::Patrons->find( $borrowernumber );
3379
            my $discount = Koha::CirculationRules->get_effective_rule({
3380
                categorycode => $patron->categorycode,
3381
                branchcode   => $branch,
3382
                itemtype     => $item_type,
3383
                rule_name    => 'rentaldiscount'
3384
            });
3385
            if ($discount) {
3386
                $charge = ( $charge * ( 100 - $discount->rule_value ) ) / 100;
3387
            }
3388
            $charge = sprintf '%.2f', $charge; # ensure no fractions of a penny returned
3388
            $charge = sprintf '%.2f', $charge; # ensure no fractions of a penny returned
3389
        }
3389
        }
3390
    }
3390
    }
(-)a/Koha/CirculationRules.pm (+1 lines)
Lines 156-161 our $RULE_KINDS = { Link Here
156
    },
156
    },
157
    rentaldiscount => {
157
    rentaldiscount => {
158
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
158
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
159
        can_be_blank => 0,
159
    },
160
    },
160
    reservesallowed => {
161
    reservesallowed => {
161
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
162
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
(-)a/installer/data/mysql/atomicupdate/bug_28774_remove_blank_rentaldiscount.perl (-1 / +8 lines)
Line 0 Link Here
0
- 
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q{
4
        DELETE FROM circulation_rules 
5
        WHERE rule_name = 'rentaldiscount' AND rule_value=''
6
    });
7
    NewVersion( $DBversion, 28774, "Delete blank rental discounts");
8
}

Return to bug 28774