From ae09df0cfda5b44492eb977e09709471e61e5a6f Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 22 Jun 2023 11:03:25 +1000 Subject: [PATCH] Adjustments for payment templates --- app/Utils/TemplateEngine.php | 6 +++++- app/Utils/Traits/MakesTemplateData.php | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Utils/TemplateEngine.php b/app/Utils/TemplateEngine.php index c0f4292da9d4..52390e082e3c 100644 --- a/app/Utils/TemplateEngine.php +++ b/app/Utils/TemplateEngine.php @@ -102,7 +102,11 @@ class TemplateEngine } elseif (stripos($this->template, 'purchase') !== false && $purchase_order = PurchaseOrder::whereHas('invitations')->withTrashed()->company()->first()) { $this->entity = 'purchase_order'; $this->entity_obj = $purchase_order; - } elseif ($invoice = Invoice::whereHas('invitations')->withTrashed()->company()->first()) { + }elseif (stripos($this->template, 'payment') !== false && $payment = Payment::withTrashed()->company()->first()) { + $this->entity = 'payment'; + $this->entity_obj = $payment; + } + elseif ($invoice = Invoice::whereHas('invitations')->withTrashed()->company()->first()) { $this->entity_obj = $invoice; } else { $this->mockEntity(); diff --git a/app/Utils/Traits/MakesTemplateData.php b/app/Utils/Traits/MakesTemplateData.php index c4a9fcb7ba12..8658e39562ae 100644 --- a/app/Utils/Traits/MakesTemplateData.php +++ b/app/Utils/Traits/MakesTemplateData.php @@ -116,6 +116,8 @@ trait MakesTemplateData $data['$quote_total'] = ['value' => '$20.00', 'label' => ctrans('texts.quote_total')]; $data['$credit_amount'] = ['value' => '$15.00', 'label' => ctrans('texts.credit_amount')]; $data['$credit_balance'] = ['value' => '$12.00', 'label' => ctrans('texts.credit_balance')]; + $data['$invoice_references'] = ['value' => 'Invoice #2222', 'label' => ctrans('texts.invoices')]; + $data['$invoice_references_subject'] = ['value' => 'Invoice #2222', 'label' => ctrans('texts.invoices')]; $data['$credit_number'] = &$data['$number']; $data['$credit_no'] = &$data['$number'];