From 99e27a32c1c681d685a4f946ee942dd286868233 Mon Sep 17 00:00:00 2001
From: "S.Listl" <S.Listl@SLISTL.aditosoftware.local>
Date: Thu, 23 Apr 2020 15:59:36 +0200
Subject: [PATCH] 1051583 - Bulkmail file type validation

---
 entity/BulkMail_entity/BulkMail_entity.aod    |  4 +++
 .../entityfields/bindata/onValidation.js      | 26 +++++++++----------
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/entity/BulkMail_entity/BulkMail_entity.aod b/entity/BulkMail_entity/BulkMail_entity.aod
index 6df0d2818b..7a97ceae09 100644
--- a/entity/BulkMail_entity/BulkMail_entity.aod
+++ b/entity/BulkMail_entity/BulkMail_entity.aod
@@ -313,6 +313,10 @@
     </entityParameter>
     <entityField>
       <name>templateType</name>
+      <valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/templatetype/valueProcess.js</valueProcess>
+    </entityField>
+    <entityField>
+      <name>templateData</name>
     </entityField>
   </entityFields>
   <recordContainers>
diff --git a/entity/BulkMail_entity/entityfields/bindata/onValidation.js b/entity/BulkMail_entity/entityfields/bindata/onValidation.js
index 3bcd60e91c..cd3a3b03df 100644
--- a/entity/BulkMail_entity/entityfields/bindata/onValidation.js
+++ b/entity/BulkMail_entity/entityfields/bindata/onValidation.js
@@ -1,15 +1,13 @@
-//import("system.translate");
-//import("Bulkmail_lib");
-//import("system.result");
-//import("system.vars");
-//import("Document_lib");
-//
-//var bindata = vars.get("$local.value");
-//if (bindata)
-//{
-//    let mimeType = DocumentUtil.getMimeTypeFromUpload(bindata);
-//    if (!BulkMailUtils.isValidMimeType(mimeType))
-//        result.string(translate.text("Invalid file type"));
-//}
+import("system.translate");
+import("Bulkmail_lib");
+import("system.result");
+import("system.vars");
+import("Document_lib");
 
-//TODO: this should be validated with the code above, waiting for ticket #1042587
\ No newline at end of file
+var bindata = vars.get("$local.value");
+if (bindata)
+{
+    let mimeType = DocumentUtil.getMimeTypeFromUpload(bindata);
+    if (!BulkMailUtils.isValidMimeType(mimeType))
+        result.string(translate.text("Invalid file type; only .html, .eml and .txt are allowed"));
+}
-- 
GitLab