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 => 53; |
135 |
plan tests => 59; |
136 |
|
136 |
|
137 |
$schema->storage->txn_begin; |
137 |
$schema->storage->txn_begin; |
138 |
|
138 |
|
Lines 358-364
subtest 'UpdateFine tests' => sub {
Link Here
|
358 |
issue_id => $checkout1->issue_id, |
358 |
issue_id => $checkout1->issue_id, |
359 |
itemnumber => $item1->itemnumber, |
359 |
itemnumber => $item1->itemnumber, |
360 |
borrowernumber => $patron->borrowernumber, |
360 |
borrowernumber => $patron->borrowernumber, |
361 |
amount => '30', |
361 |
amount => '50', |
362 |
due => $checkout1->date_due |
362 |
due => $checkout1->date_due |
363 |
} |
363 |
} |
364 |
); |
364 |
); |
Lines 373-379
subtest 'UpdateFine tests' => sub {
Link Here
|
373 |
$fine2 = $fines->next; |
373 |
$fine2 = $fines->next; |
374 |
is( $fine2->amount, '30.000000', "Second fine amount unchanged" ); |
374 |
is( $fine2->amount, '30.000000', "Second fine amount unchanged" ); |
375 |
$fine3 = $fines->next; |
375 |
$fine3 = $fines->next; |
376 |
is( $fine3->amount, '30.000000', "Third fine increased now MaxFine cap is disabled" ); |
376 |
is( $fine3->amount, '50.000000', "Third fine increased now MaxFine cap is disabled" ); |
|
|
377 |
is( $fine3->amountoutstanding, '30.000000', "Third fine increased now MaxFine cap is disabled" ); |
378 |
|
379 |
# If somehow the fine should be reduced, we changed rules or checkout date or something |
380 |
UpdateFine( |
381 |
{ |
382 |
issue_id => $checkout1->issue_id, |
383 |
itemnumber => $item1->itemnumber, |
384 |
borrowernumber => $patron->borrowernumber, |
385 |
amount => '30', |
386 |
due => $checkout1->date_due |
387 |
} |
388 |
); |
389 |
|
390 |
$fines = Koha::Account::Lines->search( |
391 |
{ borrowernumber => $patron->borrowernumber }, |
392 |
{ order_by => { '-asc' => 'accountlines_id' } } |
393 |
); |
394 |
is( $fines->count, 3, "Still only three fines after MaxFine cap removed and third fine altered" ); |
395 |
$fine = $fines->next; |
396 |
is( $fine->amount, '80.000000', "First fine amount unchanged" ); |
397 |
$fine2 = $fines->next; |
398 |
is( $fine2->amount, '30.000000', "Second fine amount unchanged" ); |
399 |
$fine3 = $fines->next; |
400 |
is( $fine3->amount, '30.000000', "Third fine reduced" ); |
401 |
is( $fine3->amountoutstanding, '10.000000', "Third fine amount outstanding is reduced" ); |
402 |
|
403 |
|
377 |
|
404 |
|
378 |
$schema->storage->txn_rollback; |
405 |
$schema->storage->txn_rollback; |
379 |
}; |
406 |
}; |
380 |
- |
|
|