From fdb885f0a326597f3f53afe20be6d352d41fa391 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 26 Sep 2024 22:46:20 +0200 Subject: [PATCH] Warehouse list display mode (#31013) Co-authored-by: Laurent Destailleur --- htdocs/product/class/html.formproduct.class.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index a440abd3471..8b45888d3ea 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -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); } }