Add support of Number2Words module (v2)

if the Number2Words Module is detected, this conversion is selected.
This commit is contained in:
Pierre Ardoin 2020-01-30 15:58:21 +01:00 committed by GitHub
parent a1b787bc08
commit 05d3c134db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,6 +44,18 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
if ($centimes && strlen($num) == 1) { if ($centimes && strlen($num) == 1) {
$num = $num*10; $num = $num*10;
} }
if (! empty($conf->global->MAIN_MODULE_NUMBERWORDS)) {
if ($currency == true) {
$type = 1;
}else{
$type = 0;
}
$concatWords = $langs->getLabelFromNumber($num, $type);
return $concatWords;
}else{
$TNum = explode('.', $num); $TNum = explode('.', $num);
$num = (int) $TNum[0]; $num = (int) $TNum[0];
$words = array(); $words = array();
@ -132,6 +144,7 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
if(!empty($currency)) $concatWords .= ' '.$langs->transnoentities('centimes'); if(!empty($currency)) $concatWords .= ' '.$langs->transnoentities('centimes');
} }
return $concatWords; return $concatWords;
}
} }