From 43d65e807351f48d10207966682247c07fd35455 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Jun 2019 22:59:00 +0200 Subject: [PATCH] Add hook --- htdocs/contrat/class/contrat.class.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index cd40be49e6ceb..91a373743c438 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1920,7 +1920,7 @@ public function LibStatut($statut, $mode) */ public function getNomUrl($withpicto = 0, $maxlength = 0, $notooltip = 0, $save_lastsearch_value = -1) { - global $conf, $langs, $user, $hookmanager, $action; + global $conf, $langs, $user, $hookmanager; $result=''; @@ -1962,14 +1962,6 @@ public function getNomUrl($withpicto = 0, $maxlength = 0, $notooltip = 0, $save_ } $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose.=' class="classfortooltip"'; - - if (is_object($hookmanager)) - { - $hookmanager->initHooks(array('contractdao')); - $parameters=array('id'=>$this->id); - $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; - } } $linkstart = 'ref?$this->ref:$this->id); $result .= $linkend; + global $action; + $hookmanager->initHooks(array('contractdao')); + $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 + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } + return $result; }