diff --git a/app/Http/Controllers/PreviewController.php b/app/Http/Controllers/PreviewController.php index 710fdfa761..e5a55fb19c 100644 --- a/app/Http/Controllers/PreviewController.php +++ b/app/Http/Controllers/PreviewController.php @@ -380,11 +380,11 @@ class PreviewController extends BaseController 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)); } - 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)); } diff --git a/app/Utils/SystemHealth.php b/app/Utils/SystemHealth.php index 4e61b40a36..4a25261fc2 100644 --- a/app/Utils/SystemHealth.php +++ b/app/Utils/SystemHealth.php @@ -89,9 +89,9 @@ class SystemHealth 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'; - elseif(config('ninja.phantomjs_pdf_generation')) + elseif(config('ninja.phantomjs_pdf_generation') || config('ninja.pdf_generator') == 'phantom') return 'Phantom JS Web Generator'; else return 'SnapPDF PDF Generator'; diff --git a/app/Utils/Traits/GeneratesCounter.php b/app/Utils/Traits/GeneratesCounter.php index 3877bdf408..591dd49a98 100644 --- a/app/Utils/Traits/GeneratesCounter.php +++ b/app/Utils/Traits/GeneratesCounter.php @@ -713,6 +713,19 @@ trait GeneratesCounter $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); } } diff --git a/config/ninja.php b/config/ninja.php index e697e07143..ad3356e0a7 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -33,7 +33,8 @@ return [ 'enabled_modules' => 32767, 'phantomjs_key' => env('PHANTOMJS_KEY', 'a-demo-key-with-low-quota-per-ip-address'), '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), 'is_docker' => env('IS_DOCKER', false), 'local_download' => env('LOCAL_DOWNLOAD', false), @@ -173,6 +174,5 @@ return [ 'ninja_default_company_id' => env('NINJA_COMPANY_ID', null), 'ninja_default_company_gateway_id' => env('NINJA_COMPANY_GATEWAY_ID', null), 'ninja_hosted_secret' => env('NINJA_HOSTED_SECRET', null), - 'pdf_generator' => env('PDF_GENERATOR', false), 'internal_queue_enabled' => env('INTERNAL_QUEUE_ENABLED', true), ];