Merge pull request #24634 from frederic34/enhance_warehouse_tooltip

add categories in warehouse ajax tooltip
This commit is contained in:
Laurent Destailleur 2023-05-01 14:37:23 +02:00 committed by GitHub
commit d31f694f49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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'] = '<br><b>'.$langs->trans('LocationSummary').':</b> '.$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'] = '<br>' . $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));
}