diff --git a/entity/Email_entity/Email_entity.aod b/entity/Email_entity/Email_entity.aod index a7ea7ade389a054472a5a1a3d8f4cfbc19a8b555..b328022e7bb7911735abc0e14869cb594e133bce 100644 --- a/entity/Email_entity/Email_entity.aod +++ b/entity/Email_entity/Email_entity.aod @@ -103,6 +103,14 @@ <name>NotificationMsg_param</name> <expose v="true" /> </entityParameter> + <entityField> + <name>subject</name> + <title>Subject</title> + </entityField> + <entityParameter> + <name>EmailFilename</name> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <jDitoRecordContainer> diff --git a/entity/Email_entity/recordcontainers/jdito/onInsert.js b/entity/Email_entity/recordcontainers/jdito/onInsert.js index 6452af3ccd2e7b4c3f51aaaac14a19f5be2f37ca..b266465e5e7d8102995d9f786ab61d9c84080438 100644 --- a/entity/Email_entity/recordcontainers/jdito/onInsert.js +++ b/entity/Email_entity/recordcontainers/jdito/onInsert.js @@ -12,8 +12,10 @@ import("system.question"); var attachments = JSON.parse(vars.get("$param.Attachments_param")); var senderContactId = vars.get("$param.ContactId_param"); var bindata = new FileUpload(vars.get("$field.bindata")); +var emailFilename = vars.get("$param.EmailFilename"); var notificationMsg = vars.get("$param.NotificationMsg_param"); var notificationTitle = translate.text("Offer status changed"); +var subject = vars.get("$field.subject"); var eml = EmailWritingUtils.openMailTemplate( vars.get("$field.RECIPIENT"), @@ -21,7 +23,9 @@ var eml = EmailWritingUtils.openMailTemplate( vars.get("$field.DOCUMENT_TEMPLATE"), senderContactId, bindata, - attachments + attachments, + subject, + emailFilename ); diff --git a/entity/Offer_entity/entityfields/offerreportdispatch/children/dispatchofferreport/onActionProcess.js b/entity/Offer_entity/entityfields/offerreportdispatch/children/dispatchofferreport/onActionProcess.js index c85acd3d4472ebd96a741c7fbffe07198f7acf72..fbd11f7034742ee93fa02bf571013cf7cfcafe3a 100644 --- a/entity/Offer_entity/entityfields/offerreportdispatch/children/dispatchofferreport/onActionProcess.js +++ b/entity/Offer_entity/entityfields/offerreportdispatch/children/dispatchofferreport/onActionProcess.js @@ -2,6 +2,7 @@ import("system.question"); import("system.translate"); import("system.vars"); import("KeywordRegistry_basic"); +import("system.translate"); import("Offer_lib"); import("Email_lib"); import("Sql_lib"); @@ -11,16 +12,17 @@ var attachmentArray = new Array(); var notificationMsg = translate.text("The status of the offer was changed to \"Sent\"."); var contactId = vars.get("$field.CONTACT_ID"); var arrayReport = OfferUtils.buildOfferReport(vars.get("$field.OFFERID")); +var emailFilename = translate.text("Offerrequest"); if (vars.get("$field.CONTACT_ID") == null || "") contactId = vars.get("$field.CONTACT_ORG_ID"); offerReport.content = arrayReport[1]; offerReport.contentType = "application/pdf"; -offerReport.filename = vars.get("$field.#CONTENTTITLE") + ".pdf"; +offerReport.filename = translate.text("Offer No.") + vars.get("$field.#CONTENTTITLE") + ".pdf"; attachmentArray[0] = offerReport; -EmailWritingUtils.sendReportAsMail(contactId, attachmentArray, "Offer", notificationMsg); +EmailWritingUtils.sendReportAsMail(contactId, attachmentArray, "Offer", notificationMsg, emailFilename); newWhere("OFFER.OFFERID", "$field.OFFERID") .updateData(true, "OFFER", ["STATUS"], null, [$KeywordRegistry.offerStatus$sent()]); diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index 943e1a53d4505e5ba4300c2e7e0e9f0806ef8819..105398a706ff0386ecf6d5bce687eb9c36da69be 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -6761,6 +6761,18 @@ <entry> <key>set New</key> </entry> + <entry> + <key>Offer No.</key> + </entry> + <entry> + <key>Version %0</key> + </entry> + <entry> + <key>Offerrequest</key> + </entry> + <entry> + <key>data</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> <sqlModels> diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index ef31478f17331c03d6c0c271c2dcd39f7df36de2..6975e70487dbd3250e2b76293bf4b690a2703613 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -8667,6 +8667,20 @@ Bitte Datumseingabe prüfen</value> <key>set New</key> <value>Neu setzen</value> </entry> + <entry> + <key>Offer No.</key> + <value>Angebots Nr.</value> + </entry> + <entry> + <key>Version %0</key> + </entry> + <entry> + <key>Offerrequest</key> + <value>Angebotsanfrage</value> + </entry> + <entry> + <key>data</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index ff938e76359f7cc571ca481a09f2d6b57d591f1d..a395b703c587a2094728d8f0496b0533b29995a9 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -6826,6 +6826,18 @@ <entry> <key>set New</key> </entry> + <entry> + <key>Offer No.</key> + </entry> + <entry> + <key>Version %0</key> + </entry> + <entry> + <key>Offerrequest</key> + </entry> + <entry> + <key>data</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/neonView/EmailEdit_view/EmailEdit_view.aod b/neonView/EmailEdit_view/EmailEdit_view.aod index 2585eb06279fc9f64f287e5f8be89c7b1f31f21e..2e045348b8c9b47c1a7950cc340c4ef62ca1894b 100644 --- a/neonView/EmailEdit_view/EmailEdit_view.aod +++ b/neonView/EmailEdit_view/EmailEdit_view.aod @@ -22,6 +22,10 @@ <name>72441756-f00d-42a7-bd3f-a6f7964891bc</name> <entityField>DOCUMENT_TEMPLATE</entityField> </entityFieldLink> + <entityFieldLink> + <name>6a72f9a6-f2fd-4a78-b1f9-2aca59cb25a1</name> + <entityField>subject</entityField> + </entityFieldLink> </fields> </genericViewTemplate> <actionsViewTemplate> diff --git a/process/Email_lib/process.js b/process/Email_lib/process.js index 8cb3bf65267d94c6979b25f3aec55bef66dacf56..131538d01f20e9e2603f83062254e5b8fbbbd3fc 100644 --- a/process/Email_lib/process.js +++ b/process/Email_lib/process.js @@ -26,9 +26,10 @@ function EmailWritingUtils () {} * @param {String} [pRecipientContactId] contactId of the recipient, required to fill placeholders * @param {String} [pBindata] base64 binary data * @param {Array} [pAttachments] attachments in a array (base64 encoded). + * @param {String} pSubject an optional subject. * @return {Array} the eml document as array with [filename, base64] */ -EmailWritingUtils.openMailTemplate = function (pToRecipients, pSenderContactId, pTemplateId, pRecipientContactId, pBindata, pAttachments) +EmailWritingUtils.openMailTemplate = function (pToRecipients, pSenderContactId, pTemplateId, pRecipientContactId, pBindata, pAttachments, pSubject, pEmailFilename) { if (pToRecipients && typeof(pToRecipients) == "string") pToRecipients = [pToRecipients]; @@ -59,7 +60,10 @@ EmailWritingUtils.openMailTemplate = function (pToRecipients, pSenderContactId, } } - return email.downloadEML(); + if (pSubject) + email.subject = pSubject; + + return email.downloadEML(pEmailFilename); } /** @@ -70,14 +74,16 @@ EmailWritingUtils.openMailTemplate = function (pToRecipients, pSenderContactId, * @param {Array} pAttachmentArray array with attachments. * @param {String} pNotificationMsg message which will be shown after the operation is done. * @param {String} pComingFrom source from where you started (e.g. "Person", "Organisation" ) + * @param {String} pEmailFilename optional file name of the email. */ -EmailWritingUtils.openNewMail = function (pToContactId, pToEmailAddress, pComingFrom, pAttachmentArray, pNotificationMsg) +EmailWritingUtils.openNewMail = function (pToContactId, pToEmailAddress, pComingFrom, pAttachmentArray, pNotificationMsg, pEmailFilename) { var params = { "ContactId_param" : pToContactId, "Attachments_param" : JSON.stringify(pAttachmentArray), "ComingFrom_param" : pComingFrom, - "NotificationMsg_param" : pNotificationMsg + "NotificationMsg_param" : pNotificationMsg, + "EmailFilename" : pEmailFilename }; if (pToEmailAddress) @@ -99,14 +105,15 @@ EmailWritingUtils.getMailbridgeAddress = function () * @param {String} pComingFrom source from where you started (e.g. "Person", "Organisation") * @param {Array} pReportArray array with reports. * @param {String} pNotificationMsg message which will be shown after the operation is done. + * @param {String} pEmailFilename optional file name of the email. * Report have to be a object with these attrs: content (base64 encoded report), contentType (mimeType of the report), filename (complete filename with filending) */ -EmailWritingUtils.sendReportAsMail = function (pRecipient, pReportArray, pComingFrom, pNotificationMsg) +EmailWritingUtils.sendReportAsMail = function (pRecipient, pReportArray, pComingFrom, pNotificationMsg, pEmailFilename) { var pRecpientEmail = newSelect("COMMUNICATION.ADDR").from("COMMUNICATION") .where("COMMUNICATION.CONTACT_ID", pRecipient).and("COMMUNICATION.MEDIUM_ID", "COMMEMAIL").cell(); - EmailWritingUtils.openNewMail(pRecipient, pRecpientEmail, pComingFrom, pReportArray, pNotificationMsg); + EmailWritingUtils.openNewMail(pRecipient, pRecpientEmail, pComingFrom, pReportArray, pNotificationMsg, pEmailFilename); } /** @@ -321,12 +328,13 @@ Email.prototype.openMail = function () /** * ask for a download of the email * + * @param {String} [pFilename] the file name. * @return {Array} array of [filename, EML (base64)] */ -Email.prototype.downloadEML = function () +Email.prototype.downloadEML = function (pFilename) { var eml = this.getEML(); - var filename = (this.subject || translate.text("Email Template")) + ".eml"; + var filename = (pFilename || translate.text("Email Template")) + ".eml"; neon.download(eml, filename); return [filename, eml]; }