From b241af94a7914ad2cbb9839f268fa5350a779385 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 23 Mar 2023 11:06:20 +0100 Subject: [PATCH 1/5] NEW show supplier name in getNomUrl of supplier order --- htdocs/fourn/class/fournisseur.commande.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 1e3f74389d5..68a4193520a 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -874,6 +874,9 @@ class CommandeFournisseur extends CommonOrder $datas = []; 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); @@ -884,6 +887,9 @@ 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 (!empty($this->total_ht)) { $datas['totalht'] = '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); } From d923ad234032f355118cf3d01eafcc0bddc9d2b2 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 23 Mar 2023 12:02:16 +0100 Subject: [PATCH 2/5] 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); From 188f9b67cf45c4e3029025cfd81424746a625901 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 23 Mar 2023 13:02:49 +0100 Subject: [PATCH 3/5] FIX missing token --- htdocs/core/js/lib_foot.js.php | 5 +++-- htdocs/fourn/class/fournisseur.commande.class.php | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 963e357199a..26a0e7756a9 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -85,12 +85,13 @@ if (empty($conf->dol_no_mouse_hover)) { tooltipClass: "mytooltip", open: function (event, ui) { var elem = $(this); - var params = $(this).attr("data-params"); + var params = JSON.parse($(this).attr("data-params")); + objparams.token = "'.currentToken().'"; $.ajax({ url:"' . dol_buildpath('/core/ajax/ajaxtooltip.php', 1) . '", type: "post", async: false, - data: JSON.parse(params), + data: params, success: function(response){ // Setting content option elem.tooltip("option","content",response); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 755a503e34f..9a08f01d27b 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -931,6 +931,7 @@ class CommandeFournisseur extends CommonOrder 'id' => $this->id, 'objecttype' => $this->element, 'option' => $option, + 'nofetch' => 1 ]; $classfortooltip = 'classfortooltip'; $dataparams = ''; From 5afc5536242d982f7a506b3aed6f0f807c9dce45 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 23 Mar 2023 13:03:55 +0100 Subject: [PATCH 4/5] FIX wrong var name --- htdocs/core/js/lib_foot.js.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 26a0e7756a9..297a33b93f5 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -86,7 +86,7 @@ if (empty($conf->dol_no_mouse_hover)) { open: function (event, ui) { var elem = $(this); var params = JSON.parse($(this).attr("data-params")); - objparams.token = "'.currentToken().'"; + params.token = "'.currentToken().'"; $.ajax({ url:"' . dol_buildpath('/core/ajax/ajaxtooltip.php', 1) . '", type: "post", From d3f81568d9cbd7874f3cf95d001ca14f3cf07953 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 23 Mar 2023 13:16:28 +0100 Subject: [PATCH 5/5] FIX avoid warning --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7d3c1030678..410f6f0961e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -721,7 +721,7 @@ abstract class CommonObject if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { $datas[$key]= '
'. $labelextra . ''; } else { - $value = $this->array_options['options_' . $key]; + $value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]); $datas[$key]= '
'. $labelextra . ': ' . $extrafields->showOutputField($key, $value, '', $this->table_element); } }