NEW Add hook printEmail

This commit is contained in:
Laurent Destailleur
2018-03-15 22:22:42 +01:00
parent 46fb2945d4
commit 71c51eb789
2 changed files with 18 additions and 10 deletions

View File

@@ -2090,7 +2090,7 @@ function dol_print_url($url,$target='_blank',$max=32,$withpicto=0)
*/ */
function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid=1,$withpicto=0) function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid=1,$withpicto=0)
{ {
global $conf,$user,$langs; global $conf,$user,$langs,$hookmanager;
$newemail=$email; $newemail=$email;
@@ -2125,7 +2125,15 @@ function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid=
$newemail.=img_warning($langs->trans("ErrorBadEMail",$email)); $newemail.=img_warning($langs->trans("ErrorBadEMail",$email));
} }
} }
return '<div class="nospan float" style="margin-right: 10px">'.($withpicto?img_picto($langs->trans("EMail"), 'object_email.png').' ':'').$newemail.'</div>';
$rep = '<div class="nospan float" style="margin-right: 10px">'.($withpicto?img_picto($langs->trans("EMail"), 'object_email.png').' ':'').$newemail.'</div>';
if ($hookmanager) {
$parameters = array('cid' => $cid, 'socid' => $socid,'addlink' => $addlink, 'picto' => $withpicto);
$reshook = $hookmanager->executeHooks('printEmail', $parameters, $email);
$rep.=$hookmanager->resPrint;
}
return $rep;
} }
/** /**

View File

@@ -2100,7 +2100,7 @@ class Societe extends CommonObject
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db); $hookmanager=new HookManager($this->db);
} }
$hookmanager->initHooks(array('societedao')); $hookmanager->initHooks(array('thirdpartydao'));
$parameters=array('id'=>$this->id); $parameters=array('id'=>$this->id);
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $linkclose = $hookmanager->resPrint; if ($reshook > 0) $linkclose = $hookmanager->resPrint;
@@ -2127,7 +2127,7 @@ class Societe extends CommonObject
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db); $hookmanager=new HookManager($this->db);
} }
$hookmanager->initHooks(array('societedao')); $hookmanager->initHooks(array('thirdpartydao'));
$parameters=array('id'=>$this->id, 'getnomurl'=>$result); $parameters=array('id'=>$this->id, 'getnomurl'=>$result);
$reshook=$hookmanager->executeHooks('getNomUrl',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('getNomUrl',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $result = $hookmanager->resPrint; if ($reshook > 0) $result = $hookmanager->resPrint;