mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-04 06:24:35 -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 = (new TemplateService());
|
||||||
$ts->setTemplate($design_object)
|
$ts->setCompany($company)
|
||||||
->build($data);
|
->setTemplate($design_object)
|
||||||
|
->build($data);
|
||||||
|
|
||||||
$html = $ts->getHtml();
|
$html = $ts->getHtml();
|
||||||
|
|
||||||
|
@ -79,6 +79,6 @@ class Design extends BaseModel
|
|||||||
|
|
||||||
public function service(): TemplateService
|
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\Quote;
|
||||||
use App\Models\Credit;
|
use App\Models\Credit;
|
||||||
use App\Models\Design;
|
use App\Models\Design;
|
||||||
|
use App\Models\Company;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\Project;
|
use App\Models\Project;
|
||||||
use App\Utils\HtmlEngine;
|
use App\Utils\HtmlEngine;
|
||||||
@ -45,6 +46,8 @@ class TemplateService
|
|||||||
|
|
||||||
private array $data = [];
|
private array $data = [];
|
||||||
|
|
||||||
|
public ?Company $company;
|
||||||
|
|
||||||
public function __construct(public ?Design $template = null)
|
public function __construct(public ?Design $template = null)
|
||||||
{
|
{
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
@ -89,6 +92,11 @@ class TemplateService
|
|||||||
|
|
||||||
public function mock(): self
|
public function mock(): self
|
||||||
{
|
{
|
||||||
|
$tm = new TemplateMock($this->company);
|
||||||
|
$this->data = $tm->engines;
|
||||||
|
|
||||||
|
$this->parseNinjaBlocks()
|
||||||
|
->parseVariables($tm->variables);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -103,8 +111,6 @@ class TemplateService
|
|||||||
|
|
||||||
$this->data = $this->preProcessDataBlocks($data);
|
$this->data = $this->preProcessDataBlocks($data);
|
||||||
|
|
||||||
nlog(json_encode($this->data));
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,4 +430,16 @@ class TemplateService
|
|||||||
return $i[PurchaseOrder::class];
|
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