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 3770-3775
subtest "Test Backdating of Returns" => sub {
Link Here
|
3770 |
is( $accountline->amount+0, 0, 'Fee amount was reduced to 0' ); |
3770 |
is( $accountline->amount+0, 0, 'Fee amount was reduced to 0' ); |
3771 |
}; |
3771 |
}; |
3772 |
|
3772 |
|
|
|
3773 |
subtest 'Do not return on renewal (LOST charge)' => sub { |
3774 |
plan tests => 1; |
3775 |
|
3776 |
t::lib::Mocks::mock_preference('MarkLostItemsAsReturned', 'onpayment'); |
3777 |
my $library = $builder->build_object( { class => "Koha::Libraries" } ); |
3778 |
my $manager = $builder->build_object( { class => "Koha::Patrons" } ); |
3779 |
t::lib::Mocks::mock_userenv({ patron => $manager,branchcode => $manager->branchcode }); |
3780 |
|
3781 |
my $biblio = $builder->build_sample_biblio; |
3782 |
|
3783 |
my $item = $builder->build_sample_item( |
3784 |
{ |
3785 |
biblionumber => $biblio->biblionumber, |
3786 |
library => $library->branchcode, |
3787 |
replacementprice => 99.00, |
3788 |
itype => $itemtype, |
3789 |
} |
3790 |
); |
3791 |
|
3792 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
3793 |
AddIssue( $patron->unblessed, $item->barcode ); |
3794 |
|
3795 |
my $accountline = Koha::Account::Line->new( |
3796 |
{ |
3797 |
borrowernumber => $patron->borrowernumber, |
3798 |
debit_type_code => 'LOST', |
3799 |
status => undef, |
3800 |
itemnumber => $item->itemnumber, |
3801 |
amount => 12, |
3802 |
amountoutstanding => 12, |
3803 |
interface => 'something', |
3804 |
} |
3805 |
)->store(); |
3806 |
|
3807 |
# AddRenewal doesn't call _FixAccountForLostAndFound |
3808 |
AddIssue( $patron->unblessed, $item->barcode ); |
3809 |
|
3810 |
is( $patron->checkouts->count, 1, |
3811 |
'Renewal should not return the item even if a LOST payment has been made earlier' |
3812 |
); |
3813 |
}; |
3814 |
|
3773 |
$schema->storage->txn_rollback; |
3815 |
$schema->storage->txn_rollback; |
3774 |
C4::Context->clear_syspref_cache(); |
3816 |
C4::Context->clear_syspref_cache(); |
3775 |
$cache->clear_from_cache('single_holidays'); |
3817 |
$cache->clear_from_cache('single_holidays'); |
3776 |
- |
|
|