From 2f68ba1e2ffbee1e0655712e0e7c9b3bbe87df0c Mon Sep 17 00:00:00 2001 From: jonathan-lescaut <91247137+jonathan-lescaut@users.noreply.github.com> Date: Tue, 25 Apr 2023 14:57:05 +0200 Subject: [PATCH 1/2] fix compatibility with actioncomm Compatibility with actioncomm table which has id instead of rowid --- htdocs/categories/class/categorie.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 57c67b8c7a1..eb67dd0aae9 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -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); From 10f286c4544b5b0ae868aa9e66e1c0883b295a4f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 25 Apr 2023 13:04:59 +0000 Subject: [PATCH 2/2] Fixing style errors. --- htdocs/categories/class/categorie.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index eb67dd0aae9..ae97601f910 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -865,7 +865,7 @@ class Categorie extends CommonObject // 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 { + } else { $sql .= " AND c.fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = o.rowid"; } // Protection for external users