|
Lines 4590-4596
subtest 'AddReturn | is_overdue' => sub {
Link Here
|
| 4590 |
}; |
4590 |
}; |
| 4591 |
|
4591 |
|
| 4592 |
subtest 'lostreturn | charge' => sub { |
4592 |
subtest 'lostreturn | charge' => sub { |
| 4593 |
plan tests => 16; |
4593 |
plan tests => 18; |
| 4594 |
|
4594 |
|
| 4595 |
t::lib::Mocks::mock_userenv( { patron => $manager, branchcode => $branchcode_charge } ); |
4595 |
t::lib::Mocks::mock_userenv( { patron => $manager, branchcode => $branchcode_charge } ); |
| 4596 |
|
4596 |
|
|
Lines 4715-4720
subtest 'AddReturn | is_overdue' => sub {
Link Here
|
| 4715 |
5, |
4715 |
5, |
| 4716 |
'The new OVERDUE amountoutstanding is correct for the backdated return' |
4716 |
'The new OVERDUE amountoutstanding is correct for the backdated return' |
| 4717 |
); |
4717 |
); |
|
|
4718 |
|
| 4719 |
my $patron_2 = $builder->build_object( |
| 4720 |
{ |
| 4721 |
class => 'Koha::Patrons', |
| 4722 |
value => { categorycode => $patron_category->{categorycode} } |
| 4723 |
} |
| 4724 |
); |
| 4725 |
$issue = C4::Circulation::AddIssue( $patron_2, $item->barcode, $five_days_ago ); |
| 4726 |
|
| 4727 |
# Do nothing |
| 4728 |
my $four_days_ago = $now->clone->subtract( days => 4 ); |
| 4729 |
( undef, $message ) = AddReturn( $item->barcode, $branchcode_charge, undef, $four_days_ago ); |
| 4730 |
my $overdue_fees_2 = Koha::Account::Lines->search( |
| 4731 |
{ |
| 4732 |
borrowernumber => $patron_2->id, |
| 4733 |
itemnumber => $item->itemnumber, |
| 4734 |
debit_type_code => 'OVERDUE' |
| 4735 |
} |
| 4736 |
); |
| 4737 |
is( $overdue_fees_2->count, 1, 'Normal overdue generated when item returned late' ); |
| 4738 |
|
| 4739 |
# Simulate item marked as lost |
| 4740 |
$item->itemlost(2)->store; |
| 4741 |
$item->discard_changes(); |
| 4742 |
|
| 4743 |
#C4::Circulation::LostItem( $item->itemnumber, 1 ); |
| 4744 |
( undef, $message ) = AddReturn( $item->barcode, $branchcode_charge, undef ); |
| 4745 |
$overdue_fees_2 = Koha::Account::Lines->search( |
| 4746 |
{ |
| 4747 |
borrowernumber => $patron_2->id, |
| 4748 |
itemnumber => $item->itemnumber, |
| 4749 |
debit_type_code => 'OVERDUE' |
| 4750 |
} |
| 4751 |
); |
| 4752 |
is( |
| 4753 |
$overdue_fees_2->count, 1, |
| 4754 |
'No overdue generated when an item previously lost by a patron is lost after another patron has borrwed it' |
| 4755 |
); |
| 4718 |
}; |
4756 |
}; |
| 4719 |
}; |
4757 |
}; |
| 4720 |
}; |
4758 |
}; |
| 4721 |
- |
|
|