Warehouse list display mode (#31013)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
John BOTELLA 2024-09-26 22:46:20 +02:00 committed by GitHub
parent 5c43f600ef
commit fdb885f0a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -235,7 +235,10 @@ class FormProduct
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return full path to current warehouse in $tab (recursive function)
*
* Set Hidden conf MAIN_WAREHOUSE_LIST_DISPLAY_MODE at 0 || 1 || 2 to unlock display
* 0 : Default behavior, display parents of warehouse
* 1 : Display only current warehouse label only
* 2 : Display last parent warehouse label
* @param array $tab warehouse data in $this->cache_warehouses line
* @param string $final_label full label with all parents, separated by ' >> ' (completed on each call)
* @return string full label with all parents, separated by ' >> '
@ -247,11 +250,14 @@ class FormProduct
$final_label = $tab['label'];
}
if (empty($tab['parent_id'])) {
if (empty($tab['parent_id']) || getDolGlobalInt('MAIN_WAREHOUSE_LIST_DISPLAY_MODE') === 1) {
return $final_label;
} else {
if (!empty($this->cache_warehouses[$tab['parent_id']])) {
$final_label = $this->cache_warehouses[$tab['parent_id']]['label'].' >> '.$final_label;
if (getDolGlobalInt('MAIN_WAREHOUSE_LIST_DISPLAY_MODE') !== 2 || (getDolGlobalInt('MAIN_WAREHOUSE_LIST_DISPLAY_MODE') === 2 && empty($this->cache_warehouses[$tab['parent_id']]['parent_id']))) {
$final_label = $this->cache_warehouses[$tab['parent_id']]['label'] . ' >> ' . $final_label;
}
return $this->get_parent_path($this->cache_warehouses[$tab['parent_id']], $final_label);
}
}