From d923ad234032f355118cf3d01eafcc0bddc9d2b2 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 23 Mar 2023 12:02:16 +0100 Subject: [PATCH] FIX add "nofetch" parameters --- htdocs/fourn/class/fournisseur.commande.class.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 20622132c00..755a503e34f 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -873,10 +873,9 @@ class CommandeFournisseur extends CommonOrder $langs->loadLangs(['bills', 'orders']); $datas = []; + $nofetch = !empty($params['nofetch']); + if ($user->hasRight("fournisseur", "commande", "read")) { - if (!is_object($this->thirdparty)) { - $this->fetch_thirdparty(); - } $datas['picto'] = ''.$langs->trans("SupplierOrder").''; if (isset($this->statut)) { $datas['picto'] .= ' '.$this->getLibStatut(5); @@ -887,8 +886,12 @@ class CommandeFournisseur extends CommonOrder if (!empty($this->ref_supplier)) { $datas['refsupplier'] = '
'.$langs->trans('RefSupplier').': '.$this->ref_supplier; } - if (!empty($this->thirdparty->name)) { - $datas['suppliername'] = '
'.$langs->trans('Supplier').': '.$this->thirdparty->name; + if (!$nofetch) { + $langs->load('companies'); + if (empty($this->thirdparty)) { + $this->fetch_thirdparty(); + } + $datas['supplier'] = '
'.$langs->trans('Supplier').': '.$this->thirdparty->getNomUrl(1, '', 0, 1); } if (!empty($this->total_ht)) { $datas['totalht'] = '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);