@@ -, +, @@ 'writeoff' - Apply the patch - Run: $ kshell k$ prove t/db_dependent/Koha/Account.t - Sign off :-D --- Koha/Account.pm | 2 +- t/db_dependent/Koha/Account.t | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) --- a/Koha/Account.pm +++ a/Koha/Account.pm @@ -346,7 +346,7 @@ sub add_credit { borrowernumber => $self->{patron_id}, accountno => $accountno, } - ); + ) if grep { $type eq $_ } ('payment', 'writeoff') ; if ( C4::Context->preference("FinesLog") ) { logaction( --- a/t/db_dependent/Koha/Account.t +++ a/t/db_dependent/Koha/Account.t @@ -62,7 +62,7 @@ subtest 'outstanding_debits() tests' => sub { subtest 'add_credit() tests' => sub { - plan tests => 13; + plan tests => 15; $schema->storage->txn_begin; @@ -83,6 +83,7 @@ subtest 'add_credit() tests' => sub { description => 'Payment of 25', library_id => $patron->branchcode, note => 'not really important', + type => 'payment', user_id => $patron->id } ); @@ -120,5 +121,17 @@ subtest 'add_credit() tests' => sub { is( $offset_2->credit_id, $line_2->id, 'No debit_id is set for credits' ); is( $offset_2->debit_id, undef, 'No debit_id is set for credits' ); + my $line_3 = $account->add_credit( + { amount => 20, + description => 'Manual credit applied', + library_id => $patron->branchcode, + user_id => $patron->id, + type => 'forgiven' + } + ); + + is( $schema->resultset('ActionLog')->count(), 2, 'Log was added' ); + is( $schema->resultset('Statistic')->count(), 2, 'No action added to statistics, because of credit type' ); + $schema->storage->txn_rollback; }; --