mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-10 03:28:18 +01:00
Add a hook in dol_print_phone
To allow more controls in this print function as in dol_print_address (there is a hook so we can create links to maps...). Eg : create a other click to dial functions (different from dolibarr ones with more parameters, because each provider give differents api ) etc Hope this one will be accepted and usefull for the community. And happy new year :)
This commit is contained in:
@@ -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)
|
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
|
// Clean phone parameter
|
||||||
$phone = preg_replace("/[\s.-]/","",trim($phone));
|
$phone = preg_replace("/[\s.-]/","",trim($phone));
|
||||||
@@ -2262,6 +2262,14 @@ function dol_print_phone($phone,$countrycode='',$cid=0,$socid=0,$addlink='',$sep
|
|||||||
$titlealt=($withpicto=='fax'?$langs->trans("Fax"):$langs->trans("Phone"));
|
$titlealt=($withpicto=='fax'?$langs->trans("Fax"):$langs->trans("Phone"));
|
||||||
}
|
}
|
||||||
$rep='';
|
$rep='';
|
||||||
|
|
||||||
|
if ($hookmanager) {
|
||||||
|
$parameters = array('countrycode' => $countrycode, 'cid' => $cid, 'socid' => $socid);
|
||||||
|
$reshook = $hookmanager->executeHooks('printPhone', $parameters, $phone);
|
||||||
|
$rep.=$hookmanager->resPrint;
|
||||||
|
}
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
$picto = '';
|
$picto = '';
|
||||||
if($withpicto){
|
if($withpicto){
|
||||||
if($withpicto=='fax'){
|
if($withpicto=='fax'){
|
||||||
@@ -2279,6 +2287,8 @@ function dol_print_phone($phone,$countrycode='',$cid=0,$socid=0,$addlink='',$sep
|
|||||||
$rep.=($withpicto?img_picto($titlealt, 'object_'.$picto.'.png').' ':'').$newphone;
|
$rep.=($withpicto?img_picto($titlealt, 'object_'.$picto.'.png').' ':'').$newphone;
|
||||||
if ($adddivfloat) $rep.='</div>';
|
if ($adddivfloat) $rep.='</div>';
|
||||||
else $rep.='</span>';
|
else $rep.='</span>';
|
||||||
|
}
|
||||||
|
|
||||||
return $rep;
|
return $rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user