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 3647-3652
subtest "Test Backdating of Returns" => sub {
Link Here
|
3647 |
is( $accountline->amount+0, 0, 'Fee amount was reduced to 0' ); |
3647 |
is( $accountline->amount+0, 0, 'Fee amount was reduced to 0' ); |
3648 |
}; |
3648 |
}; |
3649 |
|
3649 |
|
|
|
3650 |
subtest 'Do not return on renewal (LOST charge)' => sub { |
3651 |
plan tests => 1; |
3652 |
|
3653 |
t::lib::Mocks::mock_preference('MarkLostItemsAsReturned', ''); |
3654 |
my $library = $builder->build_object( { class => "Koha::Libraries" } ); |
3655 |
my $manager = $builder->build_object( { class => "Koha::Patrons" } ); |
3656 |
t::lib::Mocks::mock_userenv({ patron => $manager,branchcode => $manager->branchcode }); |
3657 |
|
3658 |
my $biblio = $builder->build_sample_biblio; |
3659 |
|
3660 |
my $item = $builder->build_sample_item( |
3661 |
{ |
3662 |
biblionumber => $biblio->biblionumber, |
3663 |
library => $library->branchcode, |
3664 |
replacementprice => 99.00, |
3665 |
itype => $itemtype, |
3666 |
} |
3667 |
); |
3668 |
|
3669 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
3670 |
AddIssue( $patron->unblessed, $item->barcode ); |
3671 |
|
3672 |
my $accountline = Koha::Account::Line->new( |
3673 |
{ |
3674 |
borrowernumber => $patron->borrowernumber, |
3675 |
debit_type_code => 'LOST', |
3676 |
status => undef, |
3677 |
itemnumber => $item->itemnumber, |
3678 |
amount => 12, |
3679 |
amountoutstanding => 12, |
3680 |
interface => 'something', |
3681 |
} |
3682 |
)->store(); |
3683 |
$patron->account->pay( |
3684 |
{ line => [$accountline], amount => 12, interface => 'something', manager_id => $patron->borrowernumber } ); |
3685 |
|
3686 |
AddRenewal( $patron->borrowernumber, $item->itemnumber, $library->branchcode ); |
3687 |
|
3688 |
is( $patron->checkouts->count, 1, |
3689 |
'Renewal should not return the item even if a LOST payment has been made earlier' |
3690 |
); |
3691 |
}; |
3692 |
|
3650 |
$schema->storage->txn_rollback; |
3693 |
$schema->storage->txn_rollback; |
3651 |
C4::Context->clear_syspref_cache(); |
3694 |
C4::Context->clear_syspref_cache(); |
3652 |
$cache->clear_from_cache('single_holidays'); |
3695 |
$cache->clear_from_cache('single_holidays'); |
3653 |
- |
|
|