diff --git a/inc/category.class.php b/inc/category.class.php index f7618000a..178adbca7 100644 --- a/inc/category.class.php +++ b/inc/category.class.php @@ -93,10 +93,16 @@ public static function getCategoryTree(): array { $form_table = PluginFormcreatorForm::getTable(); $table_fp = PluginFormcreatorForm_Profile::getTable(); + if (version_compare(GLPI_VERSION, '10.0.6') > 0) { + $knowbase_category = KnowbaseItemCategory::SEEALL; + } else { + $knowbase_category = 0; + } + $query_faqs = KnowbaseItem::getListRequest([ 'faq' => '1', 'contains' => '', - 'knowbaseitemcategories_id' => 0, + 'knowbaseitemcategories_id' => $knowbase_category, ]); // GLPI 9.5 returns an array $subQuery = new DBMysqlIterator($DB); diff --git a/inc/form.class.php b/inc/form.class.php index 7d0dd26e2..e578fa678 100644 --- a/inc/form.class.php +++ b/inc/form.class.php @@ -820,7 +820,11 @@ public static function getFormList(int $rootCategory = 0, string $keywords = '', 'faq' => '1', 'contains' => $keywords ]; - $params['knowbaseitemcategories_id'] = 0; + if (version_compare(GLPI_VERSION, '10.0.6') > 0) { + $params['knowbaseitemcategories_id'] = KnowbaseItemCategory::SEEALL; + } else { + $params['knowbaseitemcategories_id'] = 0; + } if (count($selectedCategories) > 0) { $iterator = $DB->request($table_cat, [ 'WHERE' => [ @@ -828,8 +832,8 @@ public static function getFormList(int $rootCategory = 0, string $keywords = '', ] ]); $kbcategories = []; - foreach ($iterator as $kbcat) { - $kbcategories[] = $kbcat['knowbaseitemcategories_id']; + foreach ($iterator as $knowbase_category) { + $kbcategories[] = $knowbase_category['knowbaseitemcategories_id']; } $params['knowbaseitemcategories_id'] = $kbcategories; } diff --git a/inc/knowbase.class.php b/inc/knowbase.class.php index a043195f3..f779e03d6 100644 --- a/inc/knowbase.class.php +++ b/inc/knowbase.class.php @@ -207,7 +207,11 @@ public static function getFaqItems($rootCategory = 0, $keywords = '') { 'faq' => '1', 'contains' => $keywords ]; - $params['knowbaseitemcategories_id'] = 0; + if (version_compare(GLPI_VERSION, '10.0.6') > 0) { + $params['knowbaseitemcategories_id'] = KnowbaseItemCategory::SEEALL; + } else { + $params['knowbaseitemcategories_id'] = 0; + } if (count($selectedCategories) > 0) { $params['knowbaseitemcategories_id'] = $selectedCategories; }