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/inc/info.class.php b/inc/info.class.php index 69d4bfbd..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 { @@ -281,8 +256,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..50ff3c63 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 }} + {% if rendered_infos|length > 0 %} +
+ + + {% for rendered_info in rendered_infos %} + + {{ rendered_info|raw }} + + {% endfor %} + +
- {% endfor %} + {% endif %} {% endif %} \ No newline at end of file