Lines 3074-3080
subtest 'ProcessOfflinePayment() tests' => sub {
Link Here
|
3074 |
}; |
3074 |
}; |
3075 |
|
3075 |
|
3076 |
subtest 'Incremented fee tests' => sub { |
3076 |
subtest 'Incremented fee tests' => sub { |
3077 |
plan tests => 16; |
3077 |
plan tests => 20; |
3078 |
|
3078 |
|
3079 |
my $dt = dt_from_string(); |
3079 |
my $dt = dt_from_string(); |
3080 |
Time::Fake->offset( $dt->epoch ); |
3080 |
Time::Fake->offset( $dt->epoch ); |
Lines 3207-3230
subtest 'Incremented fee tests' => sub {
Link Here
|
3207 |
is( $issuingrule->lengthunit, 'hours', |
3207 |
is( $issuingrule->lengthunit, 'hours', |
3208 |
'Issuingrule updated and retrieved correctly' ); |
3208 |
'Issuingrule updated and retrieved correctly' ); |
3209 |
|
3209 |
|
3210 |
$itemtype->rentalcharge_hourly('2.500000')->store(); |
3210 |
$itemtype->rentalcharge_hourly('0.25')->store(); |
3211 |
is( $itemtype->rentalcharge_hourly, |
3211 |
is( $itemtype->rentalcharge_hourly, |
3212 |
'2.500000', 'Hourly rental charge stored and retreived correctly' ); |
3212 |
'0.25', 'Hourly rental charge stored and retreived correctly' ); |
3213 |
|
3213 |
|
3214 |
$dt_to = dt_from_string()->add( hours => 4 ); |
3214 |
$dt_to = dt_from_string()->add( hours => 168 ); |
3215 |
$dt_to_renew = dt_from_string()->add( hours => 6 ); |
3215 |
$dt_to_renew = dt_from_string()->add( hours => 312 ); |
3216 |
$calendar->delete_holiday( weekday => 3); |
|
|
3217 |
|
3216 |
|
|
|
3217 |
t::lib::Mocks::mock_preference( 'finesCalendar', 'ignoreCalendar' ); |
3218 |
$issue = |
3218 |
$issue = |
3219 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
3219 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
3220 |
$accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); |
3220 |
$accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); |
3221 |
is( $accountline->amount, '10.000000', |
3221 |
is( $accountline->amount + 0, 42, |
3222 |
"Hourly rental charge calculated correctly" ); |
3222 |
"Hourly rental charge calculated correctly with finesCalendar = ignoreCalendar (168h * 0.25u)" ); |
3223 |
$accountline->delete(); |
3223 |
$accountline->delete(); |
3224 |
AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to ); |
3224 |
AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to ); |
3225 |
$accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); |
3225 |
$accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); |
3226 |
is( $accountline->amount, '5.000000', |
3226 |
is( $accountline->amount + 0, 36, |
3227 |
"Hourly rental charge calculated correctly, for renewal" ); |
3227 |
"Hourly rental charge calculated correctly with finesCalendar = ignoreCalendar, for renewal (312h - 168h * 0.25u)" ); |
|
|
3228 |
$accountline->delete(); |
3229 |
$issue->delete(); |
3230 |
|
3231 |
t::lib::Mocks::mock_preference( 'finesCalendar', 'noFinesWhenClosed' ); |
3232 |
$issue = |
3233 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
3234 |
$accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); |
3235 |
is( $accountline->amount + 0, 36, |
3236 |
"Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays (168h - 24h * 0.25u)" ); |
3237 |
$accountline->delete(); |
3238 |
AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to ); |
3239 |
$accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); |
3240 |
is( $accountline->amount + 0, 30, |
3241 |
"Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays, for renewal (312h - 168h - 24h * 0.25u" ); |
3242 |
$accountline->delete(); |
3243 |
$issue->delete(); |
3244 |
|
3245 |
$calendar->delete_holiday( weekday => 3 ); |
3246 |
$issue = |
3247 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
3248 |
$accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); |
3249 |
is( $accountline->amount + 0, 42, |
3250 |
"Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed (168h - 0h * 0.25u" ); |
3251 |
$accountline->delete(); |
3252 |
AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to ); |
3253 |
$accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); |
3254 |
is( $accountline->amount + 0, 36, |
3255 |
"Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed, for renewal (312h - 168h - 0h * 0.25u)" ); |
3228 |
$accountline->delete(); |
3256 |
$accountline->delete(); |
3229 |
$issue->delete(); |
3257 |
$issue->delete(); |
3230 |
$issuingrule->lengthunit('days')->store(); |
3258 |
$issuingrule->lengthunit('days')->store(); |