From 53badf1f02bf6daf9c9d664e20f802c91090b8bb Mon Sep 17 00:00:00 2001
From: Johannes Hoermann <j.hoermann@adito.de>
Date: Fri, 19 Jul 2019 14:45:38 +0200
Subject: [PATCH] fix txt letter download

---
 process/DocumentTemplate_lib/process.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/process/DocumentTemplate_lib/process.js b/process/DocumentTemplate_lib/process.js
index 898b573bca..1edd203f8a 100644
--- a/process/DocumentTemplate_lib/process.js
+++ b/process/DocumentTemplate_lib/process.js
@@ -1,3 +1,4 @@
+import("system.logging");
 import("Communication_lib");
 import("system.neon");
 import("Employee_lib");
@@ -158,7 +159,10 @@ DocumentTemplate.prototype.getReplacedContent = function (pReplacements)
 DocumentTemplate.prototype.getReplacedContentByContactId = function (pContactId) 
 {
     var replacements = this._getReplacementsByContactIds([pContactId]); 
-    return this.getReplacedContent(replacements[pContactId]);
+    var content = this.getReplacedContent(replacements[pContactId]);
+    
+    logging.log(JSON.stringify(content, null, "\t"))
+    return util.encodeBase64String(content);
 }
 
 /**
@@ -442,7 +446,7 @@ DocumentTemplate.prototype._getReplacedDOCX = function (pReplacements)
     var replacements = {};
     for (let placeholder in pReplacements)  //removes the prefix and postfix, the process needs it like this
         replacements[placeholder.slice(3, -3)] = pReplacements[placeholder];
-    
+
     //this is executed as a process because of better performance
     var documentData = process.execute("getDocxDocument_serverProcess", {
         templateb64: this.content,
-- 
GitLab