fix compatibility with actioncomm

Compatibility with actioncomm table which has id instead of rowid
This commit is contained in:
jonathan-lescaut 2023-04-25 14:57:05 +02:00 committed by GitHub
parent 0d98df9568
commit 2f68ba1e2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -862,7 +862,12 @@ class Categorie extends CommonObject
$sql .= ", ".MAIN_DB_PREFIX.(empty($this->MAP_OBJ_TABLE[$type]) ? $type : $this->MAP_OBJ_TABLE[$type])." as o";
$sql .= " WHERE o.entity IN (".getEntity($obj->element).")";
$sql .= " AND c.fk_categorie = ".((int) $this->id);
$sql .= " AND c.fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = o.rowid";
// Compatibility with actioncomm table which has id instead of rowid
if ($this->MAP_OBJ_TABLE[$type] == "actioncomm" || $type == "actioncomm") {
$sql .= " AND c.fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = o.id";
}else {
$sql .= " AND c.fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = o.rowid";
}
// Protection for external users
if (($type == 'customer' || $type == 'supplier') && $user->socid > 0) {
$sql .= " AND o.rowid = ".((int) $user->socid);