Merge pull request #4709 from marcosgdf/bug-4583

Fix #4583 Incorrect call of Categories::containing throws a DoliDB error
This commit is contained in:
Laurent Destailleur 2016-03-02 20:52:45 +01:00
commit 2fecaaf42c

View File

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