Improve payment emails

This commit is contained in:
David Bomba 2021-01-28 10:35:52 +11:00
parent 756f421319
commit 6af67e6bdd
2 changed files with 7 additions and 2 deletions

View File

@ -40,6 +40,5 @@ class PaymentEmailedActivity implements ShouldQueue
$payment = $event->payment; $payment = $event->payment;
nlog("i succeeded in emailing payment {$payment->number}");
} }
} }

View File

@ -55,11 +55,16 @@ 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*/ /* Use default translations if a custom message has not been set*/
if (iconv_strlen($body_template) == 0) { if (iconv_strlen($body_template) == 0) {
if ($payment->invoices()->exists()) if ($payment->invoices()->exists())
{ {
nlog("invoices attached to payments");
$invoice_texts = ctrans('texts.invoice_number_short'); $invoice_texts = ctrans('texts.invoice_number_short');
foreach ($this->payment->invoices as $invoice) { foreach ($this->payment->invoices as $invoice) {
@ -77,6 +82,7 @@ class PaymentEmailEngine extends BaseEmailEngine
} }
else else
{ {
nlog("no invoices attached to payments");
$body_template = trans( $body_template = trans(
'texts.payment_message', 'texts.payment_message',
@ -221,7 +227,7 @@ class PaymentEmailEngine extends BaseEmailEngine
private function formatInvoices() private function formatInvoices()
{ {
$invoice_list = ''; $invoice_list = '<br><br>';
foreach ($this->payment->invoices as $invoice) { foreach ($this->payment->invoices as $invoice) {
$invoice_list .= ctrans('texts.invoice_number_short') . " {$invoice->number} - " . Number::formatMoney($invoice->pivot->amount, $this->client) . "<br>"; $invoice_list .= ctrans('texts.invoice_number_short') . " {$invoice->number} - " . Number::formatMoney($invoice->pivot->amount, $this->client) . "<br>";