diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index 618a31df34f..5dc7d53cc49 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -1638,26 +1638,27 @@ class Categorie extends CommonObject
$forced_color = 'categtextblack';
}
}
-
- $link = '';
- } else {
- $link .= '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip '.$forced_color.'">';
+ $classfortooltip = 'classforajaxtooltip';
+ $dataparams = ' data-params='.json_encode($params);
+ $label = $langs->trans('Loading');
}
+ $link = '';
$linkend = '';
$picto = 'category';
if ($withpicto) {
- $result .= ($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
+ $result .= ($link.img_object($label, $picto, $dataparams.' class="'.$classfortooltip.'"').$linkend);
}
if ($withpicto && $withpicto != 2) {
$result .= ' ';
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index 459c7807c43..103b8177994 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -1514,23 +1514,25 @@ class Contact extends CommonObject
$url .= $moreparam;
$linkclose = "";
+ $classfortooltip = 'classfortooltip';
+ $dataparams = '';
+ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ 'option' => $option,
+ ];
+ $classfortooltip = 'classforajaxtooltip';
+ $dataparams = ' data-params='.json_encode($params);
+ $label = $langs->trans('Loading');
+ }
if (empty($notooltip)) {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$label = $langs->trans("ShowContact");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
- if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
- $params = [
- 'id' => $this->id,
- 'objecttype' => $this->element,
- 'option' => $option,
- ];
- $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"';
- $linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"';
- } else {
- $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
- }
+ $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
}
$linkstart = '';
if ($option == 'xxx') {
- $linkstart = '';
+ $linkstart = '';
$linkend = '';
}
@@ -1547,7 +1549,7 @@ class Contact extends CommonObject
if ($withpicto < 0) {
$result .= ''.Form::showphoto('contact', $this, 0, 0, 0, 'userphoto'.($withpicto == -3 ? 'small' : ''), 'mini', 0, 1).'';
} else {
- $result .= img_object(($notooltip ? '' : $label), ( $this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), ( $this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
}
if ($withpicto != 2 && $withpicto != -2) {
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 7785a8ad3e7..981d7d71f02 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -2072,31 +2072,32 @@ class Contrat extends CommonObject
}
$linkclose = '';
+ $classfortooltip = 'classfortooltip';
+ $dataparams = '';
+ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ ];
+ $classfortooltip = 'classforajaxtooltip';
+ $dataparams = ' data-params='.json_encode($params);
+ $label = $langs->trans('Loading');
+ }
if (empty($notooltip) && $user->rights->contrat->lire) {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$label = $langs->trans("ShowContract");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
- if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
- $params = [
- 'id' => $this->id,
- 'objecttype' => $this->element,
- ];
- $linkclose .= '" data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"';
- $linkclose .= ' class="classforajaxtooltip"';
- } else {
- $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip"';
- }
+ $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose .= $dataparams.' class="'.$classfortooltip.'"';
}
-
$linkstart = '';
$linkend = '';
$result .= $linkstart;
if ($withpicto) {
- $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= ($this->ref ? $this->ref : $this->id);
@@ -3152,17 +3153,19 @@ class ContratLigne extends CommonObjectLine
if (empty($label)) {
$label = $this->description;
}
- $link = '';
+ $classfortooltip = 'classforajaxtooltip';
+ $dataparams = ' data-params='.json_encode($params);
+ $label = $langs->trans('Loading');
}
+ $link = '';
$linkend = '';
$picto = 'service';
@@ -3171,7 +3174,7 @@ class ContratLigne extends CommonObjectLine
}
if ($withpicto) {
- $result .= ($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
+ $result .= ($link.img_object($label, $picto, $dataparams.' class="'.$classfortooltip.'"').$linkend);
}
if ($withpicto && $withpicto != 2) {
$result .= ' ';