NEW hook getnomurltooltip is replaced with hook getNomUrl more powerfull

This commit is contained in:
Laurent Destailleur 2018-03-15 20:46:55 +01:00
parent 83962ca70b
commit c962b89495
7 changed files with 111 additions and 21 deletions

View File

@ -1273,7 +1273,7 @@ class ActionComm extends CommonObject
$linkclose.=' title="'.dol_escape_htmltag($tooltip, 1).'"';
$linkclose.=' class="'.$classname.' classfortooltip"';
if (! is_object($hookmanager))
/*if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
@ -1282,6 +1282,7 @@ class ActionComm extends CommonObject
$parameters=array('id'=>$this->id);
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
$linkclose = ($hookmanager->resPrint ? $hookmanager->resPrint : $linkclose);
*/
}
else $linkclose.=' class="'.$classname.'"';
@ -1327,6 +1328,18 @@ class ActionComm extends CommonObject
$result.=$libelleshort;
$result.=$linkend;
global $action;
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('actiondao'));
$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;
}

View File

@ -1124,7 +1124,7 @@ class Contact extends CommonObject
}
$linkclose.='>';
if (! is_object($hookmanager))
/*if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
@ -1132,7 +1132,7 @@ class Contact extends CommonObject
$hookmanager->initHooks(array('contactdao'));
$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;
if ($reshook > 0) $linkclose = $hookmanager->resPrint;*/
$linkstart.=$linkclose;
$linkend='</a>';
@ -1143,12 +1143,23 @@ class Contact extends CommonObject
$linkend='</a>';
}
$result.=$linkstart;
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip valigntextbottom"'), 0, 0, $notooltip?0:1);
if ($withpicto != 2) $result.=($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs));
$result.=$linkend;
global $action;
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('contactdao'));
$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;
}

View File

@ -3575,7 +3575,7 @@ class Product extends CommonObject
$linkclose.= ' title="'.dol_escape_htmltag($label, 1, 1).'"';
$linkclose.= ' class="classfortooltip"';
if (! is_object($hookmanager))
/*if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
@ -3584,6 +3584,7 @@ class Product extends CommonObject
$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;
*/
}
if ($option == 'supplier' || $option == 'category') {
@ -3615,6 +3616,19 @@ class Product extends CommonObject
}
$result.= $newref;
$result.= $linkend;
global $action;
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('productdao'));
$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;
}

View File

@ -1021,17 +1021,18 @@ class Project extends CommonObject
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip"';
if (! is_object($hookmanager)) {
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
/*if (! is_object($hookmanager)) {
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('projectdao'));
$parameters=array('id'=>$this->id);
// Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action);
if ($reshook > 0)
$linkclose = $hookmanager->resPrint;
*/
}
$hookmanager->initHooks(array('projectdao'));
$parameters=array('id'=>$this->id);
// Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action);
if ($reshook > 0)
$linkclose = $hookmanager->resPrint;
}
$picto = 'projectpub';
if (! $this->public) $picto = 'project';
@ -1046,6 +1047,18 @@ class Project extends CommonObject
$result .= $linkend;
if ($withpicto != 2) $result.=(($addlabel && $this->title) ? $sep . dol_trunc($this->title, ($addlabel > 1 ? $addlabel : 0)) : '');
global $action;
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('projectdao'));
$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;
}

View File

@ -2095,7 +2095,7 @@ class Societe extends CommonObject
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip refurl"';
if (! is_object($hookmanager))
/*if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
@ -2104,6 +2104,7 @@ class Societe extends CommonObject
$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.=$linkclose.'>';
$linkend='</a>';
@ -2120,6 +2121,18 @@ class Societe extends CommonObject
if ($withpicto != 2) $result.=($maxlen?dol_trunc($name,$maxlen):$name);
$result.=$linkend;
global $action;
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('societedao'));
$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;
}
@ -2886,19 +2899,19 @@ class Societe extends CommonObject
if (!is_numeric($chaine)) return -1;
if (dol_strlen($chaine) != 14) return -1;
// on prend chaque chiffre un par un
// si son index (position dans la chaîne en commence à 0 au premier caractère) est pair
// on double sa valeur et si cette dernière est supérieure à 9, on lui retranche 9
// on ajoute cette valeur à la somme totale
for ($index = 0; $index < 14; $index ++)
{
$number = (int) $chaine[$index];
if (($index % 2) == 0) { if (($number *= 2) > 9) $number -= 9; }
$sum += $number;
}
// le numéro est valide si la somme des chiffres est multiple de 10
if (($sum % 10) != 0) return -1;
}

View File

@ -2201,7 +2201,7 @@ class User extends CommonObject
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.= ' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
}
if (! is_object($hookmanager))
/*if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
@ -2210,6 +2210,7 @@ class User extends CommonObject
$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.=$linkclose.'>';
$linkend='</a>';
@ -2238,6 +2239,18 @@ class User extends CommonObject
$result.=$companylink;
global $action;
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('userdao'));
$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;
}

View File

@ -836,7 +836,7 @@ class UserGroup extends CommonObject
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.= ' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
}
if (! is_object($hookmanager))
/*if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
@ -845,6 +845,7 @@ class UserGroup extends CommonObject
$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 = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
@ -855,6 +856,18 @@ class UserGroup extends CommonObject
if ($withpicto != 2) $result.= $this->name;
$result .= $linkend;
global $action;
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('groupdao'));
$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;
}