From c0c10866e909af56003c5c347249fe6597b2b044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 5 Feb 2023 20:54:18 +0100 Subject: [PATCH] fix tooltip --- htdocs/compta/bank/class/account.class.php | 12 ++++---- htdocs/core/class/commonobject.class.php | 2 +- htdocs/delivery/class/delivery.class.php | 12 ++++---- .../class/supplier_proposal.class.php | 28 ++++++++++--------- 4 files changed, 30 insertions(+), 24 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index b978d9cba56..230b0336631 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1460,17 +1460,19 @@ class Account extends CommonObject $label .= '
'.$langs->trans('AccountAccounting').': '.length_accountg($this->account_number); $label .= '
'.$langs->trans('AccountancyJournal').': '.$this->accountancy_journal; } + $classfortooltip = 'classfortooltip'; + $dataparams = ''; 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"'; - } else { - $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + $label = $langs->trans('Loading'); } + $linkclose = '"'.$dataparams.' title="'.dol_escape_htmltag($label, 1).'" class="'.$classfortooltip.'">'; $url = DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id; if ($mode == 'transactions') { @@ -1500,7 +1502,7 @@ class Account extends CommonObject $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.($option == 'reflabel' && $this->label ? ' - '.$this->label : ''); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e30ef60b124..f3bde4fe826 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -696,7 +696,7 @@ abstract class CommonObject } $labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]); if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { - $datas[$key]= '
'. $labelextra . ''; + $datas[$key]= '
'. $labelextra . ''; } else { $value = $this->array_options['options_' . $key]; $datas[$key]= '
'. $labelextra . ': ' . $extrafields->showOutputField($key, $value, '', $this->table_element); diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 717696ac430..525d5458891 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -768,20 +768,22 @@ class Delivery extends CommonObject } //} + $classfortooltip = 'classfortooltip'; + $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $params = [ 'id' => $this->id, 'objecttype' => $this->element, ]; - $linkstart = ''; + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + $label = $langs->trans('Loading'); } + $linkstart = ''; $linkend = ''; if ($withpicto) { - $result .= ($linkstart.img_object($label, $this->picto, 'class="classfortooltip"').$linkend); + $result .= ($linkstart.img_object($label, $this->picto, $dataparams.' class="'.$classfortooltip.'"').$linkend); } if ($withpicto && $withpicto != 2) { $result .= ' '; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 98dc1e66af2..db3070f8b8d 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2569,23 +2569,25 @@ class SupplierProposal extends CommonObject } $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) && $user->rights->propal->lire) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowSupplierProposal"); $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"'; - } else { - $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 .= $this->ref;