mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Resolve design template
This commit is contained in:
parent
5cf629d5de
commit
d9c84b275b
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace App\Services\Pdf;
|
namespace App\Services\Pdf;
|
||||||
|
|
||||||
|
use App\DataMapper\CompanySettings;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Credit;
|
use App\Models\Credit;
|
||||||
use App\Models\CreditInvitation;
|
use App\Models\CreditInvitation;
|
||||||
@ -47,6 +48,8 @@ class PdfConfiguration
|
|||||||
|
|
||||||
public $service;
|
public $service;
|
||||||
|
|
||||||
|
public array $pdf_variables;
|
||||||
|
|
||||||
public function __construct(PdfService $service)
|
public function __construct(PdfService $service)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -59,12 +62,33 @@ class PdfConfiguration
|
|||||||
|
|
||||||
$this->setEntityType()
|
$this->setEntityType()
|
||||||
->setEntityProperties()
|
->setEntityProperties()
|
||||||
|
->setPdfVariables()
|
||||||
->setDesign();
|
->setDesign();
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function setPdfVariables() :self
|
||||||
|
{
|
||||||
|
|
||||||
|
$default = (array) CompanySettings::getEntityVariableDefaults();
|
||||||
|
$variables = $this->service->company->pdf_variables;
|
||||||
|
|
||||||
|
foreach ($default as $property => $value) {
|
||||||
|
if (array_key_exists($property, $variables)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$variables[$property] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->pdf_variables = $variables;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private function setEntityType()
|
private function setEntityType()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@ class PdfService
|
|||||||
|
|
||||||
public $invitation;
|
public $invitation;
|
||||||
|
|
||||||
|
public Company $company;
|
||||||
|
|
||||||
public PdfConfiguration $config;
|
public PdfConfiguration $config;
|
||||||
|
|
||||||
public PdfBuilder $builder;
|
public PdfBuilder $builder;
|
||||||
@ -32,6 +34,8 @@ class PdfService
|
|||||||
|
|
||||||
$this->invitation = $invitation;
|
$this->invitation = $invitation;
|
||||||
|
|
||||||
|
$this->company = $invitation->company;
|
||||||
|
|
||||||
$this->config = (new PdfConfiguration($this))->init();
|
$this->config = (new PdfConfiguration($this))->init();
|
||||||
|
|
||||||
$this->html_variables = (new HtmlEngine($invitation))->generateLabelsAndValues();
|
$this->html_variables = (new HtmlEngine($invitation))->generateLabelsAndValues();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user