|
Lines 132-138
$schema->storage->txn_rollback;
Link Here
|
| 132 |
|
132 |
|
| 133 |
subtest 'UpdateFine tests' => sub { |
133 |
subtest 'UpdateFine tests' => sub { |
| 134 |
|
134 |
|
| 135 |
plan tests => 59; |
135 |
plan tests => 70; |
| 136 |
|
136 |
|
| 137 |
$schema->storage->txn_begin; |
137 |
$schema->storage->txn_begin; |
| 138 |
|
138 |
|
|
Lines 348-353
subtest 'UpdateFine tests' => sub {
Link Here
|
| 348 |
# Total : Outstanding : MaxFine |
348 |
# Total : Outstanding : MaxFine |
| 349 |
# 150 : 100 : 100 |
349 |
# 150 : 100 : 100 |
| 350 |
|
350 |
|
|
|
351 |
# Decrease fine 3 - First item, third overdue adjust (backdated return example) |
| 352 |
UpdateFine( |
| 353 |
{ |
| 354 |
issue_id => $checkout1->issue_id, |
| 355 |
itemnumber => $item1->itemnumber, |
| 356 |
borrowernumber => $patron->borrowernumber, |
| 357 |
amount => '30', |
| 358 |
due => $checkout1->date_due |
| 359 |
} |
| 360 |
); |
| 361 |
|
| 362 |
$fines = Koha::Account::Lines->search( |
| 363 |
{ borrowernumber => $patron->borrowernumber }, |
| 364 |
{ order_by => { '-asc' => 'accountlines_id' } } |
| 365 |
); |
| 366 |
is( $fines->count, 3, "Still three fines after fourth checkout update" ); |
| 367 |
$fine = $fines->next; |
| 368 |
is( $fine->amount, '80.000000', "First fine amount unchanged" ); |
| 369 |
is( $fine->amountoutstanding, '50.000000', "First fine amountoutstanding unchanged" ); |
| 370 |
$fine2 = $fines->next; |
| 371 |
is( $fine2->amount, '30.000000', "Second fine amount unchanged" ); |
| 372 |
is( $fine2->amountoutstanding, '30.000000', "Second fine amountoutstanding unchanged" ); |
| 373 |
$fine3 = $fines->next; |
| 374 |
is( $fine3->amount, '30.000000', "Third fine reduced as expected" ); |
| 375 |
is( $fine3->amountoutstanding, '10.000000', "Third fine amountoutstanding reduced..." ); |
| 376 |
is( $fine3->issue_id, $checkout1->issue_id, "Third fine is associated with the correct issue" ); |
| 377 |
is( $fine3->itemnumber, $checkout1->itemnumber, "Third fine is associated with the correct item" ); |
| 378 |
is( $fine->amount + $fine2->amount + $fine3->amount, '140', "Total fines = 140" ); |
| 379 |
is( $fine->amountoutstanding + $fine2->amountoutstanding + $fine3->amountoutstanding, '90', "Total outstanding = 90" ); |
| 380 |
# Total : Outstanding : MaxFine |
| 381 |
# 140 : 90 : 100 |
| 382 |
|
| 351 |
# FIXME: Add test to check whether sundry/manual charges are included within MaxFine. |
383 |
# FIXME: Add test to check whether sundry/manual charges are included within MaxFine. |
| 352 |
# FIXME: Add test to ensure other charges are not included within MaxFine. |
384 |
# FIXME: Add test to ensure other charges are not included within MaxFine. |
| 353 |
|
385 |
|
|
Lines 400-406
subtest 'UpdateFine tests' => sub {
Link Here
|
| 400 |
is( $fine3->amount, '30.000000', "Third fine reduced" ); |
432 |
is( $fine3->amount, '30.000000', "Third fine reduced" ); |
| 401 |
is( $fine3->amountoutstanding, '10.000000', "Third fine amount outstanding is reduced" ); |
433 |
is( $fine3->amountoutstanding, '10.000000', "Third fine amount outstanding is reduced" ); |
| 402 |
|
434 |
|
| 403 |
|
|
|
| 404 |
|
| 405 |
$schema->storage->txn_rollback; |
435 |
$schema->storage->txn_rollback; |
| 406 |
}; |
436 |
}; |
| 407 |
- |
|
|