diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index a3c726ef521..9e60ac4b8c7 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -1693,6 +1693,44 @@ class ExpenseReport extends CommonObject
}
}
+ /**
+ * getTooltipContentArray
+ *
+ * @param array $params ex option, infologin
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs;
+
+ $langs->load('expensereport');
+ $nofetch = empty($params['nofetch']) ? false : true;
+ $moretitle = $params['moretitle'] ?? '';
+ $datas = [];
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ExpenseReport").'';
+ if (isset($this->status)) {
+ $datas['picto'] .= ' '.$this->getLibStatut(5);
+ }
+ if ($moretitle) {
+ $datas['picto'] .= ' - '.$moretitle;
+ }
+ if (!empty($this->ref)) {
+ $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref;
+ }
+ if (!empty($this->total_ht)) {
+ $datas['total_ht'] = '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+ if (!empty($this->total_tva)) {
+ $datas['total_tva'] = '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+ if (!empty($this->total_ttc)) {
+ $datas['total_ttc'] = '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+
+ return $datas;
+ }
+
/**
* Return clicable name (with picto eventually)
*
@@ -1717,25 +1755,21 @@ class ExpenseReport extends CommonObject
return $url;
}
- $label = img_picto('', $this->picto).' '.$langs->trans("ExpenseReport").'';
- if (isset($this->status)) {
- $label .= ' '.$this->getLibStatut(5);
- }
- if (!empty($this->ref)) {
- $label .= '
'.$langs->trans('Ref').': '.$this->ref;
- }
- if (!empty($this->total_ht)) {
- $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
- }
- if (!empty($this->total_tva)) {
- $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
- }
- if (!empty($this->total_ttc)) {
- $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
- }
- if ($moretitle) {
- $label .= ' - '.$moretitle;
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ 'option' => $option,
+ 'moretitle' => $moretitle,
+ 'nofetch' => 1,
+ ];
+ $classfortooltip = 'classfortooltip';
+ $dataparams = '';
+ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
+ $classfortooltip = 'classforajaxtooltip';
+ $dataparams = ' data-params='.json_encode($params);
+ // $label = $langs->trans('Loading');
}
+ $label = implode($this->getTooltipContentArray($params));
if ($option != 'nolink') {
// Add param to save lastsearch_values or not
@@ -1759,8 +1793,8 @@ class ExpenseReport extends CommonObject
$label = $langs->trans("ShowExpenseReport");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
- $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip"';
+ $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose .= ' class="'.$classfortooltip.'"';
}
$linkstart = '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 .= ($max ? dol_trunc($ref, $max) : $ref);