From 32db6eebbbdb47c1366c57358ebacdf2fedf9f0f Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 19 Mar 2024 21:40:58 +0100 Subject: [PATCH] Fix arg type to abs() with cast --- htdocs/fourn/facture/paiement.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 7c9b3b8b3b7..7776dd888d3 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -13,6 +13,7 @@ * Copyright (C) 2021 Charlene Benke * Copyright (C) 2022 Udo Tamm * Copyright (C) 2023 Sylvain Legrand + * 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 @@ -178,7 +179,7 @@ if (empty($reshook)) { $amountsresttopay[$cursorfacid] = price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement()); if ($amounts[$cursorfacid]) { // Check amount - if ($amounts[$cursorfacid] && (abs($amounts[$cursorfacid]) > abs($amountsresttopay[$cursorfacid]))) { + if ($amounts[$cursorfacid] && (abs((float) $amounts[$cursorfacid]) > abs((float) $amountsresttopay[$cursorfacid]))) { $addwarning = 1; $formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPaySupplier")).' '.$langs->trans("HelpPaymentHigherThanReminderToPaySupplier"); } @@ -205,7 +206,7 @@ if (empty($reshook)) { $multicurrency_amountsresttopay[$cursorfacid] = price2num($tmpinvoice->multicurrency_total_ttc - $tmpinvoice->getSommePaiement(1)); if ($multicurrency_amounts[$cursorfacid]) { // Check amount - if ($multicurrency_amounts[$cursorfacid] && (abs($multicurrency_amounts[$cursorfacid]) > abs($multicurrency_amountsresttopay[$cursorfacid]))) { + if ($multicurrency_amounts[$cursorfacid] && (abs((float) $multicurrency_amounts[$cursorfacid]) > abs((float) $multicurrency_amountsresttopay[$cursorfacid]))) { $addwarning = 1; $formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPaySupplier")).' '.$langs->trans("HelpPaymentHigherThanReminderToPaySupplier"); } @@ -280,7 +281,7 @@ if (empty($reshook)) { $tmpinvoice->fetch($key); if ($tmpinvoice->type == FactureFournisseur::TYPE_CREDIT_NOTE) { $newvalue = price2num($value, 'MT'); - $amounts[$key] = - abs($newvalue); + $amounts[$key] = - abs((float) $newvalue); } $multicurrency_code[$key] = $tmpinvoice->multicurrency_code; $multicurrency_tx[$key] = $tmpinvoice->multicurrency_tx; @@ -291,7 +292,7 @@ if (empty($reshook)) { $tmpinvoice->fetch($key); if ($tmpinvoice->type == FactureFournisseur::TYPE_CREDIT_NOTE) { $newvalue = price2num($value, 'MT'); - $multicurrency_amounts[$key] = - abs($newvalue); + $multicurrency_amounts[$key] = - abs((float) $newvalue); } $multicurrency_code[$key] = $tmpinvoice->multicurrency_code; $multicurrency_tx[$key] = $tmpinvoice->multicurrency_tx;