fetch thirdparty in propal tooltip only in ajax request

This commit is contained in:
Frédéric FRANCE 2023-03-13 10:04:03 +01:00
parent 1da5de8326
commit 045d4284f5

View File

@ -3708,6 +3708,7 @@ class Propal extends CommonObject
global $conf, $langs, $user;
$datas = [];
$nofetch = !empty($params['nofetch']);
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
return ['optimize' => $langs->trans("Proposal")];
@ -3720,6 +3721,13 @@ class Propal extends CommonObject
if (!empty($this->ref)) {
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
}
if (!$nofetch) {
$langs->load('companies');
if (empty($this->thirdparty)) {
$this->fetch_thirdparty();
}
$datas['customer'] = '<br><b>'.$langs->trans('Customer').':</b> '.$this->thirdparty->name;
}
if (!empty($this->ref_client)) {
$datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_client;
}
@ -3767,6 +3775,7 @@ class Propal extends CommonObject
'id' => $this->id,
'objecttype' => $this->element,
'option' => $option,
'nofetch' => 1,
];
$classfortooltip = 'classfortooltip';
$dataparams = '';