Merge pull request #5105 from turbo124/v5-develop

Improve PDF creation performance
This commit is contained in:
David Bomba 2021-03-12 15:00:50 +11:00 committed by GitHub
commit 4f626ca90d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 479 additions and 343 deletions

View File

@ -25,7 +25,7 @@ DEMO_MODE=false
BROADCAST_DRIVER=log
LOG_CHANNEL=stack
CACHE_DRIVER=file
QUEUE_CONNECTION=database
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
@ -51,7 +51,7 @@ TRUSTED_PROXIES=
NINJA_ENVIRONMENT=selfhost
PHANTOMJS_PDF_GENERATION=false
PHANTOMJS_PDF_GENERATION=true
PHANTOMJS_KEY='a-demo-key-with-low-quota-per-ip-address'
PHANTOMJS_SECRET=secret

View File

@ -1 +1 @@
5.1.18
5.1.19

View File

@ -157,21 +157,21 @@ class InvoiceSum
{
$this->total += $this->total_taxes;
if (is_numeric($this->invoice->custom_value1)) {
$this->total += $this->invoice->custom_value1;
}
// if (is_numeric($this->invoice->custom_value1)) {
// $this->total += $this->invoice->custom_value1;
// }
if (is_numeric($this->invoice->custom_value2)) {
$this->total += $this->invoice->custom_value2;
}
// if (is_numeric($this->invoice->custom_value2)) {
// $this->total += $this->invoice->custom_value2;
// }
if (is_numeric($this->invoice->custom_value3)) {
$this->total += $this->invoice->custom_value3;
}
// if (is_numeric($this->invoice->custom_value3)) {
// $this->total += $this->invoice->custom_value3;
// }
if (is_numeric($this->invoice->custom_value4)) {
$this->total += $this->invoice->custom_value4;
}
// if (is_numeric($this->invoice->custom_value4)) {
// $this->total += $this->invoice->custom_value4;
// }
return $this;
}

View File

@ -166,21 +166,21 @@ class InvoiceSumInclusive
{
//$this->total += $this->total_taxes;
if (is_numeric($this->invoice->custom_value1)) {
$this->total += $this->invoice->custom_value1;
}
// if (is_numeric($this->invoice->custom_value1)) {
// $this->total += $this->invoice->custom_value1;
// }
if (is_numeric($this->invoice->custom_value2)) {
$this->total += $this->invoice->custom_value2;
}
// if (is_numeric($this->invoice->custom_value2)) {
// $this->total += $this->invoice->custom_value2;
// }
if (is_numeric($this->invoice->custom_value3)) {
$this->total += $this->invoice->custom_value3;
}
// if (is_numeric($this->invoice->custom_value3)) {
// $this->total += $this->invoice->custom_value3;
// }
if (is_numeric($this->invoice->custom_value4)) {
$this->total += $this->invoice->custom_value4;
}
// if (is_numeric($this->invoice->custom_value4)) {
// $this->total += $this->invoice->custom_value4;
// }
return $this;
}

View File

@ -134,10 +134,9 @@ class ConnectedAccountController extends BaseController
auth()->user()->save();
//$ct = CompanyUser::whereUserId(auth()->user()->id);
$ct = CompanyUser::whereUserId(auth()->user()->id);
//return $this->listResponse($ct);
return $this->listResponse($ct);
// return $this->listResponse(auth()->user());
return $this->listResponse(auth()->user());
}
return response()

View File

@ -376,6 +376,8 @@ class CreditController extends BaseController
$credit = $this->credit_repository->save($request->all(), $credit);
$credit->service()->deletePdf();
event(new CreditWasUpdated($credit, $credit->company, Ninja::eventVars()));
return $this->itemResponse($credit);

View File

@ -387,6 +387,8 @@ class QuoteController extends BaseController
$quote = $this->quote_repo->save($request->all(), $quote);
$quote->service()->deletePdf();
event(new QuoteWasUpdated($quote, $quote->company, Ninja::eventVars()));
return $this->itemResponse($quote);

View File

@ -374,6 +374,8 @@ class RecurringInvoiceController extends BaseController
$recurring_invoice = $this->recurring_invoice_repo->save($request->all(), $recurring_invoice);
$recurring_invoice->service()->deletePdf()->save();
return $this->itemResponse($recurring_invoice);
}

View File

@ -96,22 +96,6 @@ class CreateAccount
//todo implement SLACK notifications
//$sp035a66->notification(new NewAccountCreated($spaa9f78, $sp035a66))->ninja();
// $nmo = new NinjaMailerObject;
// $nmo->mailable = new NinjaMailer((new AccountCreatedObject($spaa9f78, $sp035a66))->build());
// $nmo->company = $sp035a66;
// $nmo->to_user = $spaa9f78;
// $nmo->settings = $sp035a66->settings;
// $nmo = new NinjaMailerObject;
// $nmo->mailable = new NinjaMailer((new VerifyUserObject($spaa9f78, $sp035a66))->build());
// $nmo->company = $sp035a66;
// $nmo->to_user = $spaa9f78;
// $nmo->settings = $sp035a66->settings;
// NinjaMailerJob::dispatch($nmo);
// NinjaMailerJob::dispatchNow($nmo);
VersionCheck::dispatchNow();
LightLogs::create(new AnalyticsAccountCreated())

View File

@ -88,6 +88,8 @@ class CreditService
{
$this->credit = (new ApplyPayment($this->credit, $invoice, $amount, $payment))->run();
$this->deletePdf();
return $this;
}

View File

@ -44,6 +44,7 @@ class MarkSent
->setStatus(Credit::STATUS_SENT)
->applyNumber()
->adjustBalance($this->credit->amount)
->deletePdf()
->save();

View File

@ -43,6 +43,7 @@ class MarkSent
->service()
->setStatus(Quote::STATUS_SENT)
->applyNumber()
->deletePdf()
->save();
return $this->quote;

View File

@ -39,21 +39,6 @@ class QuoteService
return $this;
}
// public function markApproved()
// {
// $mark_approved = new MarkApproved($this->quote->client);
// $this->quote = $mark_approved->run($this->quote);
// if ($this->quote->client->getSetting('auto_convert_quote') == true) {
// $this->convert();
// }
// $this->markSent()
// ->createInvitations();
// return $this;
// }
public function convert() :self
{
if ($this->quote->invoice_id) {
@ -127,6 +112,7 @@ class QuoteService
->service()
->markSent()
->createInvitations()
->deletePdf()
->save();
}

View File

@ -65,7 +65,7 @@
"predis/predis": "^1.1",
"sentry/sentry-laravel": "^2",
"stripe/stripe-php": "^7.50",
"turbo124/beacon": "^1",
"turbo124/beacon": "^1.0",
"webpatser/laravel-countries": "dev-master#75992ad",
"wildbit/swiftmailer-postmark": "^3.3"
},

713
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', ''),
'app_version' => '5.1.18',
'app_version' => '5.1.19',
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', false),

View File

@ -45,7 +45,7 @@ class BillingSubscriptionApiTest extends TestCase
Model::reguard();
}
public function testExpenseGet()
public function testBillingSubscriptionsGet()
{
$product = Product::factory()->create([
'company_id' => $this->company->id,