diff --git a/app/Mail/TemplateEmail.php b/app/Mail/TemplateEmail.php index 98d8609c22..222d767d0c 100644 --- a/app/Mail/TemplateEmail.php +++ b/app/Mail/TemplateEmail.php @@ -127,7 +127,10 @@ class TemplateEmail extends Mailable $ubl_string = CreateUbl::dispatchNow($this->invitation->invoice); - $this->attachData($ubl_string, $this->invitation->invoice->getFileName('xml')); + nlog($ubl_string); + + if($ubl_string) + $this->attachData($ubl_string, $this->invitation->invoice->getFileName('xml')); } diff --git a/app/Notifications/BaseNotification.php b/app/Notifications/BaseNotification.php index edf6d94bf4..d873855251 100644 --- a/app/Notifications/BaseNotification.php +++ b/app/Notifications/BaseNotification.php @@ -11,6 +11,8 @@ namespace App\Notifications; +use App\Jobs\Invoice\CreateUbl; +use App\Models\Invoice; use App\Utils\TempFile; use App\Utils\Traits\MakesInvoiceHtml; use Illuminate\Bus\Queueable; diff --git a/app/Services/Invoice/TriggeredActions.php b/app/Services/Invoice/TriggeredActions.php index 2516a59999..2169a63df6 100644 --- a/app/Services/Invoice/TriggeredActions.php +++ b/app/Services/Invoice/TriggeredActions.php @@ -63,8 +63,8 @@ class TriggeredActions extends AbstractService private function sendEmail() { - //$reminder_template = $this->invoice->calculateTemplate('invoice'); - $reminder_template = 'payment'; + $reminder_template = $this->invoice->calculateTemplate('invoice'); + //$reminder_template = 'payment'; $this->invoice->invitations->load('contact.client.country', 'invoice.client.country', 'invoice.company')->each(function ($invitation) use ($reminder_template) { EmailEntity::dispatch($invitation, $this->invoice->company, $reminder_template);