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

(-)a/t/db_dependent/Circulation.t (-2 / +43 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
use utf8;
19
use utf8;
20
20
21
use Test::More tests => 46;
21
use Test::More tests => 47;
22
use Test::MockModule;
22
use Test::MockModule;
23
use Test::Deep qw( cmp_deeply );
23
use Test::Deep qw( cmp_deeply );
24
24
Lines 3742-3747 subtest "Test Backdating of Returns" => sub { Link Here
3742
    is( $accountline->amount+0, 0, 'Fee amount was reduced to 0' );
3742
    is( $accountline->amount+0, 0, 'Fee amount was reduced to 0' );
3743
};
3743
};
3744
3744
3745
subtest 'Do not return on renewal (LOST charge)' => sub {
3746
    plan tests => 1;
3747
3748
    t::lib::Mocks::mock_preference('MarkLostItemsAsReturned', 'onpayment');
3749
    my $library = $builder->build_object( { class => "Koha::Libraries" } );
3750
    my $manager = $builder->build_object( { class => "Koha::Patrons" } );
3751
    t::lib::Mocks::mock_userenv({ patron => $manager,branchcode => $manager->branchcode });
3752
3753
    my $biblio = $builder->build_sample_biblio;
3754
3755
    my $item = $builder->build_sample_item(
3756
        {
3757
            biblionumber     => $biblio->biblionumber,
3758
            library          => $library->branchcode,
3759
            replacementprice => 99.00,
3760
            itype            => $itemtype,
3761
        }
3762
    );
3763
3764
    my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
3765
    AddIssue( $patron->unblessed, $item->barcode );
3766
3767
    my $accountline = Koha::Account::Line->new(
3768
        {
3769
            borrowernumber    => $patron->borrowernumber,
3770
            debit_type_code   => 'LOST',
3771
            status            => undef,
3772
            itemnumber        => $item->itemnumber,
3773
            amount            => 12,
3774
            amountoutstanding => 12,
3775
            interface         => 'something',
3776
        }
3777
    )->store();
3778
3779
    # AddRenewal doesn't call _FixAccountForLostAndFound
3780
    AddIssue( $patron->unblessed, $item->barcode );
3781
3782
    is( $patron->checkouts->count, 1,
3783
        'Renewal should not return the item even if a LOST payment has been made earlier'
3784
    );
3785
};
3786
3745
$schema->storage->txn_rollback;
3787
$schema->storage->txn_rollback;
3746
C4::Context->clear_syspref_cache();
3788
C4::Context->clear_syspref_cache();
3747
$cache->clear_from_cache('single_holidays');
3789
$cache->clear_from_cache('single_holidays');
3748
- 

Return to bug 24474