diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index e64bac17a292..8451e1d7a3e5 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -795,7 +795,7 @@ class InvoiceController extends BaseController $file_path = $invoice->service()->getInvoicePdf($contact); -nlog($file_path); + nlog($file_path); return response()->download($file_path, basename($file_path)); } diff --git a/app/Services/Invoice/GenerateDeliveryNote.php b/app/Services/Invoice/GenerateDeliveryNote.php index 79c031a1718b..581a5da1fa8c 100644 --- a/app/Services/Invoice/GenerateDeliveryNote.php +++ b/app/Services/Invoice/GenerateDeliveryNote.php @@ -17,7 +17,9 @@ use App\Models\Design; use App\Models\Invoice; use App\Services\PdfMaker\Design as PdfMakerDesign; use App\Services\PdfMaker\PdfMaker as PdfMakerService; +use App\Utils\HostedPDF\NinjaPdf; use App\Utils\HtmlEngine; +use App\Utils\PhantomJS\Phantom; use App\Utils\Traits\MakesHash; use App\Utils\Traits\Pdf\PdfMaker; use Illuminate\Support\Facades\Storage; @@ -58,6 +60,10 @@ class GenerateDeliveryNote $file_path = sprintf('%s%s_delivery_note.pdf', $this->invoice->client->invoice_filepath(), $this->invoice->number); + if (config('ninja.phantomjs_pdf_generation')) { + return (new Phantom)->generate($this->invoice->invitations->first()); + } + $design = Design::find($design_id); $html = new HtmlEngine($this->invoice->invitations->first()); @@ -86,7 +92,12 @@ class GenerateDeliveryNote // Storage::makeDirectory($this->invoice->client->invoice_filepath(), 0775); - $pdf = $this->makePdf(null, null, $maker->getCompiledHTML()); + if(config('ninja.invoiceninja_hosted_pdf_generation')){ + $pdf = (new NinjaPdf())->build($maker->getCompiledHTML(true)); + } + else { + $pdf = $this->makePdf(null, null, $maker->getCompiledHTML()); + } if (config('ninja.log_pdf_html')) { info($maker->getCompiledHTML()); diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index 72e47ceecd49..6f056e7e900f 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -263,7 +263,7 @@ class InvoiceService { if ((int)$this->invoice->balance == 0) { - InvoiceWorkflowSettings::dispatch($this->invoice); + InvoiceWorkflowSettings::dispatchNow($this->invoice); $this->setStatus(Invoice::STATUS_PAID); } diff --git a/app/Services/Payment/UpdateInvoicePayment.php b/app/Services/Payment/UpdateInvoicePayment.php index c81b87bd434d..d2fc2eefed5c 100644 --- a/app/Services/Payment/UpdateInvoicePayment.php +++ b/app/Services/Payment/UpdateInvoicePayment.php @@ -12,6 +12,7 @@ namespace App\Services\Payment; use App\Events\Invoice\InvoiceWasUpdated; +use App\Jobs\Invoice\InvoiceWorkflowSettings; use App\Models\Invoice; use App\Models\Payment; use App\Models\PaymentHash; @@ -83,6 +84,8 @@ class UpdateInvoicePayment ->updateStatus() ->save(); + InvoiceWorkflowSettings::dispatchNow($invoice); + event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars())); }); diff --git a/config/ninja.php b/config/ninja.php index 7f0411c7d12f..9f868a7a5b1d 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -142,7 +142,7 @@ return [ 'expanded_logging' => env('EXPANDED_LOGGING', false), 'snappdf_chromium_path' => env('SNAPPDF_CHROMIUM_PATH', false), 'v4_migration_version' => '4.5.35', - 'flutter_canvas_kit' => env('FLUTTER_CANVAS_KIT', 'selfhosted-html'), + 'flutter_renderer' => env('FLUTTER_RENDERER', 'selfhosted-html'), 'webcron_secret' => env('WEBCRON_SECRET', false), 'disable_auto_update' => env('DISABLE_AUTO_UPDATE', false), 'invoiceninja_hosted_pdf_generation' => env('NINJA_HOSTED_PDF', false), diff --git a/resources/views/index/index.blade.php b/resources/views/index/index.blade.php index dfd798e2c1ee..84eb079a0141 100644 --- a/resources/views/index/index.blade.php +++ b/resources/views/index/index.blade.php @@ -146,9 +146,9 @@ - @if(config('ninja.flutter_canvas_kit') == 'hosted') + @if(config('ninja.flutter_renderer') == 'hosted') - @elseif(config('ninja.flutter_canvas_kit') == 'selfhosted-canvaskit') + @elseif(config('ninja.flutter_renderer') == 'selfhosted-canvaskit') @else