Fix for phantom displaying Recurring Invoices

This commit is contained in:
David Bomba 2021-01-30 11:19:43 +11:00
parent 9fa043afdd
commit 3c72a15707

View File

@ -16,6 +16,7 @@ use App\Models\CreditInvitation;
use App\Models\Design; use App\Models\Design;
use App\Models\InvoiceInvitation; use App\Models\InvoiceInvitation;
use App\Models\QuoteInvitation; use App\Models\QuoteInvitation;
use App\Models\RecurringInvoiceInvitation;
use App\Models\SystemLog; use App\Models\SystemLog;
use App\Services\PdfMaker\Design as PdfDesignModel; use App\Services\PdfMaker\Design as PdfDesignModel;
use App\Services\PdfMaker\Design as PdfMakerDesign; use App\Services\PdfMaker\Design as PdfMakerDesign;
@ -52,6 +53,9 @@ class Phantom
} elseif ($invitation instanceof QuoteInvitation) { } elseif ($invitation instanceof QuoteInvitation) {
$entity = 'quote'; $entity = 'quote';
$entity_design_id = 'quote_design_id'; $entity_design_id = 'quote_design_id';
} elseif ($inviation instanceof RecurringInvoiceInvitation) {
$entity = 'recurring_invoice';
$entity_design_id = 'invoice_design_id';
} }
$entity_obj = $invitation->{$entity}; $entity_obj = $invitation->{$entity};
@ -68,6 +72,10 @@ class Phantom
$path = $entity_obj->client->credit_filepath(); $path = $entity_obj->client->credit_filepath();
} }
if ($entity == 'recurring_invoice') {
$path = $entity_obj->client->recurring_invoice_filepath();
}
$file_path = $path.$entity_obj->number.'.pdf'; $file_path = $path.$entity_obj->number.'.pdf';
$url = config('ninja.app_url').'/phantom/'.$entity.'/'.$invitation->key.'?phantomjs_secret='.config('ninja.phantomjs_secret'); $url = config('ninja.app_url').'/phantom/'.$entity.'/'.$invitation->key.'?phantomjs_secret='.config('ninja.phantomjs_secret');