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 => 68; |
135 |
plan tests => 70; |
136 |
|
136 |
|
137 |
$schema->storage->txn_begin; |
137 |
$schema->storage->txn_begin; |
138 |
|
138 |
|
Lines 430-434
subtest 'UpdateFine tests' => sub {
Link Here
|
430 |
is( $fine3->amount+0, 30, "Third fine reduced" ); |
430 |
is( $fine3->amount+0, 30, "Third fine reduced" ); |
431 |
is( $fine3->amountoutstanding+0, 10, "Third fine amount outstanding is reduced" ); |
431 |
is( $fine3->amountoutstanding+0, 10, "Third fine amount outstanding is reduced" ); |
432 |
|
432 |
|
|
|
433 |
t::lib::Mocks::mock_preference( 'MaxFine', '7.2' ); |
434 |
my $patron_1 = $builder->build_object( { class => 'Koha::Patrons' } ); |
435 |
my $account = $patron_1->account; |
436 |
$account->add_debit({ type => 'OVERDUE', amount => '6.99', interface => 'TEST'}); |
437 |
$account->add_debit({ type => 'OVERDUE', amount => '.10', interface => 'TEST'}); |
438 |
$account->add_debit({ type => 'OVERDUE', amount => '.10', interface => 'TEST'}); |
439 |
$account->add_debit({ type => 'OVERDUE', amount => '.01', interface => 'TEST'}); |
440 |
my $item_1 = $builder->build_sample_item(); |
441 |
my $checkout_1 = $builder->build_object( |
442 |
{ |
443 |
class => 'Koha::Checkouts', |
444 |
value => { itemnumber => $item_1->itemnumber, borrowernumber => $patron_1->id } |
445 |
} |
446 |
); |
447 |
UpdateFine( |
448 |
{ |
449 |
issue_id => $checkout_1->issue_id, |
450 |
itemnumber => $item_1->itemnumber, |
451 |
borrowernumber => $patron_1->borrowernumber, |
452 |
amount => '.1', |
453 |
due => $checkout_1->date_due |
454 |
} |
455 |
); |
456 |
$fines = Koha::Account::Lines->search( |
457 |
{ borrowernumber => $patron_1->borrowernumber }, |
458 |
{ order_by => { '-asc' => 'accountlines_id' } } |
459 |
); |
460 |
is( $fines->count, 4, "New amount should be 0 so no fine added" ); |
461 |
ok( C4::Circulation::AddReturn( $item_1->barcode, $item_1->homebranch, 1), "Returning the item and forgiving fines succeeds"); |
462 |
|
463 |
|
433 |
$schema->storage->txn_rollback; |
464 |
$schema->storage->txn_rollback; |
434 |
}; |
465 |
}; |
435 |
- |
|
|