forked from Wavyzz/dolibarr
Add patch to choose separator in phone output
This commit is contained in:
@@ -718,9 +718,10 @@ function dolibarr_print_object_info($object)
|
|||||||
* \param cid Id of contact if known
|
* \param cid Id of contact if known
|
||||||
* \param socid Id of third party if known
|
* \param socid Id of third party if known
|
||||||
* \param nolinks true means no HTML links is added
|
* \param nolinks true means no HTML links is added
|
||||||
|
* \param separ separation between numbers for a better visibility example : xx.xx.xx.xx.xx
|
||||||
* \return string Formated phone number
|
* \return string Formated phone number
|
||||||
*/
|
*/
|
||||||
function dolibarr_print_phone($phone,$country="FR",$cid=0,$socid=0,$nolinks=false)
|
function dolibarr_print_phone($phone,$country="FR",$cid=0,$socid=0,$nolinks=false,$separ=" ")
|
||||||
{
|
{
|
||||||
global $conf,$user;
|
global $conf,$user;
|
||||||
|
|
||||||
@@ -731,25 +732,24 @@ function dolibarr_print_phone($phone,$country="FR",$cid=0,$socid=0,$nolinks=fals
|
|||||||
if (strtoupper($country) == "FR")
|
if (strtoupper($country) == "FR")
|
||||||
{
|
{
|
||||||
// France
|
// France
|
||||||
if (strlen($newphone) == 10) {
|
if (strlen($phone) == 10) {
|
||||||
$newphone=substr($newphone,0,2)." ".substr($newphone,2,2)." ".substr($newphone,4,2)." ".substr($newphone,6,2)." ".substr($newphone,8,2);
|
$newphone=substr($newphone,0,2).$separ.substr($newphone,2,2).$separ.substr($newphone,4,2).$separ.substr($newphone,6,2).$separ.substr($newphone,8,2);
|
||||||
}
|
}
|
||||||
elseif (strlen($newphone) == 7)
|
elseif (strlen($newphone) == 7)
|
||||||
{
|
{
|
||||||
|
$newphone=substr($newphone,0,3).$separ.substr($newphone,3,2).$separ.substr($newphone,5,2);
|
||||||
$newphone=substr($newphone,0,3)." ".substr($newphone,3,2)." ".substr($newphone,5,2);
|
|
||||||
}
|
}
|
||||||
elseif (strlen($newphone) == 9)
|
elseif (strlen($newphone) == 9)
|
||||||
{
|
{
|
||||||
$newphone=substr($newphone,0,2)." ".substr($newphone,2,3)." ".substr($newphone,5,2)." ".substr($newphone,7,2);
|
$newphone=substr($newphone,0,2).$separ.substr($newphone,2,3).$separ.substr($newphone,5,2).$separ.substr($newphone,7,2);
|
||||||
}
|
}
|
||||||
elseif (strlen($newphone) == 11)
|
elseif (strlen($newphone) == 11)
|
||||||
{
|
{
|
||||||
$newphone=substr($newphone,0,3)." ".substr($newphone,3,2)." ".substr($newphone,5,2)." ".substr($newphone,7,2)." ".substr($newphone,9,2);
|
$newphone=substr($newphone,0,3).$separ.substr($newphone,3,2).$separ.substr($newphone,5,2).$separ.substr($newphone,7,2).$separ.substr($newphone,9,2);
|
||||||
}
|
}
|
||||||
elseif (strlen($newphone) == 12)
|
elseif (strlen($newphone) == 12)
|
||||||
{
|
{
|
||||||
$newphone=substr($newphone,0,4)." ".substr($newphone,4,2)." ".substr($newphone,6,2)." ".substr($newphone,8,2)." ".substr($newphone,10,2);
|
$newphone=substr($newphone,0,4).$separ.substr($newphone,4,2).$separ.substr($newphone,6,2).$separ.substr($newphone,8,2).$separ.substr($newphone,10,2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user