diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index a5d02c9..ac8aba9 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 043dcea..3981870 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Jamf Plugin for GLPI Changelog +## [Unreleased] + +### Added + +- GLPI 12 compatibility + ## [3.2.2] - 2026-08-03 ### Fixed diff --git a/composer.json b/composer.json index ca7a0a3..3084ecd 100644 --- a/composer.json +++ b/composer.json @@ -2,9 +2,6 @@ "require": { "php": ">=8.2" }, - "require-dev": { - "glpi-project/tools": "^0.8.1" - }, "config": { "optimize-autoloader": true, "platform": { diff --git a/composer.lock b/composer.lock index 5a090aa..9e9eab7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,885 +4,18 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0bb7734a8837cdd118f20d259d3613e7", + "content-hash": "4cacb822b12bf0d2a0dbcf952b20ef7b", "packages": [], - "packages-dev": [ - { - "name": "glpi-project/tools", - "version": "0.8.3", - "source": { - "type": "git", - "url": "https://github.com/glpi-project/tools.git", - "reference": "8ea2a7d4702a858f4b0360ba7d4f1841a5e77026" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/glpi-project/tools/zipball/8ea2a7d4702a858f4b0360ba7d4f1841a5e77026", - "reference": "8ea2a7d4702a858f4b0360ba7d4f1841a5e77026", - "shasum": "" - }, - "require": { - "symfony/console": "^5.4 || ^6.0", - "twig/twig": "^3.3" - }, - "require-dev": { - "nikic/php-parser": "^4.13", - "phpstan/phpstan-src": "^1.10" - }, - "bin": [ - "bin/extract-locales", - "bin/licence-headers-check", - "tools/plugin-release" - ], - "type": "library", - "autoload": { - "psr-4": { - "GlpiProject\\Tools\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-3.0-or-later" - ], - "authors": [ - { - "name": "Teclib'", - "email": "glpi@teclib.com", - "homepage": "http://teclib-group.com" - } - ], - "description": "Various tools for GLPI and its plugins", - "keywords": [ - "glpi", - "plugins", - "tools" - ], - "support": { - "issues": "https://github.com/glpi-project/tools/issues", - "source": "https://github.com/glpi-project/tools" - }, - "time": "2025-10-14T10:26:06+00:00" - }, - { - "name": "psr/container", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", - "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", - "shasum": "" - }, - "require": { - "php": ">=7.4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "support": { - "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/2.0.2" - }, - "time": "2021-11-05T16:47:00+00:00" - }, - { - "name": "symfony/console", - "version": "v6.4.27", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "13d3176cf8ad8ced24202844e9f95af11e2959fc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/13d3176cf8ad8ced24202844e9f95af11e2959fc", - "reference": "13d3176cf8ad8ced24202844e9f95af11e2959fc", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/service-contracts": "^2.5|^3", - "symfony/string": "^5.4|^6.0|^7.0" - }, - "conflict": { - "symfony/dependency-injection": "<5.4", - "symfony/dotenv": "<5.4", - "symfony/event-dispatcher": "<5.4", - "symfony/lock": "<5.4", - "symfony/process": "<5.4" - }, - "provide": { - "psr/log-implementation": "1.0|2.0|3.0" - }, - "require-dev": { - "psr/log": "^1|^2|^3", - "symfony/config": "^5.4|^6.0|^7.0", - "symfony/dependency-injection": "^5.4|^6.0|^7.0", - "symfony/event-dispatcher": "^5.4|^6.0|^7.0", - "symfony/http-foundation": "^6.4|^7.0", - "symfony/http-kernel": "^6.4|^7.0", - "symfony/lock": "^5.4|^6.0|^7.0", - "symfony/messenger": "^5.4|^6.0|^7.0", - "symfony/process": "^5.4|^6.0|^7.0", - "symfony/stopwatch": "^5.4|^6.0|^7.0", - "symfony/var-dumper": "^5.4|^6.0|^7.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Eases the creation of beautiful and testable command line interfaces", - "homepage": "https://symfony.com", - "keywords": [ - "cli", - "command-line", - "console", - "terminal" - ], - "support": { - "source": "https://github.com/symfony/console/tree/v6.4.27" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2025-10-06T10:25:16+00:00" - }, - { - "name": "symfony/deprecation-contracts", - "version": "v3.6.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", - "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/contracts", - "name": "symfony/contracts" - }, - "branch-alias": { - "dev-main": "3.6-dev" - } - }, - "autoload": { - "files": [ - "function.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-09-25T14:21:43+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.33.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", - "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.33.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-09-09T11:45:10+00:00" - }, - { - "name": "symfony/polyfill-intl-grapheme", - "version": "v1.33.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/380872130d3a5dd3ace2f4010d95125fde5d5c70", - "reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's grapheme_* functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "grapheme", - "intl", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.33.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2025-06-27T09:58:17+00:00" - }, - { - "name": "symfony/polyfill-intl-normalizer", - "version": "v1.33.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "3833d7255cc303546435cb650316bff708a1c75c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", - "reference": "3833d7255cc303546435cb650316bff708a1c75c", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's Normalizer class and related functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "intl", - "normalizer", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.33.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-09-09T11:45:10+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.33.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493", - "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493", - "shasum": "" - }, - "require": { - "ext-iconv": "*", - "php": ">=7.2" - }, - "provide": { - "ext-mbstring": "*" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.33.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-12-23T08:48:59+00:00" - }, - { - "name": "symfony/service-contracts", - "version": "v3.6.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "45112560a3ba2d715666a509a0bc9521d10b6c43" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/45112560a3ba2d715666a509a0bc9521d10b6c43", - "reference": "45112560a3ba2d715666a509a0bc9521d10b6c43", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "psr/container": "^1.1|^2.0", - "symfony/deprecation-contracts": "^2.5|^3" - }, - "conflict": { - "ext-psr": "<1.1|>=2" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/contracts", - "name": "symfony/contracts" - }, - "branch-alias": { - "dev-main": "3.6-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\Service\\": "" - }, - "exclude-from-classmap": [ - "/Test/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to writing services", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.6.1" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2025-07-15T11:30:57+00:00" - }, - { - "name": "symfony/string", - "version": "v7.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/string.git", - "reference": "d50e862cb0a0e0886f73ca1f31b865efbb795003" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/d50e862cb0a0e0886f73ca1f31b865efbb795003", - "reference": "d50e862cb0a0e0886f73ca1f31b865efbb795003", - "shasum": "" - }, - "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3.0", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-intl-grapheme": "~1.33", - "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/translation-contracts": "<2.5" - }, - "require-dev": { - "symfony/emoji": "^7.1|^8.0", - "symfony/http-client": "^6.4|^7.0|^8.0", - "symfony/intl": "^6.4|^7.0|^8.0", - "symfony/translation-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^6.4|^7.0|^8.0" - }, - "type": "library", - "autoload": { - "files": [ - "Resources/functions.php" - ], - "psr-4": { - "Symfony\\Component\\String\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", - "homepage": "https://symfony.com", - "keywords": [ - "grapheme", - "i18n", - "string", - "unicode", - "utf-8", - "utf8" - ], - "support": { - "source": "https://github.com/symfony/string/tree/v7.4.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2025-11-27T13:27:24+00:00" - }, - { - "name": "twig/twig", - "version": "v3.22.0", - "source": { - "type": "git", - "url": "https://github.com/twigphp/Twig.git", - "reference": "4509984193026de413baf4ba80f68590a7f2c51d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/4509984193026de413baf4ba80f68590a7f2c51d", - "reference": "4509984193026de413baf4ba80f68590a7f2c51d", - "shasum": "" - }, - "require": { - "php": ">=8.1.0", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-mbstring": "^1.3" - }, - "require-dev": { - "phpstan/phpstan": "^2.0", - "psr/container": "^1.0|^2.0", - "symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0" - }, - "type": "library", - "autoload": { - "files": [ - "src/Resources/core.php", - "src/Resources/debug.php", - "src/Resources/escaper.php", - "src/Resources/string_loader.php" - ], - "psr-4": { - "Twig\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, - { - "name": "Twig Team", - "role": "Contributors" - }, - { - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "role": "Project Founder" - } - ], - "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "https://twig.symfony.com", - "keywords": [ - "templating" - ], - "support": { - "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.22.0" - }, - "funding": [ - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/twig/twig", - "type": "tidelift" - } - ], - "time": "2025-10-29T15:56:47+00:00" - } - ], + "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { "php": ">=8.2" }, - "platform-dev": {}, + "platform-dev": [], "platform-overrides": { "php": "8.2.99" }, diff --git a/inc/abstractdevice.class.php b/inc/abstractdevice.class.php index 4d0e147..9e485b0 100644 --- a/inc/abstractdevice.class.php +++ b/inc/abstractdevice.class.php @@ -35,13 +35,13 @@ */ abstract class PluginJamfAbstractDevice extends CommonDBChild { - public static $itemtype = 'itemtype'; + public static string $itemtype = 'itemtype'; - public static $items_id = 'items_id'; + public static string $items_id = 'items_id'; public static $jamftype_name; - public static $mustBeAttached = false; + public static bool $mustBeAttached = false; /** * Display the extra information for Jamf devices on the main Computer or Phone tab. diff --git a/inc/computer.class.php b/inc/computer.class.php index 0224568..870d617 100644 --- a/inc/computer.class.php +++ b/inc/computer.class.php @@ -37,7 +37,7 @@ */ class PluginJamfComputer extends PluginJamfAbstractDevice { - public static $rightname = 'plugin_jamf_computer'; + public static string $rightname = 'plugin_jamf_computer'; public static $jamftype_name = 'Computer'; diff --git a/inc/config.class.php b/inc/config.class.php index 9aac45b..f8a32cf 100644 --- a/inc/config.class.php +++ b/inc/config.class.php @@ -36,7 +36,7 @@ */ class PluginJamfConfig extends CommonDBTM { - protected static $notable = true; + protected static bool $notable = true; public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { diff --git a/inc/dbutil.class.php b/inc/dbutil.class.php index 0918deb..0e09de8 100644 --- a/inc/dbutil.class.php +++ b/inc/dbutil.class.php @@ -52,19 +52,7 @@ public static function dropTableOrDie(string $table, string $message = '') return true; } - $res = $DB->doQuery('DROP TABLE' . $DB::quoteName($table)); - if (!$res) { - //TRANS: %1$s is the description, %2$s is the query, %3$s is the error message - $message = sprintf( - _x('error', '%1$s - Error during the drop of the table %2$s - Error is %3$s', 'jamf'), - $message, - $table, - $DB->error(), - ); - throw new RuntimeException($message); - } - - return $res; + return $DB->doQuery('DROP TABLE' . $DB::quoteName($table)); } public static function truncate($table) diff --git a/inc/devicesync.class.php b/inc/devicesync.class.php index d1bbe6d..21267ec 100644 --- a/inc/devicesync.class.php +++ b/inc/devicesync.class.php @@ -340,7 +340,7 @@ protected function finalizeSync() 'glpi_plugin_jamf_devices_id' => $device_id, ]); - if ($this->jamfplugin_device === null || empty($this->jamfplugin_device->fields)) { + if ($this->jamfplugin_device === null || $this->jamfplugin_device->fields === []) { if (!is_a(static::$jamfplugin_itemtype, CommonDBTM::class, true)) { throw new RuntimeException('Invalid jamfplugin_itemtype: ' . static::$jamfplugin_itemtype); diff --git a/inc/item_extensionattribute.class.php b/inc/item_extensionattribute.class.php index 7dec6ce..895113f 100644 --- a/inc/item_extensionattribute.class.php +++ b/inc/item_extensionattribute.class.php @@ -38,9 +38,9 @@ */ class PluginJamfItem_ExtensionAttribute extends CommonDBChild { - public static $itemtype = 'itemtype'; + public static string $itemtype = 'itemtype'; - public static $items_id = 'items_id'; + public static string $items_id = 'items_id'; public static function getTypeName($nb = 1) { diff --git a/inc/item_mdmcommand.class.php b/inc/item_mdmcommand.class.php index 363fb5b..6578f11 100644 --- a/inc/item_mdmcommand.class.php +++ b/inc/item_mdmcommand.class.php @@ -41,7 +41,7 @@ */ class PluginJamfItem_MDMCommand extends CommonDBTM { - public static $rightname = 'plugin_jamf_mdmcommand'; + public static string $rightname = 'plugin_jamf_mdmcommand'; public static function getTypeName($nb = 0) { diff --git a/inc/mobiledevice.class.php b/inc/mobiledevice.class.php index de980f9..77c6b88 100644 --- a/inc/mobiledevice.class.php +++ b/inc/mobiledevice.class.php @@ -37,11 +37,11 @@ */ class PluginJamfMobileDevice extends PluginJamfAbstractDevice { - public static $itemtype = 'itemtype'; + public static string $itemtype = 'itemtype'; - public static $items_id = 'items_id'; + public static string $items_id = 'items_id'; - public static $rightname = 'plugin_jamf_mobiledevice'; + public static string $rightname = 'plugin_jamf_mobiledevice'; public static function getTypeName($nb = 1) { @@ -401,9 +401,11 @@ function syncDevice(itemtype, items_id) { ], 'lost_location' => [ 'caption' => _x('field', 'GPS', 'jamf'), - 'value' => Html::link(sprintf('%s, %s', $lat, $long), sprintf('https://www.google.com/maps/place/%s,%s', $lat, $long), [ - 'display' => false, - ]), + 'value' => sprintf( + '%2$s', + htmlescape(sprintf('https://www.google.com/maps/place/%s,%s', $lat, $long)), + htmlescape(sprintf('%s, %s', $lat, $long)), + ), ], 'lost_location_altitude' => [ 'caption' => _x('field', 'Altitude', 'jamf'), diff --git a/inc/mobilesync.class.php b/inc/mobilesync.class.php index c32bf60..ed92c67 100644 --- a/inc/mobilesync.class.php +++ b/inc/mobilesync.class.php @@ -374,7 +374,7 @@ protected function syncExtensionAttributes(): PluginJamfDeviceSync $this->status['syncExtensionAttributes'] = self::STATUS_SKIPPED; return $this; - } elseif ($this->config['sync_general'] && ($this->jamfplugin_device === null || empty($this->jamfplugin_device->fields))) { + } elseif ($this->config['sync_general'] && ($this->jamfplugin_device === null || $this->jamfplugin_device->fields === [])) { $this->status['syncExtensionAttributes'] = self::STATUS_DEFERRED; return $this; diff --git a/inc/profile.class.php b/inc/profile.class.php index f468e12..b2ad79c 100644 --- a/inc/profile.class.php +++ b/inc/profile.class.php @@ -35,7 +35,7 @@ */ class PluginJamfProfile extends Profile { - public static $rightname = 'config'; + public static string $rightname = 'config'; public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { diff --git a/inc/ruleimport.class.php b/inc/ruleimport.class.php index 83d4794..592f792 100644 --- a/inc/ruleimport.class.php +++ b/inc/ruleimport.class.php @@ -36,9 +36,9 @@ */ class PluginJamfRuleImport extends Rule { - public static $rightname = 'plugin_jamf_ruleimport'; + public static string $rightname = 'plugin_jamf_ruleimport'; - public $can_sort = true; + public bool $can_sort = true; public function getTitle() { diff --git a/inc/ruleimportcollection.class.php b/inc/ruleimportcollection.class.php index 6ae8393..1b0ddbf 100644 --- a/inc/ruleimportcollection.class.php +++ b/inc/ruleimportcollection.class.php @@ -34,11 +34,11 @@ */ class PluginJamfRuleImportCollection extends RuleCollection { - public $stop_on_first_match = true; + public bool $stop_on_first_match = true; - public static $rightname = 'plugin_jamf_ruleimport'; + public static string $rightname = 'plugin_jamf_ruleimport'; - public $menu_option = 'jamf_import'; + public string $menu_option = 'jamf_import'; public function getTitle() { diff --git a/inc/user_jssaccount.class.php b/inc/user_jssaccount.class.php index 9cb94ab..ee5bed6 100644 --- a/inc/user_jssaccount.class.php +++ b/inc/user_jssaccount.class.php @@ -40,11 +40,11 @@ */ class PluginJamfUser_JSSAccount extends CommonDBChild { - public static $itemtype = 'User'; + public static string $itemtype = 'User'; - public static $items_id = 'users_id'; + public static string $items_id = 'users_id'; - public static $rightname = 'plugin_jamf_jssaccount'; + public static string $rightname = 'plugin_jamf_jssaccount'; public const LINK = 256; diff --git a/setup.php b/setup.php index 3f2b90c..02c19f8 100644 --- a/setup.php +++ b/setup.php @@ -35,8 +35,8 @@ use function Safe\preg_replace; define('PLUGIN_JAMF_VERSION', '3.2.2'); -define('PLUGIN_JAMF_MIN_GLPI', '11.0.0'); -define('PLUGIN_JAMF_MAX_GLPI', '11.0.99'); +define('PLUGIN_JAMF_MIN_GLPI', '12.0.0'); +define('PLUGIN_JAMF_MAX_GLPI', '12.0.99'); function plugin_init_jamf() { diff --git a/templates/config.html.twig b/templates/config.html.twig index 5a94cbb..2600377 100644 --- a/templates/config.html.twig +++ b/templates/config.html.twig @@ -30,7 +30,6 @@ {% import 'components/form/fields_macros.html.twig' as fields %}
-
diff --git a/templates/import.html.twig b/templates/import.html.twig index 8b06298..07710b7 100644 --- a/templates/import.html.twig +++ b/templates/import.html.twig @@ -33,7 +33,6 @@ href: path('/plugins/jamf/front/import.php'), start: _get['start']|default(0), }) }} -
diff --git a/templates/merge.html.twig b/templates/merge.html.twig index ebc63db..49c0ee9 100644 --- a/templates/merge.html.twig +++ b/templates/merge.html.twig @@ -35,7 +35,6 @@ href: path('/plugins/jamf/front/merge.php'), start: _get['start']|default(0), }) }} -
diff --git a/templates/user_jssaccount.html.twig b/templates/user_jssaccount.html.twig index 046b17d..d4926d8 100644 --- a/templates/user_jssaccount.html.twig +++ b/templates/user_jssaccount.html.twig @@ -42,7 +42,6 @@ {% if can_edit %} - {% endif %} diff --git a/tests/units/PluginJamfMobileSync.php b/tests/units/PluginJamfMobileSync.php index 615e8df..4cccc63 100644 --- a/tests/units/PluginJamfMobileSync.php +++ b/tests/units/PluginJamfMobileSync.php @@ -44,6 +44,7 @@ use PluginJamfMobileDevice; use PluginJamfSync; use ReflectionClass; +use PHPUnit\Framework\Attributes\DataProvider; class PluginJamfMobileSync extends AbstractDBTest { @@ -207,9 +208,7 @@ public static function deviceSyncEnginesProvider() return $result; } - /** - * @dataProvider deviceSyncEnginesProvider - */ + #[DataProvider('deviceSyncEnginesProvider')] public function testGetDeviceSyncEngineItem($device_class, $sync_class) { $rdc = new ReflectionClass($device_class);