From dc63c3cc1d9d884135622e5381b0c306dd3d149c Mon Sep 17 00:00:00 2001 From: Rom1-B <8530352+Rom1-B@users.noreply.github.com> Date: Tue, 18 Aug 2026 14:06:23 +0200 Subject: [PATCH 1/3] feature/glpi-12.0 --- .github/workflows/continuous-integration.yml | 2 +- CHANGELOG.md | 4 ++++ inc/computergroup.class.php | 4 ++-- inc/computergroupdynamic.class.php | 2 +- inc/computergroupstatic.class.php | 16 ++++++++-------- inc/contactlog.class.php | 4 ++-- inc/credential.class.php | 4 ++-- inc/credentialtype.class.php | 2 +- inc/databaseparam.class.php | 4 ++-- inc/databaseparam_computergroup.class.php | 16 ++++++++-------- inc/databaseparam_credential.class.php | 16 ++++++++-------- inc/inventoryaction.class.php | 2 +- inc/profile.class.php | 2 +- setup.php | 4 ++-- templates/computergroupstatic.html.twig | 2 -- templates/databaseparam_computergroup.html.twig | 2 -- templates/databaseparam_credential.html.twig | 2 -- 17 files changed, 43 insertions(+), 45 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 0f40e9f..7c5fcbd 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -20,7 +20,7 @@ jobs: name: "Generate CI matrix" uses: "glpi-project/plugin-ci-workflows/.github/workflows/generate-ci-matrix.yml@v1" with: - glpi-version: "11.0.x" + glpi-version: "12.0.x" ci: name: "GLPI ${{ matrix.glpi-version }} - php:${{ matrix.php-version }} - ${{ matrix.db-image }}" needs: "generate-ci-matrix" diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f5214b..d09e439 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Added + +- GLPI 12 compatibility + ### Fixed - CI: fix Psalm cache directory, drop the stray `glpi-project/tools` composer dependency, declare a unique composer autoloader suffix diff --git a/inc/computergroup.class.php b/inc/computergroup.class.php index f655a0d..da29f22 100644 --- a/inc/computergroup.class.php +++ b/inc/computergroup.class.php @@ -60,9 +60,9 @@ class PluginDatabaseinventoryComputerGroup extends CommonDBTM { - public $dohistory = true; + public bool $dohistory = true; - public static $rightname = 'database_inventory'; + public static string $rightname = 'database_inventory'; public static function getTypeName($nb = 0) { diff --git a/inc/computergroupdynamic.class.php b/inc/computergroupdynamic.class.php index 88b08b3..2de3833 100644 --- a/inc/computergroupdynamic.class.php +++ b/inc/computergroupdynamic.class.php @@ -39,7 +39,7 @@ class PluginDatabaseinventoryComputerGroupDynamic extends CommonDBTM { - public static $rightname = 'database_inventory'; + public static string $rightname = 'database_inventory'; public static function getTypeName($nb = 0) { diff --git a/inc/computergroupstatic.class.php b/inc/computergroupstatic.class.php index f3c953b..15af522 100644 --- a/inc/computergroupstatic.class.php +++ b/inc/computergroupstatic.class.php @@ -61,21 +61,21 @@ class PluginDatabaseinventoryComputerGroupStatic extends CommonDBRelation { // From CommonDBRelation - public static $itemtype_1 = 'PluginDatabaseinventoryComputerGroup'; + public static ?string $itemtype_1 = 'PluginDatabaseinventoryComputerGroup'; - public static $items_id_1 = 'plugin_databaseinventory_computergroups_id'; + public static ?string $items_id_1 = 'plugin_databaseinventory_computergroups_id'; - public static $itemtype_2 = 'Computer'; + public static ?string $itemtype_2 = 'Computer'; - public static $items_id_2 = 'computers_id'; + public static ?string $items_id_2 = 'computers_id'; - public static $checkItem_2_Rights = self::DONT_CHECK_ITEM_RIGHTS; + public static int $checkItem_2_Rights = self::DONT_CHECK_ITEM_RIGHTS; - public static $logs_for_item_2 = false; + public static bool $logs_for_item_2 = false; - public $auto_message_on_action = false; + public bool $auto_message_on_action = false; - public static $rightname = 'database_inventory'; + public static string $rightname = 'database_inventory'; public static function getTypeName($nb = 0) { diff --git a/inc/contactlog.class.php b/inc/contactlog.class.php index aafeca7..63194a8 100644 --- a/inc/contactlog.class.php +++ b/inc/contactlog.class.php @@ -60,9 +60,9 @@ class PluginDatabaseinventoryContactLog extends CommonDBTM { - public $dohistory = true; + public bool $dohistory = true; - public static $rightname = 'database_inventory'; + public static string $rightname = 'database_inventory'; public static function canCreate(): bool { diff --git a/inc/credential.class.php b/inc/credential.class.php index c6c852e..f3ccef0 100644 --- a/inc/credential.class.php +++ b/inc/credential.class.php @@ -60,9 +60,9 @@ class PluginDatabaseinventoryCredential extends CommonDBTM { - public $dohistory = true; + public bool $dohistory = true; - public static $rightname = 'database_inventory'; + public static string $rightname = 'database_inventory'; public static function canCreate(): bool { diff --git a/inc/credentialtype.class.php b/inc/credentialtype.class.php index 337eb85..d98d1fc 100644 --- a/inc/credentialtype.class.php +++ b/inc/credentialtype.class.php @@ -32,7 +32,7 @@ class PluginDatabaseinventoryCredentialType extends CommonDropdown { - public static $rightname = 'dropdown'; + public static string $rightname = 'dropdown'; private const MYSQL = 1; diff --git a/inc/databaseparam.class.php b/inc/databaseparam.class.php index 5da76f2..7e52f67 100644 --- a/inc/databaseparam.class.php +++ b/inc/databaseparam.class.php @@ -60,9 +60,9 @@ class PluginDatabaseinventoryDatabaseParam extends CommonDBTM { - public $dohistory = true; + public bool $dohistory = true; - public static $rightname = 'database_inventory'; + public static string $rightname = 'database_inventory'; public static function getTypeName($nb = 0) { diff --git a/inc/databaseparam_computergroup.class.php b/inc/databaseparam_computergroup.class.php index 8e4b781..b946c62 100644 --- a/inc/databaseparam_computergroup.class.php +++ b/inc/databaseparam_computergroup.class.php @@ -61,21 +61,21 @@ class PluginDatabaseinventoryDatabaseParam_ComputerGroup extends CommonDBRelation { // From CommonDBRelation - public static $itemtype_1 = 'PluginDatabaseinventoryDatabaseParam'; + public static ?string $itemtype_1 = 'PluginDatabaseinventoryDatabaseParam'; - public static $items_id_1 = 'plugin_databaseinventory_databaseparams_id'; + public static ?string $items_id_1 = 'plugin_databaseinventory_databaseparams_id'; - public static $itemtype_2 = 'PluginDatabaseinventoryComputerGroup'; + public static ?string $itemtype_2 = 'PluginDatabaseinventoryComputerGroup'; - public static $items_id_2 = 'plugin_databaseinventory_computergroups_id'; + public static ?string $items_id_2 = 'plugin_databaseinventory_computergroups_id'; - public static $checkItem_2_Rights = self::DONT_CHECK_ITEM_RIGHTS; + public static int $checkItem_2_Rights = self::DONT_CHECK_ITEM_RIGHTS; - public static $logs_for_item_2 = false; + public static bool $logs_for_item_2 = false; - public $auto_message_on_action = false; + public bool $auto_message_on_action = false; - public static $rightname = 'database_inventory'; + public static string $rightname = 'database_inventory'; public static function canCreate(): bool { diff --git a/inc/databaseparam_credential.class.php b/inc/databaseparam_credential.class.php index 9de9615..791f1a4 100644 --- a/inc/databaseparam_credential.class.php +++ b/inc/databaseparam_credential.class.php @@ -61,21 +61,21 @@ class PluginDatabaseinventoryDatabaseParam_Credential extends CommonDBRelation { // From CommonDBRelation - public static $itemtype_1 = 'PluginDatabaseinventoryDatabaseParam'; + public static ?string $itemtype_1 = 'PluginDatabaseinventoryDatabaseParam'; - public static $items_id_1 = 'plugin_databaseinventory_databaseparams_id'; + public static ?string $items_id_1 = 'plugin_databaseinventory_databaseparams_id'; - public static $itemtype_2 = 'PluginDatabaseinventoryCredential'; + public static ?string $itemtype_2 = 'PluginDatabaseinventoryCredential'; - public static $items_id_2 = 'plugin_databaseinventory_credentials_id'; + public static ?string $items_id_2 = 'plugin_databaseinventory_credentials_id'; - public static $checkItem_2_Rights = self::DONT_CHECK_ITEM_RIGHTS; + public static int $checkItem_2_Rights = self::DONT_CHECK_ITEM_RIGHTS; - public static $logs_for_item_2 = false; + public static bool $logs_for_item_2 = false; - public $auto_message_on_action = false; + public bool $auto_message_on_action = false; - public static $rightname = 'database_inventory'; + public static string $rightname = 'database_inventory'; public static function canCreate(): bool { diff --git a/inc/inventoryaction.class.php b/inc/inventoryaction.class.php index f75fb39..c473000 100644 --- a/inc/inventoryaction.class.php +++ b/inc/inventoryaction.class.php @@ -36,7 +36,7 @@ class PluginDatabaseinventoryInventoryAction extends CommonDBTM private const ENDPOINT_PARTIAL = 'now?'; - public static $rightname = 'database_inventory_run_inventory'; + public static string $rightname = 'database_inventory_run_inventory'; public static function showMassiveActionsSubForm(MassiveAction $ma) { diff --git a/inc/profile.class.php b/inc/profile.class.php index 715e174..fe7e183 100644 --- a/inc/profile.class.php +++ b/inc/profile.class.php @@ -30,7 +30,7 @@ class PluginDatabaseinventoryProfile extends Profile { - public static $rightname = 'profile'; + public static string $rightname = 'profile'; public const RUN_DATABSE_INVENTORY = 256; diff --git a/setup.php b/setup.php index 70b5122..a5af4d2 100644 --- a/setup.php +++ b/setup.php @@ -32,9 +32,9 @@ define('PLUGIN_DATABASEINVENTORY_VERSION', '1.1.4'); // Minimal GLPI version, inclusive -define('PLUGIN_DATABASEINVENTORY_MIN_GLPI', '11.0.0'); +define('PLUGIN_DATABASEINVENTORY_MIN_GLPI', '12.0.0'); // Maximum GLPI version, exclusive -define('PLUGIN_DATABASEINVENTORY_MAX_GLPI', '11.0.99'); +define('PLUGIN_DATABASEINVENTORY_MAX_GLPI', '12.0.99'); /** * Init hooks of the plugin. diff --git a/templates/computergroupstatic.html.twig b/templates/computergroupstatic.html.twig index e41455d..5e49e22 100644 --- a/templates/computergroupstatic.html.twig +++ b/templates/computergroupstatic.html.twig @@ -32,7 +32,6 @@ {% block more_fields %} {% if canadd %}