Skip to content

Commit

Permalink
fix(category): fix SQL error
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Jun 25, 2020
1 parent 426a16b commit 3470b61
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions inc/category.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,14 @@ public static function getCategoryTree($rootId = 0, $helpdeskHome = false) {
$query_faqs = $subQuery->getSQL();
}

$dbUtils = new DbUtils();
$entityRestrict = $dbUtils->getEntitiesRestrictCriteria($form_table, "", "", true, false);
if (count($entityRestrict)) {
$entityRestrict = [$entityRestrict];
}

// Selects categories containing forms or sub-categories
$categoryFk = self::getForeignKeyField();
$dbUtils = new DbUtils();
$count1 = new QuerySubQuery([
'COUNT' => 'count',
'FROM' => $form_table,
Expand All @@ -120,7 +125,7 @@ public static function getCategoryTree($rootId = 0, $helpdeskHome = false) {
]
]
+ ($helpdeskHome ? ['helpdesk_home' => '1']: [])
+ [$dbUtils->getEntitiesRestrictCriteria($form_table, "", "", true, false)],
+ $entityRestrict,
]);
$count2 = new QuerySubQuery([
'COUNT' => 'count',
Expand Down

0 comments on commit 3470b61

Please sign in to comment.