mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Merge pull request #4371 from turbo124/authorize_refactor
Fixes for Phantom JS implementation
This commit is contained in:
commit
e99cb4436e
@ -52,8 +52,9 @@ TRUSTED_PROXIES=
|
||||
|
||||
NINJA_ENVIRONMENT=selfhost
|
||||
|
||||
PHANTOMJS_PDF_GENERATION=true
|
||||
PHANTOMJS_KEY='a-demo-key-with-low-quota-per-ip-address'
|
||||
PHANTOMJS_SECRET=
|
||||
PHANTOMJS_SECRET=secret
|
||||
|
||||
COMPOSER_AUTH='{"github-oauth": {"github.com": "${{ secrets.GITHUB_TOKEN }}"}}'
|
||||
SENTRY_LARAVEL_DSN=https://cc7e8e2c678041689e53e409b7dba236@sentry.invoicing.co/5
|
@ -65,6 +65,7 @@ class BaseController extends Controller
|
||||
'company.task_statuses',
|
||||
'company.expense_categories',
|
||||
'company.documents',
|
||||
'company.users',
|
||||
//'company.users.company_user',
|
||||
'company.clients.contacts.company',
|
||||
'company.clients.gateway_tokens',
|
||||
|
@ -87,7 +87,7 @@ class CreateEntityPdf implements ShouldQueue
|
||||
|
||||
public function handle()
|
||||
{
|
||||
if (config('ninja.phantomjs_key')) {
|
||||
if (config('ninja.phantomjs_pdf_generation')) {
|
||||
return (new Phantom)->generate($this->invitation);
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\TaxRate;
|
||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
@ -55,6 +56,11 @@ class CompanyUser extends Pivot
|
||||
return self::class;
|
||||
}
|
||||
|
||||
public function tax_rates()
|
||||
{
|
||||
return $this->hasMany(TaxRate::class,'company_id', 'company_id');
|
||||
}
|
||||
|
||||
public function account()
|
||||
{
|
||||
return $this->belongsTo(Account::class);
|
||||
|
@ -88,8 +88,7 @@ class Phantom
|
||||
{
|
||||
$key = $entity.'_id';
|
||||
|
||||
$invitation_instance = 'App\Models\\'.Str::camel(ucfirst($entity)).'Invitation';
|
||||
|
||||
$invitation_instance = 'App\Models\\'.ucfirst(Str::camel($entity)).'Invitation';
|
||||
$invitation = $invitation_instance::whereRaw('BINARY `key`= ?', [$invitation_key])->first();
|
||||
|
||||
$entity_obj = $invitation->{$entity};
|
||||
@ -115,9 +114,9 @@ class Phantom
|
||||
|
||||
$state = [
|
||||
'template' => $template->elements([
|
||||
'client' => $this->entity->client,
|
||||
'entity' => $this->entity,
|
||||
'pdf_variables' => (array) $this->entity->company->settings->pdf_variables,
|
||||
'client' => $entity_obj->client,
|
||||
'entity' => $entity_obj,
|
||||
'pdf_variables' => (array) $entity_obj->company->settings->pdf_variables,
|
||||
'$product' => $design->design->product,
|
||||
]),
|
||||
'variables' => $html->generateLabelsAndValues(),
|
||||
|
@ -78,9 +78,19 @@ class SystemHealth
|
||||
'simple_db_check' => (bool) self::simpleDbCheck(),
|
||||
'npm_status' => self::checkNpm(),
|
||||
'node_status' => self::checkNode(),
|
||||
'cache_enabled' => self::checkConfigCache(),
|
||||
'phantom_enabled' => (bool) config('ninja.phantomjs_pdf_generation'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function checkConfigCache()
|
||||
{
|
||||
if(env('APP_URL'))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function checkNode()
|
||||
{
|
||||
try {
|
||||
|
@ -29,6 +29,7 @@ return [
|
||||
'enabled_modules' => 32767,
|
||||
'phantomjs_key' => env('PHANTOMJS_KEY', false),
|
||||
'phantomjs_secret' => env('PHANTOMJS_SECRET', false),
|
||||
'phantomjs_pdf_generation' => env('PHANTOMJS_PDF_GENERATION', true),
|
||||
'trusted_proxies' => env('TRUSTED_PROXIES', false),
|
||||
|
||||
'sentry_dsn' => env('SENTRY_LARAVEL_DSN', 'https://9b4e15e575214354a7d666489783904a@sentry.invoicing.co/6'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user