From fbcab33519263a71aafe2ce30168f80048b6d22f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 28 Apr 2023 08:43:34 +0200 Subject: [PATCH] add categories in warehouse ajax tooltip --- htdocs/product/stock/class/entrepot.class.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 2abe2007175..61d422b83d1 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -708,6 +708,10 @@ class Entrepot extends CommonObject $langs->load('stocks'); $datas = []; + + $option = $params['option'] ?? ''; + $nofetch = !empty($params['nofetch']); + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { return ['optimize' => $langs->trans("Warehouse")]; } @@ -719,6 +723,12 @@ class Entrepot extends CommonObject if (!empty($this->lieu)) { $datas['locationsummary'] = '
'.$langs->trans('LocationSummary').': '.$this->lieu; } + // show categories for this record only in ajax to not overload lists + if (!$nofetch && isModEnabled('categorie')) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $form = new Form($this->db); + $datas['categories_warehouse'] = '
' . $form->showCategories($this->id, Categorie::TYPE_WAREHOUSE, 1, 1); + } return $datas; } @@ -752,13 +762,14 @@ class Entrepot extends CommonObject 'id' => $this->id, 'objecttype' => $this->element, 'option' => $option, + 'nofetch' => 1, ]; $classfortooltip = 'classfortooltip'; $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; - $label = ''; + $label = 'ToComplete'; } else { $label = implode($this->getTooltipContentArray($params)); }