Skip to content
Snippets Groups Projects
Commit 8c2c0333 authored by Benjamin Ulrich's avatar Benjamin Ulrich :speech_balloon:
Browse files

Merge branch '1051275_FixSerialLetter' into '2020.0'

1051275 fix serial letter

See merge request xrm/basic!122
parents d6713f3f 9b6f2b3b
No related branches found
No related tags found
No related merge requests found
......@@ -14,5 +14,5 @@ var template = DocumentTemplate.fromUpload(bindata);
if (template.content)
{
SingleBinaryUtils.insert("SERIALLETTER", "DOCUMENT", letterId, template.content, template.filename, "");
SingleBinaryUtils.insert("SERIALLETTER", "SERIALLETTERFILE", letterId, template.content, template.filename, "");
}
\ No newline at end of file
......@@ -431,12 +431,18 @@ SerialLetterUtils.buildSerialLetter = function (pSerialLetterId, pRecipientIds)
contactIdsSelect.and("LETTERRECIPIENT.LETTERRECIPIENTID", pRecipientIds, SqlBuilder.IN());
var contactIds = contactIdsSelect.table();
if(template != null){
return {
content : template.getSerialLetterByContactIds(contactIds),
content : template.content,
filename : template.filename,
title : title
};
};}
else{
return{
title : title
}
}
}
/**
......
......@@ -256,7 +256,13 @@ DocumentTemplate.loadTemplate = function (pAssignmentRowId, pAssignmentTable, pR
var template = DocumentTemplateUtils.getTemplate(templateId, pResolveSubtemplates);
if (template == null)
{
question.showMessage(translate.text("File from this template could not be found anymore. Please go to the template and upload a new file."), question.ERROR, translate.text("Error"));
if(vars.getString("$sys.isserver") == "true")
throw new Error("loadTemplate: File from this template could not be found anymore. "
+ "Please go to the template and upload a new file. TemplateID: '" + templateId + "'")
else
question.showMessage(translate.text("File from this template could not be found anymore. "
+ "Please go to the template and upload a new file."), question.ERROR, translate.text("Error"));
return null;
}
}
......@@ -269,7 +275,8 @@ DocumentTemplate.loadTemplate = function (pAssignmentRowId, pAssignmentTable, pR
var mimeType = templateDocument[0][db.BINARY_MIMETYPE];
var type = DocumentTemplate.types.fromBinaryMetadata(templateDocument[0]);
if (pResolveSubtemplates == undefined) pResolveSubtemplates = true;
if (pResolveSubtemplates == undefined)
pResolveSubtemplates = true;
return new DocumentTemplate(db.getBinaryContent(binaryId, alias), type, filename, pResolveSubtemplates, templateId, mimeType);
}
......
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