Skip to content

Commit

Permalink
NEW : function to display full path to current warehouse
Browse files Browse the repository at this point in the history
  • Loading branch information
atm-gauthier committed Oct 14, 2016
1 parent 416311a commit fe1bcb7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion htdocs/product/class/html.formproduct.class.php
Expand Up @@ -118,7 +118,7 @@ function loadWarehouses($fk_product=0, $batch = '', $status=null, $sumStock = tr
$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++;
Expand Down
29 changes: 29 additions & 0 deletions htdocs/product/stock/class/entrepot.class.php
Expand Up @@ -606,4 +606,33 @@ function initAsSpecimen()
$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));

}

}

0 comments on commit fe1bcb7

Please sign in to comment.