From a0787a18097d86b42544c2e0db7976c129e32d8d Mon Sep 17 00:00:00 2001 From: Rom1-B <8530352+Rom1-B@users.noreply.github.com> Date: Tue, 18 Aug 2026 15:09:11 +0200 Subject: [PATCH 01/10] feature/glpi-12.0 --- .github/workflows/continuous-integration.yml | 2 +- CHANGELOG.md | 4 + composer.json | 3 - composer.lock | 722 +------------------ inc/appliance.class.php | 2 +- inc/cartridge.class.php | 2 +- inc/cartridgeitem.class.php | 2 +- inc/change.class.php | 2 +- inc/change_item.class.php | 6 +- inc/change_problem.class.php | 10 +- inc/change_ticket.class.php | 10 +- inc/changetask.class.php | 2 +- inc/changevalidation.class.php | 2 +- inc/common.class.php | 2 +- inc/commonitilcost.class.php | 2 +- inc/computer.class.php | 2 +- inc/computer_item.class.php | 2 +- inc/computer_softwarelicense.class.php | 2 +- inc/computer_softwareversion.class.php | 2 +- inc/config.class.php | 2 +- inc/consumableitem.class.php | 4 +- inc/contract.class.php | 2 +- inc/contract_item.class.php | 2 +- inc/document.class.php | 2 +- inc/domain_item.class.php | 2 +- inc/group.class.php | 2 +- inc/group_user.class.php | 2 +- inc/infocom.class.php | 2 +- inc/item_device.class.php | 2 +- inc/item_disk.class.php | 2 +- inc/item_knowbaseitem.class.php | 2 +- inc/item_operatingsystem.class.php | 2 +- inc/item_problem.class.php | 6 +- inc/item_softwarelicense.class.php | 2 +- inc/item_softwareversion.class.php | 2 +- inc/item_ticket.class.php | 6 +- inc/itemantivirus.class.php | 2 +- inc/itemvirtualmachine.class.php | 2 +- inc/itilfollowup.class.php | 2 +- inc/itilsolution.class.php | 2 +- inc/knowbaseitem.class.php | 2 +- inc/link.class.php | 2 +- inc/log.class.php | 2 +- inc/monitor.class.php | 2 +- inc/networkequipment.class.php | 2 +- inc/networkport.class.php | 2 +- inc/peripheral.class.php | 2 +- inc/phone.class.php | 2 +- inc/preference.class.php | 2 +- inc/printer.class.php | 2 +- inc/problem.class.php | 2 +- inc/problem_ticket.class.php | 10 +- inc/problemtask.class.php | 2 +- inc/profile.class.php | 6 +- inc/reservation.class.php | 2 +- inc/software.class.php | 2 +- inc/softwarelicense.class.php | 2 +- inc/softwareversion.class.php | 2 +- inc/ticket.class.php | 2 +- inc/ticket_contract.class.php | 2 +- inc/ticketsatisfaction.class.php | 2 +- inc/tickettask.class.php | 2 +- inc/ticketvalidation.class.php | 2 +- inc/user.class.php | 2 +- setup.php | 4 +- templates/preference_form.html.twig | 33 - 66 files changed, 90 insertions(+), 840 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 62d4e17d..b5c91c38 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -53,7 +53,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 acb810ef..e64aa1c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [4.1.5] - 2026-09-01 +### Added + +- GLPI 12 compatibility + ### Fixed - Fix PDF export of tabs renamed in GLPI 11 diff --git a/composer.json b/composer.json index d3e2efd9..8f13b274 100644 --- a/composer.json +++ b/composer.json @@ -3,9 +3,6 @@ "php": ">=8.2", "symfony/yaml": "^7.3" }, - "require-dev": { - "glpi-project/tools": "^0.8.3" - }, "provide": { "tecnickcom/tcpdf": "*" }, diff --git a/composer.lock b/composer.lock index 07b95ee1..22825c15 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c577ebc4284d2e065e9d457bc09d619c", + "content-hash": "821cb13aed320faeafc865945d816564", "packages": [ { "name": "symfony/deprecation-contracts", @@ -237,725 +237,7 @@ "time": "2026-08-30T00:47:26+00:00" } ], - "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.45", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "3b8473e0d14157f2d22b0a0d7259ad23483d1e6d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/3b8473e0d14157f2d22b0a0d7259ad23483d1e6d", - "reference": "3b8473e0d14157f2d22b0a0d7259ad23483d1e6d", - "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.45" - }, - "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": "2026-08-25T13:08:31+00:00" - }, - { - "name": "symfony/polyfill-intl-grapheme", - "version": "v1.41.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "bb899c1db0aa8127dc3afe8cda4a67eb24915f8d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/bb899c1db0aa8127dc3afe8cda4a67eb24915f8d", - "reference": "bb899c1db0aa8127dc3afe8cda4a67eb24915f8d", - "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.41.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": "2026-07-28T08:25:59+00:00" - }, - { - "name": "symfony/polyfill-intl-normalizer", - "version": "v1.42.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "aa20edea75bd9c48cfecc8360922e5a6e5c44502" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/aa20edea75bd9c48cfecc8360922e5a6e5c44502", - "reference": "aa20edea75bd9c48cfecc8360922e5a6e5c44502", - "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.42.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": "2026-08-07T06:33:24+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.38.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6", - "reference": "d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6", - "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.38.2" - }, - "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": "2026-05-27T06:59:30+00:00" - }, - { - "name": "symfony/service-contracts", - "version": "v3.7.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "15e6a07ec2a2c75ceb1b21dd98105ee8456d2257" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/15e6a07ec2a2c75ceb1b21dd98105ee8456d2257", - "reference": "15e6a07ec2a2c75ceb1b21dd98105ee8456d2257", - "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.7-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.7.3" - }, - "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": "2026-07-27T15:39:01+00:00" - }, - { - "name": "symfony/string", - "version": "v7.4.15", - "source": { - "type": "git", - "url": "https://github.com/symfony/string.git", - "reference": "e394af32256bf9e7bf80849d95e589167c10097b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/e394af32256bf9e7bf80849d95e589167c10097b", - "reference": "e394af32256bf9e7bf80849d95e589167c10097b", - "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.15" - }, - "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": "2026-07-28T07:33:02+00:00" - }, - { - "name": "twig/twig", - "version": "v3.28.0", - "source": { - "type": "git", - "url": "https://github.com/twigphp/Twig.git", - "reference": "597c12ed286fb9d1701a36684ce6e0cbe28ebc8b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/597c12ed286fb9d1701a36684ce6e0cbe28ebc8b", - "reference": "597c12ed286fb9d1701a36684ce6e0cbe28ebc8b", - "shasum": "" - }, - "require": { - "php": ">=8.1.0", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-mbstring": "^1.3" - }, - "require-dev": { - "php-cs-fixer/shim": "^3.0@stable", - "phpstan/phpstan": "^2.0@stable", - "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.28.0" - }, - "funding": [ - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/twig/twig", - "type": "tidelift" - } - ], - "time": "2026-07-03T20:44:34+00:00" - } - ], + "packages-dev": [], "aliases": [], "minimum-stability": "stable", "stability-flags": {}, diff --git a/inc/appliance.class.php b/inc/appliance.class.php index bbee4b13..e49d6608 100644 --- a/inc/appliance.class.php +++ b/inc/appliance.class.php @@ -32,7 +32,7 @@ class PluginPdfAppliance extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; /** * @param $obj (defult NULL) diff --git a/inc/cartridge.class.php b/inc/cartridge.class.php index efda6d04..9daa8cce 100644 --- a/inc/cartridge.class.php +++ b/inc/cartridge.class.php @@ -32,7 +32,7 @@ class PluginPdfCartridge extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; /** * @param $obj (defult NULL) diff --git a/inc/cartridgeitem.class.php b/inc/cartridgeitem.class.php index 63a09db5..cfa54ded 100644 --- a/inc/cartridgeitem.class.php +++ b/inc/cartridgeitem.class.php @@ -32,7 +32,7 @@ class PluginPdfCartridgeItem extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/change.class.php b/inc/change.class.php index 1a6d8ac4..43f9e64e 100644 --- a/inc/change.class.php +++ b/inc/change.class.php @@ -32,7 +32,7 @@ class PluginPdfChange extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/change_item.class.php b/inc/change_item.class.php index dca4a695..36140f55 100644 --- a/inc/change_item.class.php +++ b/inc/change_item.class.php @@ -32,7 +32,7 @@ class PluginPdfChange_Item extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { @@ -384,7 +384,7 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tr $first = false; } } - if ($col) { + if ($col !== '' && $col !== '0') { $texte = '' . sprintf(__s('%1$s: %2$s'), __s('Requester') . '', ''); $pdf->displayText($texte, $col, 1); } @@ -425,7 +425,7 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tr $first = false; } } - if ($col) { + if ($col !== '' && $col !== '0') { $texte = '' . sprintf(__s('%1$s: %2$s') . '', __s('Assigned to'), ''); $pdf->displayText($texte, $col, 1); } diff --git a/inc/change_problem.class.php b/inc/change_problem.class.php index 16eca1b7..6fe62f8f 100644 --- a/inc/change_problem.class.php +++ b/inc/change_problem.class.php @@ -32,7 +32,7 @@ class PluginPdfChange_Problem extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { @@ -225,7 +225,7 @@ public static function pdfForChange(PluginPdfSimplePDF $pdf, Change $change) $first = false; } } - if ($col) { + if ($col !== '' && $col !== '0') { $texte = '' . sprintf(__s('%1$s: %2$s'), __s('Requester') . '', ''); $pdf->displayText($texte, $col, 1); } @@ -266,7 +266,7 @@ public static function pdfForChange(PluginPdfSimplePDF $pdf, Change $change) $first = false; } } - if ($col) { + if ($col !== '' && $col !== '0') { $texte = '' . sprintf(__s('%1$s: %2$s') . '', ('Assigned to'), ''); $pdf->displayText($texte, $col, 1); } @@ -452,7 +452,7 @@ public static function pdfForProblem(PluginPdfSimplePDF $pdf, Problem $problem) $first = false; } } - if ($col) { + if ($col !== '' && $col !== '0') { $texte = '' . sprintf(__s('%1$s: %2$s'), __s('Requester') . '', ''); $pdf->displayText($texte, $col, 1); } @@ -493,7 +493,7 @@ public static function pdfForProblem(PluginPdfSimplePDF $pdf, Problem $problem) $first = false; } } - if ($col) { + if ($col !== '' && $col !== '0') { $texte = '' . sprintf(__s('%1$s: %2$s') . '', __s('Assigned to'), ''); $pdf->displayText($texte, $col, 1); } diff --git a/inc/change_ticket.class.php b/inc/change_ticket.class.php index 97127939..4b927a2e 100644 --- a/inc/change_ticket.class.php +++ b/inc/change_ticket.class.php @@ -32,7 +32,7 @@ class PluginPdfChange_Ticket extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { @@ -226,7 +226,7 @@ public static function pdfForChange(PluginPdfSimplePDF $pdf, Change $change) $first = false; } } - if ($col) { + if ($col !== '' && $col !== '0') { $texte = '' . sprintf(__s('%1$s: %2$s'), __s('Requester') . '', ''); $pdf->displayText($texte, $col, 1); } @@ -267,7 +267,7 @@ public static function pdfForChange(PluginPdfSimplePDF $pdf, Change $change) $first = false; } } - if ($col) { + if ($col !== '' && $col !== '0') { $texte = '' . sprintf(__s('%1$s: %2$s') . '', __s('Assigned to'), ''); $pdf->displayText($texte, $col, 1); } @@ -483,7 +483,7 @@ public static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $ticket) $first = false; } } - if ($col) { + if ($col !== '' && $col !== '0') { $texte = '' . sprintf(__s('%1$s: %2$s'), __s('Requester') . '', ''); $pdf->displayText($texte, $col, 1); } @@ -524,7 +524,7 @@ public static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $ticket) $first = false; } } - if ($col) { + if ($col !== '' && $col !== '0') { $texte = '' . sprintf(__s('%1$s: %2$s') . '', __s('Assigned to'), ''); $pdf->displayText($texte, $col, 1); } diff --git a/inc/changetask.class.php b/inc/changetask.class.php index c438de71..d782a3be 100644 --- a/inc/changetask.class.php +++ b/inc/changetask.class.php @@ -32,7 +32,7 @@ class PluginPdfChangeTask extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/changevalidation.class.php b/inc/changevalidation.class.php index 2a8e7132..486981b4 100644 --- a/inc/changevalidation.class.php +++ b/inc/changevalidation.class.php @@ -32,7 +32,7 @@ class PluginPdfChangeValidation extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/common.class.php b/inc/common.class.php index 49509e94..98acf9d7 100644 --- a/inc/common.class.php +++ b/inc/common.class.php @@ -37,7 +37,7 @@ abstract class PluginPdfCommon extends CommonGLPI protected $obj = null; protected $pdf = null; - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; /** * Constructor, should intialize $this->obj property diff --git a/inc/commonitilcost.class.php b/inc/commonitilcost.class.php index 8532c2bc..776e938e 100644 --- a/inc/commonitilcost.class.php +++ b/inc/commonitilcost.class.php @@ -32,7 +32,7 @@ class PluginPdfCommonItilCost extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/computer.class.php b/inc/computer.class.php index 0b610cf3..c0949d17 100644 --- a/inc/computer.class.php +++ b/inc/computer.class.php @@ -34,7 +34,7 @@ class PluginPdfComputer extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/computer_item.class.php b/inc/computer_item.class.php index b242e933..f04d731d 100644 --- a/inc/computer_item.class.php +++ b/inc/computer_item.class.php @@ -34,7 +34,7 @@ class PluginPdfComputer_Item extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/computer_softwarelicense.class.php b/inc/computer_softwarelicense.class.php index 67ac3f26..30e1f7dc 100644 --- a/inc/computer_softwarelicense.class.php +++ b/inc/computer_softwarelicense.class.php @@ -63,7 +63,7 @@ */ class PluginPdfComputer_SoftwareLicense extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/computer_softwareversion.class.php b/inc/computer_softwareversion.class.php index 306ba5a3..5c22df57 100644 --- a/inc/computer_softwareversion.class.php +++ b/inc/computer_softwareversion.class.php @@ -63,7 +63,7 @@ */ class PluginPdfComputer_SoftwareVersion extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/config.class.php b/inc/config.class.php index 7dc583b5..896a2d99 100644 --- a/inc/config.class.php +++ b/inc/config.class.php @@ -65,7 +65,7 @@ class PluginPdfConfig extends CommonDBTM { private static $_instance = null; - public static $rightname = 'config'; + public static string $rightname = 'config'; public static function canCreate(): bool { diff --git a/inc/consumableitem.class.php b/inc/consumableitem.class.php index 991a641f..737022bb 100644 --- a/inc/consumableitem.class.php +++ b/inc/consumableitem.class.php @@ -32,7 +32,7 @@ class PluginPdfConsumableItem extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { @@ -165,7 +165,7 @@ public static function pdfForConsumableItem(PluginPdfSimplePDF $pdf, ConsumableI 'ORDER' => $order], ); - if (!$number) { + if ($number === 0) { $pdf->setColumnsSize(100); $pdf->displayTitle(__s('No consumable')); } else { diff --git a/inc/contract.class.php b/inc/contract.class.php index c44664a0..c127dc1d 100644 --- a/inc/contract.class.php +++ b/inc/contract.class.php @@ -32,7 +32,7 @@ class PluginPdfContract extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/contract_item.class.php b/inc/contract_item.class.php index ed33e589..bbd41c25 100644 --- a/inc/contract_item.class.php +++ b/inc/contract_item.class.php @@ -32,7 +32,7 @@ class PluginPdfContract_Item extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/document.class.php b/inc/document.class.php index 418cd128..ad67286c 100644 --- a/inc/document.class.php +++ b/inc/document.class.php @@ -32,7 +32,7 @@ class PluginPdfDocument extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/domain_item.class.php b/inc/domain_item.class.php index 22e54562..cfc106b8 100644 --- a/inc/domain_item.class.php +++ b/inc/domain_item.class.php @@ -32,7 +32,7 @@ class PluginPdfDomain_Item extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/group.class.php b/inc/group.class.php index 31eea5d1..07ed6a4f 100644 --- a/inc/group.class.php +++ b/inc/group.class.php @@ -32,7 +32,7 @@ class PluginPdfGroup extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/group_user.class.php b/inc/group_user.class.php index a1d02b18..ed856f6d 100644 --- a/inc/group_user.class.php +++ b/inc/group_user.class.php @@ -32,7 +32,7 @@ class PluginPdfGroup_User extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/infocom.class.php b/inc/infocom.class.php index 37b45a45..d19a20ec 100644 --- a/inc/infocom.class.php +++ b/inc/infocom.class.php @@ -32,7 +32,7 @@ class PluginPdfInfocom extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/item_device.class.php b/inc/item_device.class.php index 27c715ff..37968590 100644 --- a/inc/item_device.class.php +++ b/inc/item_device.class.php @@ -33,7 +33,7 @@ class PluginPdfItem_Device extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/item_disk.class.php b/inc/item_disk.class.php index 7c0f1651..fe11cbad 100644 --- a/inc/item_disk.class.php +++ b/inc/item_disk.class.php @@ -32,7 +32,7 @@ class PluginPdfItem_Disk extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/item_knowbaseitem.class.php b/inc/item_knowbaseitem.class.php index 2096bc91..533238a1 100644 --- a/inc/item_knowbaseitem.class.php +++ b/inc/item_knowbaseitem.class.php @@ -32,7 +32,7 @@ class PluginPdfItem_Knowbaseitem extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/item_operatingsystem.class.php b/inc/item_operatingsystem.class.php index 50686fe7..15262ee7 100644 --- a/inc/item_operatingsystem.class.php +++ b/inc/item_operatingsystem.class.php @@ -32,7 +32,7 @@ class PluginPdfItem_OperatingSystem extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/item_problem.class.php b/inc/item_problem.class.php index 0ceb1fba..32a83683 100644 --- a/inc/item_problem.class.php +++ b/inc/item_problem.class.php @@ -63,7 +63,7 @@ */ class PluginPdfItem_Problem extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { @@ -472,7 +472,7 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tr $first = false; } } - if ($col) { + if ($col !== '' && $col !== '0') { $texte = '' . sprintf(__s('%1$s: %2$s'), __s('Requester') . '', ''); $pdf->displayText($texte, $col, 1); } @@ -513,7 +513,7 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tr $first = false; } } - if ($col) { + if ($col !== '' && $col !== '0') { $texte = '' . sprintf(__s('%1$s: %2$s') . '', __s('Assigned to'), ''); $pdf->displayText($texte, $col, 1); } diff --git a/inc/item_softwarelicense.class.php b/inc/item_softwarelicense.class.php index 35aa2cf7..9fff1670 100644 --- a/inc/item_softwarelicense.class.php +++ b/inc/item_softwarelicense.class.php @@ -63,7 +63,7 @@ */ class PluginPdfItem_SoftwareLicense extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/item_softwareversion.class.php b/inc/item_softwareversion.class.php index a67b47c1..b973d6ae 100644 --- a/inc/item_softwareversion.class.php +++ b/inc/item_softwareversion.class.php @@ -64,7 +64,7 @@ */ class PluginPdfItem_SoftwareVersion extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/item_ticket.class.php b/inc/item_ticket.class.php index 0c0a2ca8..e42b7128 100644 --- a/inc/item_ticket.class.php +++ b/inc/item_ticket.class.php @@ -63,7 +63,7 @@ */ class PluginPdfItem_Ticket extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { @@ -516,7 +516,7 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tr $first = false; } } - if ($col) { + if ($col !== '' && $col !== '0') { $texte = '' . sprintf(__s('%1$s: %2$s'), __s('Requester') . '', ''); $pdf->displayText($texte, $col, 1); } @@ -557,7 +557,7 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tr $first = false; } } - if ($col) { + if ($col !== '' && $col !== '0') { $texte = '' . sprintf(__s('%1$s: %2$s') . '', __s('Assigned to'), ''); $pdf->displayText($texte, $col, 1); } diff --git a/inc/itemantivirus.class.php b/inc/itemantivirus.class.php index d9821c26..1d143ff5 100644 --- a/inc/itemantivirus.class.php +++ b/inc/itemantivirus.class.php @@ -32,7 +32,7 @@ class PluginPdfItemAntivirus extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/itemvirtualmachine.class.php b/inc/itemvirtualmachine.class.php index 90779ea8..bc4fa09d 100644 --- a/inc/itemvirtualmachine.class.php +++ b/inc/itemvirtualmachine.class.php @@ -32,7 +32,7 @@ class PluginPdfItemVirtualMachine extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/itilfollowup.class.php b/inc/itilfollowup.class.php index 1ef03b1d..55895a56 100644 --- a/inc/itilfollowup.class.php +++ b/inc/itilfollowup.class.php @@ -32,7 +32,7 @@ class PluginPdfItilFollowup extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/itilsolution.class.php b/inc/itilsolution.class.php index 94302fe2..9526f1ae 100644 --- a/inc/itilsolution.class.php +++ b/inc/itilsolution.class.php @@ -32,7 +32,7 @@ class PluginPdfITILSolution extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/knowbaseitem.class.php b/inc/knowbaseitem.class.php index e01d23da..677065bc 100644 --- a/inc/knowbaseitem.class.php +++ b/inc/knowbaseitem.class.php @@ -32,7 +32,7 @@ class PluginPdfKnowbaseItem extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/link.class.php b/inc/link.class.php index b4e040db..22b5df38 100644 --- a/inc/link.class.php +++ b/inc/link.class.php @@ -32,7 +32,7 @@ class PluginPdfLink extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/log.class.php b/inc/log.class.php index feb190c1..382da092 100644 --- a/inc/log.class.php +++ b/inc/log.class.php @@ -32,7 +32,7 @@ class PluginPdfLog extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/monitor.class.php b/inc/monitor.class.php index 5d7ccc7e..a2aca15e 100644 --- a/inc/monitor.class.php +++ b/inc/monitor.class.php @@ -32,7 +32,7 @@ class PluginPdfMonitor extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/networkequipment.class.php b/inc/networkequipment.class.php index cbd11557..afba623a 100644 --- a/inc/networkequipment.class.php +++ b/inc/networkequipment.class.php @@ -32,7 +32,7 @@ class PluginPdfNetworkEquipment extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/networkport.class.php b/inc/networkport.class.php index 1d5a0eee..c2f4faa2 100644 --- a/inc/networkport.class.php +++ b/inc/networkport.class.php @@ -34,7 +34,7 @@ class PluginPdfNetworkPort extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/peripheral.class.php b/inc/peripheral.class.php index 9f383122..06d9fd70 100644 --- a/inc/peripheral.class.php +++ b/inc/peripheral.class.php @@ -32,7 +32,7 @@ class PluginPdfPeripheral extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/phone.class.php b/inc/phone.class.php index e35cf925..e69766d5 100644 --- a/inc/phone.class.php +++ b/inc/phone.class.php @@ -32,7 +32,7 @@ class PluginPdfPhone extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/preference.class.php b/inc/preference.class.php index 15a8dc78..0208cae6 100644 --- a/inc/preference.class.php +++ b/inc/preference.class.php @@ -34,7 +34,7 @@ class PluginPdfPreference extends CommonDBTM { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public static function getTypeName($nb = 0) { diff --git a/inc/printer.class.php b/inc/printer.class.php index d493fc01..35d3b242 100644 --- a/inc/printer.class.php +++ b/inc/printer.class.php @@ -32,7 +32,7 @@ class PluginPdfPrinter extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/problem.class.php b/inc/problem.class.php index 24849501..b492a5d8 100644 --- a/inc/problem.class.php +++ b/inc/problem.class.php @@ -32,7 +32,7 @@ class PluginPdfProblem extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/problem_ticket.class.php b/inc/problem_ticket.class.php index e1629ece..96c118c8 100644 --- a/inc/problem_ticket.class.php +++ b/inc/problem_ticket.class.php @@ -32,7 +32,7 @@ class PluginPdfProblem_Ticket extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { @@ -223,7 +223,7 @@ public static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $ticket) $first = false; } } - if ($col) { + if ($col !== '' && $col !== '0') { $texte = '' . sprintf(__s('%1$s: %2$s'), __s('Requester') . '', ''); $pdf->displayText($texte, $col, 1); } @@ -264,7 +264,7 @@ public static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $ticket) $first = false; } } - if ($col) { + if ($col !== '' && $col !== '0') { $texte = '' . sprintf(__s('%1$s: %2$s') . '', ('Assigned to'), ''); $pdf->displayText($texte, $col, 1); } @@ -448,7 +448,7 @@ public static function pdfForProblem(PluginPdfSimplePDF $pdf, Problem $problem) $first = false; } } - if ($col) { + if ($col !== '' && $col !== '0') { $texte = '' . sprintf(__s('%1$s: %2$s'), __s('Requester') . '', ''); $pdf->displayText($texte, $col, 1); } @@ -489,7 +489,7 @@ public static function pdfForProblem(PluginPdfSimplePDF $pdf, Problem $problem) $first = false; } } - if ($col) { + if ($col !== '' && $col !== '0') { $texte = '' . sprintf(__s('%1$s: %2$s') . '', __s('Assigned to'), ''); $pdf->displayText($texte, $col, 1); } diff --git a/inc/problemtask.class.php b/inc/problemtask.class.php index f89d5065..c49d4d42 100755 --- a/inc/problemtask.class.php +++ b/inc/problemtask.class.php @@ -32,7 +32,7 @@ class PluginPdfProblemTask extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/profile.class.php b/inc/profile.class.php index 19350b29..aea669e5 100644 --- a/inc/profile.class.php +++ b/inc/profile.class.php @@ -32,7 +32,7 @@ class PluginPdfProfile extends Profile { - public static $rightname = 'profile'; + public static string $rightname = 'profile'; public static function getTypeName($nb = 0) { @@ -127,11 +127,11 @@ public static function addDefaultProfileInfos($profiles_id, $rights, $drop_exist 'name' => $right]); } - if (!$dbu->countElementsInTable( + if ($dbu->countElementsInTable( 'glpi_profilerights', ['profiles_id' => $profiles_id, 'name' => $right], - )) { + ) === 0) { $myright['profiles_id'] = $profiles_id; $myright['name'] = $right; $myright['rights'] = $value; diff --git a/inc/reservation.class.php b/inc/reservation.class.php index 69c4545a..c72c521f 100644 --- a/inc/reservation.class.php +++ b/inc/reservation.class.php @@ -32,7 +32,7 @@ class PluginPdfReservation extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/software.class.php b/inc/software.class.php index 21a3526e..5a58167a 100644 --- a/inc/software.class.php +++ b/inc/software.class.php @@ -32,7 +32,7 @@ class PluginPdfSoftware extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/softwarelicense.class.php b/inc/softwarelicense.class.php index 3f712645..53f2d866 100644 --- a/inc/softwarelicense.class.php +++ b/inc/softwarelicense.class.php @@ -32,7 +32,7 @@ class PluginPdfSoftwareLicense extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/softwareversion.class.php b/inc/softwareversion.class.php index 3c1fb1b2..b404a9fb 100644 --- a/inc/softwareversion.class.php +++ b/inc/softwareversion.class.php @@ -32,7 +32,7 @@ class PluginPdfSoftwareVersion extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/ticket.class.php b/inc/ticket.class.php index 78677a76..13646308 100644 --- a/inc/ticket.class.php +++ b/inc/ticket.class.php @@ -32,7 +32,7 @@ class PluginPdfTicket extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/ticket_contract.class.php b/inc/ticket_contract.class.php index ee33a239..ff3630e2 100644 --- a/inc/ticket_contract.class.php +++ b/inc/ticket_contract.class.php @@ -32,7 +32,7 @@ class PluginPdfTicket_Contract extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/ticketsatisfaction.class.php b/inc/ticketsatisfaction.class.php index 09fbecd6..9f056c2a 100644 --- a/inc/ticketsatisfaction.class.php +++ b/inc/ticketsatisfaction.class.php @@ -32,7 +32,7 @@ class PluginPdfTicketSatisfaction extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/tickettask.class.php b/inc/tickettask.class.php index 55e5d902..596af6fa 100644 --- a/inc/tickettask.class.php +++ b/inc/tickettask.class.php @@ -32,7 +32,7 @@ class PluginPdfTicketTask extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/ticketvalidation.class.php b/inc/ticketvalidation.class.php index 848934c2..9fabf820 100644 --- a/inc/ticketvalidation.class.php +++ b/inc/ticketvalidation.class.php @@ -32,7 +32,7 @@ class PluginPdfTicketValidation extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/inc/user.class.php b/inc/user.class.php index 838d5c81..61e05357 100644 --- a/inc/user.class.php +++ b/inc/user.class.php @@ -32,7 +32,7 @@ class PluginPdfUser extends PluginPdfCommon { - public static $rightname = 'plugin_pdf'; + public static string $rightname = 'plugin_pdf'; public function __construct(?CommonGLPI $obj = null) { diff --git a/setup.php b/setup.php index 100b41cc..9a85facf 100644 --- a/setup.php +++ b/setup.php @@ -36,8 +36,8 @@ define('PLUGIN_PDF_VERSION', '4.1.5'); -define('PLUGIN_PDF_MIN_GLPI', '11.0.0'); -define('PLUGIN_PDF_MAX_GLPI', '11.0.99'); +define('PLUGIN_PDF_MIN_GLPI', '12.0.0'); +define('PLUGIN_PDF_MAX_GLPI', '12.0.99'); function plugin_init_pdf() { diff --git a/templates/preference_form.html.twig b/templates/preference_form.html.twig index ffbfbd41..29c493ca 100644 --- a/templates/preference_form.html.twig +++ b/templates/preference_form.html.twig @@ -146,7 +146,6 @@
- {% if item_id %} @@ -206,37 +205,5 @@ }); updateSelectionCount(formId); - - function refreshCsrfToken(formId) { - fetch(window.location.href, { credentials: 'same-origin' }) - .then(r => r.text()) - .then(html => { - try { - const newTokenInput = new DOMParser() - .parseFromString(html, 'text/html') - .querySelector('input[name="_glpi_csrf_token"]'); - if (!newTokenInput) return; - - const currentTokenInput = document.querySelector(`#${formId} input[name="_glpi_csrf_token"]`); - if (currentTokenInput) { - currentTokenInput.value = newTokenInput.value; - } - } catch (e) { - // Ignore errors silently - } - }) - .catch(() => { - // Ignore errors silently - }); - } - - // Schedule a CSRF token refresh after form submission - const form = document.getElementById(formId); - if (form) { - form.addEventListener('submit', () => { - // Delay to allow server-side AJAX handlers to complete; full navigation will reload everything - setTimeout(() => refreshCsrfToken(formId), 800); - }); - } }); From 40fb597af04555e520e6520d4b847d605d4380e2 Mon Sep 17 00:00:00 2001 From: Julien Durand Date: Thu, 3 Sep 2026 10:06:56 +0200 Subject: [PATCH 02/10] chore: remove deprecated Rector rule --- rector.php | 1 - 1 file changed, 1 deletion(-) diff --git a/rector.php b/rector.php index 65a1f6ed..35d41f46 100644 --- a/rector.php +++ b/rector.php @@ -67,7 +67,6 @@ CodeQuality\Foreach_\ForeachItemsAssignToEmptyArrayToAssignRector::class, CodeQuality\Foreach_\ForeachToInArrayRector::class, CodeQuality\Foreach_\SimplifyForeachToCoalescingRector::class, - CodeQuality\Foreach_\UnusedForeachValueToArrayKeysRector::class, CodeQuality\FuncCall\ChangeArrayPushToArrayAssignRector::class, CodeQuality\FuncCall\CompactToVariablesRector::class, CodeQuality\FuncCall\InlineIsAInstanceOfRector::class, From b9e62a7b20696d16a0fb1e8fd27c8a32063e8b95 Mon Sep 17 00:00:00 2001 From: Julien Durand Date: Thu, 3 Sep 2026 10:07:06 +0200 Subject: [PATCH 03/10] chore: rector lint --- inc/cartridge.class.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/inc/cartridge.class.php b/inc/cartridge.class.php index 9daa8cce..b69a6e12 100644 --- a/inc/cartridge.class.php +++ b/inc/cartridge.class.php @@ -366,10 +366,7 @@ public static function pdfForCartridgeItem(PluginPdfSimplePDF $pdf, CartridgeIte - mktime(0, 0, 0, (int) $tmp_dbeg[1], (int) $tmp_dbeg[2], (int) $tmp_dbeg[0]); $use_time += $use_time_tmp; - // Get initial counter page - if (!isset($pages[$printer])) { - $pages[$printer] = $data['init_pages_counter']; - } + $pages[$printer] ??= $data['init_pages_counter']; if ($pages[$printer] < $data['pages']) { $pages_printed += $data['pages'] - $pages[$printer]; $nb_pages_printed++; From b3ab332d6180c77ac3b39cf26471d72b583d4187 Mon Sep 17 00:00:00 2001 From: Julien Durand Date: Tue, 8 Sep 2026 14:32:39 +0200 Subject: [PATCH 04/10] fix: Change_Item where clause --- inc/change_item.class.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/inc/change_item.class.php b/inc/change_item.class.php index 36140f55..e6ed3c5c 100644 --- a/inc/change_item.class.php +++ b/inc/change_item.class.php @@ -161,34 +161,35 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tr $dbu = new DbUtils(); - $restrict = ''; + $restrict = []; $order = ''; switch ($item->getType()) { case 'User': - $restrict = "(`glpi_changes_users`.`users_id` = '" . $item->getID() . "')"; + $restrict = ['glpi_changes_users.users_id' => $item->getID()]; $order = '`glpi_changes`.`date_mod` DESC'; break; case 'Supplier': - $restrict = "(`glpi_changes_suppliers`.`suppliers_id` = '" . $item->getID() . "')"; + $restrict = ['glpi_changes_suppliers.suppliers_id' => $item->getID()]; $order = '`glpi_changes`.`date_mod` DESC'; break; case 'Group': if ($tree) { - $restrict = 'IN (' . implode(',', $dbu->getSonsOf('glpi_groups', $item->getID())) . ')'; + $restrict = ['glpi_changes_groups.groups_id' => $dbu->getSonsOf('glpi_groups', $item->getID())]; } else { - $restrict = "='" . $item->getID() . "'"; + $restrict = ['glpi_changes_groups.groups_id' => $item->getID()]; } - $restrict = "(`glpi_changes_groups`.`groups_id` $restrict - AND `glpi_changes_groups`.`type` = " . CommonITILActor::REQUESTER . ')'; + $restrict['glpi_changes_groups.type'] = CommonITILActor::REQUESTER; $order = '`glpi_changes`.`date_mod` DESC'; break; default: - $restrict = "(`items_id` = '" . $item->getID() . "' - AND `itemtype` = '" . $item->getType() . "')"; + $restrict = [ + 'glpi_changes_items.items_id' => $item->getID(), + 'glpi_changes_items.itemtype' => $item->getType(), + ]; $order = '`glpi_changes`.`date_mod` DESC'; break; } @@ -225,7 +226,7 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tr 'DISTINCT' => true, 'FROM' => 'glpi_changes', 'LEFT JOIN' => $LEFT_JOIN, - 'WHERE' => [$restrict] + $dbu->getEntitiesRestrictCriteria('glpi_changes'), + 'WHERE' => $restrict + $dbu->getEntitiesRestrictCriteria('glpi_changes'), 'ORDER' => $order, 'LIMIT' => (int) $_SESSION['glpilist_limit'], ]; From 858ca864951d6fd4c1f239af4dcd0a904a96f98c Mon Sep 17 00:00:00 2001 From: Julien Durand Date: Tue, 8 Sep 2026 15:53:25 +0200 Subject: [PATCH 05/10] Revert "fix: Change_Item where clause" This reverts commit b3ab332d6180c77ac3b39cf26471d72b583d4187. --- inc/change_item.class.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/inc/change_item.class.php b/inc/change_item.class.php index e6ed3c5c..36140f55 100644 --- a/inc/change_item.class.php +++ b/inc/change_item.class.php @@ -161,35 +161,34 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tr $dbu = new DbUtils(); - $restrict = []; + $restrict = ''; $order = ''; switch ($item->getType()) { case 'User': - $restrict = ['glpi_changes_users.users_id' => $item->getID()]; + $restrict = "(`glpi_changes_users`.`users_id` = '" . $item->getID() . "')"; $order = '`glpi_changes`.`date_mod` DESC'; break; case 'Supplier': - $restrict = ['glpi_changes_suppliers.suppliers_id' => $item->getID()]; + $restrict = "(`glpi_changes_suppliers`.`suppliers_id` = '" . $item->getID() . "')"; $order = '`glpi_changes`.`date_mod` DESC'; break; case 'Group': if ($tree) { - $restrict = ['glpi_changes_groups.groups_id' => $dbu->getSonsOf('glpi_groups', $item->getID())]; + $restrict = 'IN (' . implode(',', $dbu->getSonsOf('glpi_groups', $item->getID())) . ')'; } else { - $restrict = ['glpi_changes_groups.groups_id' => $item->getID()]; + $restrict = "='" . $item->getID() . "'"; } - $restrict['glpi_changes_groups.type'] = CommonITILActor::REQUESTER; + $restrict = "(`glpi_changes_groups`.`groups_id` $restrict + AND `glpi_changes_groups`.`type` = " . CommonITILActor::REQUESTER . ')'; $order = '`glpi_changes`.`date_mod` DESC'; break; default: - $restrict = [ - 'glpi_changes_items.items_id' => $item->getID(), - 'glpi_changes_items.itemtype' => $item->getType(), - ]; + $restrict = "(`items_id` = '" . $item->getID() . "' + AND `itemtype` = '" . $item->getType() . "')"; $order = '`glpi_changes`.`date_mod` DESC'; break; } @@ -226,7 +225,7 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tr 'DISTINCT' => true, 'FROM' => 'glpi_changes', 'LEFT JOIN' => $LEFT_JOIN, - 'WHERE' => $restrict + $dbu->getEntitiesRestrictCriteria('glpi_changes'), + 'WHERE' => [$restrict] + $dbu->getEntitiesRestrictCriteria('glpi_changes'), 'ORDER' => $order, 'LIMIT' => (int) $_SESSION['glpilist_limit'], ]; From 3f567014b18d8637995d31e1b5f69f60c839521d Mon Sep 17 00:00:00 2001 From: Julien Durand Date: Tue, 8 Sep 2026 14:32:39 +0200 Subject: [PATCH 06/10] fix: Change_Item where clause --- inc/change_item.class.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/inc/change_item.class.php b/inc/change_item.class.php index 36140f55..e6ed3c5c 100644 --- a/inc/change_item.class.php +++ b/inc/change_item.class.php @@ -161,34 +161,35 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tr $dbu = new DbUtils(); - $restrict = ''; + $restrict = []; $order = ''; switch ($item->getType()) { case 'User': - $restrict = "(`glpi_changes_users`.`users_id` = '" . $item->getID() . "')"; + $restrict = ['glpi_changes_users.users_id' => $item->getID()]; $order = '`glpi_changes`.`date_mod` DESC'; break; case 'Supplier': - $restrict = "(`glpi_changes_suppliers`.`suppliers_id` = '" . $item->getID() . "')"; + $restrict = ['glpi_changes_suppliers.suppliers_id' => $item->getID()]; $order = '`glpi_changes`.`date_mod` DESC'; break; case 'Group': if ($tree) { - $restrict = 'IN (' . implode(',', $dbu->getSonsOf('glpi_groups', $item->getID())) . ')'; + $restrict = ['glpi_changes_groups.groups_id' => $dbu->getSonsOf('glpi_groups', $item->getID())]; } else { - $restrict = "='" . $item->getID() . "'"; + $restrict = ['glpi_changes_groups.groups_id' => $item->getID()]; } - $restrict = "(`glpi_changes_groups`.`groups_id` $restrict - AND `glpi_changes_groups`.`type` = " . CommonITILActor::REQUESTER . ')'; + $restrict['glpi_changes_groups.type'] = CommonITILActor::REQUESTER; $order = '`glpi_changes`.`date_mod` DESC'; break; default: - $restrict = "(`items_id` = '" . $item->getID() . "' - AND `itemtype` = '" . $item->getType() . "')"; + $restrict = [ + 'glpi_changes_items.items_id' => $item->getID(), + 'glpi_changes_items.itemtype' => $item->getType(), + ]; $order = '`glpi_changes`.`date_mod` DESC'; break; } @@ -225,7 +226,7 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tr 'DISTINCT' => true, 'FROM' => 'glpi_changes', 'LEFT JOIN' => $LEFT_JOIN, - 'WHERE' => [$restrict] + $dbu->getEntitiesRestrictCriteria('glpi_changes'), + 'WHERE' => $restrict + $dbu->getEntitiesRestrictCriteria('glpi_changes'), 'ORDER' => $order, 'LIMIT' => (int) $_SESSION['glpilist_limit'], ]; From 0c3433229c0321fb5d200598a4b165d89e126c0b Mon Sep 17 00:00:00 2001 From: Julien Durand Date: Wed, 9 Sep 2026 08:50:42 +0200 Subject: [PATCH 07/10] fix: usage of deprecated methods triggering warnings --- inc/item_problem.class.php | 36 +++++++++---------------- inc/item_ticket.class.php | 55 +++++++++++++++++--------------------- 2 files changed, 37 insertions(+), 54 deletions(-) diff --git a/inc/item_problem.class.php b/inc/item_problem.class.php index 32a83683..dffb9b5a 100644 --- a/inc/item_problem.class.php +++ b/inc/item_problem.class.php @@ -155,8 +155,7 @@ public static function pdfForProblem(PluginPdfSimplePDF $pdf, Problem $problem) } // Ajout de la restriction d'entités - $entity_restrict = $dbu->getEntitiesRestrictRequest( - '', + $entity_restrict = $dbu->getEntitiesRestrictCriteria( $itemtable, '', '', @@ -212,32 +211,34 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tr $dbu = new DbUtils(); - $restrict = ''; + $restrict = []; $order = ''; switch ($item->getType()) { case 'User': - $restrict = "(`glpi_problems_users`.`users_id` = '" . $item->getID() . "')"; + $restrict = ["glpi_problems_users.users_id" => $item->getID()]; $order = '`glpi_problems`.`date_mod` DESC'; break; case 'Supplier': - $restrict = "(`glpi_problems_suppliers`.`suppliers_id` = '" . $item->getID() . "')"; + $restrict = ["glpi_problems_suppliers.suppliers_id" => $item->getID()]; $order = '`glpi_problems`.`date_mod` DESC'; break; case 'Group': if ($tree) { - $restrict = 'IN (' . implode(',', $dbu->getSonsOf('glpi_groups', $item->getID())) . ')'; + $restrict = ["glpi_groups_problems.groups_id" => $dbu->getSonsOf('glpi_groups', $item->getID())]; } else { - $restrict = "='" . $item->getID() . "'"; + $restrict = ["glpi_groups_problems.groups_id" => $item->getID()]; } - $restrict = "(`glpi_groups_problems`.`groups_id` $restrict)"; + //$restrict = "(`glpi_groups_problems`.`groups_id` $restrict)"; $order = '`glpi_problems`.`date_mod` DESC'; break; default: - $restrict = "(`items_id` = '" . $item->getID() . "' - AND `itemtype` = '" . $item->getType() . "')"; + $restrict = [ + 'glpi_items_problems.items_id' => $item->getID(), + 'glpi_items_problems.itemtype' => $item->getType(), + ]; $order = '`glpi_problems`.`date_mod` DESC'; break; } @@ -294,25 +295,12 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tr ]; } - $where_conditions = []; - - if (str_contains($restrict, 'IN (') || str_contains($restrict, 'AND') || str_contains($restrict, 'OR')) { - $where_conditions[] = new QueryExpression($restrict); - } else { - $where_conditions[] = new QueryExpression($restrict); - } - - $entity_restrict = $dbu->getEntitiesRestrictRequest('', 'glpi_problems'); - if (!empty($entity_restrict)) { - $where_conditions[] = new QueryExpression($entity_restrict); - } - $query_params = [ 'SELECT' => $select_fields, 'DISTINCT' => true, 'FROM' => 'glpi_problems', 'LEFT JOIN' => $left_joins, - 'WHERE' => $where_conditions, + 'WHERE' => $restrict + $dbu->getEntitiesRestrictCriteria('glpi_problems'), 'ORDER' => $order, 'LIMIT' => intval($_SESSION['glpilist_limit']), ]; diff --git a/inc/item_ticket.class.php b/inc/item_ticket.class.php index e42b7128..7ba809ea 100644 --- a/inc/item_ticket.class.php +++ b/inc/item_ticket.class.php @@ -230,46 +230,54 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tr return false; } - $restrict = ''; + $restrict = []; $order = ''; switch ($item->getType()) { case 'User': - $restrict = "(`glpi_tickets_users`.`users_id` = '" . $item->getID() . "' - AND `glpi_tickets_users`.`type` = " . CommonITILActor::REQUESTER . ')'; + $restrict = [ + 'glpi_tickets_users.users_id' => $item->getID(), + 'glpi_tickets_users.type' => CommonITILActor::REQUESTER, + ]; $order = '`glpi_tickets`.`time_to_resolve` DESC'; break; case 'SLA': - $restrict = "(`slas_id` = '" . $item->getID() . "')"; + $restrict = ['slas_id' => $item->getID()]; $order = '`glpi_tickets`.`time_to_resolve` DESC'; break; case 'Supplier': - $restrict = "(`glpi_suppliers_tickets`.`suppliers_id` = '" . $item->getID() . "' - AND `glpi_suppliers_tickets`.`type` = " . CommonITILActor::ASSIGN . ')'; + $restrict = [ + 'glpi_suppliers_tickets.suppliers_id' => $item->getID(), + 'glpi_suppliers_tickets.type' => CommonITILActor::ASSIGN, + ]; $order = '`glpi_tickets`.`date_mod` DESC'; break; case 'Group': if ($tree) { - $restrict = 'IN (' . implode(',', $dbu->getSonsOf('glpi_groups', $item->getID())) . ')'; + $restrict = ['glpi_groups_tickets.groups_id' => $dbu->getSonsOf('glpi_groups', $item->getID())]; } else { - $restrict = "='" . $item->getID() . "'"; + $restrict = ['glpi_groups_tickets.groups_id' => $item->getID()]; } - $restrict = "(`glpi_groups_tickets`.`groups_id` $restrict - AND `glpi_groups_tickets`.`type` = " . CommonITILActor::REQUESTER . ')'; + $restrict['glpi_groups_tickets.type'] = CommonITILActor::REQUESTER; $order = '`glpi_tickets`.`date_mod` DESC'; break; default: - $restrict = "(`glpi_items_tickets`.`items_id` = '" . $item->getID() . "' " . - " AND `glpi_items_tickets`.`itemtype` = '" . $item->getType() . "')"; + $restrict = [ + 'glpi_items_tickets.items_id' => $item->getID(), + 'glpi_items_tickets.itemtype' => $item->getType(), + ]; // you can only see your tickets if (!Session::haveRight('ticket', Ticket::READALL)) { - $restrict .= " AND (`glpi_tickets`.`users_id_recipient` = '" . Session::getLoginUserID() . "' - OR (`glpi_tickets_users`.`tickets_id` = '" . $item->getID() . "' - AND `glpi_tickets_users`.`users_id` - = '" . Session::getLoginUserID() . "'))"; + $restrict['OR'] = [ + 'glpi_tickets.users_id_recipient' => Session::getLoginUserID(), + [ + 'glpi_tickets_users.tickets_id' => $item->getID(), + 'glpi_tickets_users.users_id' => Session::getLoginUserID(), + ], + ]; } $order = '`glpi_tickets`.`date_mod` DESC'; } @@ -332,25 +340,12 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tr ]; } - $where_conditions = []; - - if (str_contains($restrict, 'OR') || str_contains($restrict, 'AND')) { - $where_conditions[] = new QueryExpression($restrict); - } else { - $where_conditions[] = $restrict; - } - - $entity_restrict = $dbu->getEntitiesRestrictRequest('', 'glpi_tickets'); - if (!empty($entity_restrict)) { - $where_conditions[] = new QueryExpression($entity_restrict); - } - $query_params = [ 'SELECT' => $select_fields, 'DISTINCT' => true, 'FROM' => 'glpi_tickets', 'LEFT JOIN' => $left_joins, - 'WHERE' => $where_conditions, + 'WHERE' => $restrict + $dbu->getEntitiesRestrictCriteria('glpi_tickets'), 'ORDER' => $order, 'LIMIT' => intval($_SESSION['glpilist_limit']), ]; From b9c92a5a0d110fe8e00c664f8c3a26beda1979ec Mon Sep 17 00:00:00 2001 From: Julien Durand Date: Fri, 11 Sep 2026 15:47:29 +0200 Subject: [PATCH 08/10] fix: set default language to avoid 500 error if user has no defined language --- inc/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/user.class.php b/inc/user.class.php index 61e05357..6935208d 100644 --- a/inc/user.class.php +++ b/inc/user.class.php @@ -153,7 +153,7 @@ public static function pdfMain(PluginPdfSimplePDF $pdf, User $item) '' . sprintf( __s('%1$s: %2$s'), __s('Language') . '', - Dropdown::getLanguageName($item->fields['language']), + Dropdown::getLanguageName($item->fields['language'] ?? "en_GB"), ), ); From b1b8540a91607c7ff2602aa3e2a4208f75aa3f1b Mon Sep 17 00:00:00 2001 From: Julien Durand Date: Fri, 11 Sep 2026 15:48:20 +0200 Subject: [PATCH 09/10] fix: several pdf generation errors --- inc/item_problem.class.php | 2 +- inc/knowbaseitem.class.php | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/inc/item_problem.class.php b/inc/item_problem.class.php index dffb9b5a..e9676fe8 100644 --- a/inc/item_problem.class.php +++ b/inc/item_problem.class.php @@ -163,7 +163,7 @@ public static function pdfForProblem(PluginPdfSimplePDF $pdf, Problem $problem) ); if (!empty($entity_restrict)) { - $query_params['WHERE'][] = new QueryExpression($entity_restrict); + $query_params['WHERE'] += $entity_restrict; } $result_linked = $DB->request($query_params); diff --git a/inc/knowbaseitem.class.php b/inc/knowbaseitem.class.php index 677065bc..daf68484 100644 --- a/inc/knowbaseitem.class.php +++ b/inc/knowbaseitem.class.php @@ -30,6 +30,8 @@ * -------------------------------------------------------------------------- */ +use Glpi\Form\ServiceCatalog\ServiceCatalog; + class PluginPdfKnowbaseItem extends PluginPdfCommon { public static string $rightname = 'plugin_pdf'; @@ -47,6 +49,11 @@ public function defineAllTabsPDF($options = []) unset($onglets['KnowbaseItemTranslation$1']); unset($onglets['KnowbaseItem_Revision$1']); + $this->obj->addStandardTab(Document_Item::class, $onglets, $options); + $this->obj->addStandardTab(ServiceCatalog::class, $onglets, $options); + $this->obj->addStandardTab(Log::class, $onglets, $options); + $this->obj->addStandardTab(KnowbaseItem_Comment::class, $onglets, $options); + return $onglets; } @@ -63,11 +70,11 @@ public static function pdfMain(PluginPdfSimplePDF $pdf, KnowbaseItem $item) return false; } - $knowbaseitemcategories_id = $item->getField('knowbaseitemcategories_id'); + $forms_categories_id = $item->getField('forms_categories_id'); $fullcategoryname = Toolbox::stripTags($dbu->getTreeValueCompleteName( - 'glpi_knowbaseitemcategories', - $knowbaseitemcategories_id, + 'glpi_forms_categories', + (int) $forms_categories_id, )); $question From 59dae8cab9721566369beecb7336e635598d9069 Mon Sep 17 00:00:00 2001 From: Julien Durand Date: Mon, 14 Sep 2026 09:28:12 +0200 Subject: [PATCH 10/10] chore: rector --- inc/item_problem.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/item_problem.class.php b/inc/item_problem.class.php index e9676fe8..f086fa57 100644 --- a/inc/item_problem.class.php +++ b/inc/item_problem.class.php @@ -30,7 +30,7 @@ * -------------------------------------------------------------------------- */ -use Glpi\DBAL\QueryExpression; + /** * ------------------------------------------------------------------------- @@ -162,7 +162,7 @@ public static function pdfForProblem(PluginPdfSimplePDF $pdf, Problem $problem) $item->maybeRecursive(), ); - if (!empty($entity_restrict)) { + if ($entity_restrict !== []) { $query_params['WHERE'] += $entity_restrict; }