From 4e10d4665ec1177d0587620a6fa4bdb4f805a966 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 28 Jan 2021 10:36:43 +1100 Subject: [PATCH] Remove redundant code in PaymentEmailEngine --- app/Mail/Engine/PaymentEmailEngine.php | 48 -------------------------- 1 file changed, 48 deletions(-) diff --git a/app/Mail/Engine/PaymentEmailEngine.php b/app/Mail/Engine/PaymentEmailEngine.php index f8d73724d3dc..218a92995551 100644 --- a/app/Mail/Engine/PaymentEmailEngine.php +++ b/app/Mail/Engine/PaymentEmailEngine.php @@ -55,45 +55,6 @@ class PaymentEmailEngine extends BaseEmailEngine $body_template = EmailTemplateDefaults::getDefaultTemplate('email_template_payment', $this->client->locale()); } - //this will never get hit. - - - /* Use default translations if a custom message has not been set*/ - if (iconv_strlen($body_template) == 0) { - - if ($payment->invoices()->exists()) - { - nlog("invoices attached to payments"); - - $invoice_texts = ctrans('texts.invoice_number_short'); - - foreach ($this->payment->invoices as $invoice) { - $invoice_texts .= $invoice->number.','; - } - - $invoice_texts = substr($invoice_texts, 0, -1); - - $body_template = trans( - 'texts.payment_message_extended', - ['amount' => $payment->amount, 'company' => $payment->company->present()->name(), 'invoice' => $invoice_texts], - null, - $this->client->locale() - ); - } - else - { - nlog("no invoices attached to payments"); - - $body_template = trans( - 'texts.payment_message', - ['amount' => $payment->amount, 'company' => $payment->company->present()->name()], - null, - $this->client->locale() - ); - } - - } - if (is_array($this->template_data) && array_key_exists('subject', $this->template_data) && strlen($this->template_data['subject']) > 0) { $subject_template = $this->template_data['subject']; } elseif (strlen($this->client->getSetting('email_subject_payment')) > 0) { @@ -102,15 +63,6 @@ class PaymentEmailEngine extends BaseEmailEngine $subject_template = EmailTemplateDefaults::getDefaultTemplate('email_subject_payment', $this->client->locale()); } - if (iconv_strlen($subject_template) == 0) { - $subject_template = trans( - 'texts.payment_subject', - ['number' => $payment->number, 'company' => $payment->company->present()->name()], - null, - $this->client->locale() - ); - } - $this->setTemplate($this->client->getSetting('email_style')) ->setContact($this->contact) ->setVariables($this->makeValues())