diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0db8542..5ec378a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
+## Unreleased ##
+
+### Fixed
+
+- Fix restrict mode
+- Fix warnings and errors in logs
+
## [2.6.2] - 2026-05-12
###
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..ef1bed5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1 @@
+include ../../PluginsMakefile.mk
diff --git a/front/category.form.php b/front/category.form.php
deleted file mode 100644
index 7bc21a7..0000000
--- a/front/category.form.php
+++ /dev/null
@@ -1,44 +0,0 @@
-.
- * -------------------------------------------------------------------------
- * @copyright Copyright (C) 2012-2022 by ItilCategoryGroups plugin team.
- * @license GPLv2 https://www.gnu.org/licenses/gpl-2.0.html
- * @link https://github.com/pluginsGLPI/itilcategorygroups
- * -------------------------------------------------------------------------
- */
-
-include(__DIR__ . '/../../../inc/includes.php');
-Session::checkLoginUser();
-
-Html::header(
- PluginItilcategorygroupsCategory::getTypeName(),
- '',
- 'admin',
- 'pluginitilcategorygroupsmenu',
- 'model',
-);
-
-$dropdown = new PluginItilcategorygroupsCategory();
-
-include(GLPI_ROOT . '/front/dropdown.common.form.php');
diff --git a/front/category.php b/front/category.php
deleted file mode 100644
index 79a4f7f..0000000
--- a/front/category.php
+++ /dev/null
@@ -1,44 +0,0 @@
-.
- * -------------------------------------------------------------------------
- * @copyright Copyright (C) 2012-2022 by ItilCategoryGroups plugin team.
- * @license GPLv2 https://www.gnu.org/licenses/gpl-2.0.html
- * @link https://github.com/pluginsGLPI/itilcategorygroups
- * -------------------------------------------------------------------------
- */
-
-include(__DIR__ . '/../../../inc/includes.php');
-Session::checkLoginUser();
-
-Html::header(
- PluginItilcategorygroupsCategory::getTypeName(),
- '',
- 'admin',
- 'pluginitilcategorygroupsmenu',
- 'model',
-);
-
-$dropdown = new PluginItilcategorygroupsCategory();
-
-include(GLPI_ROOT . '/front/dropdown.common.php');
diff --git a/front/group_level.form.php b/front/group_level.form.php
index aef56c6..007a3bb 100644
--- a/front/group_level.form.php
+++ b/front/group_level.form.php
@@ -30,8 +30,6 @@
use Glpi\Exception\Http\BadRequestHttpException;
-include(__DIR__ . '/../../../inc/includes.php');
-
Session::checkCentralAccess();
$level = new PluginItilcategorygroupsGroup_Level();
diff --git a/hook.php b/hook.php
index 60e89e3..8bab7d2 100644
--- a/hook.php
+++ b/hook.php
@@ -70,7 +70,7 @@ function plugin_itilcategorygroups_getAddSearchOptions($itemtype)
function plugin_itilcategorygroups_giveItem($type, $ID, $data, $num)
{
- $searchopt = &Search::getOptions($type);
+ $searchopt = Search::getOptions($type);
$table = $searchopt[$ID]['table'];
$field = $searchopt[$ID]['field'];
$value = $data['raw']['ITEM_' . $num];
diff --git a/inc/category.class.php b/inc/category.class.php
index 552976b..221bdad 100644
--- a/inc/category.class.php
+++ b/inc/category.class.php
@@ -33,34 +33,7 @@
use Glpi\DBAL\QueryFunction;
use function Safe\json_decode;
-
-/**
- * -------------------------------------------------------------------------
- * ItilCategoryGroups plugin for GLPI
- * -------------------------------------------------------------------------
- *
- * LICENSE
- *
- * This file is part of ItilCategoryGroups.
- *
- * ItilCategoryGroups is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * ItilCategoryGroups is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with ItilCategoryGroups. If not, see .
- * -------------------------------------------------------------------------
- * @copyright Copyright (C) 2012-2022 by ItilCategoryGroups plugin team.
- * @license GPLv2 https://www.gnu.org/licenses/gpl-2.0.html
- * @link https://github.com/pluginsGLPI/itilcategorygroups
- * -------------------------------------------------------------------------
- */
+use function Safe\preg_replace;
class PluginItilcategorygroupsCategory extends CommonDropdown
{
@@ -81,6 +54,14 @@ public static function getTypeName($nb = 0)
return __s('Link ItilCategory - Groups', 'itilcategorygroups');
}
+ /**
+ * @return array{0: string, 1: string, 2: string}
+ */
+ public static function getSectorizedDetails(): array
+ {
+ return ['admin', 'pluginitilcategorygroupsmenu', 'model'];
+ }
+
public static function canCreate(): bool
{
return static::canUpdate();
@@ -302,7 +283,7 @@ public static function filterActors(array $params = []): array
// Selects the level min that will be displayed
if ($level == 0) {
$criteria = [
- 'SELECT' => ['MIN' => 'level'],
+ 'SELECT' => ['MIN' => 'level as level'],
'FROM' => $table,
'WHERE' => [
'itilcategories_id' => $itilcategories_id,
@@ -429,10 +410,15 @@ public static function getGroupsForCategory($itilcategories_id, $params = [])
],
],
],
- 'WHERE' => [
- 'cat.itilcategories_id' => $itilcategories_id,
- 'cat.is_active' => 1,
- ] + $entity_restrict,
+ 'WHERE' => array_merge(
+ [
+ 'cat.itilcategories_id' => $itilcategories_id,
+ 'cat.is_active' => 1,
+ ],
+ $entity_restrict,
+ // extra caller-provided filtering (ticket type, level restriction, already assigned groups)
+ [new QueryExpression(preg_replace('/^\s*AND\s+/i', '', $options['condition']))],
+ ),
'GROUPBY' => 'cat.id',
];
diff --git a/inc/group_level.class.php b/inc/group_level.class.php
index 06ed3b8..f6ffbd5 100644
--- a/inc/group_level.class.php
+++ b/inc/group_level.class.php
@@ -30,34 +30,6 @@
use Glpi\Application\View\TemplateRenderer;
-/**
- * -------------------------------------------------------------------------
- * ItilCategoryGroups plugin for GLPI
- * -------------------------------------------------------------------------
- *
- * LICENSE
- *
- * This file is part of ItilCategoryGroups.
- *
- * ItilCategoryGroups is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * ItilCategoryGroups is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with ItilCategoryGroups. If not, see .
- * -------------------------------------------------------------------------
- * @copyright Copyright (C) 2012-2022 by ItilCategoryGroups plugin team.
- * @license GPLv2 https://www.gnu.org/licenses/gpl-2.0.html
- * @link https://github.com/pluginsGLPI/itilcategorygroups
- * -------------------------------------------------------------------------
- */
-
class PluginItilcategorygroupsGroup_Level extends CommonDBChild
{
// From CommonDBChild