diff --git a/CHANGELOG.md b/CHANGELOG.md index 813e79f..e5c01d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fixed table formatting and border in PDF - Fixed table cell size in PDF generation +- Fixed approval comments rendering as raw HTML in PDF +- Fixed PDF crash when exporting Problems with linked items lacking serial/inventory fields +- Fixed PHP warnings flood when exporting Changes with linked items lacking serial/inventory fields +- Fixed Change and Problem description exported as a single unstructured text block +- Fixed Change analysis and plan fields rendering as raw HTML in PDF ## [4.0.2] - 2025-09-30 diff --git a/inc/change.class.php b/inc/change.class.php index 2d6a8a3..0b01239 100644 --- a/inc/change.class.php +++ b/inc/change.class.php @@ -299,7 +299,7 @@ public static function pdfMain(PluginPdfSimplePDF $pdf, Change $job) $pdf->displayText( '' . sprintf(__('%1$s: %2$s') . '', __('Description'), ''), - Toolbox::stripTags($job->fields['content']), + $job->fields['content'], 1, ); @@ -311,19 +311,15 @@ public static function pdfAnalysis(PluginPdfSimplePDF $pdf, Change $job) $pdf->setColumnsSize(100); $pdf->displayTitle('' . __('Analysis') . ''); - $pdf->setColumnsSize(10, 90); - - $pdf->displayText(sprintf( - __('%1$s: %2$s'), + $pdf->displayText( '' . __('Impacts') . '', $job->fields['impactcontent'], - )); + ); - $pdf->displayText(sprintf( - __('%1$s: %2$s'), + $pdf->displayText( '' . __('Control list') . '', $job->fields['controlistcontent'], - )); + ); } public static function pdfPlan(PluginPdfSimplePDF $pdf, Change $job) @@ -331,25 +327,20 @@ public static function pdfPlan(PluginPdfSimplePDF $pdf, Change $job) $pdf->setColumnsSize(100); $pdf->displayTitle('' . __('Plans') . ''); - $pdf->setColumnsSize(10, 90); - - $pdf->displayText(sprintf( - __('%1$s: %2$s'), + $pdf->displayText( '' . __('Deployment plan') . '', $job->fields['rolloutplancontent'], - )); + ); - $pdf->displayText(sprintf( - __('%1$s: %2$s'), + $pdf->displayText( '' . __('Backup plan') . '', $job->fields['backoutplancontent'], - )); + ); - $pdf->displayText(sprintf( - __('%1$s: %2$s'), + $pdf->displayText( '' . __('Checklist') . '', $job->fields['checklistcontent'], - )); + ); } public static function pdfStat(PluginPdfSimplePDF $pdf, Change $job) diff --git a/inc/change_item.class.php b/inc/change_item.class.php index daebdde..9f5da00 100644 --- a/inc/change_item.class.php +++ b/inc/change_item.class.php @@ -130,8 +130,8 @@ public static function pdfForChange(PluginPdfSimplePDF $pdf, Change $change) Toolbox::stripTags(sprintf(__('%1$s: %2$s'), $typename, $nb)), Toolbox::stripTags($name), Dropdown::getDropdownName('glpi_entities', $data['entity']), - Toolbox::stripTags((string) $data["serial"]), - Toolbox::stripTags((string) $data["otherserial"]), + Toolbox::stripTags($data['serial'] ?? ''), + Toolbox::stripTags($data['otherserial'] ?? ''), $nb, ); } else { @@ -139,8 +139,8 @@ public static function pdfForChange(PluginPdfSimplePDF $pdf, Change $change) '', Toolbox::stripTags($name), Dropdown::getDropdownName('glpi_entities', $data['entity']), - Toolbox::stripTags((string) $data["serial"]), - Toolbox::stripTags((string) $data["otherserial"]), + Toolbox::stripTags($data['serial'] ?? ''), + Toolbox::stripTags($data['otherserial'] ?? ''), $nb, ); } diff --git a/inc/item_problem.class.php b/inc/item_problem.class.php index 9cae4e1..d111d8a 100644 --- a/inc/item_problem.class.php +++ b/inc/item_problem.class.php @@ -132,8 +132,8 @@ public static function pdfForProblem(PluginPdfSimplePDF $pdf, Problem $problem) Toolbox::stripTags(sprintf(__('%1$s: %2$s'), $typename, $nb)), Toolbox::stripTags($name), Dropdown::getDropdownName('glpi_entities', $data['entity']), - Toolbox::stripTags($data['serial']), - Toolbox::stripTags($data['otherserial']), + Toolbox::stripTags($data['serial'] ?? ''), + Toolbox::stripTags($data['otherserial'] ?? ''), $nb, ); } else { @@ -141,8 +141,8 @@ public static function pdfForProblem(PluginPdfSimplePDF $pdf, Problem $problem) '', Toolbox::stripTags($name), Dropdown::getDropdownName('glpi_entities', $data['entity']), - Toolbox::stripTags($data['serial']), - Toolbox::stripTags($data['otherserial']), + Toolbox::stripTags($data['serial'] ?? ''), + Toolbox::stripTags($data['otherserial'] ?? ''), $nb, ); } diff --git a/inc/problem.class.php b/inc/problem.class.php index f2bf915..ec4de9e 100644 --- a/inc/problem.class.php +++ b/inc/problem.class.php @@ -299,7 +299,7 @@ public static function pdfMain(PluginPdfSimplePDF $pdf, Problem $job) $pdf->displayText( '' . sprintf(__('%1$s: %2$s'), __('Description') . '', ''), - Toolbox::stripTags($job->fields['content']), + $job->fields['content'], 1, ); diff --git a/inc/ticketvalidation.class.php b/inc/ticketvalidation.class.php index bf1d617..00fc061 100644 --- a/inc/ticketvalidation.class.php +++ b/inc/ticketvalidation.class.php @@ -81,7 +81,7 @@ public static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $ticket) Html::convDateTime($row['validation_date']), $dbu->getUserName($row['users_id_validate']), ); - $tmp = trim($row['comment_submission']); + $tmp = trim(html_entity_decode($row['comment_submission'] ?? '', ENT_QUOTES, 'UTF-8')); $pdf->displayText('' . sprintf( __('%1$s: %2$s'), __('Request comments') . '', @@ -89,7 +89,7 @@ public static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $ticket) ), (empty($tmp) ? __('None') : $tmp), 1); if ($row['validation_date']) { - $tmp = trim($row['comment_validation']); + $tmp = trim(html_entity_decode($row['comment_validation'] ?? '', ENT_QUOTES, 'UTF-8')); $pdf->displayText( '' . sprintf( __('%1$s: %2$s'), diff --git a/tools/move_to_po.php b/tools/move_to_po.php index 2c28b44..5d0d268 100755 --- a/tools/move_to_po.php +++ b/tools/move_to_po.php @@ -37,6 +37,7 @@ chdir(dirname($_SERVER['SCRIPT_FILENAME'])); +$argv = $argv ?? []; for ($i = 1 ; $i < count($argv) ; $i++) { //To be able to use = in search filters, enter \= instead in command line //Replace the \= by ° not to match the split function