From 1575974099b956d435330981069a6528625edc4e Mon Sep 17 00:00:00 2001 From: thirstyice Date: Sun, 23 Jun 2024 17:03:46 -0600 Subject: [PATCH] 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 --- app/Utils/HtmlEngine.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/app/Utils/HtmlEngine.php b/app/Utils/HtmlEngine.php index 05880f5bcee9..57aaaf3e0bd2 100644 --- a/app/Utils/HtmlEngine.php +++ b/app/Utils/HtmlEngine.php @@ -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' => '
' . ctrans('texts.paid') .'
', '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' => '']; } }