1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-12 22:22:32 +01:00

Merge pull request #6435 from beganovich/v5-620

(v5) Control markdown processing using setting
This commit is contained in:
Benjamin Beganović 2021-08-09 16:38:59 +02:00 committed by GitHub
commit 49bb80b328
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 5 deletions

View File

@ -136,6 +136,7 @@ class PreviewController extends BaseController
'products' => request()->design['design']['product'],
]),
'variables' => $html->generateLabelsAndValues(),
'process_markdown' => $entity_obj->client->company->markdown_enabled,
];
$design = new Design(request()->design['name']);
@ -251,6 +252,7 @@ class PreviewController extends BaseController
'all_pages_header' => $entity_obj->client->getSetting('all_pages_header'),
'all_pages_footer' => $entity_obj->client->getSetting('all_pages_footer'),
],
'process_markdown' => $entity_obj->client->company->markdown_enabled,
];
@ -362,6 +364,7 @@ class PreviewController extends BaseController
'products' => request()->design['design']['product'],
]),
'variables' => $html->generateLabelsAndValues(),
'process_markdown' => $invoice->client->company->markdown_enabled,
];
$maker = new PdfMaker($state);

View File

@ -166,6 +166,7 @@ class CreateEntityPdf implements ShouldQueue
'all_pages_header' => $this->entity->client->getSetting('all_pages_header'),
'all_pages_footer' => $this->entity->client->getSetting('all_pages_footer'),
],
'process_markdown' => $this->entity->client->company->markdown_enabled,
];
$maker = new PdfMakerService($state);

View File

@ -153,6 +153,7 @@ class ActivityRepository extends BaseRepository
'all_pages_header' => $entity->client->getSetting('all_pages_header'),
'all_pages_footer' => $entity->client->getSetting('all_pages_footer'),
],
'process_markdown' => $entity->client->company->markdown_enabled,
];
$maker = new PdfMakerService($state);

View File

@ -85,6 +85,7 @@ class GenerateDeliveryNote
'contact' => $this->contact,
], 'delivery_note'),
'variables' => $html->generateLabelsAndValues(),
'process_markdown' => $this->invoice->client->company->markdown_enabled,
];
$maker = new PdfMakerService($state);

View File

@ -348,8 +348,6 @@ class Design extends BaseDesign
$items = $this->transformLineItems($this->entity->line_items, $type);
$this->processMarkdownOnLineItems($items);
if (count($items) == 0) {
return [];
}

View File

@ -92,11 +92,13 @@ trait PdfMakerUtilities
$contains_html = false;
if ($child['element'] !== 'script') {
$child['content'] = $this->commonmark->convertToHtml($child['content'] ?? '');
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']) : '';
}
}
// $child['content'] = array_key_exists('content', $child) ? nl2br($child['content']) : '';
if (isset($child['content'])) {
if (isset($child['is_empty']) && $child['is_empty'] === true) {
continue;

View File

@ -193,6 +193,7 @@ class Phantom
'all_pages_header' => $entity_obj->client->getSetting('all_pages_header'),
'all_pages_footer' => $entity_obj->client->getSetting('all_pages_footer'),
],
'process_markdown' => $entity_obj->client->company->markdown_enabled,
];
$maker = new PdfMakerService($state);