Merge pull request #5481 from defrance/patch-12
NEW Add hook "getnomurltooltip" to replace tooltips on getNomUrl functions
This commit is contained in:
commit
5a8c08e6cc
@ -957,7 +957,7 @@ class Contact extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='')
|
function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='')
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs, $hookmanager;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
$label = '<u>' . $langs->trans("ShowContact") . '</u>';
|
$label = '<u>' . $langs->trans("ShowContact") . '</u>';
|
||||||
@ -973,13 +973,27 @@ class Contact extends CommonObject
|
|||||||
$label.= '<br><b>' . $langs->trans("Address") . ':</b> '.dol_format_address($this, 1, ' ', $langs);
|
$label.= '<br><b>' . $langs->trans("Address") . ':</b> '.dol_format_address($this, 1, ' ', $langs);
|
||||||
|
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'"';
|
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'"';
|
||||||
|
$linkclose="";
|
||||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||||
{
|
{
|
||||||
$label=$langs->trans("ShowContact");
|
$label=$langs->trans("ShowContact");
|
||||||
$link.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
}
|
}
|
||||||
$link.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
$link.= ' class="classfortooltip">';
|
$linkclose.= ' class="classfortooltip">';
|
||||||
|
|
||||||
|
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);
|
||||||
|
$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;
|
||||||
|
|
||||||
|
$link.=$linkclose;
|
||||||
|
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
if ($option == 'xxx')
|
if ($option == 'xxx')
|
||||||
|
|||||||
@ -3132,7 +3132,7 @@ class Product extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0,$option='',$maxlength=0)
|
function getNomUrl($withpicto=0,$option='',$maxlength=0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs, $hookmanager;
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
@ -3157,6 +3157,17 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
$linkclose = '" title="'.str_replace('\n', '', dol_escape_htmltag($label, 1)).'" class="classfortooltip">';
|
$linkclose = '" title="'.str_replace('\n', '', dol_escape_htmltag($label, 1)).'" class="classfortooltip">';
|
||||||
|
|
||||||
|
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);
|
||||||
|
$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') {
|
if ($option == 'supplier') {
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/product/fournisseurs.php?id='.$this->id.$linkclose;
|
$link = '<a href="'.DOL_URL_ROOT.'/product/fournisseurs.php?id='.$this->id.$linkclose;
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
@ -3174,8 +3185,8 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($withpicto) {
|
if ($withpicto) {
|
||||||
if ($this->type == Product::TYPE_PRODUCT) $result.=($link.img_object($langs->trans("ShowProduct").' '.$this->label, 'product', 'class="classfortooltip"').$linkend.' ');
|
if ($this->type == Product::TYPE_PRODUCT) $result.=($link.img_object('', 'product', '').$linkend.' ');
|
||||||
if ($this->type == Product::TYPE_SERVICE) $result.=($link.img_object($langs->trans("ShowService").' '.$this->label, 'service', 'class="classfortooltip"').$linkend.' ');
|
if ($this->type == Product::TYPE_SERVICE) $result.=($link.img_object('', 'service', '').$linkend.' ');
|
||||||
}
|
}
|
||||||
$result.=$link.$newref.$linkend;
|
$result.=$link.$newref.$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@ -1811,7 +1811,7 @@ class Societe extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0, $option='', $maxlen=0, $notooltip=0)
|
function getNomUrl($withpicto=0, $option='', $maxlen=0, $notooltip=0)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs, $hookmanager;
|
||||||
|
|
||||||
$name=$this->name?$this->name:$this->nom;
|
$name=$this->name?$this->name:$this->nom;
|
||||||
|
|
||||||
@ -1899,17 +1899,29 @@ class Societe extends CommonObject
|
|||||||
|
|
||||||
// Add type of canvas
|
// Add type of canvas
|
||||||
$link.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'"';
|
$link.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'"';
|
||||||
|
$linkclose='';
|
||||||
if (empty($notooltip))
|
if (empty($notooltip))
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||||
{
|
{
|
||||||
$label=$langs->trans("ShowCompany");
|
$label=$langs->trans("ShowCompany");
|
||||||
$link.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
}
|
}
|
||||||
$link.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
$link.=' class="classfortooltip"';
|
$linkclose.=' class="classfortooltip"';
|
||||||
|
|
||||||
|
if (! is_object($hookmanager))
|
||||||
|
{
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||||
|
$hookmanager=new HookManager($this->db);
|
||||||
}
|
}
|
||||||
$link.='>';
|
$hookmanager->initHooks(array('societedao'));
|
||||||
|
$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;
|
||||||
|
|
||||||
|
}
|
||||||
|
$link.=$linkclose.'>';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
if ($withpicto) $result.=($link.img_object(($notooltip?'':$label), 'company', ($notooltip?'':'class="classfortooltip"')).$linkend);
|
if ($withpicto) $result.=($link.img_object(($notooltip?'':$label), 'company', ($notooltip?'':'class="classfortooltip"')).$linkend);
|
||||||
|
|||||||
@ -1941,7 +1941,7 @@ class User extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function getNomUrl($withpictoimg=0, $option='', $infologin=0, $notooltip=0, $maxlen=24, $hidethirdpartylogo=0, $mode='',$morecss='')
|
function getNomUrl($withpictoimg=0, $option='', $infologin=0, $notooltip=0, $maxlen=24, $hidethirdpartylogo=0, $mode='',$morecss='')
|
||||||
{
|
{
|
||||||
global $langs, $conf, $db;
|
global $langs, $conf, $db, $hookmanager;
|
||||||
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||||
global $menumanager;
|
global $menumanager;
|
||||||
|
|
||||||
@ -2001,18 +2001,29 @@ class User extends CommonObject
|
|||||||
if ($option == 'leave') $link.= '<a href="'.DOL_URL_ROOT.'/holiday/list.php?id='.$this->id.'"';
|
if ($option == 'leave') $link.= '<a href="'.DOL_URL_ROOT.'/holiday/list.php?id='.$this->id.'"';
|
||||||
else $link.= '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'"';
|
else $link.= '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'"';
|
||||||
|
|
||||||
|
$linkclose="";
|
||||||
if (empty($notooltip))
|
if (empty($notooltip))
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||||
{
|
{
|
||||||
$langs->load("users");
|
$langs->load("users");
|
||||||
$label=$langs->trans("ShowUser");
|
$label=$langs->trans("ShowUser");
|
||||||
$link.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
}
|
}
|
||||||
$link.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
$link.= ' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
$linkclose.= ' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
||||||
}
|
}
|
||||||
$link.= '>';
|
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);
|
||||||
|
$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;
|
||||||
|
|
||||||
|
$link.=$linkclose.'>';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
//if ($withpictoimg == -1) $result.='<div class="nowrap">';
|
//if ($withpictoimg == -1) $result.='<div class="nowrap">';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user