From 3c72a1570754dc2d5bfa9d263d370976d12369bf Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 30 Jan 2021 11:19:43 +1100 Subject: [PATCH] Fix for phantom displaying Recurring Invoices --- app/Utils/PhantomJS/Phantom.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Utils/PhantomJS/Phantom.php b/app/Utils/PhantomJS/Phantom.php index 50796ab5d381..4757e2decce0 100644 --- a/app/Utils/PhantomJS/Phantom.php +++ b/app/Utils/PhantomJS/Phantom.php @@ -16,6 +16,7 @@ use App\Models\CreditInvitation; use App\Models\Design; use App\Models\InvoiceInvitation; use App\Models\QuoteInvitation; +use App\Models\RecurringInvoiceInvitation; use App\Models\SystemLog; use App\Services\PdfMaker\Design as PdfDesignModel; use App\Services\PdfMaker\Design as PdfMakerDesign; @@ -52,6 +53,9 @@ class Phantom } elseif ($invitation instanceof QuoteInvitation) { $entity = 'quote'; $entity_design_id = 'quote_design_id'; + } elseif ($inviation instanceof RecurringInvoiceInvitation) { + $entity = 'recurring_invoice'; + $entity_design_id = 'invoice_design_id'; } $entity_obj = $invitation->{$entity}; @@ -68,6 +72,10 @@ class Phantom $path = $entity_obj->client->credit_filepath(); } + if ($entity == 'recurring_invoice') { + $path = $entity_obj->client->recurring_invoice_filepath(); + } + $file_path = $path.$entity_obj->number.'.pdf'; $url = config('ninja.app_url').'/phantom/'.$entity.'/'.$invitation->key.'?phantomjs_secret='.config('ninja.phantomjs_secret');