mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Remove redundant code in PaymentEmailEngine
This commit is contained in:
parent
6af67e6bdd
commit
4e10d4665e
@ -55,45 +55,6 @@ class PaymentEmailEngine extends BaseEmailEngine
|
|||||||
$body_template = EmailTemplateDefaults::getDefaultTemplate('email_template_payment', $this->client->locale());
|
$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) {
|
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'];
|
$subject_template = $this->template_data['subject'];
|
||||||
} elseif (strlen($this->client->getSetting('email_subject_payment')) > 0) {
|
} 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());
|
$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'))
|
$this->setTemplate($this->client->getSetting('email_style'))
|
||||||
->setContact($this->contact)
|
->setContact($this->contact)
|
||||||
->setVariables($this->makeValues())
|
->setVariables($this->makeValues())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user