diff --git a/inc/knowbase.class.php b/inc/knowbase.class.php index 71999a0c0..9f83bffb6 100644 --- a/inc/knowbase.class.php +++ b/inc/knowbase.class.php @@ -105,20 +105,19 @@ public static function getCategoryTree() { [ 'SELECT' => ['COUNT DISTINCT' => KnowbaseItem::getTableField('id') . ' as cpt'], 'FROM' => KnowbaseItem::getTable(), - 'LEFT JOIN' => [ + 'INNER JOIN' => [ KnowbaseItem_KnowbaseItemCategory::getTable() => [ 'FKEY' => [ KnowbaseItem::getTable() => 'id', KnowbaseItem_KnowbaseItemCategory::getTable() => KnowbaseItem::getForeignKeyField(), ], ], - KnowbaseItemCategory::getTable() => [ - 'FKEY' => [ - KnowbaseItem_KnowbaseItemCategory::getTable() => KnowbaseItemCategory::getForeignKeyField(), - KnowbaseItemCategory::getTable() => 'id', - ], - ], ], + 'WHERE' => [ + KnowbaseItem_KnowbaseItemCategory::getTableField($cat_fk) => new QueryExpression( + $DB->quoteName(KnowbaseItemCategory::getTableField('id')) + ), + ] ], $kbitem_visibility_crit ), @@ -230,4 +229,4 @@ public static function getFaqItems($rootCategory = 0, $keywords = '') { return ['default' => [], 'forms' => $formList]; } -} \ No newline at end of file +}