Lines 2827-2833
subtest '_FixAccountForLostAndFound' => sub {
Link Here
|
2827 |
}; |
2827 |
}; |
2828 |
|
2828 |
|
2829 |
subtest '_FixOverduesOnReturn' => sub { |
2829 |
subtest '_FixOverduesOnReturn' => sub { |
2830 |
plan tests => 12; |
2830 |
plan tests => 14; |
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-2898
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; |
2894 |
|
2895 |
|
2895 |
# Bug 25417 - Only forgive fines where there is an amount oustanding to forgive |
2896 |
$accountline->set( |
2896 |
$accountline->set( |
2897 |
{ |
2897 |
{ |
2898 |
debit_type_code => 'OVERDUE', |
2898 |
debit_type_code => 'OVERDUE', |
Lines 2900-2911
subtest '_FixOverduesOnReturn' => sub {
Link Here
|
2900 |
amountoutstanding => 0.00, |
2900 |
amountoutstanding => 0.00, |
2901 |
} |
2901 |
} |
2902 |
)->store(); |
2902 |
)->store(); |
|
|
2903 |
$offset->delete; |
2903 |
|
2904 |
|
2904 |
C4::Circulation::_FixOverduesOnReturn( $patron->{borrowernumber}, $item->itemnumber, 1, 'RETURNED' ); |
2905 |
C4::Circulation::_FixOverduesOnReturn( $patron->{borrowernumber}, $item->itemnumber, 1, 'RETURNED' ); |
2905 |
|
2906 |
|
2906 |
$accountline->_result()->discard_changes(); |
2907 |
$accountline->_result()->discard_changes(); |
2907 |
$offset = Koha::Account::Offsets->search({ debit_id => $accountline->id, type => 'Forgiven' })->next(); |
2908 |
$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" ); |
2909 |
is( $offset, undef, "No offset created when trying to forgive fine with no outstanding balance" ); |
|
|
2910 |
isnt( $accountline->status, 'UNRETURNED', 'Open fine ( account type OVERDUE ) has been closed out ( status not UNRETURNED )'); |
2911 |
is( $accountline->status, 'RETURNED', 'Passed status has been used to set as RETURNED )'); |
2909 |
}; |
2912 |
}; |
2910 |
|
2913 |
|
2911 |
subtest '_FixAccountForLostAndFound returns undef if patron is deleted' => sub { |
2914 |
subtest '_FixAccountForLostAndFound returns undef if patron is deleted' => sub { |
2912 |
- |
|
|