From f3b5990d2b8012909fb24614ee4aa89d5eefdcf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 6 Feb 2023 21:49:23 +0100 Subject: [PATCH] clean code --- htdocs/contrat/class/contrat.class.php | 37 ++++++-------------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index c3177bd2b1e..97b586a2cde 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2047,42 +2047,21 @@ class Contrat extends CommonObject $url .= '&save_lastsearch_values=1'; } //} - - $label = ''; - - if ($user->hasRight('contrat', 'lire')) { - $label = img_picto('', $this->picto).' '.$langs->trans("Contract").''; - /* Status of a contract is status of all services, so disabled - if (isset($this->statut)) { - $label .= ' '.$this->getLibStatut(5); - }*/ - $label .= '
'.$langs->trans('Ref').': '.($this->ref ? $this->ref : $this->id); - $ref_customer = (!empty($this->ref_customer) ? $this->ref_customer : (empty($this->ref_client) ? '' : $this->ref_client)); - $label .= '
'.$langs->trans('RefCustomer').': '.$ref_customer; - $label .= '
'.$langs->trans('RefSupplier').': '.$this->ref_supplier; - 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); - } - } - - $linkclose = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + ]; $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'); } + + $label = implode($this->getTooltipContentArray($params)); + + $linkclose = ''; if (empty($notooltip) && $user->rights->contrat->lire) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowContract");