Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 6; |
20 |
use Test::More tests => 7; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
22 |
use Test::Warn; |
22 |
use Test::Warn; |
23 |
|
23 |
|
Lines 399-402
subtest 'BranchTransferLimitsType' => sub {
Link Here
|
399 |
is( $doreturn, 1, 'AddReturn should have checkin the item if BranchTransferLimitsType=itemtype'); |
399 |
is( $doreturn, 1, 'AddReturn should have checkin the item if BranchTransferLimitsType=itemtype'); |
400 |
}; |
400 |
}; |
401 |
|
401 |
|
|
|
402 |
subtest 'Backdated returns should reduce fine if needed' => sub { |
403 |
plan tests => 1; |
404 |
|
405 |
t::lib::Mocks::mock_preference( "CalculateFinesOnReturn", 0 ); |
406 |
|
407 |
my $biblio = $builder->build_object( { class => 'Koha::Biblios' } ); |
408 |
my $item = $builder->build_object( |
409 |
{ |
410 |
class => 'Koha::Items', |
411 |
value => { |
412 |
biblionumber => $biblio->biblionumber, |
413 |
notforloan => 0, |
414 |
itemlost => 0, |
415 |
withdrawn => 0, |
416 |
} |
417 |
} |
418 |
); |
419 |
my $patron = $builder->build_object({class => 'Koha::Patrons'}); |
420 |
my $checkout = AddIssue( $patron->unblessed, $item->barcode ); |
421 |
my $fine = Koha::Account::Line->new({ |
422 |
issue_id => $checkout->id, |
423 |
borrowernumber => $patron->id, |
424 |
itemnumber => $item->id, |
425 |
date => dt_from_string(), |
426 |
amount => 100, |
427 |
amountoutstanding => 100, |
428 |
debit_type_code => 'OVERDUE', |
429 |
status => 'UNRETURNED', |
430 |
timestamp => dt_from_string(), |
431 |
manager_id => undef, |
432 |
interface => 'cli', |
433 |
branchcode => $patron->branchcode, |
434 |
})->store(); |
435 |
|
436 |
my ( $doreturn, $messages, $issue ) = AddReturn($item->barcode, undef, undef, dt_from_string('1999-01-01') ); |
437 |
|
438 |
$fine->discard_changes; |
439 |
is( $fine->amountoutstanding, '0.000000', "Fine was reduced correctly with a backdated return" ); |
440 |
}; |
441 |
|
402 |
$schema->storage->txn_rollback; |
442 |
$schema->storage->txn_rollback; |
403 |
- |
|
|