diff --git a/app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php b/app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php index 9fea0b23cd10..b9aea8184d42 100644 --- a/app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php +++ b/app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php @@ -28,6 +28,8 @@ trait DesignHelpers public function setup(): self { + $this->syncPdfVariables(); + if (isset($this->context['client'])) { $this->client = $this->context['client']; } @@ -54,6 +56,20 @@ trait DesignHelpers return $this; } + protected function syncPdfVariables(): void + { + $default = (array) \App\DataMapper\CompanySettings::getEntityVariableDefaults(); + $variables = $this->context['pdf_variables']; + + foreach ($default as $property => $value) { + if (array_key_exists($property, $variables)) { + continue; + } + + $variables[$property] = $value; + } + } + /** * Initialize local dom document instance. Used for getting raw HTML out of template. *