Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 5; |
20 |
use Test::More tests => 6; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
22 |
use Test::Warn; |
22 |
use Test::Warn; |
23 |
|
23 |
|
Lines 364-367
subtest 'Checkin of an item claimed as returned should generate a message' => su
Link Here
|
364 |
ok( $messages->{ReturnClaims}, "ReturnClaims is in messages for return of a claimed as returned itm" ); |
364 |
ok( $messages->{ReturnClaims}, "ReturnClaims is in messages for return of a claimed as returned itm" ); |
365 |
}; |
365 |
}; |
366 |
|
366 |
|
|
|
367 |
subtest 'Backdated returns should reduce fine if needed' => sub { |
368 |
plan tests => 1; |
369 |
|
370 |
t::lib::Mocks::mock_preference( "CalculateFinesOnReturn", 0 ); |
371 |
|
372 |
my $biblio = $builder->build_object( { class => 'Koha::Biblios' } ); |
373 |
my $item = $builder->build_object( |
374 |
{ |
375 |
class => 'Koha::Items', |
376 |
value => { |
377 |
biblionumber => $biblio->biblionumber, |
378 |
notforloan => 0, |
379 |
itemlost => 0, |
380 |
withdrawn => 0, |
381 |
} |
382 |
} |
383 |
); |
384 |
my $patron = $builder->build_object({class => 'Koha::Patrons'}); |
385 |
my $checkout = AddIssue( $patron->unblessed, $item->barcode ); |
386 |
my $fine = Koha::Account::Line->new({ |
387 |
issue_id => $checkout->id, |
388 |
borrowernumber => $patron->id, |
389 |
itemnumber => $item->id, |
390 |
date => dt_from_string(), |
391 |
amount => 100, |
392 |
amountoutstanding => 100, |
393 |
debit_type_code => 'OVERDUE', |
394 |
status => 'UNRETURNED', |
395 |
timestamp => dt_from_string(), |
396 |
manager_id => undef, |
397 |
interface => 'cli', |
398 |
branchcode => $patron->branchcode, |
399 |
})->store(); |
400 |
|
401 |
my ( $doreturn, $messages, $issue ) = AddReturn($item->barcode, undef, undef, dt_from_string('1999-01-01') ); |
402 |
|
403 |
$fine->discard_changes; |
404 |
is( $fine->amountoutstanding, '0.000000', "Fine was reduced correctly with a backdated return" ); |
405 |
}; |
406 |
|
367 |
$schema->storage->txn_rollback; |
407 |
$schema->storage->txn_rollback; |
368 |
- |
|
|