From 77833ec0066d93e657d3a64aa648ad4b993b2818 Mon Sep 17 00:00:00 2001
From: s j <sj@1729.be>
Date: Wed, 26 Aug 2020 07:46:14 +0200
Subject: [PATCH] i5057 only send automatic mail on issue transaction

---
 src/EventSubscriber/ShareTransactionEventSubscriber.php | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/EventSubscriber/ShareTransactionEventSubscriber.php b/src/EventSubscriber/ShareTransactionEventSubscriber.php
index 5ac0fab9..ca46527f 100644
--- a/src/EventSubscriber/ShareTransactionEventSubscriber.php
+++ b/src/EventSubscriber/ShareTransactionEventSubscriber.php
@@ -4,6 +4,7 @@ namespace Drupal\shareholder_register\EventSubscriber;
 
 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 
+use Drupal\shareholder_register\Entity\ShareTransactionGroupType;
 use Drupal\shareholder_register\Event\ShareTransactionEvent;
 use Drupal\shareholder_register\Event\ShareTransactionGroupEvent;
 
@@ -36,6 +37,9 @@ class ShareTransactionEventSubscriber implements EventSubscriberInterface {
    *   The event.
    */
   public function sendShareTransactionMail(ShareTransactionGroupEvent $event) {
+    if ($event->getShareTransactionGroup()->getShareGroupTypeBaseType() !== ShareTransactionGroupType::BASE_ISSUE) {
+      return;
+    }
     if (\Drupal::config('shareholder_register.settings')->get('mail_extract_upon_validation')) {
       foreach ($event->getShareTransactionGroup()->getShareholders() as $shareholder) {
         $shareholder->sendExtractMail();
-- 
GitLab