From c93d615e4282b2efdd76d52f9a7324a1a3c76f99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 14 Mar 2023 22:27:35 +0100 Subject: [PATCH] enhance tooltip ajax info --- htdocs/comm/propal/class/propal.class.php | 11 ++++++++++- htdocs/commande/class/commande.class.php | 11 ++++++++++- htdocs/contrat/class/contrat.class.php | 18 ++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 5df317c0a2a..40e8fe385d7 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3726,11 +3726,20 @@ class Propal extends CommonObject if (empty($this->thirdparty)) { $this->fetch_thirdparty(); } - $datas['customer'] = '
'.$langs->trans('Customer').': '.$this->thirdparty->name; + $datas['customer'] = '
'.$langs->trans('Customer').': '.$this->thirdparty->getNomUrl(1, '', 0, 1); } if (!empty($this->ref_client)) { $datas['refcustomer'] = '
'.$langs->trans('RefCustomer').': '.$this->ref_client; } + if (!$nofetch) { + $langs->load('project'); + if (empty($this->project)) { + $res = $this->fetch_project(); + if ($res > 0) { + $datas['project'] = '
'.$langs->trans('Project').': '.$this->project->getNomUrl(1, '', 0, 1); + } + } + } if (!empty($this->total_ht)) { $datas['amountht'] = '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 590a7fbe132..026d931a89a 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3745,9 +3745,18 @@ class Commande extends CommonOrder if (empty($this->thirdparty)) { $this->fetch_thirdparty(); } - $datas['customer'] = '
'.$langs->trans('Customer').': '.$this->thirdparty->name; + $datas['customer'] = '
'.$langs->trans('Customer').': '.$this->thirdparty->getNomUrl(1, '', 0, 1); } $datas['RefCustomer'] = '
'.$langs->trans('RefCustomer').': '.(empty($this->ref_customer) ? (empty($this->ref_client) ? '' : $this->ref_client) : $this->ref_customer); + if (!$nofetch) { + $langs->load('project'); + if (empty($this->project)) { + $res = $this->fetch_project(); + if ($res > 0) { + $datas['project'] = '
'.$langs->trans('Project').': '.$this->project->getNomUrl(1, '', 0, 1); + } + } + } if (!empty($this->total_ht)) { $datas['AmountHT'] = '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 3e3678fbcad..8e6c2ea0161 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1995,6 +1995,7 @@ class Contrat extends CommonObject $langs->load('contracts'); $datas = []; + $nofetch = !empty($params['nofetch']); if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { return ['optimize' => $langs->trans("ShowContract")]; @@ -2006,7 +2007,23 @@ class Contrat extends CommonObject $label .= ' '.$this->getLibStatut(5); }*/ $datas['ref'] = '
'.$langs->trans('Ref').': '.($this->ref ? $this->ref : $this->id); + if (!$nofetch) { + $langs->load('companies'); + if (empty($this->thirdparty)) { + $this->fetch_thirdparty(); + } + $datas['customer'] = '
'.$langs->trans('Customer').': '.$this->thirdparty->getNomUrl(1, '', 0, 1); + } $datas['refcustomer'] = '
'.$langs->trans('RefCustomer').': '. $this->ref_customer; + if (!$nofetch) { + $langs->load('project'); + if (empty($this->project)) { + $res = $this->fetch_project(); + if ($res > 0) { + $datas['project'] = '
'.$langs->trans('Project').': '.$this->project->getNomUrl(1, '', 0, 1); + } + } + } $datas['refsupplier'] = '
'.$langs->trans('RefSupplier').': '.$this->ref_supplier; if (!empty($this->total_ht)) { $datas['amountht'] = '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); @@ -2052,6 +2069,7 @@ class Contrat extends CommonObject $params = [ 'id' => $this->id, 'objecttype' => $this->element, + 'nofetch' => 1, ]; $classfortooltip = 'classfortooltip'; $dataparams = '';