clean code

This commit is contained in:
Frédéric FRANCE 2023-02-12 21:15:16 +01:00
parent f043345706
commit 0f4adbedab

View File

@ -5012,6 +5012,7 @@ class Product extends CommonObject
$langs->load('products'); $langs->load('products');
$datas = []; $datas = [];
$nofetch = empty($params['nofetch']) ? false : true;
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
return ['optimize' => $langs->trans("ShowProduct")]; return ['optimize' => $langs->trans("ShowProduct")];
@ -5103,6 +5104,12 @@ class Product extends CommonObject
$datas['accountancybuy'] = $buylabel; $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'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1);
}
return $datas; return $datas;
} }
@ -5135,6 +5142,7 @@ class Product extends CommonObject
'id' => $this->id, 'id' => $this->id,
'objecttype' => $this->element, 'objecttype' => $this->element,
'option' => $option, 'option' => $option,
'nofetch' => 1,
]; ];
$classfortooltip = 'classfortooltip'; $classfortooltip = 'classfortooltip';
$dataparams = ''; $dataparams = '';