mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 07:54:36 -04:00
Refactors for excessive PDF generation
This commit is contained in:
parent
cf4b87e701
commit
8017b589c2
@ -408,7 +408,7 @@ class InvoiceController extends BaseController
|
|||||||
|
|
||||||
$invoice->service()
|
$invoice->service()
|
||||||
->triggeredActions($request)
|
->triggeredActions($request)
|
||||||
->touchPdf()
|
->deletePdf()
|
||||||
->adjustInventory($old_invoice);
|
->adjustInventory($old_invoice);
|
||||||
|
|
||||||
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||||
@ -740,7 +740,8 @@ class InvoiceController extends BaseController
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'cancel':
|
case 'cancel':
|
||||||
$invoice = $invoice->service()->handleCancellation()->touchPdf()->save();
|
$invoice = $invoice->service()->handleCancellation()->deletePdf()->save();
|
||||||
|
// $invoice = $invoice->service()->handleCancellation()->touchPdf()->save();
|
||||||
|
|
||||||
if (! $bulk) {
|
if (! $bulk) {
|
||||||
$this->itemResponse($invoice);
|
$this->itemResponse($invoice);
|
||||||
|
@ -362,7 +362,7 @@ class MatchBankTransactions implements ShouldQueue
|
|||||||
$this->invoice
|
$this->invoice
|
||||||
->service()
|
->service()
|
||||||
->applyNumber()
|
->applyNumber()
|
||||||
->touchPdf()
|
->deletePdf()
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
$payment->ledger()
|
$payment->ledger()
|
||||||
|
@ -208,7 +208,8 @@ class ReminderJob implements ShouldQueue
|
|||||||
->markSent()
|
->markSent()
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
$invoice->service()->touchPdf(true);
|
//30-6-2023 - fix for duplicate touching
|
||||||
|
// $invoice->service()->touchPdf(true);
|
||||||
|
|
||||||
$enabled_reminder = 'enable_'.$reminder_template;
|
$enabled_reminder = 'enable_'.$reminder_template;
|
||||||
if ($reminder_template == 'endless_reminder') {
|
if ($reminder_template == 'endless_reminder') {
|
||||||
@ -268,7 +269,6 @@ class ReminderJob implements ShouldQueue
|
|||||||
}
|
}
|
||||||
|
|
||||||
return [$late_fee_amount, $late_fee_percent];
|
return [$late_fee_amount, $late_fee_percent];
|
||||||
// return $this->setLateFee($invoice, $late_fee_amount, $late_fee_percent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -525,7 +525,7 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->withTrashed()->get();
|
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->withTrashed()->get();
|
||||||
|
|
||||||
$invoices->each(function ($invoice) {
|
$invoices->each(function ($invoice) {
|
||||||
$invoice->service()->touchPdf();
|
$invoice->service()->deletePdf();
|
||||||
});
|
});
|
||||||
|
|
||||||
$invoices->first()->invitations->each(function ($invitation) use ($nmo) {
|
$invoices->first()->invitations->each(function ($invitation) use ($nmo) {
|
||||||
@ -570,7 +570,7 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->withTrashed()->get();
|
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->withTrashed()->get();
|
||||||
|
|
||||||
$invoices->each(function ($invoice) {
|
$invoices->each(function ($invoice) {
|
||||||
$invoice->service()->touchPdf();
|
$invoice->service()->deletePdf();
|
||||||
});
|
});
|
||||||
|
|
||||||
$invoices->first()->invitations->each(function ($invitation) use ($nmo) {
|
$invoices->first()->invitations->each(function ($invitation) use ($nmo) {
|
||||||
|
@ -44,9 +44,7 @@ class HandleCancellation extends AbstractService
|
|||||||
$this->invoice->balance = 0;
|
$this->invoice->balance = 0;
|
||||||
$this->invoice = $this->invoice->service()->setStatus(Invoice::STATUS_CANCELLED)->save();
|
$this->invoice = $this->invoice->service()->setStatus(Invoice::STATUS_CANCELLED)->save();
|
||||||
|
|
||||||
//adjust client balance
|
|
||||||
$this->invoice->client->service()->updateBalance($adjustment)->save();
|
$this->invoice->client->service()->updateBalance($adjustment)->save();
|
||||||
// $this->invoice->fresh();
|
|
||||||
|
|
||||||
$this->invoice->service()->workFlow()->save();
|
$this->invoice->service()->workFlow()->save();
|
||||||
|
|
||||||
@ -54,16 +52,6 @@ class HandleCancellation extends AbstractService
|
|||||||
|
|
||||||
event('eloquent.updated: App\Models\Invoice', $this->invoice);
|
event('eloquent.updated: App\Models\Invoice', $this->invoice);
|
||||||
|
|
||||||
$transaction = [
|
|
||||||
'invoice' => $this->invoice->transaction_event(),
|
|
||||||
'payment' => [],
|
|
||||||
'client' => $this->invoice->client->transaction_event(),
|
|
||||||
'credit' => [],
|
|
||||||
'metadata' => [],
|
|
||||||
];
|
|
||||||
|
|
||||||
// TransactionLog::dispatch(TransactionEvent::INVOICE_CANCELLED, $transaction, $this->invoice->company->db);
|
|
||||||
|
|
||||||
return $this->invoice;
|
return $this->invoice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ class TriggeredActions extends AbstractService
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->request->has('send_email') && $this->request->input('send_email') == 'true') {
|
if ($this->request->has('send_email') && $this->request->input('send_email') == 'true') {
|
||||||
$this->invoice->service()->markSent()->touchPdf()->save();
|
$this->invoice->service()->markSent()->save();
|
||||||
$this->sendEmail();
|
$this->sendEmail();
|
||||||
$this->updated = false;
|
$this->updated = false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user