View | Details | Raw Unified | Return to bug 24380
Collapse All | Expand All

(-)a/t/db_dependent/Circulation/Returns.t (-2 / +41 lines)
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 405-408 subtest 'BranchTransferLimitsType' => sub { Link Here
405
    is( $doreturn, 1, 'AddReturn should have checkin the item if BranchTransferLimitsType=itemtype');
405
    is( $doreturn, 1, 'AddReturn should have checkin the item if BranchTransferLimitsType=itemtype');
406
};
406
};
407
407
408
subtest 'Backdated returns should reduce fine if needed' => sub {
409
    plan tests => 1;
410
411
    t::lib::Mocks::mock_preference( "CalculateFinesOnReturn", 0 );
412
413
    my $biblio = $builder->build_object( { class => 'Koha::Biblios' } );
414
    my $item = $builder->build_object(
415
        {
416
            class  => 'Koha::Items',
417
            value  => {
418
                biblionumber => $biblio->biblionumber,
419
                notforloan => 0,
420
                itemlost   => 0,
421
                withdrawn  => 0,
422
        }
423
    }
424
    );
425
    my $patron = $builder->build_object({class => 'Koha::Patrons'});
426
    my $checkout = AddIssue( $patron->unblessed, $item->barcode );
427
    my $fine = Koha::Account::Line->new({
428
        issue_id => $checkout->id,
429
        borrowernumber => $patron->id,
430
        itemnumber => $item->id,
431
        date => dt_from_string(),
432
        amount => 100,
433
        amountoutstanding => 100,
434
        debit_type_code => 'OVERDUE',
435
        status => 'UNRETURNED',
436
        timestamp => dt_from_string(),
437
        manager_id => undef,
438
        interface => 'cli',
439
        branchcode => $patron->branchcode,
440
    })->store();
441
442
    my ( $doreturn, $messages, $issue ) = AddReturn($item->barcode, undef, undef, dt_from_string('1999-01-01') );
443
444
    $fine->discard_changes;
445
    is( $fine->amountoutstanding, '0.000000', "Fine was reduced correctly with a backdated return" );
446
};
447
408
$schema->storage->txn_rollback;
448
$schema->storage->txn_rollback;
409
- 

Return to bug 24380