mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-06 03:02:34 +01:00
Small fix for new PDF generator
This commit is contained in:
parent
bbcc06f22c
commit
ac6feb706e
@ -18,6 +18,7 @@ use App\Models\Invoice;
|
|||||||
use App\Models\InvoiceInvitation;
|
use App\Models\InvoiceInvitation;
|
||||||
use App\Services\PdfMaker\Design;
|
use App\Services\PdfMaker\Design;
|
||||||
use App\Services\PdfMaker\PdfMaker;
|
use App\Services\PdfMaker\PdfMaker;
|
||||||
|
use App\Utils\HostedPDF\NinjaPdf;
|
||||||
use App\Utils\HtmlEngine;
|
use App\Utils\HtmlEngine;
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
use App\Utils\PhantomJS\Phantom;
|
use App\Utils\PhantomJS\Phantom;
|
||||||
@ -134,6 +135,10 @@ class PreviewController extends BaseController
|
|||||||
return (new Phantom)->convertHtmlToPdf($maker->getCompiledHTML(true));
|
return (new Phantom)->convertHtmlToPdf($maker->getCompiledHTML(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(config('ninja.invoiceninja_hosted_pdf_generation')){
|
||||||
|
return (new NinjaPdf())->build($maker->getCompiledHTML(true));
|
||||||
|
}
|
||||||
|
|
||||||
//else
|
//else
|
||||||
$file_path = PreviewPdf::dispatchNow($maker->getCompiledHTML(true), auth()->user()->company());
|
$file_path = PreviewPdf::dispatchNow($maker->getCompiledHTML(true), auth()->user()->company());
|
||||||
|
|
||||||
@ -217,6 +222,10 @@ class PreviewController extends BaseController
|
|||||||
return (new Phantom)->convertHtmlToPdf($maker->getCompiledHTML(true));
|
return (new Phantom)->convertHtmlToPdf($maker->getCompiledHTML(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(config('ninja.invoiceninja_hosted_pdf_generation')){
|
||||||
|
return (new NinjaPdf())->build($maker->getCompiledHTML(true));
|
||||||
|
}
|
||||||
|
|
||||||
$file_path = PreviewPdf::dispatchNow($maker->getCompiledHTML(true), auth()->user()->company());
|
$file_path = PreviewPdf::dispatchNow($maker->getCompiledHTML(true), auth()->user()->company());
|
||||||
|
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
|
@ -241,7 +241,7 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
|
|
||||||
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
|
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
|
||||||
|
|
||||||
BillingSubscriptionService::completePurchase($this->payment_hash);
|
(new BillingSubscriptionService)->completePurchase($this->payment_hash);
|
||||||
|
|
||||||
return $payment->service()->applyNumber()->save();
|
return $payment->service()->applyNumber()->save();
|
||||||
}
|
}
|
||||||
|
@ -32,11 +32,17 @@ class BillingSubscriptionService
|
|||||||
public function completePurchase(PaymentHash $payment_hash)
|
public function completePurchase(PaymentHash $payment_hash)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (!property_exists($payment_hash, 'billing_context')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// At this point we have some state carried from the billing page
|
||||||
|
// to this, available as $payment_hash->data->billing_context. Make something awesome ⭐
|
||||||
|
|
||||||
// create client subscription record
|
// create client subscription record
|
||||||
//
|
//
|
||||||
// create recurring invoice if is_recurring
|
// create recurring invoice if is_recurring
|
||||||
//
|
//
|
||||||
// s
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -53,7 +59,6 @@ class BillingSubscriptionService
|
|||||||
$data['line_items'] = $this->createLineItems($data['quantity']);
|
$data['line_items'] = $this->createLineItems($data['quantity']);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
If trial_enabled -> return early
|
If trial_enabled -> return early
|
||||||
|
|
||||||
-- what we need to know that we don't already
|
-- what we need to know that we don't already
|
||||||
@ -118,13 +123,5 @@ class BillingSubscriptionService
|
|||||||
//scan for any notification we are required to send
|
//scan for any notification we are required to send
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function completePurchase(PaymentHash $payment_hash)
|
|
||||||
{
|
|
||||||
if (!property_exists($payment_hash, 'billing_context')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point we have some state carried from the billing page
|
|
||||||
// to this, available as $payment_hash->data->billing_context. Make something awesome ⭐
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,9 @@ class NinjaPdf
|
|||||||
public function build($html)
|
public function build($html)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
nlog("building remotely");
|
||||||
|
|
||||||
|
|
||||||
$client = new \GuzzleHttp\Client(['headers' =>
|
$client = new \GuzzleHttp\Client(['headers' =>
|
||||||
[
|
[
|
||||||
'X-Ninja-Token' => 'test_token_for_now',
|
'X-Ninja-Token' => 'test_token_for_now',
|
||||||
|
Loading…
Reference in New Issue
Block a user