From 2f2451edff0b61f177c59f95535f3c41ff552c43 Mon Sep 17 00:00:00 2001 From: "b.ulrich" <b.ulrich@adito.de> Date: Mon, 3 Aug 2020 16:48:05 +0200 Subject: [PATCH] =?UTF-8?q?[Projekt:=20Entwicklung=20-=20Neon][TicketNr.:?= =?UTF-8?q?=201062998][Angebot=20-=20Angebot=20anzeigen=20-=20als=20Email?= =?UTF-8?q?=20versenden=20-=20Status=20versendet=20wird=20zu=20fr=C3=BCh?= =?UTF-8?q?=20gesetzt]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entity/Email_entity/Email_entity.aod | 6 ++++++ .../entityfields/offerid_param/documentation.adoc | 3 +++ .../entityfields/sendmail/onActionProcess.js | 7 +++++++ .../children/dispatchofferreport/onActionProcess.js | 8 ++------ process/Email_lib/process.js | 11 +++++++---- 5 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 entity/Email_entity/entityfields/offerid_param/documentation.adoc diff --git a/entity/Email_entity/Email_entity.aod b/entity/Email_entity/Email_entity.aod index fc65d44a8a..f3a15f3c8a 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 0000000000..cc60a8f815 --- /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 a7bdf5af90..74810743f4 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 a5b761ab29..108e16a156 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 94a4ab8ba9..34ae40ebfa 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); } /** -- GitLab