mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -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()
|
||||
->triggeredActions($request)
|
||||
->touchPdf()
|
||||
->deletePdf()
|
||||
->adjustInventory($old_invoice);
|
||||
|
||||
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
@ -740,7 +740,8 @@ class InvoiceController extends BaseController
|
||||
}
|
||||
break;
|
||||
case 'cancel':
|
||||
$invoice = $invoice->service()->handleCancellation()->touchPdf()->save();
|
||||
$invoice = $invoice->service()->handleCancellation()->deletePdf()->save();
|
||||
// $invoice = $invoice->service()->handleCancellation()->touchPdf()->save();
|
||||
|
||||
if (! $bulk) {
|
||||
$this->itemResponse($invoice);
|
||||
|
@ -362,7 +362,7 @@ class MatchBankTransactions implements ShouldQueue
|
||||
$this->invoice
|
||||
->service()
|
||||
->applyNumber()
|
||||
->touchPdf()
|
||||
->deletePdf()
|
||||
->save();
|
||||
|
||||
$payment->ledger()
|
||||
|
@ -208,7 +208,8 @@ class ReminderJob implements ShouldQueue
|
||||
->markSent()
|
||||
->save();
|
||||
|
||||
$invoice->service()->touchPdf(true);
|
||||
//30-6-2023 - fix for duplicate touching
|
||||
// $invoice->service()->touchPdf(true);
|
||||
|
||||
$enabled_reminder = 'enable_'.$reminder_template;
|
||||
if ($reminder_template == 'endless_reminder') {
|
||||
@ -268,7 +269,6 @@ class ReminderJob implements ShouldQueue
|
||||
}
|
||||
|
||||
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->each(function ($invoice) {
|
||||
$invoice->service()->touchPdf();
|
||||
$invoice->service()->deletePdf();
|
||||
});
|
||||
|
||||
$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->each(function ($invoice) {
|
||||
$invoice->service()->touchPdf();
|
||||
$invoice->service()->deletePdf();
|
||||
});
|
||||
|
||||
$invoices->first()->invitations->each(function ($invitation) use ($nmo) {
|
||||
|
@ -44,9 +44,7 @@ class HandleCancellation extends AbstractService
|
||||
$this->invoice->balance = 0;
|
||||
$this->invoice = $this->invoice->service()->setStatus(Invoice::STATUS_CANCELLED)->save();
|
||||
|
||||
//adjust client balance
|
||||
$this->invoice->client->service()->updateBalance($adjustment)->save();
|
||||
// $this->invoice->fresh();
|
||||
|
||||
$this->invoice->service()->workFlow()->save();
|
||||
|
||||
@ -54,16 +52,6 @@ class HandleCancellation extends AbstractService
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ class TriggeredActions extends AbstractService
|
||||
}
|
||||
|
||||
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->updated = false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user