Skip to content
Snippets Groups Projects
Commit 90f3dc7b authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

fix: html content type wrong

parent d4d384b1
No related branches found
No related tags found
No related merge requests found
...@@ -9,8 +9,7 @@ if (vars.exists("$context.currentTemplateType")) ...@@ -9,8 +9,7 @@ if (vars.exists("$context.currentTemplateType"))
if (vars.get("$context.currentTemplateType") == DocumentTemplate.types.HTML) if (vars.get("$context.currentTemplateType") == DocumentTemplate.types.HTML)
result.string("HTML"); result.string("HTML");
// force HTML for documentTemplateTypeCategory$htmlTemplate and mail if bindata is not set else use type form bindata // force HTML for documentTemplateTypeCategory$htmlTemplate and mail if bindata is not set else use type form bindata
else if (!vars.get("$field.BINDATA") && (vars.get("$field.CLASSIFICATION") == $KeywordRegistry.documentTemplateTypeCategory$htmlTemplate() else if (!vars.get("$field.BINDATA") && (vars.get("$field.CLASSIFICATION") == $KeywordRegistry.documentTemplateTypeCategory$htmlTemplate()))
|| vars.get("$field.KIND") == $KeywordRegistry.documentTemplateType$mail()))
{ {
result.string("HTML"); result.string("HTML");
} }
......
import("system.logging");
import("Bulkmail_lib"); import("Bulkmail_lib");
import("system.text"); import("system.text");
import("Employee_lib"); import("Employee_lib");
...@@ -8,25 +7,23 @@ import("system.result"); ...@@ -8,25 +7,23 @@ import("system.result");
import("system.neon"); import("system.neon");
import("DocumentTemplate_lib"); import("DocumentTemplate_lib");
var type; if (vars.exists("$context.currentTemplateType"))
if (!vars.exists("$context.currentTemplateType")) {
type = DocumentTemplate.types.TXT; var type = vars.get("$context.currentTemplateType");
else
type = vars.get("$context.currentTemplateType");
logging.log(JSON.stringify([type], null, "\t")) // if this was done for every row, like in a lookup, the performance would be very bad
// if this was done for every row, like in a lookup, the performance would be very bad if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET && type != null && type != DocumentTemplate.types.DOCX && type != DocumentTemplate.types.ODT)
if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET && type != null && type != DocumentTemplate.types.DOCX && type != DocumentTemplate.types.ODT) {
{ var template = new DocumentTemplate(util.encodeBase64String(vars.get("$field.Content")), type, "unknown", true)
var template = new DocumentTemplate(util.encodeBase64String(vars.get("$field.Content")), type, "unknown", true)
var contactId = EmployeeUtils.getCurrentContactId();
var contactId = EmployeeUtils.getCurrentContactId(); var preview = template.getReplacedContentByContactId(contactId, false, true);
var preview = template.getReplacedContentByContactId(contactId, false, true);
if (type == DocumentTemplate.types.TXT)
if (type == DocumentTemplate.types.TXT) result.string(text.text2html(preview, false));
result.string(text.text2html(preview, false)); else
result.string(preview);
}
else else
result.string(preview); result.string("");
} }
else
result.string("");
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment