From d6c65f9e2d9585244dc75b3b42c36e61424451c7 Mon Sep 17 00:00:00 2001 From: "p.neub" <p.neub@adito.de> Date: Wed, 17 Nov 2021 14:17:57 +0100 Subject: [PATCH] =?UTF-8?q?[Projekt:=20xRM-Sales][TicketNr.:=201077547][An?= =?UTF-8?q?gebots-Email=20=C3=BCber=20EmailWritingUtils.sendReportAsMail()?= =?UTF-8?q?:=20Anh=C3=A4nge=20eines=20Email=20Templates=20werden=20=C3=BCb?= =?UTF-8?q?erschrieben,=20wenn=20das=20Angebot=20als=20Anhang=20=C3=BCberg?= =?UTF-8?q?eben=20wird.]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- process/Email_lib/process.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/process/Email_lib/process.js b/process/Email_lib/process.js index 1988968dd9..e70f94f853 100644 --- a/process/Email_lib/process.js +++ b/process/Email_lib/process.js @@ -40,7 +40,9 @@ EmailWritingUtils.openMailTemplate = function (pToRecipients, pSenderContactId, pEmailFilename, pAdditionalPlaceholders) { if (pToRecipients && typeof(pToRecipients) == "string") + { pToRecipients = [pToRecipients]; + } var email, retVal, isBinaryExistent; isBinaryExistent = db.getBinaryCount("DOCUMENTTEMPLATE", "DOCUMENT", pTemplateId, SqlUtils.getBinariesAlias(), null); @@ -49,7 +51,9 @@ EmailWritingUtils.openMailTemplate = function (pToRecipients, pSenderContactId, { email = Email.fromTemplate(pTemplateId, pRecipientContactId, pBindata, pAdditionalPlaceholders); if (!email) + { email = new Email(); + } } else { @@ -58,8 +62,10 @@ EmailWritingUtils.openMailTemplate = function (pToRecipients, pSenderContactId, email.setSender(pSenderContactId); - if (pToRecipients) + if (pToRecipients) + { email.toRecipients = pToRecipients; + } email.bccRecipients = [EmailWritingUtils.getMailbridgeAddress()]; @@ -68,8 +74,10 @@ EmailWritingUtils.openMailTemplate = function (pToRecipients, pSenderContactId, for (var i = 0; i < pAttachments.length; i++) { if (pAttachments[i] != null || pAttachments[i] != "") - email.attachmentTemplates[i] = pAttachments[i]; - } + { + email.attachmentTemplates.push(pAttachments[i]); + } + } } if (pSubject) -- GitLab