|
dolibarr 24.0.0-beta
|
Helper functions for phone number formatting. More...
Go to the source code of this file.
Functions | |
| dol_parse_phone ($phone) | |
| Parse a stored phone number into country code and number parts. | |
| dol_build_phone ($db, $code, $number) | |
| Build a normalized phone string from code and number parts. | |
| dol_get_trunk_prefix ($db, $phone_code) | |
| Get the national trunk prefix for a phone code. | |
| dol_get_phone_code_from_country ($db, $country_id) | |
| Get the phone calling code for a country. | |
Helper functions for phone number formatting.
Definition in file phone.lib.php.
| dol_build_phone | ( | $db, | |
| $code, | |||
| $number ) |
Build a normalized phone string from code and number parts.
Strips formatting characters (spaces, dashes, dots, parentheses) from number. Also strips the national trunk prefix for the country matching $code (e.g. leading "0" for France, "8" for Russia, "06" for Hungary). Returns "+{code} {number}" or just the number if code is empty.
| DoliDB | $db | Database handler |
| string | $code | Country calling code (e.g. "+33") |
| string | $number | Phone number (may contain formatting) |
Definition at line 68 of file phone.lib.php.
References $db.
| dol_get_phone_code_from_country | ( | $db, | |
| $country_id ) |
Get the phone calling code for a country.
Definition at line 141 of file phone.lib.php.
References $db.
Referenced by Form\showPhoneInput().
| dol_get_trunk_prefix | ( | $db, | |
| $phone_code ) |
Get the national trunk prefix for a phone code.
Definition at line 110 of file phone.lib.php.
References $db.
Referenced by Form\showPhoneInput().
| dol_parse_phone | ( | $phone | ) |
Parse a stored phone number into country code and number parts.
Stored format is "+{code} {number}" (e.g. "+33 644986885"). If no code is found, returns empty code and the full string as number.
| string | $phone | Stored phone number |
Definition at line 33 of file phone.lib.php.
Referenced by Form\showPhoneInput().