Updates for populating options

This commit is contained in:
David Bomba 2023-10-26 17:13:06 +11:00
parent 0d285b606d
commit c66fecb39c
5 changed files with 26 additions and 4 deletions

View File

@ -128,6 +128,9 @@ class PreviewController extends BaseController
'options' => [
'all_pages_header' => $client->getSetting('all_pages_header'),
'all_pages_footer' => $client->getSetting('all_pages_footer'),
'client' => $entity_obj->client ?? [],
'vendor' => $entity_obj->vendor ?? [],
$request->input('entity')."s" => [$entity_obj],
],
'process_markdown' => $client->company->markdown_enabled,
];
@ -271,7 +274,8 @@ class PreviewController extends BaseController
'variables' => $html->generateLabelsAndValues(),
'process_markdown' => $entity_obj->client->company->markdown_enabled,
'options' => [
'client' => $entity_obj->client,
'client' => $entity_obj->client ?? [],
'vendor' => $entity_obj->vendor ?? [],
request()->input('entity_type', 'invoice')."s" => [$entity_obj],
]
];

View File

@ -122,6 +122,10 @@ class PreviewPurchaseOrderController extends BaseController
]),
'variables' => $html->generateLabelsAndValues(),
'process_markdown' => $entity_obj->company->markdown_enabled,
'options' => [
'vendor' => $entity_obj->vendor ?? [],
request()->input('entity')."s" => [$entity_obj],
]
];
$design = new Design(request()->design['name']);
@ -235,7 +239,7 @@ class PreviewPurchaseOrderController extends BaseController
'options' => [
'client' => null,
'vendor' => $entity_obj->vendor,
'entity' => $entity_obj,
'purchase_orders' => [$entity_obj],
'variables' => $html->generateLabelsAndValues(),
],
'process_markdown' => $entity_obj->company->markdown_enabled,
@ -330,6 +334,10 @@ class PreviewPurchaseOrderController extends BaseController
]),
'variables' => $html->generateLabelsAndValues(),
'process_markdown' => $invitation->company->markdown_enabled,
'options' => [
'vendor' => $invitation->purchase_order->vendor,
'purchase_orders' => $invitation->purchase_order,
],
];
@ -435,6 +443,10 @@ class PreviewPurchaseOrderController extends BaseController
]),
'variables' => $html->generateLabelsAndValues(),
'process_markdown' => $purchase_order->company->markdown_enabled,
'options' => [
'vendor' => $invitation->purchase_order->vendor,
'purchase_orders' => $invitation->purchase_order,
],
];
$maker = new PdfMaker($state);

View File

@ -83,7 +83,8 @@ class CreateRawPdf
{
/** Testing this override to improve PDF generation performance */
$ps = new PdfService($this->invitation, 'product', [
'client' => $this->entity->client,
'client' => $this->entity->client ?? false,
'vendor' => $this->entity->vendor ?? false,
"{$this->entity_string}s" => [$this->entity],
]);

View File

@ -49,6 +49,10 @@ class ExampleIntegrationTest extends TestCase
'pdf_variables' => (array) $invoice->company->settings->pdf_variables,
]),
'variables' => $engine->generateLabelsAndValues(),
'options' => [
'client' => $invoice->client,
'invoices' => [$invoice]
],
];
$maker = new PdfMaker($state);

View File

@ -684,7 +684,8 @@ class TemplateTest extends TestCase
'all_pages_header' => $entity_obj->client->getSetting('all_pages_header'),
'all_pages_footer' => $entity_obj->client->getSetting('all_pages_footer'),
'client' => $entity_obj->client,
'entity' => $entity_obj,
'entity' => [$entity_obj],
'invoices' => [$entity_obj],
'variables' => $variables,
],
'process_markdown' => $entity_obj->client->company->markdown_enabled,