Improve PDF creation performance

This commit is contained in:
David Bomba 2021-03-10 21:00:18 +11:00
parent 853ca8fa94
commit b9c9874533
7 changed files with 11 additions and 15 deletions

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

@ -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();
}