Clean code
This commit is contained in:
parent
0a4735fdaa
commit
f413481f7d
6 changed files with 12 additions and 12 deletions
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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'];
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue