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