From 67142a91b39b6a2957077696d86b6cd9d396243d Mon Sep 17 00:00:00 2001
From: Johannes Hoermann <j.hoermann@adito.de>
Date: Tue, 3 Sep 2019 09:45:33 +0200
Subject: [PATCH] fix mails

---
 .../basic/init/data/defaultBlob/mailServerIMAP.xml         | 7 +++++--
 process/DocumentTemplate_lib/process.js                    | 4 ++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/.liquibase/_____SYSTEMALIAS/basic/init/data/defaultBlob/mailServerIMAP.xml b/.liquibase/_____SYSTEMALIAS/basic/init/data/defaultBlob/mailServerIMAP.xml
index bdab62bfe2..783efb1f10 100644
--- a/.liquibase/_____SYSTEMALIAS/basic/init/data/defaultBlob/mailServerIMAP.xml
+++ b/.liquibase/_____SYSTEMALIAS/basic/init/data/defaultBlob/mailServerIMAP.xml
@@ -1,9 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<aliasConfig xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/aliasConfig/1.1.1">
+<aliasConfig xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/aliasConfig/1.1.2">
   <name>mailServerIMAP_default</name>
   <serverId>default</serverId>
   <definitionName>mailServerIMAP</definitionName>
   <aliasConfigSub>
-    <aliasSubMailserverImap />
+    <aliasSubMailserverImap>
+      <host>localhost</host>
+      <smtpHost>localhost</smtpHost>
+    </aliasSubMailserverImap>
   </aliasConfigSub>
 </aliasConfig>
diff --git a/process/DocumentTemplate_lib/process.js b/process/DocumentTemplate_lib/process.js
index 8bd0c76490..a3d6b55605 100644
--- a/process/DocumentTemplate_lib/process.js
+++ b/process/DocumentTemplate_lib/process.js
@@ -67,7 +67,7 @@ DocumentTemplate.prototype.toString = function ()
 
 DocumentTemplate.prototype._resolveEmbeddedTemplate = function ()
 {    
-    if (this.type == DocumentTemplate.types.PLAIN || this.type == DocumentTemplate.types.TXT || this.type == DocumentTemplate.types.HTML)
+    if (this.content != null && (this.type == DocumentTemplate.types.PLAIN || this.type == DocumentTemplate.types.TXT || this.type == DocumentTemplate.types.HTML))
     {
         var replacedContent = "";
         if (this.type == DocumentTemplate.types.PLAIN)
@@ -111,7 +111,7 @@ DocumentTemplate.prototype._resolveEmbeddedTemplate = function ()
 
         // Note: some embedded templates in embedded templates may be replaced, but this is NOT SUPPORTED, as it only works if the second template is not already replaced at that time.
         placeholders.forEach(function(pPlaceholder) {
-            replacedContent = replacedContent.replace("{@" + pPlaceholder[0] + "@}", pPlaceholder[1])
+            replacedContent = replacedContent.replace("{@" + pPlaceholder[0] + "@}", pPlaceholder[1], "g")
         }, this);
         
         this.content = util.encodeBase64String(replacedContent);
-- 
GitLab