Make $project.name defined as empty for invoices with no project

Allows inclusion of $project.name in emails without needing a special case for invoices with no project

Signed-off-by: thirstyice <thirstyice@users.noreply.github.com>
This commit is contained in:
thirstyice 2024-06-23 17:03:46 -06:00 committed by GitHub
parent d0795c0a12
commit 1575974099
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -221,9 +221,11 @@ class HtmlEngine
if ($this->entity->project) {
$data['$project.name'] = ['value' => $this->entity->project->name, 'label' => ctrans('texts.project')];
$data['$invoice.project'] = &$data['$project.name'];
$data['$quote.project'] = &$data['$project.name'];
} else {
$data['$project.name'] = ['value' => '', 'label' => ''];
}
$data['$invoice.project'] = &$data['$project.name'];
$data['$quote.project'] = &$data['$project.name'];
$data['$status_logo'] = ['value' => '<div class="stamp is-paid"> ' . ctrans('texts.paid') .'</div>', 'label' => ''];
@ -231,6 +233,8 @@ class HtmlEngine
if ($this->entity->vendor) {
$data['$invoice.vendor'] = ['value' => $this->entity->vendor->present()->name(), 'label' => ctrans('texts.vendor_name')];
} else {
$data['$invoice.vendor'] = ['value' => '', 'label' => ''];
}
if (strlen($this->company->getSetting('qr_iban')) > 5) {
@ -277,14 +281,17 @@ class HtmlEngine
$data['$credit.custom4'] = &$data['$quote.custom4'];
if ($this->entity->project) {
$data['$project.name'] = ['value' => $this->entity->project->name, 'label' => ctrans('texts.project')];
$data['$invoice.project'] = &$data['$project.name'];
$data['$quote.project'] = &$data['$project.name'];
$data['$project.name'] = ['value' => $this->entity->project->name, 'label' => ctrans('texts.project')];
} else {
$data['$project.name'] = ['value' => '', 'label' => ''];
}
$data['$invoice.project'] = &$data['$project.name'];
$data['$quote.project'] = &$data['$project.name'];
if ($this->entity->vendor) {
$data['$invoice.vendor'] = ['value' => $this->entity->vendor->present()->name(), 'label' => ctrans('texts.vendor_name')];
} else {
$data['$invoice.vendor'] = ['value' => '', 'label' => ''];
}
}