Skip to content
Snippets Groups Projects
Commit e1410cd4 authored by Vinzent Broens's avatar Vinzent Broens Committed by Martin Groppe
Browse files

Marketing 1075546 notifications

parent fa8d6349
No related branches found
No related tags found
No related merge requests found
......@@ -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>
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);
}
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())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment