mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 10:17:30 -04:00
Functionality to inject the setting if it doesn't exists
This commit is contained in:
parent
7639746178
commit
00dbec0ce1
@ -28,6 +28,8 @@ trait DesignHelpers
|
|||||||
|
|
||||||
public function setup(): self
|
public function setup(): self
|
||||||
{
|
{
|
||||||
|
$this->syncPdfVariables();
|
||||||
|
|
||||||
if (isset($this->context['client'])) {
|
if (isset($this->context['client'])) {
|
||||||
$this->client = $this->context['client'];
|
$this->client = $this->context['client'];
|
||||||
}
|
}
|
||||||
@ -54,6 +56,20 @@ trait DesignHelpers
|
|||||||
return $this;
|
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.
|
* Initialize local dom document instance. Used for getting raw HTML out of template.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user