From 9846e87d99534a0f22ddc1a7b8c36e26975787d4 Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Thu, 18 Mar 2021 10:23:57 +0000
Subject: [PATCH] Bug 22435: Fix CREATE offset amounts

Updateing the tests highlighted a mistake in the original code.. the
offsets for the cancel and reduce creation lines were incorrectly
signed.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
---
 Koha/Account/Line.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm
index 4831d14dcd..c1f0613dc0 100644
--- a/Koha/Account/Line.pm
+++ b/Koha/Account/Line.pm
@@ -417,7 +417,7 @@ sub cancel {
                 {
                     credit_id => $cancellation->accountlines_id,
                     type      => 'CREATE',
-                    amount    => $self->amount
+                    amount    => 0 - $self->amount
                 }
             )->store();
 
@@ -536,7 +536,7 @@ sub reduce {
                 {
                     credit_id => $reduction->accountlines_id,
                     type      => 'CREATE',
-                    amount    => $params->{amount}
+                    amount    => 0 - $params->{amount}
                 }
             )->store();
 
-- 
2.20.1