|
Lines 2044-2050
subtest 'AddReturn + suspension_chargeperiod' => sub {
Link Here
|
| 2044 |
|
2044 |
|
| 2045 |
# We want to charge 2 days every 2 days, without grace |
2045 |
# We want to charge 2 days every 2 days, without grace |
| 2046 |
# With 5 days of overdue: (5 * 2) / 2 |
2046 |
# With 5 days of overdue: (5 * 2) / 2 |
| 2047 |
$rule->suspension_chargeperiod(2)->store; |
2047 |
Koha::CirculationRules->set_rule( |
|
|
2048 |
{ |
| 2049 |
categorycode => undef, |
| 2050 |
branchcode => undef, |
| 2051 |
itemtype => undef, |
| 2052 |
rule_name => 'suspension_chargeperiod', |
| 2053 |
rule_value => '2', |
| 2054 |
} |
| 2055 |
); |
| 2056 |
|
| 2048 |
$expected_expiration = dt_from_string->add( days => floor( 5 * 2 ) / 2 ); |
2057 |
$expected_expiration = dt_from_string->add( days => floor( 5 * 2 ) / 2 ); |
| 2049 |
test_debarment_on_checkout( |
2058 |
test_debarment_on_checkout( |
| 2050 |
{ |
2059 |
{ |
|
Lines 2058-2065
subtest 'AddReturn + suspension_chargeperiod' => sub {
Link Here
|
| 2058 |
|
2067 |
|
| 2059 |
# We want to charge 2 days every 3 days, with 1 day of grace |
2068 |
# We want to charge 2 days every 3 days, with 1 day of grace |
| 2060 |
# With 5 days of overdue: ((5-1) / 3 ) * 2 |
2069 |
# With 5 days of overdue: ((5-1) / 3 ) * 2 |
| 2061 |
$rule->suspension_chargeperiod(3)->store; |
2070 |
Koha::CirculationRules->set_rules( |
| 2062 |
$rule->firstremind(1)->store; |
2071 |
{ |
|
|
2072 |
categorycode => undef, |
| 2073 |
branchcode => undef, |
| 2074 |
itemtype => undef, |
| 2075 |
rules => { |
| 2076 |
suspension_chargeperiod => 3, |
| 2077 |
firstremind => 1, |
| 2078 |
} |
| 2079 |
} |
| 2080 |
); |
| 2063 |
$expected_expiration = dt_from_string->add( days => floor( ( ( 5 - 1 ) / 3 ) * 2 ) ); |
2081 |
$expected_expiration = dt_from_string->add( days => floor( ( ( 5 - 1 ) / 3 ) * 2 ) ); |
| 2064 |
test_debarment_on_checkout( |
2082 |
test_debarment_on_checkout( |
| 2065 |
{ |
2083 |
{ |
|
Lines 2073-2081
subtest 'AddReturn + suspension_chargeperiod' => sub {
Link Here
|
| 2073 |
|
2091 |
|
| 2074 |
# Use finesCalendar to know if holiday must be skipped to calculate the due date |
2092 |
# Use finesCalendar to know if holiday must be skipped to calculate the due date |
| 2075 |
# We want to charge 2 days every days, with 0 day of grace (to not burn brains) |
2093 |
# We want to charge 2 days every days, with 0 day of grace (to not burn brains) |
| 2076 |
$rule->finedays(2)->store; |
2094 |
Koha::CirculationRules->set_rules( |
| 2077 |
$rule->suspension_chargeperiod(1)->store; |
2095 |
{ |
| 2078 |
$rule->firstremind(0)->store; |
2096 |
categorycode => undef, |
|
|
2097 |
branchcode => undef, |
| 2098 |
itemtype => undef, |
| 2099 |
rules => { |
| 2100 |
finedays => 2, |
| 2101 |
suspension_chargeperiod => 1, |
| 2102 |
firstremind => 0, |
| 2103 |
} |
| 2104 |
} |
| 2105 |
); |
| 2079 |
t::lib::Mocks::mock_preference('finesCalendar', 'noFinesWhenClosed'); |
2106 |
t::lib::Mocks::mock_preference('finesCalendar', 'noFinesWhenClosed'); |
| 2080 |
|
2107 |
|
| 2081 |
# Adding a holiday 2 days ago |
2108 |
# Adding a holiday 2 days ago |
|
Lines 2222-2228
subtest 'AddReturn | is_overdue' => sub {
Link Here
|
| 2222 |
)->unblessed; |
2249 |
)->unblessed; |
| 2223 |
|
2250 |
|
| 2224 |
Koha::CirculationRules->search->delete; |
2251 |
Koha::CirculationRules->search->delete; |
| 2225 |
my $rule = Koha::CirculationRules->set_rules( |
2252 |
Koha::CirculationRules->set_rules( |
| 2226 |
{ |
2253 |
{ |
| 2227 |
categorycode => undef, |
2254 |
categorycode => undef, |
| 2228 |
itemtype => undef, |
2255 |
itemtype => undef, |
| 2229 |
- |
|
|