From dbdb9a0b4a7f7749f438d8f7727e575862d11de3 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 7 Dec 2016 12:10:17 +0200 Subject: [PATCH] Don't notify when paid invoices are viewed --- app/Listeners/NotificationListener.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Listeners/NotificationListener.php b/app/Listeners/NotificationListener.php index d18b0a32671b..ad94e5767a61 100644 --- a/app/Listeners/NotificationListener.php +++ b/app/Listeners/NotificationListener.php @@ -80,6 +80,10 @@ class NotificationListener */ public function viewedInvoice(InvoiceInvitationWasViewed $event) { + if ( ! floatval($event->invoice->balance)) { + return; + } + $this->sendEmails($event->invoice, 'viewed'); $this->pushService->sendNotification($event->invoice, 'viewed'); } @@ -89,6 +93,10 @@ class NotificationListener */ public function viewedQuote(QuoteInvitationWasViewed $event) { + if ($event->quote->quote_invoice_id) { + return; + } + $this->sendEmails($event->quote, 'viewed'); $this->pushService->sendNotification($event->quote, 'viewed'); } @@ -118,4 +126,4 @@ class NotificationListener $this->pushService->sendNotification($event->payment->invoice, 'paid'); } -} \ No newline at end of file +}