From 0f4adbedab3466eacbe41296fd9a1ae9b69bec43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 21:15:16 +0100 Subject: [PATCH] clean code --- htdocs/product/class/product.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 9db4565ca49..c8b3104aed0 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5012,6 +5012,7 @@ class Product extends CommonObject $langs->load('products'); $datas = []; + $nofetch = empty($params['nofetch']) ? false : true; if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { return ['optimize' => $langs->trans("ShowProduct")]; @@ -5103,6 +5104,12 @@ class Product extends CommonObject $datas['accountancybuy'] = $buylabel; } } + // show categories for this record only in ajax to not overload lists + if (isModEnabled('categorie') && !$nofetch) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $form = new Form($this->db); + $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1); + } return $datas; } @@ -5135,6 +5142,7 @@ class Product extends CommonObject 'id' => $this->id, 'objecttype' => $this->element, 'option' => $option, + 'nofetch' => 1, ]; $classfortooltip = 'classfortooltip'; $dataparams = '';