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"))
if (vars.get("$context.currentTemplateType") == DocumentTemplate.types.HTML)
result.string("HTML");
// 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()
|| vars.get("$field.KIND") == $KeywordRegistry.documentTemplateType$mail()))
else if (!vars.get("$field.BINDATA") && (vars.get("$field.CLASSIFICATION") == $KeywordRegistry.documentTemplateTypeCategory$htmlTemplate()))
{
result.string("HTML");
}
......
import("system.logging");
import("Bulkmail_lib");
import("system.text");
import("Employee_lib");
......@@ -8,25 +7,23 @@ import("system.result");
import("system.neon");
import("DocumentTemplate_lib");
var type;
if (!vars.exists("$context.currentTemplateType"))
type = DocumentTemplate.types.TXT;
else
type = vars.get("$context.currentTemplateType");
if (vars.exists("$context.currentTemplateType"))
{
var 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 (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 contactId = EmployeeUtils.getCurrentContactId();
var preview = template.getReplacedContentByContactId(contactId, false, true);
if (type == DocumentTemplate.types.TXT)
result.string(text.text2html(preview, false));
// 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)
{
var template = new DocumentTemplate(util.encodeBase64String(vars.get("$field.Content")), type, "unknown", true)
var contactId = EmployeeUtils.getCurrentContactId();
var preview = template.getReplacedContentByContactId(contactId, false, true);
if (type == DocumentTemplate.types.TXT)
result.string(text.text2html(preview, false));
else
result.string(preview);
}
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