From addcaae976c612a5a2a3d5a544919ebba88d3a68 Mon Sep 17 00:00:00 2001 From: MyuTsu Date: Thu, 5 Feb 2026 14:59:31 +0100 Subject: [PATCH 1/3] fix(model): prevent error when displaying additional info form --- inc/info.class.php | 11 +++++++++++ templates/infoadditionnalinfo.html.twig | 18 +++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/inc/info.class.php b/inc/info.class.php index 69d4bfbd..af54c504 100644 --- a/inc/info.class.php +++ b/inc/info.class.php @@ -281,8 +281,19 @@ public static function showAdditionalInformationsForm(PluginDatainjectionModel $ $modeltype = PluginDatainjectionModel::getInstance($model->getField('filetype')); $modeltype->getFromDBByModelID($model->getField('id')); + $rendered_infos = []; + foreach ($infos as $info_data) { + $info = new self(); + $info->fields = $info_data; + + ob_start(); + self::displayAdditionalInformation($info, $_SESSION['datainjection']['infos'] ?? []); + $rendered_infos[] = ob_get_clean(); + } + $data = [ 'infos' => $infos, + 'rendered_infos' => $rendered_infos, 'model' => $model, 'modeltype' => $modeltype, 'has_sample' => $modeltype->haveSample(), diff --git a/templates/infoadditionnalinfo.html.twig b/templates/infoadditionnalinfo.html.twig index 71c63ebf..c898cae4 100644 --- a/templates/infoadditionnalinfo.html.twig +++ b/templates/infoadditionnalinfo.html.twig @@ -47,9 +47,17 @@ {% endif %} - {% for info in infos %} -
- {{ self.displayAdditionalInformation(info, session_infos)|raw }} -
- {% endfor %} + {% if rendered_infos|length > 0 %} +
+ + + {% for rendered_info in rendered_infos %} + + {{ rendered_info|raw }} + + {% endfor %} + +
+
+ {% endif %} {% endif %} \ No newline at end of file From 5322ea3fc0f6599a3716790952566fba1c1032ce Mon Sep 17 00:00:00 2001 From: MyuTsu Date: Thu, 5 Feb 2026 15:08:30 +0100 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 1 + templates/infoadditionnalinfo.html.twig | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95c806d4..d2172086 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Rename visibility field label to "Is Private" - Restored group selection in mappings - Fix special caracters malformed in translations +- Fix error when displaying the additional information form ## [2.15.3] - 2025-12-22 diff --git a/templates/infoadditionnalinfo.html.twig b/templates/infoadditionnalinfo.html.twig index c898cae4..50ff3c63 100644 --- a/templates/infoadditionnalinfo.html.twig +++ b/templates/infoadditionnalinfo.html.twig @@ -48,16 +48,16 @@ {% endif %} {% if rendered_infos|length > 0 %} -
- - - {% for rendered_info in rendered_infos %} - - {{ rendered_info|raw }} - - {% endfor %} - -
-
+
+ + + {% for rendered_info in rendered_infos %} + + {{ rendered_info|raw }} + + {% endfor %} + +
+
{% endif %} {% endif %} \ No newline at end of file From fff906b908d05ac81640f6630fbd3649b317c24e Mon Sep 17 00:00:00 2001 From: MyuTsu Date: Thu, 5 Feb 2026 15:15:57 +0100 Subject: [PATCH 3/3] fix lint --- inc/info.class.php | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/inc/info.class.php b/inc/info.class.php index af54c504..2eaff495 100644 --- a/inc/info.class.php +++ b/inc/info.class.php @@ -30,33 +30,8 @@ use Glpi\Application\View\TemplateRenderer; -/** - * ------------------------------------------------------------------------- - * DataInjection plugin for GLPI - * ------------------------------------------------------------------------- - * - * LICENSE - * - * This file is part of DataInjection. - * - * DataInjection is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * DataInjection is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with DataInjection. If not, see . - * ------------------------------------------------------------------------- - * @copyright Copyright (C) 2007-2023 by DataInjection plugin team. - * @license GPLv2 https://www.gnu.org/licenses/gpl-2.0.html - * @link https://github.com/pluginsGLPI/datainjection - * ------------------------------------------------------------------------- - */ +use function Safe\ob_start; +use function Safe\ob_get_clean; class PluginDatainjectionInfo extends CommonDBTM {