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

(-)a/C4/Overdues.pm (+1 lines)
Lines 318-323 sub get_chargeable_units { Link Here
318
        if(C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed') {
318
        if(C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed') {
319
            my $calendar = Koha::Calendar->new( branchcode => $branchcode );
319
            my $calendar = Koha::Calendar->new( branchcode => $branchcode );
320
            $charge_duration = $calendar->days_between( $date_due, $date_returned );
320
            $charge_duration = $calendar->days_between( $date_due, $date_returned );
321
            $charge_duration->subtract(days=>1) if $calendar->is_holiday( $date_returned );
321
        } else {
322
        } else {
322
            $charge_duration = $date_returned->delta_days( $date_due );
323
            $charge_duration = $date_returned->delta_days( $date_due );
323
        }
324
        }
(-)a/t/db_dependent/Circulation/CalcFine.t (-2 / +13 lines)
Lines 4-9 use Modern::Perl; Link Here
4
4
5
use Test::More tests => 3;
5
use Test::More tests => 3;
6
6
7
use C4::Calendar;
7
use C4::Context;
8
use C4::Context;
8
use C4::Overdues;
9
use C4::Overdues;
9
10
Lines 62-68 my $item = $builder->build_sample_item( Link Here
62
);
63
);
63
64
64
subtest 'Test basic functionality' => sub {
65
subtest 'Test basic functionality' => sub {
65
    plan tests => 1;
66
    plan tests => 3;
67
68
    t::lib::Mocks::mock_preference('finesCalendar', 'ignoreCalendar');
66
69
67
    Koha::CirculationRules->set_rules(
70
    Koha::CirculationRules->set_rules(
68
        {
71
        {
Lines 97-102 subtest 'Test basic functionality' => sub { Link Here
97
100
98
    is( $amount, 29, 'Amount is calculated correctly' );
101
    is( $amount, 29, 'Amount is calculated correctly' );
99
102
103
104
    C4::Calendar->new(branchcode=>$branch->{branchcode})->insert_single_holiday(date=>'2000-01-30',title=>'test',description=>'test');
105
    ($amount) = CalcFine( $item->unblessed, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt );
106
    is( $amount, 29, 'Amount is calculated correctly ignoring holidays' );
107
108
    t::lib::Mocks::mock_preference('finesCalendar', 'noFinesWhenClosed');
109
    ($amount) = CalcFine( $item->unblessed, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt );
110
    is( $amount, 28, 'Amount is calculated correctly excluding holidays' );
111
100
    teardown();
112
    teardown();
101
};
113
};
102
114
103
- 

Return to bug 27835