diff --git a/app/Mail/TemplateEmail.php b/app/Mail/TemplateEmail.php index bbfabebc09d0..955e0d5de4d4 100644 --- a/app/Mail/TemplateEmail.php +++ b/app/Mail/TemplateEmail.php @@ -126,7 +126,9 @@ class TemplateEmail extends Mailable if($this->invitation->invoice && $settings->ubl_email_attachment && $this->company->account->hasFeature(Account::FEATURE_DOCUMENTS)){ $ubl_string = CreateUbl::dispatchNow($this->invitation->invoice); - $this->attachData($ubl_string, $this->invitation->invoice->getFileName('xml')); + + if($ubl_string) + $this->attachData($ubl_string, $this->invitation->invoice->getFileName('xml')); } diff --git a/app/PaymentDrivers/BaseDriver.php b/app/PaymentDrivers/BaseDriver.php index 45cd0b1c3e6c..be410cf1134c 100644 --- a/app/PaymentDrivers/BaseDriver.php +++ b/app/PaymentDrivers/BaseDriver.php @@ -205,7 +205,6 @@ class BaseDriver extends AbstractPaymentDriver $invoices->each(function ($invoice) use ($payment) { event(new InvoiceWasPaid($invoice, $payment, $payment->company, Ninja::eventVars())); - $invoice->service()->workFlow(); }); return $payment->service()->applyNumber()->save(); diff --git a/app/Services/Payment/UpdateInvoicePayment.php b/app/Services/Payment/UpdateInvoicePayment.php index e344050cfa63..88aa81856818 100644 --- a/app/Services/Payment/UpdateInvoicePayment.php +++ b/app/Services/Payment/UpdateInvoicePayment.php @@ -83,6 +83,7 @@ class UpdateInvoicePayment ->updatePaidToDate($paid_amount) ->updateStatus() ->deletePdf() + ->workFlow() ->save(); event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));