mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-02 19:04:33 -04:00
Refactor PDF generation into common .env var
This commit is contained in:
parent
9d551b6e1d
commit
543288c525
@ -380,11 +380,11 @@ class PreviewController extends BaseController
|
|||||||
return $maker->getCompiledHTML();
|
return $maker->getCompiledHTML();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config('ninja.phantomjs_pdf_generation')) {
|
if (config('ninja.phantomjs_pdf_generation') || config('ninja.pdf_generator') == 'phantom') {
|
||||||
return (new Phantom)->convertHtmlToPdf($maker->getCompiledHTML(true));
|
return (new Phantom)->convertHtmlToPdf($maker->getCompiledHTML(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(config('ninja.invoiceninja_hosted_pdf_generation')){
|
if(config('ninja.invoiceninja_hosted_pdf_generation') || config('ninja.pdf_generator') == 'hosted_ninja'){
|
||||||
return (new NinjaPdf())->build($maker->getCompiledHTML(true));
|
return (new NinjaPdf())->build($maker->getCompiledHTML(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,9 +89,9 @@ class SystemHealth
|
|||||||
|
|
||||||
public static function getPdfEngine()
|
public static function getPdfEngine()
|
||||||
{
|
{
|
||||||
if(config('ninja.invoiceninja_hosted_pdf_generation'))
|
if(config('ninja.invoiceninja_hosted_pdf_generation') || config('ninja.pdf_generator') == 'hosted_ninja')
|
||||||
return 'Invoice Ninja Hosted PDF Generator';
|
return 'Invoice Ninja Hosted PDF Generator';
|
||||||
elseif(config('ninja.phantomjs_pdf_generation'))
|
elseif(config('ninja.phantomjs_pdf_generation') || config('ninja.pdf_generator') == 'phantom')
|
||||||
return 'Phantom JS Web Generator';
|
return 'Phantom JS Web Generator';
|
||||||
else
|
else
|
||||||
return 'SnapPDF PDF Generator';
|
return 'SnapPDF PDF Generator';
|
||||||
|
@ -713,6 +713,19 @@ trait GeneratesCounter
|
|||||||
$replace[] = $client->id_number;
|
$replace[] = $client->id_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$search[] = '{$user_custom1}';
|
||||||
|
$replace[] = $entity->user->custom_value1;
|
||||||
|
|
||||||
|
$search[] = '{$user_custom2}';
|
||||||
|
$replace[] = $entity->user->custom_value2;
|
||||||
|
|
||||||
|
$search[] = '{$user_custom3}';
|
||||||
|
$replace[] = $entity->user->custom_value3;
|
||||||
|
|
||||||
|
$search[] = '{$client_custom4}';
|
||||||
|
$replace[] = $entity->user->custom_value4;
|
||||||
|
|
||||||
|
|
||||||
return str_replace($search, $replace, $pattern);
|
return str_replace($search, $replace, $pattern);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,8 @@ return [
|
|||||||
'enabled_modules' => 32767,
|
'enabled_modules' => 32767,
|
||||||
'phantomjs_key' => env('PHANTOMJS_KEY', 'a-demo-key-with-low-quota-per-ip-address'),
|
'phantomjs_key' => env('PHANTOMJS_KEY', 'a-demo-key-with-low-quota-per-ip-address'),
|
||||||
'phantomjs_secret' => env('PHANTOMJS_SECRET', false),
|
'phantomjs_secret' => env('PHANTOMJS_SECRET', false),
|
||||||
'phantomjs_pdf_generation' => env('PHANTOMJS_PDF_GENERATION', true),
|
'phantomjs_pdf_generation' => env('PHANTOMJS_PDF_GENERATION', false),
|
||||||
|
'pdf_generator' => env('PDF_GENERATOR', false),
|
||||||
'trusted_proxies' => env('TRUSTED_PROXIES', false),
|
'trusted_proxies' => env('TRUSTED_PROXIES', false),
|
||||||
'is_docker' => env('IS_DOCKER', false),
|
'is_docker' => env('IS_DOCKER', false),
|
||||||
'local_download' => env('LOCAL_DOWNLOAD', false),
|
'local_download' => env('LOCAL_DOWNLOAD', false),
|
||||||
@ -173,6 +174,5 @@ return [
|
|||||||
'ninja_default_company_id' => env('NINJA_COMPANY_ID', null),
|
'ninja_default_company_id' => env('NINJA_COMPANY_ID', null),
|
||||||
'ninja_default_company_gateway_id' => env('NINJA_COMPANY_GATEWAY_ID', null),
|
'ninja_default_company_gateway_id' => env('NINJA_COMPANY_GATEWAY_ID', null),
|
||||||
'ninja_hosted_secret' => env('NINJA_HOSTED_SECRET', null),
|
'ninja_hosted_secret' => env('NINJA_HOSTED_SECRET', null),
|
||||||
'pdf_generator' => env('PDF_GENERATOR', false),
|
|
||||||
'internal_queue_enabled' => env('INTERNAL_QUEUE_ENABLED', true),
|
'internal_queue_enabled' => env('INTERNAL_QUEUE_ENABLED', true),
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user