diff --git a/app/Services/PdfMaker/Design.php b/app/Services/PdfMaker/Design.php index 9e6c64518e61..eeafbbd2d981 100644 --- a/app/Services/PdfMaker/Design.php +++ b/app/Services/PdfMaker/Design.php @@ -348,6 +348,8 @@ class Design extends BaseDesign $items = $this->transformLineItems($this->entity->line_items, $type); + $this->processNewLines($items); + if (count($items) == 0) { return []; } diff --git a/app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php b/app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php index 1869849f29f7..d43465d0ed60 100644 --- a/app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php +++ b/app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php @@ -331,7 +331,7 @@ document.addEventListener('DOMContentLoaded', function() { return $converter->convertToHtml($markdown); } - public function processMarkdownOnLineItems(array &$items) + public function processMarkdownOnLineItems(array &$items): void { foreach ($items as $key => $item) { foreach ($item as $variable => $value) { @@ -341,4 +341,15 @@ document.addEventListener('DOMContentLoaded', function() { $items[$key] = $item; } } + + public function processNewLines(array &$items): void + { + foreach ($items as $key => $item) { + foreach ($item as $variable => $value) { + $item[$variable] = nl2br($value); + } + + $items[$key] = $item; + } + } } diff --git a/app/Services/PdfMaker/PdfMakerUtilities.php b/app/Services/PdfMaker/PdfMakerUtilities.php index 7d3ddb3dae05..c90005e43b28 100644 --- a/app/Services/PdfMaker/PdfMakerUtilities.php +++ b/app/Services/PdfMaker/PdfMakerUtilities.php @@ -94,8 +94,6 @@ trait PdfMakerUtilities if ($child['element'] !== 'script') { if (array_key_exists('process_markdown', $this->data) && $this->data['process_markdown']) { $child['content'] = $this->commonmark->convertToHtml($child['content'] ?? ''); - } else { - $child['content'] = array_key_exists('content', $child) ? nl2br($child['content']) : ''; } }