Merge pull request #18123 from OPEN-DSI/fix_00011

FIX get categories linked to another object type
This commit is contained in:
Laurent Destailleur 2021-07-11 01:37:37 +02:00 committed by GitHub
commit bffbf4ae63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1498,7 +1498,7 @@ class Categorie extends CommonObject
} else {
$sql = "SELECT ct.fk_categorie, c.label, c.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."categorie_".(empty($this->MAP_CAT_TABLE[$type]) ? $type : $this->MAP_CAT_TABLE[$type])." as ct, ".MAIN_DB_PREFIX."categorie as c";
$sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = ".(int) $id." AND c.type = ".$this->MAP_ID[$type];
$sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = ".(int) $id;
$sql .= " AND c.entity IN (".getEntity('category').")";
$res = $this->db->query($sql);