};
subtest '_FixOverduesOnReturn' => sub {
- plan tests => 11;
+ plan tests => 12;
my $manager = $builder->build_object({ class => "Koha::Patrons" });
t::lib::Mocks::mock_userenv({ patron => $manager, branchcode => $manager->branchcode });
is( ref $credit, "Koha::Account::Line", "Found matching credit for fine forgiveness" );
is( $credit->amount + 0, -99, "Credit amount is set correctly" );
is( $credit->amountoutstanding + 0, 0, "Credit amountoutstanding is correctly set to 0" );
+ $offset->delete;
+
+ $accountline->set(
+ {
+ debit_type_code => 'OVERDUE',
+ status => 'UNRETURNED',
+ amountoutstanding => 0.00,
+ }
+ )->store();
+
+ C4::Circulation::_FixOverduesOnReturn( $patron->{borrowernumber}, $item->itemnumber, 1, 'RETURNED' );
+
+ $accountline->_result()->discard_changes();
+ $offset = Koha::Account::Offsets->search({ debit_id => $accountline->id, type => 'Forgiven' })->next();
+ is( $offset, undef, "No offset created when trying to forgive fine with no outstanding balance" );
};
subtest '_FixAccountForLostAndFound returns undef if patron is deleted' => sub {