diff --git a/entity/Email_entity/Email_entity.aod b/entity/Email_entity/Email_entity.aod index fc65d44a8a9fde47fccacef66a19b03e60160dfc..f3a15f3c8ad189a57e5dd9c9b3167d59a5043bed 100644 --- a/entity/Email_entity/Email_entity.aod +++ b/entity/Email_entity/Email_entity.aod @@ -128,6 +128,12 @@ <name>AdditionalPlaceholders_param</name> <expose v="true" /> </entityParameter> + <entityParameter> + <name>OfferId_param</name> + <expose v="true" /> + <mandatory v="true" /> + <documentation>%aditoprj%/entity/Email_entity/entityfields/offerid_param/documentation.adoc</documentation> + </entityParameter> </entityFields> <recordContainers> <datalessRecordContainer> diff --git a/entity/Email_entity/entityfields/offerid_param/documentation.adoc b/entity/Email_entity/entityfields/offerid_param/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..cc60a8f815575f3ed65faa6cc6634e6878b173c6 --- /dev/null +++ b/entity/Email_entity/entityfields/offerid_param/documentation.adoc @@ -0,0 +1,3 @@ +=OfferId_pram + +optional param needed for the offerEmails, to change the status of the offer \ No newline at end of file diff --git a/entity/Email_entity/entityfields/sendmail/onActionProcess.js b/entity/Email_entity/entityfields/sendmail/onActionProcess.js index a7bdf5af9030a2f9352c7f5ccd597d334995fd35..74810743f42a7d88c0dfd8989917e0603864ba98 100644 --- a/entity/Email_entity/entityfields/sendmail/onActionProcess.js +++ b/entity/Email_entity/entityfields/sendmail/onActionProcess.js @@ -1,3 +1,5 @@ +import("KeywordRegistry_basic"); +import("Sql_lib"); import("system.translate"); import("ActivityTask_lib"); import("system.neon"); @@ -38,6 +40,11 @@ var eml = EmailWritingUtils.openMailTemplate( additionalPlaceholders ); +if(vars.get("$param.ComingFrom_param") == "Offer") +{ + newWhere("OFFER.OFFERID", vars.get("$param.OfferId_param")) + .updateData(true, "OFFER", ["STATUS"], null, [$KeywordRegistry.offerStatus$sent()]); +} if (notificationMsg) question.showMessage(notificationMsg, question.INFORMATION, notificationTitle); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/offerreportdispatch/children/dispatchofferreport/onActionProcess.js b/entity/Offer_entity/entityfields/offerreportdispatch/children/dispatchofferreport/onActionProcess.js index a5b761ab29d8a43dfb5e9f3aa4a2b19a79bf057c..108e16a1568111f622d71415968423884be95d78 100644 --- a/entity/Offer_entity/entityfields/offerreportdispatch/children/dispatchofferreport/onActionProcess.js +++ b/entity/Offer_entity/entityfields/offerreportdispatch/children/dispatchofferreport/onActionProcess.js @@ -27,9 +27,5 @@ attachmentArray[0] = offerReport; var additionalPlaceholders = [ new Placeholder("offerCode", Placeholder.types.FIXEDVALUE, vars.get("$field.FullOfferCode")) ]; - -EmailWritingUtils.sendReportAsMail(contactId, attachmentArray, "Offer", notificationMsg, emailFilename, additionalPlaceholders); - -newWhere("OFFER.OFFERID", "$field.OFFERID") - .updateData(true, "OFFER", ["STATUS"], null, [$KeywordRegistry.offerStatus$sent()]); - +var offerId = vars.get("$field.OFFERID") +EmailWritingUtils.sendReportAsMail(contactId, attachmentArray, "Offer", notificationMsg, emailFilename, additionalPlaceholders, offerId); \ No newline at end of file diff --git a/process/Email_lib/process.js b/process/Email_lib/process.js index 94a4ab8ba9daa08c1021663cb1d6435a661e94c7..34ae40ebfa34a87d89f1a84131521b9220e36b06 100644 --- a/process/Email_lib/process.js +++ b/process/Email_lib/process.js @@ -78,8 +78,9 @@ EmailWritingUtils.openMailTemplate = function (pToRecipients, pSenderContactId, * @param {String} pComingFrom source from where you started (e.g. "Person", "Organisation" ) * @param {String} pEmailFilename optional file name of the email. * @param {String} [pAdditionalPlaceholders] additional placeholders for the email + * @param {String} [pOfferId] optional needed for the offerEmails, to change the status of the offer */ -EmailWritingUtils.openNewMail = function (pToContactId, pToEmailAddress, pComingFrom, pAttachmentArray, pNotificationMsg, pEmailFilename, pAdditionalPlaceholders) +EmailWritingUtils.openNewMail = function (pToContactId, pToEmailAddress, pComingFrom, pAttachmentArray, pNotificationMsg, pEmailFilename, pAdditionalPlaceholders, pOfferId) { var params = { "ContactId_param" : pToContactId, @@ -87,7 +88,8 @@ EmailWritingUtils.openNewMail = function (pToContactId, pToEmailAddress, pComing "ComingFrom_param" : pComingFrom, "NotificationMsg_param" : pNotificationMsg, "EmailFilename" : pEmailFilename, - "AdditionalPlaceholders_param" : JSON.stringify(pAdditionalPlaceholders) + "AdditionalPlaceholders_param" : JSON.stringify(pAdditionalPlaceholders), + "OfferId_param" : pOfferId }; if (pToEmailAddress) @@ -111,14 +113,15 @@ EmailWritingUtils.getMailbridgeAddress = function () * @param {String} pNotificationMsg message which will be shown after the operation is done. * @param {String} pEmailFilename optional file name of the email. * @param {String} [pAdditionalPlaceholders] additional placeholders for the email + * @param {String} [pOfferId] optional needed for the offerEmails, to change the status of the offer * 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, pEmailFilename, pAdditionalPlaceholders) +EmailWritingUtils.sendReportAsMail = function (pRecipient, pReportArray, pComingFrom, pNotificationMsg, pEmailFilename, pAdditionalPlaceholders, pOfferId) { 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, pEmailFilename, pAdditionalPlaceholders); + EmailWritingUtils.openNewMail(pRecipient, pRecpientEmail, pComingFrom, pReportArray, pNotificationMsg, pEmailFilename, pAdditionalPlaceholders, pOfferId); } /**