1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Fixes for templates

This commit is contained in:
David Bomba 2022-07-01 18:35:52 +10:00
parent 3499ad885c
commit 0ac5acda82

View File

@ -84,6 +84,10 @@ class TemplateEngine
public function build()
{
if ($this->template == 'email_template_null')
$this->template = 'email_template_purchase_order';
return $this->setEntity()
->setSettingsObject()
->setTemplates()
@ -156,7 +160,7 @@ class TemplateEngine
if($this->entity == 'purchaseOrder'){
$this->fakerValues();
}
elseif ($this->entity_obj) {
elseif ($this->entity_obj->client()->exists()) {
$this->entityValues($this->entity_obj->client->primary_contact()->first());
}
else {
@ -186,7 +190,7 @@ class TemplateEngine
private function entityValues($contact)
{
if($this->entity == 'purchase_order')
if($this->entity == 'purchaseOrder')
$this->labels_and_values = (new VendorHtmlEngine($this->entity_obj->invitations->first()))->generateLabelsAndValues();
else
$this->labels_and_values = (new HtmlEngine($this->entity_obj->invitations->first()))->generateLabelsAndValues();
@ -214,7 +218,7 @@ class TemplateEngine
$data['footer'] = '';
$data['logo'] = auth()->user()->company()->present()->logo();
if($this->entity_obj->client)
if($this->entity_obj->client()->exists())
$data = array_merge($data, Helpers::sharedEmailVariables($this->entity_obj->client));
else{
@ -323,7 +327,7 @@ class TemplateEngine
if($this->entity == 'purchase_order')
if($this->entity == 'purchaseOrder')
{
$vendor = Vendor::factory()->create([