diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index b5ef0f8efa7fcb8417f59c5a7cab5fcf3e4eb5ad..2dc7d4f6088ee51dbaf1fdce45c55c888e718dbc 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -126,6 +126,10 @@ <key>This setting is overridden by the setting '%0'</key> <value>Diese Einstellung wird durch die Einstellung '%0' überschrieben</value> </entry> + <entry> + <key>was missed</key> + <value>wurde verpasst</value> + </entry> <entry> <key>Move down</key> <value>Nach unten verschieben</value> @@ -6301,6 +6305,10 @@ <key>Existing contact</key> <value>Bestehender Kontakt</value> </entry> + <entry> + <key>Mailing</key> + <value>Mailing</value> + </entry> <entry> <key>Recommendation</key> <value>Empfehlung</value> @@ -6309,6 +6317,10 @@ <key>Print media</key> <value>Printmedien</value> </entry> + <entry> + <key>Mailing missed</key> + <value>Mailing verpasst</value> + </entry> <entry> <key>Call back (WV)</key> <value>Rückruf (WV)</value> @@ -12211,15 +12223,6 @@ Bitte Datumseingabe prüfen</value> <entry> <key>During processing the e-mail an error has occurred.\n Please contact an administrator</key> </entry> - <entry> - <key>DSGVO-Anonymisierung</key> - </entry> - <entry> - <key>privat</key> - </entry> - <entry> - <key>During processing the e-mail an error has occurred.\n Please contact an administrator</key> - </entry> <entry> <key>Authorware Binary File</key> <value>Authorware Binärdatei</value> @@ -12550,6 +12553,15 @@ Bitte Datumseingabe prüfen</value> <key>Grouptask</key> <value>Guppenaufgabe</value> </entry> + <entry> + <key>DSGVO-Anonymisierung</key> + </entry> + <entry> + <key>privat</key> + </entry> + <entry> + <key>During processing the e-mail an error has occurred.\n Please contact an administrator</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/process/sendBulkMail_serverProcess/process.js b/process/sendBulkMail_serverProcess/process.js index acccd48561fcadd14dac08dc6123709e768afca2..6a6c0749033f4720e77a4d03b87fc725d41639e0 100644 --- a/process/sendBulkMail_serverProcess/process.js +++ b/process/sendBulkMail_serverProcess/process.js @@ -1,3 +1,5 @@ +import("system.logging"); +import("Employee_lib"); import("system.datetime"); import("Sql_lib"); import("system.db"); @@ -24,5 +26,12 @@ if (user && !testRun) var description = translate.withArguments("%0 mails sent sucessfully, %1 mails failed. Process took %2 s.", [res.sucessful, res.failed, Math.round((datetime.date() - startTime) / datetime.ONE_SECOND)]); notification.addNotification(util.getNewUUID(), null, null, null, "BulkMailSent", notification.PRIO_NORMAL, 2, notification.STATE_UNSEEN, [user], message, description); - -} \ No newline at end of file + + var responsibleUser = newSelect("BULKMAIL.EMPLOYEE_CONTACT_ID") + .from("BULKMAIL") + .whereIfSet("BULKMAIL.BULKMAILID", bulkMailId) + .cell(true); + var employee = EmployeeUtils.getUserByContactId(responsibleUser); + var employeeUser = employee.myRole; + notification.addNotification(util.getNewUUID(), null, null, null, "BulkMailSent", notification.PRIO_NORMAL, 2, notification.STATE_UNSEEN, [employeeUser], message, description); +} diff --git a/process/sendPlannedBulkmails_serverProcess/process.js b/process/sendPlannedBulkmails_serverProcess/process.js index 3f74ac7a527a49ae1dbe7fc416e40edf21e2aecd..45d573f8b3c020cacd632ac446d9f3e8bb164645 100644 --- a/process/sendPlannedBulkmails_serverProcess/process.js +++ b/process/sendPlannedBulkmails_serverProcess/process.js @@ -1,4 +1,8 @@ -import("system.logging"); +import("Keyword_lib"); +import("system.tools"); +import("Employee_lib"); +import("system.translate"); +import("system.notification"); import("Bulkmail_lib"); import("system.project"); import("system.datetime"); @@ -16,13 +20,52 @@ var bulkMailData = newSelect("BULKMAIL.BULKMAILID") .and("BULKMAIL.DATE_TO_SEND", datetime.date(), SqlBuilder.LESS_OR_EQUAL()) .and("BULKMAIL.DATE_TO_SEND",eMath.subInt(datetime.date(), eMath.mulInt(dateToSendPassedAfter, datetime.ONE_HOUR)), SqlBuilder.GREATER()) .arrayColumn(); -for (let i = 0; i < bulkMailData.length; i++) + +bulkMailData.forEach(function (element) { - newWhere("BULKMAIL.BULKMAILID", bulkMailData[i]) + newWhere("BULKMAIL.BULKMAILID", element) .updateFields({"STATUS" : $KeywordRegistry.bulkMailStatus$beingSent()}); - BulkMailUtils.sendBulkMailOnServer(bulkMailData[i],null,null); -} + BulkMailUtils.sendBulkMailOnServer(element,null,null); +}); + +//find all missed bulkmails and send responsible notification + +var bulkMailMissed = newSelect("BULKMAIL.EMPLOYEE_CONTACT_ID, BULKMAIL.NAME, BULKMAIL.DATE_TO_SEND") + .from("BULKMAIL") + .where("BULKMAIL.STATUS", $KeywordRegistry.bulkMailStatus$planned()) + .and("BULKMAIL.DATE_TO_SEND", eMath.subInt(datetime.date(), eMath.mulInt(dateToSendPassedAfter, datetime.ONE_HOUR)), SqlBuilder.LESS_OR_EQUAL()) + .table(); + + + +bulkMailMissed.forEach(function([pEmployeeContactId, pName, pDateToSend]){ + var targetLocale = newSelect("CONTACT.ISOLANGUAGE") + .from("CONTACT") + .where("CONTACT.CONTACTID",pEmployeeContactId) + .cell(); + var langIso2 = LanguageKeywordUtils.Iso2FromIso3(targetLocale); + + let caption = translate.text("Mailing missed",langIso2); + let description = translate.text("Mailing",langIso2) + " " + pName + " " + + translate.text("was missed",langIso2) + +". " + translate.text("Send Date",langIso2) + ": " + +datetime.toDate(pDateToSend,"dd.MM.yyyy"); + + var employee = EmployeeUtils.getUserByContactId(pEmployeeContactId); + var employeeUser = employee.myRole; + + let notificationConfig = notification.createConfig() + .addUserWithId(employeeUser) + .forcedPriority(notification.PRIO_NORMAL) + .notificationType("BulkMailSent") + .initialState(notification.STATE_UNSEEN) + .caption(caption) + .description(description); + + notification.addNotificationWith(notificationConfig); +}); + //set all missed bulkmails to status missed newWhere("BULKMAIL.STATUS", $KeywordRegistry.bulkMailStatus$planned())