dolibarr 24.0.0-beta
functionsnumtoword.lib.php File Reference

A set of functions for Dolibarr This file contains all frequently used functions. More...

Go to the source code of this file.

Functions

 dol_convertToWord ($num, $langs, $currency='', $centimes=false)
 Function to return a number into a text.
 
 dolConvertIntToFrenchWords ($n, $reform=false)
 Convert a non-negative integer into French words (standard French: soixante-dix, quatre-vingts, quatre-vingt-dix).
 
 dolConvertToWordFrench ($num, $langs, $currency='', $centimes=false)
 Convert a number into French words.
 
 dolNumberToWord ($numero, $langs, $numorcurrency='number')
 Function to return number or amount in text.
 
 hundreds2text ($hundreds, $tens, $units)
 hundreds2text
 

Detailed Description

A set of functions for Dolibarr This file contains all frequently used functions.

Definition in file functionsnumtoword.lib.php.

Function Documentation

◆ dol_convertToWord()

dol_convertToWord ( $num,
$langs,
$currency = '',
$centimes = false )

Function to return a number into a text.

May use module NUMBERWORDS if found.

Parameters
float$numNumber to convert (must be a numeric value, like reported by price2num())
Translate$langsLanguage
string$currency''=number to translate | 'XX'=currency code to use into text
boolean$centimesfalse=no cents/centimes | true=there is cents/centimes
Returns
string|false Text of the number

Definition at line 38 of file functionsnumtoword.lib.php.

References dolConvertToWordFrench(), and isModEnabled().

Referenced by pdf_standard_supplierpayment\_tableau_cheque().

◆ dolConvertIntToFrenchWords()

dolConvertIntToFrenchWords ( $n,
$reform = false )

Convert a non-negative integer into French words (standard French: soixante-dix, quatre-vingts, quatre-vingt-dix).

Handles "et", hyphens and the agreement of "cent" and "quatre-vingt(s)".

Parameters
int$nInteger to convert (sign is ignored)
bool$reformfalse = traditional spelling (hyphen only between tens and units), true = 1990 rectified spelling (hyphens everywhere)
Returns
string Number written in French words

Definition at line 185 of file functionsnumtoword.lib.php.

Referenced by dolConvertToWordFrench().

◆ dolConvertToWordFrench()

dolConvertToWordFrench ( $num,
$langs,
$currency = '',
$centimes = false )

Convert a number into French words.

Used by dol_convertToWord() for French languages.

Parameters
float$numNumber to convert
Translate$langsLanguage object (used for the "and"/"centime"/"centimes" labels)
string$currency'' = no currency word, otherwise a currency string appended after the integer part
bool$centimestrue = render the decimal part as "et X centime(s)"
Returns
string Number written in French words

Definition at line 316 of file functionsnumtoword.lib.php.

References dolConvertIntToFrenchWords(), and getDolGlobalString().

Referenced by dol_convertToWord().

◆ dolNumberToWord()

dolNumberToWord ( $numero,
$langs,
$numorcurrency = 'number' )

Function to return number or amount in text.

Parameters
float$numeroNumber to convert
Translate$langsLanguage
string$numorcurrency'number' or 'amount'
Returns
string|int Text of the number or -1 in case TOO LONG (more than 1000000000000.99)
Deprecated
Use dol_convertToWord instead

Definition at line 379 of file functionsnumtoword.lib.php.

References $c, and hundreds2text().

◆ hundreds2text()

hundreds2text ( $hundreds,
$tens,
$units )

hundreds2text

Parameters
integer$hundredsHundreds
integer$tensTens
integer$unitsUnits
Returns
string

Definition at line 481 of file functionsnumtoword.lib.php.

Referenced by dolNumberToWord().