Rename all_page_* to all_pages_* for dynamic header/footer

This commit is contained in:
Benjamin Beganović 2020-08-27 08:47:51 +02:00
parent c893a547ef
commit af7995815c
4 changed files with 16 additions and 6 deletions

View File

@ -99,6 +99,10 @@ class CreateInvoicePdf implements ShouldQueue
'product-table-columns' => $pdf_variables['product_columns'], 'product-table-columns' => $pdf_variables['product_columns'],
]), ]),
'variables' => $html->generateLabelsAndValues(), 'variables' => $html->generateLabelsAndValues(),
'options' => [
'all_pages_header' => $this->invoice->client->getSetting('all_pages_header'),
'all_pages_footer' => $this->invoice->client->getSetting('all_pages_footer'),
],
]; ];
$maker = new PdfMakerService($state); $maker = new PdfMakerService($state);
@ -110,6 +114,8 @@ class CreateInvoicePdf implements ShouldQueue
//todo - move this to the client creation stage so we don't keep hitting this unnecessarily //todo - move this to the client creation stage so we don't keep hitting this unnecessarily
Storage::makeDirectory($path, 0775); Storage::makeDirectory($path, 0775);
info($maker->getCompiledHTML());
$pdf = $this->makePdf(null, null, $maker->getCompiledHTML()); $pdf = $this->makePdf(null, null, $maker->getCompiledHTML());
$instance = Storage::disk($this->disk)->put($file_path, $pdf); $instance = Storage::disk($this->disk)->put($file_path, $pdf);

View File

@ -97,6 +97,10 @@ class CreateQuotePdf implements ShouldQueue
'product-table-columns' => $pdf_variables['product_columns'], 'product-table-columns' => $pdf_variables['product_columns'],
]), ]),
'variables' => $html->generateLabelsAndValues(), 'variables' => $html->generateLabelsAndValues(),
'options' => [
'all_pages_header' => $this->invoice->client->getSetting('all_pages_header'),
'all_pages_footer' => $this->invoice->client->getSetting('all_pages_footer'),
],
]; ];
$maker = new PdfMakerService($state); $maker = new PdfMakerService($state);

View File

@ -156,7 +156,7 @@ trait PdfMakerUtilities
public function processOptions() public function processOptions()
{ {
if (!isset($this->options['all_page_header']) && !isset($this->options['all_page_footer'])) { if (!isset($this->options['all_pages_header']) && !isset($this->options['all_pages_footer'])) {
return; return;
} }
@ -260,8 +260,8 @@ trait PdfMakerUtilities
if ( if (
$header = $this->document->getElementById('header') && $header = $this->document->getElementById('header') &&
isset($this->data['options']['all_page_header']) && isset($this->data['options']['all_pages_header']) &&
$this->data['options']['all_page_header'] $this->data['options']['all_pages_header']
) { ) {
$header = $this->document->getElementById('header'); $header = $this->document->getElementById('header');
@ -273,8 +273,8 @@ trait PdfMakerUtilities
if ( if (
$footer = $this->document->getElementById('footer') && $footer = $this->document->getElementById('footer') &&
isset($this->data['options']['all_page_footer']) && isset($this->data['options']['all_pages_footer']) &&
$this->data['options']['all_page_footer'] $this->data['options']['all_pages_footer']
) { ) {
$footer = $this->document->getElementById('footer'); $footer = $this->document->getElementById('footer');
$clone = $footer->cloneNode(true); $clone = $footer->cloneNode(true);

View File

@ -357,7 +357,7 @@ class PdfMakerTest extends TestCase
'values' => [], 'values' => [],
], ],
'options' => [ 'options' => [
'all_page_footer' => true, 'all_pages_footer' => true,
], ],
]; ];