diff --git a/app/Jobs/Entity/CreateEntityPdf.php b/app/Jobs/Entity/CreateEntityPdf.php index e28c288fc457..82037a4fadff 100644 --- a/app/Jobs/Entity/CreateEntityPdf.php +++ b/app/Jobs/Entity/CreateEntityPdf.php @@ -86,7 +86,7 @@ class CreateEntityPdf implements ShouldQueue $this->contact = $invitation->contact; - $this->disk = $disk; + $this->disk = Ninja::isHosted() ? config('filesystems.default') : $disk; // $this->disk = $disk ?? config('filesystems.default'); } diff --git a/app/Mail/Engine/InvoiceEmailEngine.php b/app/Mail/Engine/InvoiceEmailEngine.php index c8ace469cef8..a0a8630364c5 100644 --- a/app/Mail/Engine/InvoiceEmailEngine.php +++ b/app/Mail/Engine/InvoiceEmailEngine.php @@ -12,6 +12,7 @@ namespace App\Mail\Engine; use App\DataMapper\EmailTemplateDefaults; +use App\Jobs\Entity\CreateEntityPdf; use App\Models\Account; use App\Utils\HtmlEngine; use App\Utils\Ninja; @@ -111,13 +112,13 @@ class InvoiceEmailEngine extends BaseEmailEngine if ($this->client->getSetting('pdf_email_attachment') !== false && $this->invoice->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) { + CreateEntityPdf::dispatchNow($invitation); + if(Ninja::isHosted()) $this->setAttachments([$this->invoice->pdf_file_path($this->invitation, 'url', true)]); else $this->setAttachments([$this->invoice->pdf_file_path($this->invitation)]); - // $this->setAttachments(['path' => $this->invoice->pdf_file_path(), 'name' => basename($this->invoice->pdf_file_path())]); - } //attach third party documents