From 40b48b2f9005e134954ae2da20e9663b9a552c37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Thu, 16 Mar 2023 12:13:13 +0300 Subject: [PATCH] close #2627 Enhancement: Invoice viewed mail send several times ( #8669hjurd ) --- app/Listeners/Document/SendDocumentViewNotification.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Listeners/Document/SendDocumentViewNotification.php b/app/Listeners/Document/SendDocumentViewNotification.php index 177bc8c9d..7399b2039 100644 --- a/app/Listeners/Document/SendDocumentViewNotification.php +++ b/app/Listeners/Document/SendDocumentViewNotification.php @@ -18,6 +18,14 @@ class SendDocumentViewNotification public function handle(Event $event) { $document = $event->document; + + if (in_array($documet->status, [ + 'viewed', 'approved', 'received', 'refused', 'partial', 'paid', + 'cancelled', 'voided', 'completed', 'refunded', + ])) { + return; + } + $config = config('type.document.' . $document->type . '.notification'); if (empty($config) || empty($config['class'])) {