diff --git a/entity/SerialLetter_entity/recordcontainers/db/onDBInsert.js b/entity/SerialLetter_entity/recordcontainers/db/onDBInsert.js index 8b5fdc99a8701aa1d4fa95b9fcab9be4359dbd01..b22db286189a867374922dafbfe8893cee329ed0 100644 --- a/entity/SerialLetter_entity/recordcontainers/db/onDBInsert.js +++ b/entity/SerialLetter_entity/recordcontainers/db/onDBInsert.js @@ -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 diff --git a/process/Bulkmail_lib/process.js b/process/Bulkmail_lib/process.js index ed01a6c323b20ac02645adb1d757d883a96db58e..c1fe514fe548e0ce8ecdcbc9264776d6aafe8fd2 100644 --- a/process/Bulkmail_lib/process.js +++ b/process/Bulkmail_lib/process.js @@ -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 +} + + } } /** diff --git a/process/DocumentTemplate_lib/process.js b/process/DocumentTemplate_lib/process.js index 7630a1c2fea10e5f8a2dc64b6de2fcddda44fd91..79562b7f6456483b106022366d8b58a4e8b9ddf2 100644 --- a/process/DocumentTemplate_lib/process.js +++ b/process/DocumentTemplate_lib/process.js @@ -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); }