diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9e7bb7f7ce8..77882d590d6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2172,7 +2172,7 @@ function dol_print_skype($skype,$cid=0,$socid=0,$addlink=0,$max=64) */ function dol_print_phone($phone,$countrycode='',$cid=0,$socid=0,$addlink='',$separ=" ",$withpicto='',$titlealt='',$adddivfloat=0) { - global $conf,$user,$langs,$mysoc; + global $conf, $user, $langs, $mysoc, $hookmanager; // Clean phone parameter $phone = preg_replace("/[\s.-]/","",trim($phone)); @@ -2262,23 +2262,33 @@ function dol_print_phone($phone,$countrycode='',$cid=0,$socid=0,$addlink='',$sep $titlealt=($withpicto=='fax'?$langs->trans("Fax"):$langs->trans("Phone")); } $rep=''; - $picto = ''; - if($withpicto){ - if($withpicto=='fax'){ - $picto = 'phoning_fax'; - }elseif($withpicto=='phone'){ - $picto = 'phoning'; - }elseif($withpicto=='mobile'){ - $picto = 'phoning_mobile'; - }else{ - $picto = ''; + + if ($hookmanager) { + $parameters = array('countrycode' => $countrycode, 'cid' => $cid, 'socid' => $socid); + $reshook = $hookmanager->executeHooks('printPhone', $parameters, $phone); + $rep.=$hookmanager->resPrint; + } + if (empty($reshook)) + { + $picto = ''; + if($withpicto){ + if($withpicto=='fax'){ + $picto = 'phoning_fax'; + }elseif($withpicto=='phone'){ + $picto = 'phoning'; + }elseif($withpicto=='mobile'){ + $picto = 'phoning_mobile'; + }else{ + $picto = ''; + } } - } - if ($adddivfloat) $rep.='
'; - else $rep.=''; - $rep.=($withpicto?img_picto($titlealt, 'object_'.$picto.'.png').' ':'').$newphone; - if ($adddivfloat) $rep.='
'; - else $rep.=''; + if ($adddivfloat) $rep.='
'; + else $rep.=''; + $rep.=($withpicto?img_picto($titlealt, 'object_'.$picto.'.png').' ':'').$newphone; + if ($adddivfloat) $rep.='
'; + else $rep.=''; + } + return $rep; }