diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 9e08ad86159..1d8eb4578ca 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -118,7 +118,7 @@ class FormProduct $obj = $this->db->fetch_object($resql); if ($sumStock) $obj->stock = price2num($obj->stock,5); $this->cache_warehouses[$obj->rowid]['id'] =$obj->rowid; - $this->cache_warehouses[$obj->rowid]['label']=$obj->label; + $this->cache_warehouses[$obj->rowid]['label']=$o->get_full_arbo(); $this->cache_warehouses[$obj->rowid]['description'] = $obj->description; $this->cache_warehouses[$obj->rowid]['stock'] = $obj->stock; $i++; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 6bec94d9640..539b714ec2e 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -606,4 +606,33 @@ class Entrepot extends CommonObject $this->country_id=1; $this->country_code='FR'; } + + function get_full_arbo() { + + global $user,$langs,$conf; + + $TArbo = array($this->libelle); + + $id = $this->id; + + while(true) { + $sql = 'SELECT fk_parent + FROM '.MAIN_DB_PREFIX.'entrepot + WHERE rowid = '.$id; + + $resql = $this->db->query($sql); + if($resql) { + $res = $this->db->fetch_object($resql); + if(empty($res->fk_parent)) break; + $id = $res->fk_parent; + $o = new Entrepot($this->db); + $o->fetch($id); + $TArbo[] = $o->libelle; + } else break; + } + + return implode(' >> ', array_reverse($TArbo)); + + } + }