|
Lines 2827-2833
subtest '_FixAccountForLostAndFound' => sub {
Link Here
|
| 2827 |
}; |
2827 |
}; |
| 2828 |
|
2828 |
|
| 2829 |
subtest '_FixOverduesOnReturn' => sub { |
2829 |
subtest '_FixOverduesOnReturn' => sub { |
| 2830 |
plan tests => 11; |
2830 |
plan tests => 12; |
| 2831 |
|
2831 |
|
| 2832 |
my $manager = $builder->build_object({ class => "Koha::Patrons" }); |
2832 |
my $manager = $builder->build_object({ class => "Koha::Patrons" }); |
| 2833 |
t::lib::Mocks::mock_userenv({ patron => $manager, branchcode => $manager->branchcode }); |
2833 |
t::lib::Mocks::mock_userenv({ patron => $manager, branchcode => $manager->branchcode }); |
|
Lines 2891-2896
subtest '_FixOverduesOnReturn' => sub {
Link Here
|
| 2891 |
is( ref $credit, "Koha::Account::Line", "Found matching credit for fine forgiveness" ); |
2891 |
is( ref $credit, "Koha::Account::Line", "Found matching credit for fine forgiveness" ); |
| 2892 |
is( $credit->amount + 0, -99, "Credit amount is set correctly" ); |
2892 |
is( $credit->amount + 0, -99, "Credit amount is set correctly" ); |
| 2893 |
is( $credit->amountoutstanding + 0, 0, "Credit amountoutstanding is correctly set to 0" ); |
2893 |
is( $credit->amountoutstanding + 0, 0, "Credit amountoutstanding is correctly set to 0" ); |
|
|
2894 |
$offset->delete; |
| 2895 |
|
| 2896 |
$accountline->set( |
| 2897 |
{ |
| 2898 |
debit_type_code => 'OVERDUE', |
| 2899 |
status => 'UNRETURNED', |
| 2900 |
amountoutstanding => 0.00, |
| 2901 |
} |
| 2902 |
)->store(); |
| 2903 |
|
| 2904 |
C4::Circulation::_FixOverduesOnReturn( $patron->{borrowernumber}, $item->itemnumber, 1, 'RETURNED' ); |
| 2905 |
|
| 2906 |
$accountline->_result()->discard_changes(); |
| 2907 |
$offset = Koha::Account::Offsets->search({ debit_id => $accountline->id, type => 'Forgiven' })->next(); |
| 2908 |
is( $offset, undef, "No offset created when trying to forgive fine with no outstanding balance" ); |
| 2894 |
}; |
2909 |
}; |
| 2895 |
|
2910 |
|
| 2896 |
subtest '_FixAccountForLostAndFound returns undef if patron is deleted' => sub { |
2911 |
subtest '_FixAccountForLostAndFound returns undef if patron is deleted' => sub { |
| 2897 |
- |
|
|