Skip to content

Commit

Permalink
FIX #11942
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Oct 8, 2019
1 parent 51be0fa commit 760783b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions htdocs/categories/class/categorie.class.php
Expand Up @@ -842,11 +842,14 @@ public function getListForItem($id, $type = 'customer', $sortfield = "s.rowid",
if ($type=="contact") {
$subcol_name="fk_socpeople";
}

$idoftype = array_search($type, self::$MAP_ID_TO_CODE);

$sql = "SELECT s.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as s";
$sql.= " , ".MAIN_DB_PREFIX."categorie_".$sub_type." as sub ";
$sql.= ' WHERE s.entity IN ('.getEntity('category').')';
$sql.= ' AND s.type='.array_search($type, self::$MAP_ID_TO_CODE);
$sql.= ' AND s.type='.$idoftype;
$sql.= ' AND s.rowid = sub.fk_categorie';
$sql.= ' AND sub.'.$subcol_name.' = '.$id;

Expand All @@ -865,7 +868,7 @@ public function getListForItem($id, $type = 'customer', $sortfield = "s.rowid",
}
}

$sql.= $this->db->plimit($limit + 1, $offset);
if ($limit) $sql.= $this->db->plimit($limit + 1, $offset);

$result = $this->db->query($sql);
if ($result)
Expand Down

0 comments on commit 760783b

Please sign in to comment.