From 389377f793428d10b6b7ba00b462ce7c84734eed Mon Sep 17 00:00:00 2001
From: Thibault Dockx <thibault.dockx@fusiondirectory.org>
Date: Tue, 10 May 2022 17:29:52 +0100
Subject: [PATCH] :sparkles: Feat(MailTemplate) - Removes mail list

Mail list will be implemented within Task object
---
 contrib/openldap/core-fd.schema               |  8 +----
 .../class_mailTemplateInvitations.inc         | 36 ++-----------------
 2 files changed, 4 insertions(+), 40 deletions(-)

diff --git a/contrib/openldap/core-fd.schema b/contrib/openldap/core-fd.schema
index b74c4544e..a8a66c11c 100644
--- a/contrib/openldap/core-fd.schema
+++ b/contrib/openldap/core-fd.schema
@@ -251,12 +251,6 @@ attributetype ( 1.3.6.1.4.1.38414.88.1.26 NAME 'fdMTInvitationReplyTo'
   SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
   SINGLE-VALUE )
 
-attributetype ( 1.3.6.1.4.1.38414.88.1.27 NAME 'fdMTInvitationEmailList'
-  DESC 'FusionDirectory - Lists of emails registered - received'
-  EQUALITY caseExactMatch
-  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
-  SINGLE-VALUE )
-
 # Classes
 
 objectclass ( 1.3.6.1.4.1.10098.1.2.1.19.4 NAME 'gosaDepartment' SUP top AUXILIARY
@@ -329,4 +323,4 @@ objectclass ( 1.3.6.1.4.1.38414.88.2.5 NAME 'fdMailTemplateInvitations'
   DESC 'FusionDirectory mail template Invitations'
   SUP top AUXILIARY
   MUST ( cn $ fdMTInvitationEmailSubject $ fdMTInvitationEmailContent)
-  MAY ( fdMTInvitationReplyTo $ fdMTInvitationEmailList ) )
+  MAY ( fdMTInvitationReplyTo ) )
diff --git a/plugins/addons/mailtemplate/class_mailTemplateInvitations.inc b/plugins/addons/mailtemplate/class_mailTemplateInvitations.inc
index 131988663..f33c3fac7 100644
--- a/plugins/addons/mailtemplate/class_mailTemplateInvitations.inc
+++ b/plugins/addons/mailtemplate/class_mailTemplateInvitations.inc
@@ -52,24 +52,14 @@ class mailTemplateInvitations extends simplePlugin
           new TextAreaAttribute(
             _('Email content'), _('Content of the email sent for this invitation'),
             'fdMTInvitationEmailContent', TRUE,
-            'A default Email here - was previously fetched by default configuration'
+            'A default Email here - was previously fetched by default configuration - %token%'
           ),
-        ]
-      ],
-      'emails' => [
-        'name'  => _('Emails'),
-        'attrs' => [
-          new StringAttribute(
+         new StringAttribute(
             _('Reply to'), _('Email address set as "Reply to" in the sent emails'),
             'fdMTInvitationReplyTo', FALSE
           ),
-          new FileTextAreaAttribute(
-            _('Emails'), _('List of email adresses of people to invite - one per line'),
-            'fdMTInvitationEmailList', FALSE,
-            '.txt', TRUE, FALSE
-          ),
         ]
-      ]
+      ],
     ];
   }
 
@@ -79,24 +69,4 @@ class mailTemplateInvitations extends simplePlugin
     parent::__construct($dn, $object, $parent, $mainTab);
   }
 
-  /*
-   *  Used to verify if the list of emails imported by the mails_file are correct emails format.
-   *
-   */
-  function check (): array
-  {
-    $errors = parent::check();
-
-    $emails = explode("\n", $this->fdMTInvitationEmailList);
-    foreach ($emails as $email) {
-      if (!tests::is_email($email)) {
-        $errors[] = new SimplePluginCheckError(
-          $this->attributesAccess['fdMTInvitationEmailList'],
-          htmlescape(sprintf(_('"%s" is not a valid email address'), $email))
-        );
-      }
-    }
-
-    return $errors;
-  }
 }
-- 
GitLab