From 77f4fc7b763cba3b105960a3f226ce0ee8d49b3d Mon Sep 17 00:00:00 2001 From: Rayan LAURENT Date: Thu, 11 Dec 2025 18:48:18 +0100 Subject: [PATCH] FIX | Fixing addPayment /invoices/id/payments Fixing the API route as it is currently impossible to pay a Facture::TYPE_CREDIT_NOTE with this route (it keeps negating the ttc amount used as resteapayer), inspired by the other route /paymentsdistributed, line 1717. --- htdocs/compta/facture/class/api_invoices.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 87f147a7f73..09f1110231e 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -1562,7 +1562,7 @@ class Invoices extends DolibarrApi // Clean parameters amount if payment is for a credit note if ($this->invoice->type == Facture::TYPE_CREDIT_NOTE) { $resteapayer = price2num($resteapayer, 'MT'); - $amounts[$id] = (float) price2num(-1 * (float) $resteapayer, 'MT'); + $amounts[$id] = (float) price2num(-1 * abs((float) $resteapayer), 'MT'); // Multicurrency $newvalue = price2num($this->invoice->multicurrency_total_ttc, 'MT'); $multicurrency_amounts[$id] = (float) price2num(-1 * (float) $newvalue, 'MT');