|
Lines 2065-2071
subtest 'AddReturn + suspension_chargeperiod' => sub {
Link Here
|
| 2065 |
|
2065 |
|
| 2066 |
# We want to charge 2 days every 2 days, without grace |
2066 |
# We want to charge 2 days every 2 days, without grace |
| 2067 |
# With 5 days of overdue: (5 * 2) / 2 |
2067 |
# With 5 days of overdue: (5 * 2) / 2 |
| 2068 |
$rule->suspension_chargeperiod(2)->store; |
2068 |
Koha::CirculationRules->set_rule( |
|
|
2069 |
{ |
| 2070 |
categorycode => undef, |
| 2071 |
branchcode => undef, |
| 2072 |
itemtype => undef, |
| 2073 |
rule_name => 'suspension_chargeperiod', |
| 2074 |
rule_value => '2', |
| 2075 |
} |
| 2076 |
); |
| 2077 |
|
| 2069 |
$expected_expiration = dt_from_string->add( days => floor( 5 * 2 ) / 2 ); |
2078 |
$expected_expiration = dt_from_string->add( days => floor( 5 * 2 ) / 2 ); |
| 2070 |
test_debarment_on_checkout( |
2079 |
test_debarment_on_checkout( |
| 2071 |
{ |
2080 |
{ |
|
Lines 2079-2086
subtest 'AddReturn + suspension_chargeperiod' => sub {
Link Here
|
| 2079 |
|
2088 |
|
| 2080 |
# We want to charge 2 days every 3 days, with 1 day of grace |
2089 |
# We want to charge 2 days every 3 days, with 1 day of grace |
| 2081 |
# With 5 days of overdue: ((5-1) / 3 ) * 2 |
2090 |
# With 5 days of overdue: ((5-1) / 3 ) * 2 |
| 2082 |
$rule->suspension_chargeperiod(3)->store; |
2091 |
Koha::CirculationRules->set_rules( |
| 2083 |
$rule->firstremind(1)->store; |
2092 |
{ |
|
|
2093 |
categorycode => undef, |
| 2094 |
branchcode => undef, |
| 2095 |
itemtype => undef, |
| 2096 |
rules => { |
| 2097 |
suspension_chargeperiod => 3, |
| 2098 |
firstremind => 1, |
| 2099 |
} |
| 2100 |
} |
| 2101 |
); |
| 2084 |
$expected_expiration = dt_from_string->add( days => floor( ( ( 5 - 1 ) / 3 ) * 2 ) ); |
2102 |
$expected_expiration = dt_from_string->add( days => floor( ( ( 5 - 1 ) / 3 ) * 2 ) ); |
| 2085 |
test_debarment_on_checkout( |
2103 |
test_debarment_on_checkout( |
| 2086 |
{ |
2104 |
{ |
|
Lines 2094-2102
subtest 'AddReturn + suspension_chargeperiod' => sub {
Link Here
|
| 2094 |
|
2112 |
|
| 2095 |
# Use finesCalendar to know if holiday must be skipped to calculate the due date |
2113 |
# Use finesCalendar to know if holiday must be skipped to calculate the due date |
| 2096 |
# We want to charge 2 days every days, with 0 day of grace (to not burn brains) |
2114 |
# We want to charge 2 days every days, with 0 day of grace (to not burn brains) |
| 2097 |
$rule->finedays(2)->store; |
2115 |
Koha::CirculationRules->set_rules( |
| 2098 |
$rule->suspension_chargeperiod(1)->store; |
2116 |
{ |
| 2099 |
$rule->firstremind(0)->store; |
2117 |
categorycode => undef, |
|
|
2118 |
branchcode => undef, |
| 2119 |
itemtype => undef, |
| 2120 |
rules => { |
| 2121 |
finedays => 2, |
| 2122 |
suspension_chargeperiod => 1, |
| 2123 |
firstremind => 0, |
| 2124 |
} |
| 2125 |
} |
| 2126 |
); |
| 2100 |
t::lib::Mocks::mock_preference('finesCalendar', 'noFinesWhenClosed'); |
2127 |
t::lib::Mocks::mock_preference('finesCalendar', 'noFinesWhenClosed'); |
| 2101 |
t::lib::Mocks::mock_preference('SuspensionsCalendar', 'noSuspensionsWhenClosed'); |
2128 |
t::lib::Mocks::mock_preference('SuspensionsCalendar', 'noSuspensionsWhenClosed'); |
| 2102 |
|
2129 |
|
|
Lines 2241-2247
subtest 'AddReturn | is_overdue' => sub {
Link Here
|
| 2241 |
)->unblessed; |
2268 |
)->unblessed; |
| 2242 |
|
2269 |
|
| 2243 |
Koha::CirculationRules->search->delete; |
2270 |
Koha::CirculationRules->search->delete; |
| 2244 |
my $rule = Koha::CirculationRules->set_rules( |
2271 |
Koha::CirculationRules->set_rules( |
| 2245 |
{ |
2272 |
{ |
| 2246 |
categorycode => undef, |
2273 |
categorycode => undef, |
| 2247 |
itemtype => undef, |
2274 |
itemtype => undef, |
| 2248 |
- |
|
|