diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 6f515dbcf920..1c691f36f577 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -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); diff --git a/app/Jobs/Bank/MatchBankTransactions.php b/app/Jobs/Bank/MatchBankTransactions.php index 31c1e1538059..f2a44c60c809 100644 --- a/app/Jobs/Bank/MatchBankTransactions.php +++ b/app/Jobs/Bank/MatchBankTransactions.php @@ -362,7 +362,7 @@ class MatchBankTransactions implements ShouldQueue $this->invoice ->service() ->applyNumber() - ->touchPdf() + ->deletePdf() ->save(); $payment->ledger() diff --git a/app/Jobs/Util/ReminderJob.php b/app/Jobs/Util/ReminderJob.php index e11234f6785c..879b759204fd 100644 --- a/app/Jobs/Util/ReminderJob.php +++ b/app/Jobs/Util/ReminderJob.php @@ -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); } /** diff --git a/app/PaymentDrivers/BaseDriver.php b/app/PaymentDrivers/BaseDriver.php index 4bad13f054a3..4f2c6807b706 100644 --- a/app/PaymentDrivers/BaseDriver.php +++ b/app/PaymentDrivers/BaseDriver.php @@ -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) { diff --git a/app/Services/Invoice/HandleCancellation.php b/app/Services/Invoice/HandleCancellation.php index fe83909e3e36..2fcd20013fee 100644 --- a/app/Services/Invoice/HandleCancellation.php +++ b/app/Services/Invoice/HandleCancellation.php @@ -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; } diff --git a/app/Services/Invoice/TriggeredActions.php b/app/Services/Invoice/TriggeredActions.php index 7c6e7c4f6ad9..3dae6339b743 100644 --- a/app/Services/Invoice/TriggeredActions.php +++ b/app/Services/Invoice/TriggeredActions.php @@ -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; }