Skip to content
Snippets Groups Projects
Commit 54355e37 authored by Daniel Tran's avatar Daniel Tran Committed by Sebastian Pongratz
Browse files

[Projekt: xRM-ContactManagement][TicketNr.: 1046178][Bessere Fhelermeldungen,...

[Projekt: xRM-ContactManagement][TicketNr.: 1046178][Bessere Fhelermeldungen, wenn bei den Dokuvorlagen das Template in asys_binaries fehlt]
- Customized sendMail-action to prevent start download .eml after
    error msg that no matching file in ASYS_BINARIES exists for doc-template.
parent 94de5288
No related branches found
No related tags found
No related merge requests found
......@@ -7,5 +7,12 @@ import("system.neon");
var template = DocumentTemplateUtils.getTemplate(vars.get("$field.DOCUMENTTEMPLATEID"), false);
var kind = vars.get("$field.KIND");
if(template.type == DocumentTemplate.types.HTML && kind == $KeywordRegistry.documentTemplateType$textModular() || kind == $KeywordRegistry.documentTemplateType$mail())
result.string(neon.COMPONENTSTATE_EDITABLE);
if (template)
{
if(template.type == DocumentTemplate.types.HTML &&
kind == $KeywordRegistry.documentTemplateType$textModular() ||
kind == $KeywordRegistry.documentTemplateType$mail())
{
result.string(neon.COMPONENTSTATE_EDITABLE);
}
}
......@@ -30,7 +30,7 @@ if (vars.exists("$param.AdditionalPlaceholders_param") && vars.get("$param.Addit
});
}
var eml = EmailWritingUtils.openMailTemplate(
EmailWritingUtils.openMailTemplate(
vars.get("$field.RECIPIENT"),
EmployeeUtils.getCurrentContactId(),
vars.get("$field.DOCUMENT_TEMPLATE"),
......
......@@ -33,6 +33,4 @@ if (template)
}
ActivityUtils.createNewActivity(null, links, null, null, translate.text("Letter"), text.parseDocument(content), $KeywordRegistry.activityDirection$outgoing(), [[template.filename, content, false]]);
}
else
throw new Error("Error while using a document template: The provided template does not contain data.");
\ No newline at end of file
}
\ No newline at end of file
......@@ -34,7 +34,8 @@ function EmailWritingUtils () {}
* @param {Placeholder[]} [pAdditionalPlaceholders] additional placeholders
* @return {Array} the eml document as array with [filename, base64]
*/
EmailWritingUtils.openMailTemplate = function (pToRecipients, pSenderContactId, pTemplateId, pRecipientContactId, pBindata, pAttachments, pSubject, pEmailFilename, pAdditionalPlaceholders)
EmailWritingUtils.openMailTemplate = function (pToRecipients, pSenderContactId, pTemplateId, pRecipientContactId, pBindata, pAttachments, pSubject,
pEmailFilename, pAdditionalPlaceholders)
{
if (pToRecipients && typeof(pToRecipients) == "string")
pToRecipients = [pToRecipients];
......@@ -66,9 +67,13 @@ EmailWritingUtils.openMailTemplate = function (pToRecipients, pSenderContactId,
}
if (pSubject)
{
email.subject = pSubject;
}
var isBinaryExistent = db.getBinaryCount("DOCUMENTTEMPLATE", "DOCUMENT", pTemplateId, SqlUtils.getBinariesAlias(), null);
return email.downloadEML(pEmailFilename);
return isBinaryExistent > 0 ? email.downloadEML(pEmailFilename) : [];
}
......
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