From 191b0a3138347dbf8b21c059d88cca5d4c45231d Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 30 Jul 2017 20:11:33 +0300 Subject: [PATCH] Fix download invoice PDFs --- app/Jobs/DownloadInvoices.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/Jobs/DownloadInvoices.php b/app/Jobs/DownloadInvoices.php index 9a7062ebe49e..651d0012837c 100644 --- a/app/Jobs/DownloadInvoices.php +++ b/app/Jobs/DownloadInvoices.php @@ -12,9 +12,10 @@ use Barracuda\ArchiveStream\Archive; /** * Class SendInvoiceEmail. */ -class DownloadInvoices extends Job implements ShouldQueue +//class DownloadInvoices extends Job implements ShouldQueue +class DownloadInvoices extends Job { - use InteractsWithQueue, SerializesModels; + //use InteractsWithQueue, SerializesModels; /** * @var User @@ -45,6 +46,16 @@ class DownloadInvoices extends Job implements ShouldQueue */ public function handle(UserMailer $userMailer) { + $zip = Archive::instance_by_useragent(date('Y-m-d') . '-Invoice_PDFs'); + + foreach ($this->invoices as $invoice) { + $zip->add_file($invoice->getFileName(), $invoice->getPDFString()); + } + + $zip->finish(); + exit; + + /* // if queues are disabled download a zip file if (config('queue.default') === 'sync' || count($this->invoices) <= 10) { $zip = Archive::instance_by_useragent(date('Y-m-d') . '-Invoice_PDFs'); @@ -71,5 +82,6 @@ class DownloadInvoices extends Job implements ShouldQueue $userMailer->sendMessage($this->user, $subject, false, $data); } + */ } }