mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fallback to phantomjscloud
This commit is contained in:
parent
1bf072ca27
commit
27ee08d541
@ -91,7 +91,7 @@ class ClientPortalController extends BaseController
|
|||||||
];
|
];
|
||||||
$invoice->invoice_fonts = $account->getFontsData();
|
$invoice->invoice_fonts = $account->getFontsData();
|
||||||
|
|
||||||
if ($design = $account->getCustomDesign($invoice->getDesignId())) {
|
if ($design = $account->getCustomDesign($invoice->invoice_design_id)) {
|
||||||
$invoice->invoice_design->javascript = $design;
|
$invoice->invoice_design->javascript = $design;
|
||||||
} else {
|
} else {
|
||||||
$invoice->invoice_design->javascript = $invoice->invoice_design->pdfmake;
|
$invoice->invoice_design->javascript = $invoice->invoice_design->pdfmake;
|
||||||
|
@ -594,11 +594,6 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
return $this->is_recurring ? trans('texts.recurring') : $this->invoice_number;
|
return $this->is_recurring ? trans('texts.recurring') : $this->invoice_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDesignId()
|
|
||||||
{
|
|
||||||
return $this->isQuote() ? $this->quote_design_id : $this->invoice_design_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@ -1258,15 +1253,13 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
$pdfString = CurlUtils::phantom('GET', $link . '?phantomjs=true&phantomjs_secret=' . env('PHANTOMJS_SECRET'));
|
$pdfString = CurlUtils::phantom('GET', $link . '?phantomjs=true&phantomjs_secret=' . env('PHANTOMJS_SECRET'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $pdfString && (Utils::isNinja() || ! env('PHANTOMJS_BIN_PATH'))) {
|
if (! $pdfString && ($key = env('PHANTOMJS_CLOUD_KEY'))) {
|
||||||
if ($key = env('PHANTOMJS_CLOUD_KEY')) {
|
|
||||||
if (Utils::isNinjaDev()) {
|
if (Utils::isNinjaDev()) {
|
||||||
$link = env('TEST_LINK');
|
$link = env('TEST_LINK');
|
||||||
}
|
}
|
||||||
$url = "http://api.phantomjscloud.com/api/browser/v2/{$key}/?request=%7Burl:%22{$link}?phantomjs=true%22,renderType:%22html%22%7D";
|
$url = "http://api.phantomjscloud.com/api/browser/v2/{$key}/?request=%7Burl:%22{$link}?phantomjs=true%22,renderType:%22html%22%7D";
|
||||||
$pdfString = CurlUtils::get($url);
|
$pdfString = CurlUtils::get($url);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$pdfString = strip_tags($pdfString);
|
$pdfString = strip_tags($pdfString);
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
|
44
config/pdf.php
Normal file
44
config/pdf.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
'phantomjs' => [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| PhantomJS Secret
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This enables the PhantomJS request to bypass client authorization.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'secret' => env('PHANTOMJS_SECRET'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| PhantomJS Bin Path
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The path to the local PhantomJS binary.
|
||||||
|
| For example: /usr/local/bin/phantomjs
|
||||||
|
| You can run which phantomjs to determine the value
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'bin_path' => env('PHANTOMJS_BIN_PATH'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| PhantomJS Cloud Key
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Key for the https://phantomjscloud.com service
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'cloud_key' => env('PHANTOMJS_CLOUD_KEY')
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
];
|
@ -2262,6 +2262,7 @@ $LANG = array(
|
|||||||
'empty' => 'Empty',
|
'empty' => 'Empty',
|
||||||
'load_design' => 'Load Design',
|
'load_design' => 'Load Design',
|
||||||
'accepted_card_logos' => 'Accepted Card Logos',
|
'accepted_card_logos' => 'Accepted Card Logos',
|
||||||
|
'phantomjs_local_and_cloud' => 'Using local PhantomJS, falling back to phantomjscloud.com',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
{!! Former::checkbox('pdf_email_attachment')
|
{!! Former::checkbox('pdf_email_attachment')
|
||||||
->text(trans('texts.enable'))
|
->text(trans('texts.enable'))
|
||||||
->value(1)
|
->value(1)
|
||||||
->help( ! Utils::isNinja() ? (env('PHANTOMJS_BIN_PATH') ? 'phantomjs_local' : trans('texts.phantomjs_help', [
|
->help( ! Utils::isNinja() ? (config('pdf.phantomjs.bin_path') ? (config('pdf.phantomjs.cloud_key') ? 'phantomjs_local_and_cloud' : 'phantomjs_local') : trans('texts.phantomjs_help', [
|
||||||
'link_phantom' => link_to('https://phantomjscloud.com/', 'phantomjscloud.com', ['target' => '_blank']),
|
'link_phantom' => link_to('https://phantomjscloud.com/', 'phantomjscloud.com', ['target' => '_blank']),
|
||||||
'link_docs' => link_to('http://docs.invoiceninja.com/en/latest/configure.html#phantomjs', 'PhantomJS', ['target' => '_blank'])
|
'link_docs' => link_to('http://docs.invoiceninja.com/en/latest/configure.html#phantomjs', 'PhantomJS', ['target' => '_blank'])
|
||||||
])) : false) !!}
|
])) : false) !!}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user