From 202d0d2c61f16997f443bd2b02387c7595d29e3e Mon Sep 17 00:00:00 2001 From: tremo Date: Tue, 18 Aug 2026 13:48:41 +0200 Subject: [PATCH 1/3] GLPI 12 compatibility --- inc/entity.class.php | 2 +- inc/entityconfig.class.php | 2 +- inc/ticket.class.php | 2 +- inc/ticketconfig.class.php | 8 ++++++-- inc/type.class.php | 4 ++-- plugin.xml | 5 +++++ setup.php | 6 +++--- templates/creditentity.hmtl.twig | 1 - templates/creditentity_config.hmtl.twig | 1 - templates/tickets/config.html.twig | 1 - templates/tickets/form.html.twig | 1 - 11 files changed, 19 insertions(+), 14 deletions(-) diff --git a/inc/entity.class.php b/inc/entity.class.php index d760dbb5..152bc10c 100644 --- a/inc/entity.class.php +++ b/inc/entity.class.php @@ -36,7 +36,7 @@ class PluginCreditEntity extends CommonDBTM { - public static $rightname = 'entity'; + public static string $rightname = 'entity'; public static function getTypeName($nb = 0) { diff --git a/inc/entityconfig.class.php b/inc/entityconfig.class.php index 6146c832..5df50213 100644 --- a/inc/entityconfig.class.php +++ b/inc/entityconfig.class.php @@ -65,7 +65,7 @@ class PluginCreditEntityConfig extends CommonDBTM { - public static $rightname = 'entity'; + public static string $rightname = 'entity'; public static function getTypeName($nb = 0) { diff --git a/inc/ticket.class.php b/inc/ticket.class.php index 76370b78..e3684406 100644 --- a/inc/ticket.class.php +++ b/inc/ticket.class.php @@ -63,7 +63,7 @@ class PluginCreditTicket extends CommonDBTM { - public static $rightname = 'ticket'; + public static string $rightname = 'ticket'; public static function getTypeName($nb = 0) { diff --git a/inc/ticketconfig.class.php b/inc/ticketconfig.class.php index 5662bca9..30b5ad6c 100644 --- a/inc/ticketconfig.class.php +++ b/inc/ticketconfig.class.php @@ -30,10 +30,11 @@ */ use Glpi\Application\View\TemplateRenderer; +use Glpi\Config\ConfigContainer; class PluginCreditTicketConfig extends CommonDBTM { - public static $rightname = 'plugin_credit_ticketconfig'; + public static string $rightname = 'plugin_credit_ticketconfig'; public const TICKET_TAB = 1024; public const TICKET_FORM = 2048; @@ -111,7 +112,10 @@ public static function showForTicket(Ticket $ticket, bool $embed_in_ticket_form } if ($embed_in_ticket_form) { - $uncollapsed = (importArrayFromDB(Config::getSafeConfig()['itil_layout'])['items']['plugin-credit-ticket-config'] ?? 'true') == 'true'; + /** @var ConfigContainer $CFG_GLPI */ + global $CFG_GLPI; + + $uncollapsed = (importArrayFromDB($CFG_GLPI->getSafeConfig()['itil_layout'])['items']['plugin-credit-ticket-config'] ?? 'true') == 'true'; } else { $form_url = self::getFormUrl(); } diff --git a/inc/type.class.php b/inc/type.class.php index 0c7c7ff9..765e81c6 100644 --- a/inc/type.class.php +++ b/inc/type.class.php @@ -32,8 +32,8 @@ class PluginCreditType extends CommonTreeDropdown { // From CommonDBTM - public $dohistory = true; - public $can_be_translated = true; + public bool $dohistory = true; + public bool $can_be_translated = true; public static function getTypeName($nb = 0) { diff --git a/plugin.xml b/plugin.xml index c1df0a4f..6ef31779 100644 --- a/plugin.xml +++ b/plugin.xml @@ -24,6 +24,11 @@ TECLIB' + + 1.16.0 + ~12.0.0 + https://github.com/pluginsGLPI/credit/releases/download/1.16.0/glpi-credit-1.16.0.tar.bz2 + 1.15.6 ~11.0.0 diff --git a/setup.php b/setup.php index ff1dd541..fcd0759c 100644 --- a/setup.php +++ b/setup.php @@ -31,12 +31,12 @@ use function Safe\define; -define('PLUGIN_CREDIT_VERSION', '1.15.6'); +define('PLUGIN_CREDIT_VERSION', '1.16.0'); // Minimal GLPI version, inclusive -define("PLUGIN_CREDIT_MIN_GLPI", "11.0.0"); +define("PLUGIN_CREDIT_MIN_GLPI", "12.0.0"); // Maximum GLPI version, exclusive -define("PLUGIN_CREDIT_MAX_GLPI", "11.0.99"); +define("PLUGIN_CREDIT_MAX_GLPI", "12.0.99"); /** * Init hooks of the plugin. diff --git a/templates/creditentity.hmtl.twig b/templates/creditentity.hmtl.twig index efc143f0..1e97baa4 100644 --- a/templates/creditentity.hmtl.twig +++ b/templates/creditentity.hmtl.twig @@ -33,7 +33,6 @@ {% if canedit %}
-
diff --git a/templates/creditentity_config.hmtl.twig b/templates/creditentity_config.hmtl.twig index f99b0bb8..a1289969 100644 --- a/templates/creditentity_config.hmtl.twig +++ b/templates/creditentity_config.hmtl.twig @@ -144,7 +144,6 @@
-
{% if is_new_item %} diff --git a/templates/tickets/config.html.twig b/templates/tickets/config.html.twig index 144cce1b..0ad0a132 100644 --- a/templates/tickets/config.html.twig +++ b/templates/tickets/config.html.twig @@ -112,7 +112,6 @@ }) ) }}
-