Skip to content

Commit 252ef20

Browse files
authored
fix(faq): visibility (#3118)
Compatibility update for GLPI 10.0.7
1 parent 0a08eb7 commit 252ef20

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

inc/category.class.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,16 @@ public static function getCategoryTree(): array {
9393
$form_table = PluginFormcreatorForm::getTable();
9494
$table_fp = PluginFormcreatorForm_Profile::getTable();
9595

96+
if (version_compare(GLPI_VERSION, '10.0.6') > 0) {
97+
$knowbase_category = KnowbaseItemCategory::SEEALL;
98+
} else {
99+
$knowbase_category = 0;
100+
}
101+
96102
$query_faqs = KnowbaseItem::getListRequest([
97103
'faq' => '1',
98104
'contains' => '',
99-
'knowbaseitemcategories_id' => 0,
105+
'knowbaseitemcategories_id' => $knowbase_category,
100106
]);
101107
// GLPI 9.5 returns an array
102108
$subQuery = new DBMysqlIterator($DB);

inc/form.class.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -820,16 +820,20 @@ public static function getFormList(int $rootCategory = 0, string $keywords = '',
820820
'faq' => '1',
821821
'contains' => $keywords
822822
];
823-
$params['knowbaseitemcategories_id'] = 0;
823+
if (version_compare(GLPI_VERSION, '10.0.6') > 0) {
824+
$params['knowbaseitemcategories_id'] = KnowbaseItemCategory::SEEALL;
825+
} else {
826+
$params['knowbaseitemcategories_id'] = 0;
827+
}
824828
if (count($selectedCategories) > 0) {
825829
$iterator = $DB->request($table_cat, [
826830
'WHERE' => [
827831
'id' => $selectedCategories
828832
]
829833
]);
830834
$kbcategories = [];
831-
foreach ($iterator as $kbcat) {
832-
$kbcategories[] = $kbcat['knowbaseitemcategories_id'];
835+
foreach ($iterator as $knowbase_category) {
836+
$kbcategories[] = $knowbase_category['knowbaseitemcategories_id'];
833837
}
834838
$params['knowbaseitemcategories_id'] = $kbcategories;
835839
}

inc/knowbase.class.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,11 @@ public static function getFaqItems($rootCategory = 0, $keywords = '') {
207207
'faq' => '1',
208208
'contains' => $keywords
209209
];
210-
$params['knowbaseitemcategories_id'] = 0;
210+
if (version_compare(GLPI_VERSION, '10.0.6') > 0) {
211+
$params['knowbaseitemcategories_id'] = KnowbaseItemCategory::SEEALL;
212+
} else {
213+
$params['knowbaseitemcategories_id'] = 0;
214+
}
211215
if (count($selectedCategories) > 0) {
212216
$params['knowbaseitemcategories_id'] = $selectedCategories;
213217
}

0 commit comments

Comments
 (0)