|
Lines 3177-3184
subtest 'Incremented fee tests' => sub {
Link Here
|
| 3177 |
$issue->delete(); |
3177 |
$issue->delete(); |
| 3178 |
|
3178 |
|
| 3179 |
my $calendar = C4::Calendar->new( branchcode => $library->id ); |
3179 |
my $calendar = C4::Calendar->new( branchcode => $library->id ); |
|
|
3180 |
# DateTime 1..7 (Mon..Sun), C4::Calender 0..6 (Sun..Sat) |
| 3181 |
my $closed_day = |
| 3182 |
( $dt_from->day_of_week == 6 ) ? 0 |
| 3183 |
: ( $dt_from->day_of_week == 7 ) ? 1 |
| 3184 |
: $dt_from->day_of_week + 1; |
| 3185 |
my $closed_day_name = $dt_from->clone->add(days => 1)->day_name; |
| 3180 |
$calendar->insert_week_day_holiday( |
3186 |
$calendar->insert_week_day_holiday( |
| 3181 |
weekday => 3, |
3187 |
weekday => $closed_day, |
| 3182 |
title => 'Test holiday', |
3188 |
title => 'Test holiday', |
| 3183 |
description => 'Test holiday' |
3189 |
description => 'Test holiday' |
| 3184 |
); |
3190 |
); |
|
Lines 3186-3198
subtest 'Incremented fee tests' => sub {
Link Here
|
| 3186 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
3192 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
| 3187 |
$accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); |
3193 |
$accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); |
| 3188 |
is( $accountline->amount, '6.000000', |
3194 |
is( $accountline->amount, '6.000000', |
| 3189 |
"Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays" |
3195 |
"Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed $closed_day_name" |
| 3190 |
); |
3196 |
); |
| 3191 |
$accountline->delete(); |
3197 |
$accountline->delete(); |
| 3192 |
AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to ); |
3198 |
AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to ); |
| 3193 |
$accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); |
3199 |
$accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); |
| 3194 |
is( $accountline->amount, '5.000000', |
3200 |
is( $accountline->amount, '5.000000', |
| 3195 |
"Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays, for renewal" |
3201 |
"Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed $closed_day_name, for renewal" |
| 3196 |
); |
3202 |
); |
| 3197 |
$accountline->delete(); |
3203 |
$accountline->delete(); |
| 3198 |
$issue->delete(); |
3204 |
$issue->delete(); |
|
Lines 3255-3270
subtest 'Incremented fee tests' => sub {
Link Here
|
| 3255 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
3261 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
| 3256 |
$accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); |
3262 |
$accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); |
| 3257 |
is( $accountline->amount + 0, 36, |
3263 |
is( $accountline->amount + 0, 36, |
| 3258 |
"Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays (168h - 24h * 0.25u)" ); |
3264 |
"Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed $closed_day_name (168h - 24h * 0.25u)" ); |
| 3259 |
$accountline->delete(); |
3265 |
$accountline->delete(); |
| 3260 |
AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to ); |
3266 |
AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to ); |
| 3261 |
$accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); |
3267 |
$accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); |
| 3262 |
is( $accountline->amount + 0, 30, |
3268 |
is( $accountline->amount + 0, 30, |
| 3263 |
"Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays, for renewal (312h - 168h - 24h * 0.25u" ); |
3269 |
"Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed $closed_day_name, for renewal (312h - 168h - 24h * 0.25u" ); |
| 3264 |
$accountline->delete(); |
3270 |
$accountline->delete(); |
| 3265 |
$issue->delete(); |
3271 |
$issue->delete(); |
| 3266 |
|
3272 |
|
| 3267 |
$calendar->delete_holiday( weekday => 3 ); |
3273 |
$calendar->delete_holiday( weekday => $closed_day ); |
| 3268 |
$issue = |
3274 |
$issue = |
| 3269 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
3275 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
| 3270 |
$accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); |
3276 |
$accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); |
| 3271 |
- |
|
|