diff --git a/entity/BulkMail_entity/entityfields/content/contentTypeProcess.js b/entity/BulkMail_entity/entityfields/content/contentTypeProcess.js index 49308df2f63a8fe57518af58217c92ea93baac4f..8f43fce9661f887d40adc8465b2cc2dedfe7209d 100644 --- a/entity/BulkMail_entity/entityfields/content/contentTypeProcess.js +++ b/entity/BulkMail_entity/entityfields/content/contentTypeProcess.js @@ -5,6 +5,6 @@ import("Document_lib"); import("system.vars"); import("DocumentTemplate_lib"); -result.string(vars.get("$context.currentTemplateType") == DocumentTemplate.types.TXT +result.string(vars.exists("$context.currentTemplateType") && vars.get("$context.currentTemplateType") == DocumentTemplate.types.TXT ? "LONG_TEXT" : "HTML"); \ No newline at end of file diff --git a/entity/BulkMail_entity/entityfields/content/displayValueProcess.js b/entity/BulkMail_entity/entityfields/content/displayValueProcess.js index eb9e6ef7f14579906731e58e54c7a667389e92ab..577d092a84b9b39993e248f77556bfce72e91c6d 100644 --- a/entity/BulkMail_entity/entityfields/content/displayValueProcess.js +++ b/entity/BulkMail_entity/entityfields/content/displayValueProcess.js @@ -8,7 +8,7 @@ import("system.neon"); import("DocumentTemplate_lib"); // 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) +if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET && vars.get("$field.content")) { var template = new DocumentTemplate(util.encodeBase64String(vars.get("$field.content")), vars.get("$context.currentTemplateType"), undefined, true) diff --git a/entity/BulkMail_entity/entityfields/content/stateProcess.js b/entity/BulkMail_entity/entityfields/content/stateProcess.js index d48b2b6f0074a0be65f266402613082c57db6f84..1debaa69264cc6c3811a17bee2e16a40f1fe368c 100644 --- a/entity/BulkMail_entity/entityfields/content/stateProcess.js +++ b/entity/BulkMail_entity/entityfields/content/stateProcess.js @@ -4,7 +4,7 @@ import("system.neon"); import("DocumentTemplate_lib"); // in edit mode -if (vars.get("$sys.recordstate") != neon.OPERATINGSTATE_VIEW && +if (vars.get("$sys.recordstate") != neon.OPERATINGSTATE_VIEW && vars.exists("$context.currentTemplateType") && (vars.get("$context.currentTemplateType") == DocumentTemplate.types.EML || vars.get("$context.currentTemplateType") == DocumentTemplate.types.HTML)) // TODO: invisible for html as there are problems with images which are removed by the html-editor { diff --git a/entity/BulkMail_entity/entityfields/name/valueProcess.js b/entity/BulkMail_entity/entityfields/name/valueProcess.js index 829431cf9f199070dbd735ea9f6e391d49b59599..adb0f3d6b2fdf8627655ec017e6eba58491048a7 100644 --- a/entity/BulkMail_entity/entityfields/name/valueProcess.js +++ b/entity/BulkMail_entity/entityfields/name/valueProcess.js @@ -12,7 +12,7 @@ if (!vars.get("$this.value") && vars.get("$sys.recordstate") == neon.OPERATINGST var filename = DocumentUtil.getFilenameFromUpload(upload); result.string(filename.split(".")[0]); } - else + else if (vars.get("$field.DOCUMENTTEMPLATE_ID")) { var conf = entities.createConfigForLoadingRows(); conf.entity("DocumentTemplate_entity") diff --git a/entity/BulkMail_entity/recordcontainers/db/onDBInsert.js b/entity/BulkMail_entity/recordcontainers/db/onDBInsert.js index a7026f989684e2ce27c21a14c15bf5bcc7a2a5a0..e8fcb2f9e54fb381889575657f6a15b92d834051 100644 --- a/entity/BulkMail_entity/recordcontainers/db/onDBInsert.js +++ b/entity/BulkMail_entity/recordcontainers/db/onDBInsert.js @@ -20,7 +20,7 @@ var bulkMailName = rowdata["BULKMAIL.NAME"]; var template = DocumentTemplate.getSelectedTemplate(templateId, new FileUpload(bindata), content, DocumentTemplate.types.HTML); -if (template && template.content) +if (template && template.content && BulkMailUtils.isValidTemplateType(template.type)) { if (!template.filename) template.filename = bulkMailName + ".html"; diff --git a/entity/BulkMail_entity/recordcontainers/db/onDBUpdate.js b/entity/BulkMail_entity/recordcontainers/db/onDBUpdate.js index 3d3fb01019622a4e43ae0bcbb5496b5508ae7cf9..258fff593db6fdfa4ccdb6698685066edeef7424 100644 --- a/entity/BulkMail_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/BulkMail_entity/recordcontainers/db/onDBUpdate.js @@ -20,7 +20,7 @@ var bulkMailName = rowdata["BULKMAIL.NAME"]; var template = DocumentTemplate.getSelectedTemplate(templateId, new FileUpload(bindata), content, DocumentTemplate.types.HTML); -if (template && template.content) +if (template && template.content && BulkMailUtils.isValidTemplateType(template.type)) { if (!template.filename) template.filename = bulkMailName + ".html";