diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index f06265f5491..b14f8c998b7 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1123,11 +1123,11 @@ class Categorie extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Rebuilding the category tree as an array - * Return an array of table('id','id_mere',...) trie selon arbre et avec: - * id = id de la categorie - * id_mere = id de la categorie mere - * id_children = tableau des id enfant - * label = nom de la categorie + * Return an array of table('id','id_mere',...) sorted to have a human readable tree, with + * id = id of category + * id_mere = id of parent category + * id_children = array of child ids + * label = name of category * fulllabel = Name with full path for the category * fullpath = Full path built with the id's * diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index d5f8d114e01..c84458b532f 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -335,7 +335,7 @@ if ($modecompta == 'CREANCES-DETTES') { $TListOfCats = $categorie->get_full_arbo('product', $selected_cat, 1); $searchCategoryProductList = array(); foreach ($TListOfCats as $key => $cat) { - $searchCategoryProductList[] = $cat['rowid']; + $searchCategoryProductList[] = $cat['id']; } } if (!empty($searchCategoryProductList)) { diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 6399cb12986..4994a462519 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -910,8 +910,6 @@ class Entrepot extends CommonObject public function get_full_arbo() { // phpcs:enable - global $user, $langs, $conf; - $TArbo = array($this->label); $protection = 100; // We limit depth of warehouses to 100 @@ -921,7 +919,9 @@ class Entrepot extends CommonObject $parentid = $this->fk_parent; // If parent_id not defined on current object, we do not start consecutive searches of parents $i = 0; while ($parentid > 0 && $i < $protection) { - $sql = "SELECT fk_parent FROM ".$this->db->prefix()."entrepot WHERE rowid = ".((int) $parentid); + $sql = "SELECT fk_parent FROM ".$this->db->prefix()."entrepot"; + $sql .= " WHERE rowid = ".((int) $parentid); + $resql = $this->db->query($sql); if ($resql) { $objarbo = $this->db->fetch_object($resql); diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index a3092f66627..cb4b489206c 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -153,7 +153,7 @@ if ($action == 'getProducts') { if (getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID') > 0) { // A root category is defined, we must filter on products inside this category tree $object = new Categorie($db); //$result = $object->fetch($conf->global->TAKEPOS_ROOT_CATEGORY_ID); - $arrayofcateg = $object->get_full_arbo('product', $conf->global->TAKEPOS_ROOT_CATEGORY_ID, 1); + $arrayofcateg = $object->get_full_arbo('product', getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID'), 1); if (is_array($arrayofcateg) && count($arrayofcateg) > 0) { foreach ($arrayofcateg as $val) { $filteroncategids .= ($filteroncategids ? ', ' : '').$val['id']; diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php index 97dde7a45bf..6c7d2135dfc 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -205,7 +205,7 @@ if ($action == "productinfo") { $levelofrootcategory = 0; if (getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID') > 0) { foreach ($categories as $key => $categorycursor) { - if ($categorycursor['id'] == $conf->global->TAKEPOS_ROOT_CATEGORY_ID) { + if ($categorycursor['id'] == getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID')) { $levelofrootcategory = $categorycursor['level']; break; } diff --git a/htdocs/takepos/public/menu.php b/htdocs/takepos/public/menu.php index 255168d5554..646a55258ee 100644 --- a/htdocs/takepos/public/menu.php +++ b/htdocs/takepos/public/menu.php @@ -63,7 +63,7 @@ $categories = $categorie->get_full_arbo('product', ((getDolGlobalInt('TAKEPOS_RO $levelofrootcategory = 0; if (getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID') > 0) { foreach ($categories as $key => $categorycursor) { - if ($categorycursor['id'] == $conf->global->TAKEPOS_ROOT_CATEGORY_ID) { + if ($categorycursor['id'] == getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID')) { $levelofrootcategory = $categorycursor['level']; break; }