|
dolibarr 25.0.0-alpha
|
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_all_trunk_prefixes ($db) | |
| Get the list of all distinct national trunk prefixes known in llx_c_country. | |
| dol_natural_search_phone ($db, $fields, $value, $nofirstand=0) | |
| Build a natural_search() SQL fragment for a phone/fax field, tolerant of the international storage format "+{code} {number}" vs a national search input (e.g. | |
| 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 69 of file phone.lib.php.
| dol_get_all_trunk_prefixes | ( | $db | ) |
Get the list of all distinct national trunk prefixes known in llx_c_country.
Definition at line 141 of file phone.lib.php.
Referenced by dol_natural_search_phone().
| dol_get_phone_code_from_country | ( | $db, | |
| $country_id ) |
Get the phone calling code for a country.
Definition at line 208 of file phone.lib.php.
Referenced by Form\showPhoneInput().
| dol_get_trunk_prefix | ( | $db, | |
| $phone_code ) |
Get the national trunk prefix for a phone code.
Definition at line 111 of file phone.lib.php.
Referenced by Form\showPhoneInput().
| dol_natural_search_phone | ( | $db, | |
| $fields, | |||
| $value, | |||
| $nofirstand = 0 ) |
Build a natural_search() SQL fragment for a phone/fax field, tolerant of the international storage format "+{code} {number}" vs a national search input (e.g.
searching "0645821542" must still match stored "+33 645821542").
| DoliDB | $db | Database handler |
| string | string[] | $fields | Field(s) to search, same as natural_search() |
| string | $value | Raw value entered by the user |
| int | $nofirstand | 1=Do not output the first 'AND' |
Definition at line 173 of file phone.lib.php.
References $c, dol_get_all_trunk_prefixes(), and natural_search().
| 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 34 of file phone.lib.php.
Referenced by Form\showPhoneInput().