From 7fdae69546ee20175379eb71ac964dc31011b3e7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Dec 2020 14:11:50 +0100 Subject: [PATCH] Fix warning --- htdocs/core/lib/functionsnumtoword.lib.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/lib/functionsnumtoword.lib.php b/htdocs/core/lib/functionsnumtoword.lib.php index 02a2de8058c..930c6d06a9e 100644 --- a/htdocs/core/lib/functionsnumtoword.lib.php +++ b/htdocs/core/lib/functionsnumtoword.lib.php @@ -139,8 +139,7 @@ function dol_convertToWord($num, $langs, $currency = '', $centimes = false) } // If we need to write cents call again this function for cents - $decimalpart = $TNum[1]; - $decimalpart = preg_replace('/0+$/', '', $decimalpart); + $decimalpart = empty($TNum[1]) ? '' : preg_replace('/0+$/', '', $TNum[1]); if ($decimalpart) { if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('and');