From 26b8112d4ef23024d5f61a3d3b526bb665ee9b83 Mon Sep 17 00:00:00 2001 From: arnaud <arnaud.saint-patrice@atm-consulting.fr> Date: Mon, 20 Feb 2017 09:22:57 +0100 Subject: [PATCH] FIX travis check --- htdocs/core/lib/functionsnumtoword.lib.php | 12 +++++++----- .../modules/supplier_payment/pdf/pdf_cow.modules.php | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/functionsnumtoword.lib.php b/htdocs/core/lib/functionsnumtoword.lib.php index 2e51567da7c..156a046db5a 100644 --- a/htdocs/core/lib/functionsnumtoword.lib.php +++ b/htdocs/core/lib/functionsnumtoword.lib.php @@ -29,14 +29,15 @@ * @deprecated * @param float $numero Number to convert * @param Lang $langs Language - * @param string $numorcurrency 'number' or 'amount' - * @return string Text of the number or -1 in case TOO LONG (more than 1000000000000.99) + * @param boolean $currency 0=number to translate | 1=currency to translate + * @param boolean $centimes 0=no centimes | 1=centimes to translate + * @return string Text of the number */ -function dol_convertToWord($num = false, $langs, $currency=false, $centimes=false) +function dol_convertToWord($num=0, $langs, $currency=false, $centimes=false) { global $conf; - $num = str_replace(array(',', ' '), '' , trim($num)); + $num = str_replace(array(',', ' '), '', trim($num)); if(! $num) { return false; } @@ -89,6 +90,7 @@ function dol_convertToWord($num = false, $langs, $currency=false, $centimes=fals $langs->transnoentitiesnoconv('trillion'), $langs->transnoentitiesnoconv('quadrillion') ); + $num_length = strlen($num); $levels = (int) (($num_length + 2) / 3); $max_length = $levels * 3; @@ -103,7 +105,7 @@ function dol_convertToWord($num = false, $langs, $currency=false, $centimes=fals if ( $tens < 20 ) { $tens = ($tens ? ' ' . $list1[$tens] . ' ' : '' ); } else { - $tens = (int)($tens / 10); + $tens = (int) ($tens / 10); $tens = ' ' . $list2[$tens] . ' '; $singles = (int) ($num_levels[$i] % 10); $singles = ' ' . $list1[$singles] . ' '; diff --git a/htdocs/core/modules/supplier_payment/pdf/pdf_cow.modules.php b/htdocs/core/modules/supplier_payment/pdf/pdf_cow.modules.php index 5e570a6cfe9..83c0d38b0ce 100644 --- a/htdocs/core/modules/supplier_payment/pdf/pdf_cow.modules.php +++ b/htdocs/core/modules/supplier_payment/pdf/pdf_cow.modules.php @@ -494,7 +494,7 @@ class pdf_cow extends ModelePDFSuppliersPayments // translate amount $currency = $conf->currency; - $translateinletter = strtoupper(dol_convertToWord($object->montant, $outputlangs ,$currency)); + $translateinletter = strtoupper(dol_convertToWord($object->montant,$outputlangs,$currency)); $pdf->SetXY($this->marge_gauche + 50, $posy); $pdf->MultiCell(90, 8, $translateinletter, 0, 'L', 1); $posy += 8; -- GitLab