mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Minor fixes for static analysis
This commit is contained in:
parent
5e987c5ee7
commit
7281f0f281
@ -375,8 +375,9 @@ class PreviewController extends BaseController
|
||||
];
|
||||
|
||||
$ts = (new TemplateService());
|
||||
$ts->setTemplate($design_object)
|
||||
->build($data);
|
||||
$ts->setCompany($company)
|
||||
->setTemplate($design_object)
|
||||
->build($data);
|
||||
|
||||
$html = $ts->getHtml();
|
||||
|
||||
|
@ -79,6 +79,6 @@ class Design extends BaseModel
|
||||
|
||||
public function service(): TemplateService
|
||||
{
|
||||
return new TemplateService($this);
|
||||
return (new TemplateService($this))->setCompany($this->company);
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -15,6 +15,7 @@ use App\Models\Task;
|
||||
use App\Models\Quote;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Design;
|
||||
use App\Models\Company;
|
||||
use App\Models\Payment;
|
||||
use App\Models\Project;
|
||||
use App\Utils\HtmlEngine;
|
||||
@ -45,6 +46,8 @@ class TemplateService
|
||||
|
||||
private array $data = [];
|
||||
|
||||
public ?Company $company;
|
||||
|
||||
public function __construct(public ?Design $template = null)
|
||||
{
|
||||
$this->template = $template;
|
||||
@ -89,6 +92,11 @@ class TemplateService
|
||||
|
||||
public function mock(): self
|
||||
{
|
||||
$tm = new TemplateMock($this->company);
|
||||
$this->data = $tm->engines;
|
||||
|
||||
$this->parseNinjaBlocks()
|
||||
->parseVariables($tm->variables);
|
||||
|
||||
return $this;
|
||||
}
|
||||
@ -103,8 +111,6 @@ class TemplateService
|
||||
|
||||
$this->data = $this->preProcessDataBlocks($data);
|
||||
|
||||
nlog(json_encode($this->data));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -424,4 +430,16 @@ class TemplateService
|
||||
return $i[PurchaseOrder::class];
|
||||
|
||||
}
|
||||
|
||||
public function setCompany(Company $company): self
|
||||
{
|
||||
$this->company = $company;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCompany(): Company
|
||||
{
|
||||
return $this->company;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user