Skip to content
Snippets Groups Projects
Commit e2f68e03 authored by Sebastian Pongratz's avatar Sebastian Pongratz :ping_pong:
Browse files

Merge branch 'cm_dt_1046178_better_errormsg_missing_asys_binaries' into '2021.0.2'

Cm dt 1046178 better errormsg missing asys binaries

See merge request xrm/basic!796
parents 929fcb85 54355e37
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