@@ -, +, @@ negative amounts - Run $ kshell k$ prove t/db_dependent/Koha/Account/Lines.t - Sign off :-D --- Koha/Account/Line.pm | 2 +- t/db_dependent/Koha/Account/Lines.t | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) --- a/Koha/Account/Line.pm +++ a/Koha/Account/Line.pm @@ -190,7 +190,7 @@ sub apply { Koha::Account::Offset->new( { credit_id => $self->id, debit_id => $debit->id, - amount => $amount_to_cancel, + amount => $amount_to_cancel * -1, type => $offset_type, } )->store(); --- a/t/db_dependent/Koha/Account/Lines.t +++ a/t/db_dependent/Koha/Account/Lines.t @@ -202,7 +202,7 @@ subtest 'apply() tests' => sub { my $offsets = Koha::Account::Offsets->search( { credit_id => $credit->id, debit_id => $debit_1->id } ); is( $offsets->count, 1, 'Only one offset is generated' ); my $THE_offset = $offsets->next; - is( $THE_offset->amount * 1, 10, 'Amount was calculated correctly (less than the available credit)' ); + is( $THE_offset->amount * 1, -10, 'Amount was calculated correctly (less than the available credit)' ); is( $THE_offset->type, 'Manual Credit', 'Passed type stored correctly' ); $debits = Koha::Account::Lines->search({ accountlines_id => $debit_2->id }); @@ -216,7 +216,7 @@ subtest 'apply() tests' => sub { $offsets = Koha::Account::Offsets->search( { credit_id => $credit->id, debit_id => $debit_2->id } ); is( $offsets->count, 1, 'Only one offset is generated' ); $THE_offset = $offsets->next; - is( $THE_offset->amount * 1, 90, 'Amount was calculated correctly (less than the available credit)' ); + is( $THE_offset->amount * 1, -90, 'Amount was calculated correctly (less than the available credit)' ); is( $THE_offset->type, 'Credit Applied', 'Defaults to \'Credit Applied\' offset type' ); $debits = Koha::Account::Lines->search({ accountlines_id => $debit_1->id }); --