From cb620f09ed8a934142f51e595cf8ae6dd087a0a8 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 22 Jan 2023 18:25:04 +1100 Subject: [PATCH] Fixes for sending payment email on Mark Paid --- app/Services/Invoice/MarkPaid.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Services/Invoice/MarkPaid.php b/app/Services/Invoice/MarkPaid.php index dedd6f172091..02af5d2e9f37 100644 --- a/app/Services/Invoice/MarkPaid.php +++ b/app/Services/Invoice/MarkPaid.php @@ -91,16 +91,16 @@ class MarkPaid extends AbstractService $payment->service()->applyNumber()->save(); - if($payment->company->getSetting('send_email_on_mark_paid')) - $payment->service()->sendEmail(); - - $this->setExchangeRate($payment); - /* Create a payment relationship to the invoice entity */ $payment->invoices()->attach($this->invoice->id, [ 'amount' => $this->payable_balance, ]); + if($payment->company->getSetting('send_email_on_mark_paid')) + $payment->service()->sendEmail(); + + $this->setExchangeRate($payment); + event('eloquent.created: App\Models\Payment', $payment); $this->invoice->next_send_date = null;