diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index ef52e74f6c8..8ca14c775a7 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2020 Thibault FOUCART * Copyright (C) 2023 Joachim Kueter * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1480,10 +1481,10 @@ 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 * $resteapayer, 'MT'); + $amounts[$id] = (float) price2num(-1 * (float) $resteapayer, 'MT'); // Multicurrency $newvalue = price2num($this->invoice->multicurrency_total_ttc, 'MT'); - $multicurrency_amounts[$id] = (float) price2num(-1 * $newvalue, 'MT'); + $multicurrency_amounts[$id] = (float) price2num(-1 * (float) $newvalue, 'MT'); } else { $resteapayer = price2num($resteapayer, 'MT'); $amounts[$id] = (float) $resteapayer; @@ -1626,7 +1627,7 @@ class Invoices extends DolibarrApi } if ($this->invoice->type == Facture::TYPE_CREDIT_NOTE) { - $amount = price2num(-1 * $amount, 'MT'); + $amount = price2num(-1 * (float) $amount, 'MT'); } if ($is_multicurrency) {