From 0b8bf4fbf1e4138b6d7090765732f8c080b5322f Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 17 Feb 2021 00:31:00 +1100 Subject: [PATCH] Remove invoice deletion observer --- app/Jobs/Entity/EmailEntity.php | 5 +---- app/Observers/InvoiceObserver.php | 2 +- app/Services/Credit/ApplyPayment.php | 2 +- app/Services/Invoice/InvoiceService.php | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/Jobs/Entity/EmailEntity.php b/app/Jobs/Entity/EmailEntity.php index 5711d5dccdef..3c35ba56d5aa 100644 --- a/app/Jobs/Entity/EmailEntity.php +++ b/app/Jobs/Entity/EmailEntity.php @@ -38,7 +38,7 @@ use Illuminate\Support\Str; /*Multi Mailer implemented*/ -class EmailEntity extends BaseMailerJob implements ShouldQueue +class EmailEntity implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; @@ -105,9 +105,6 @@ class EmailEntity extends BaseMailerJob implements ShouldQueue /* Set DB */ MultiDB::setDB($this->company->db); - /* Set the correct mail driver */ - $this->setMailDriver(); - $nmo = new NinjaMailerObject; $nmo->mailable = new TemplateEmail($this->email_entity_builder,$this->invitation->contact); $nmo->company = $this->company; diff --git a/app/Observers/InvoiceObserver.php b/app/Observers/InvoiceObserver.php index 14f5aa9c68de..260629be76d5 100644 --- a/app/Observers/InvoiceObserver.php +++ b/app/Observers/InvoiceObserver.php @@ -52,7 +52,7 @@ class InvoiceObserver WebhookHandler::dispatch(Webhook::EVENT_UPDATE_INVOICE, $invoice, $invoice->company); } - UnlinkFile::dispatchNow(config('filesystems.default'), $invoice->client->invoice_filepath() . $invoice->number.'.pdf'); + // UnlinkFile::dispatchNow(config('filesystems.default'), $invoice->client->invoice_filepath() . $invoice->number.'.pdf'); } diff --git a/app/Services/Credit/ApplyPayment.php b/app/Services/Credit/ApplyPayment.php index 40a6652e1e71..e97e38c3854b 100644 --- a/app/Services/Credit/ApplyPayment.php +++ b/app/Services/Credit/ApplyPayment.php @@ -147,7 +147,7 @@ class ApplyPayment event(new InvoiceWasUpdated($this->invoice, $this->invoice->company, Ninja::eventVars())); if ((int)$this->invoice->balance == 0) { - // $this->invoice->service()->deletePdf(); + $this->invoice->service()->deletePdf(); event(new InvoiceWasPaid($this->invoice, $payment, $this->payment->company, Ninja::eventVars())); } } diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index ccaa2e929954..b45e5eb19b6e 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -266,7 +266,7 @@ class InvoiceService //$this->invoice = $this->invoice->calc()->getInvoice(); - // $this->deletePdf(); + $this->deletePdf(); return $this; }