Skip to content
Snippets Groups Projects
Commit 23853b33 authored by S.Listl's avatar S.Listl
Browse files

Bulkmail

parent 7a52f166
No related branches found
No related tags found
No related merge requests found
......@@ -180,6 +180,12 @@
</entityParameter>
</children>
</entityConsumer>
<entityActionField>
<name>testMail</name>
<title>Test email</title>
<onActionProcess>%aditoprj%/entity/BulkMail_entity/entityfields/testmail/onActionProcess.js</onActionProcess>
<iconId>VAADIN:CLIPBOARD_CHECK</iconId>
</entityActionField>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import("system.vars");
import("Bulkmail_lib");
BulkMailUtils.sendBulkMailOnServer(vars.get("$field.BULKMAILID"));
\ No newline at end of file
......@@ -22,16 +22,18 @@ function BulkMailUtils () {}
* Executes a process to send bulk mails on the server and creates a notification when finished.
*
* @param {String} pBulkMailId id of the bulk mail
* @param {Array} [pRecipients=bulkMailRecipients] overwrite the recipients (e.g. for testing)
* @param {String} [pUser=currentUser] User that will get the notification, if null (not undefined!), no notification
* will be created.
*/
BulkMailUtils.sendBulkMailOnServer = function (pBulkMailId, pUser)
BulkMailUtils.sendBulkMailOnServer = function (pBulkMailId, pRecipients, pUser)
{
if (pUser === undefined)
pUser = EmployeeUtils.getCurrentUserId();
process.execute("sendBulkMail_serverProcess",
{
bulkMailId : pBulkMailId,
recipients : JSON.stringify(pRecipients),
user : pUser || ""
}
);
......@@ -42,10 +44,11 @@ BulkMailUtils.sendBulkMailOnServer = function (pBulkMailId, pUser)
* can take some time to execute, use BulkMailUtils.sendBulkMailOnServer instead.
*
* @param {String} pBulkMailId id of the bulk mail
* @param {Array} [pRecipients=bulkMailRecipients] overwrite the recipients (e.g. for testing)
*
* @return {Object} count of sucessful and failed mails
*/
BulkMailUtils.sendBulkMail = function (pBulkMailId)
BulkMailUtils.sendBulkMail = function (pBulkMailId, pRecipients)
{
var [templateId, subject, emailSender] = db.array(db.ROW, SqlCondition.begin()
.andPrepare("BULKMAIL.BULKMAILID", pBulkMailId)
......
......@@ -10,7 +10,8 @@ import("system.notification");
var startTime = datetime.date();
var bulkMailId = vars.get("$local.bulkMailId");
var user = vars.get("$local.user");
var res = BulkMailUtils.sendBulkMail(bulkMailId);
var recipients = JSON.parse(vars.get("$local.recipients"));
var res = BulkMailUtils.sendBulkMail(bulkMailId, recipients);
if (user)
{
......
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