Skip to content
Snippets Groups Projects
Commit 0a973800 authored by Andre Loreth's avatar Andre Loreth
Browse files

Merge remote-tracking branch 'origin/master'

parents 78f89978 1e035061
No related branches found
No related tags found
No related merge requests found
......@@ -4,4 +4,5 @@ import("system.vars");
var contactIds = JSON.parse(vars.getString("$field.recipientContactIds"));
var bulkMailId = vars.get("$field.BULKMAIL_ID");
BulkMailUtils.addRecipients(bulkMailId, contactIds);
\ No newline at end of file
BulkMailUtils.addRecipients(bulkMailId, contactIds);
BulkMailUtils.openBulkMail(bulkMailId);
\ No newline at end of file
......@@ -20,7 +20,7 @@ switch (accesstype) {
break;
case "F":
actions = [
["read", "read"],
["view", "view"],
["update", "update"]
]
}
......
......@@ -11,6 +11,7 @@
<name>SERIALLETTER_ID</name>
<title>Serial letter</title>
<consumer>SerialLetters</consumer>
<mandatory v="true" />
</entityField>
<entityField>
<name>UID</name>
......
......@@ -5,3 +5,4 @@ var contactIds = JSON.parse(vars.getString("$field.recipientContactIds"));
var letterId = vars.get("$field.SERIALLETTER_ID");
SerialLetterUtils.addRecipients(letterId, contactIds);
SerialLetterUtils.openSerialLetter(letterId);
\ No newline at end of file
......@@ -143,7 +143,11 @@ BulkMailUtils.sendBulkMail = function (pBulkMailId, pTestRecipients)
};
}
/**
* opens a context to select a bulk mail to add recipients to
*
* @param {String[]} pContactIds recipients that should be added
*/
BulkMailUtils.openAddRecipientView = function (pContactIds)
{
var params = {
......@@ -216,6 +220,13 @@ BulkMailUtils.getBulkMailTemplate = function (pBulkMailId, pDocumentTemplateId)
return template;
}
/**
* checks if a contact is a recipient of a bulk mail
*
* @param {String} pBulkMailId bulkmail id
* @param {String} pContactId contact id
* @return {boolean} true, if the contact is a recipient
*/
BulkMailUtils.isRecipient = function (pBulkMailId, pContactId)
{
return db.cell(SqlCondition.begin()
......@@ -225,6 +236,11 @@ BulkMailUtils.isRecipient = function (pBulkMailId, pContactId)
) != "0";
}
/**
* opens the BulkMail context in new mode
*
* @param {String[]} [pRecipients] recipients that should be added after creation
*/
BulkMailUtils.newBulkMail = function (pRecipients)
{
var params = {
......@@ -233,6 +249,14 @@ BulkMailUtils.newBulkMail = function (pRecipients)
neon.openContext("BulkMail", "BulkMailEdit_view", null, neon.OPERATINGSTATE_NEW, params);
}
/**
* Filters the given contactIds if they can be added as new recipients.
* Checks if a contact is already a recipient or if there is a advertising ban.
*
* @param {String} pBulkMailId id of the bulk mail the contacts should be added to
* @param {String[]} pContactIds contacts to filter
* @return {String[]} contacts that can be added as recipients
*/
BulkMailUtils.filterNewRecipients = function (pBulkMailId, pContactIds)
{
var existsQuery = "not exists(select BULKMAILRECIPIENTID from BULKMAILRECIPIENT where BULKMAILRECIPIENT.CONTACT_ID = CONTACT.CONTACTID and # = ?)";
......@@ -245,9 +269,12 @@ BulkMailUtils.filterNewRecipients = function (pBulkMailId, pContactIds)
return db.array(db.COLUMN, query);
}
/**
* opens the given bulk mail
*/
BulkMailUtils.openBulkMail = function (pBulkMailId)
{
neon.openContext("BulkMail", "BulkMailMain_view", [pBulkMailId], neon.OPERATINGSTATE_NEW, null);
neon.openContext("BulkMail", "BulkMailMain_view", [pBulkMailId], neon.OPERATINGSTATE_VIEW, null);
}
function SerialLetterUtils () {}
......@@ -273,7 +300,11 @@ SerialLetterUtils.addRecipients = function (pSerialLetterId, pContactIds)
db.inserts(inserts);
}
/**
* opens a context to select a serial letter to add recipients to
*
* @param {String[]} pContactIds recipients that should be added
*/
SerialLetterUtils.openAddRecipientView = function (pContactIds)
{
var params = {
......@@ -297,6 +328,13 @@ SerialLetterUtils.buildSerialLetter = function (pSerialLetterId, pRecipientIds)
});
}
/**
* checks if a contact is a recipient of a serial letter
*
* @param {String} pSerialLetterId serial letter id
* @param {String} pContactId contact id
* @return {boolean} true, if the contact is a recipient
*/
SerialLetterUtils.isRecipient = function (pSerialLetterId, pContactId)
{
return db.cell(SqlCondition.begin()
......@@ -304,4 +342,9 @@ SerialLetterUtils.isRecipient = function (pSerialLetterId, pContactId)
.andPrepare("LETTERRECIPIENT.SERIALLETTER_ID", pSerialLetterId)
.buildSql("select count(*) from LETTERRECIPIENT") //TODO: is there a way exists could be used?
) != "0";
}
SerialLetterUtils.openSerialLetter = function (pSerialLetterId)
{
neon.openContext("SerialLetter", "SerialLetterMain_view", [pSerialLetterId], neon.OPERATINGSTATE_VIEW, null);
}
\ No newline at end of file
......@@ -29,6 +29,13 @@ import("Email_lib");
var DocumentTemplate = (function ()
{
/**
* constructor for DocumentTemplate
*
* @param {String} pTemplateContent content, as base64 string (except for DocumentTemplate.types.PLAIN, then it's a normal string)
* @param {String} pType type of the template, use the DocumentTemplate.types constants here
* @param {String} [pFilename] file name of the template
*/
function DocumentTemplate (pTemplateContent, pType, pFilename)
{
this.content = pTemplateContent;
......@@ -36,6 +43,9 @@ function DocumentTemplate (pTemplateContent, pType, pFilename)
this.filename = pFilename;
}
/**
* @return {String} the text of the content
*/
DocumentTemplate.prototype.toString = function ()
{
if (this.type == DocumentTemplate.types.PLAIN)
......@@ -265,7 +275,7 @@ DocumentTemplate.prototype.getReplacedEmailsByContactIds = function (pContactIds
}
/**
* Provides functions for the DocumentTemplate object.
* Provides functions for the DocumentTemplate object that aren't accessible from outside
*/
function TemplateHelper () {}
/**
......@@ -485,7 +495,7 @@ TemplateHelper._getReplacedDOCX = function (pTemplate, pReplacements)
{
var replacements = {};
for (let placeholder in pReplacements) //removes the prefix and postfix, the process needs it like this
replacements[placeholder.slice(3, -3)] = pReplacements[placeholder];
replacements[placeholder.slice(2, -2)] = pReplacements[placeholder];
//this is executed as a process because of better performance
var documentData = process.execute("getDocxDocument_serverProcess", {
......@@ -505,6 +515,11 @@ TemplateHelper._getReplacedDOCX = function (pTemplate, pReplacements)
*/
function LetterUtils () {}
/**
* opens a new letter
*
* @param {String} pContactId id of the contact to fetch the data from
*/
LetterUtils.openNewLetter = function (pContactId)
{
var params = {
......
......@@ -20,7 +20,6 @@ function EmailWritingUtils () {}
* @param {String} pSenderContactId contactId of the sender. the standard mailadress of the contact is used as sender-address
* @param {String} [pTemplateId] if a document-template shall be used, give the templateId here
* @param {String} [pRecipientContactId] contactId of the recipient, required to fill placeholders
*
* @return {Array} the eml document as array with [filename, base64]
*/
EmailWritingUtils.openMailTemplate = function (pToRecipients, pSenderContactId, pTemplateId, pRecipientContactId)
......@@ -59,7 +58,6 @@ EmailWritingUtils.openNewMail = function (pToContactId, pToEmailAddress)
* @param {String} [pBody=null] mail body
* @param {Array} [pCcRecipients=[]] array of recipient cc addresses
* @param {Array} [pBccRecipients=[]] array of recipient bcc addresses
*
* @class
*/
function Email (pToRecipients, pSender, pSubject, pBody, pCcRecipients, pBccRecipients)
......@@ -76,7 +74,10 @@ function Email (pToRecipients, pSender, pSubject, pBody, pCcRecipients, pBccReci
}
/**
* makes an Email object from a RFC mail (base64 encoded)
* makes an Email object from a RFC
*
* @param {String} pBase64RFC the RFC mail, base64 encoded
* @return {Email} a new Email object
*/
Email.fromRFC = function (pBase64RFC)
{
......@@ -186,7 +187,6 @@ Email.prototype.getRFCmail = function ()
//X-Uniform-Type-Identifier: com.apple.mail-draft
//this could be added later if needed
var mailObj = mail.getCachedMail(mailId);
return mail.toRFC(mailObj);
}
......@@ -201,6 +201,8 @@ Email.prototype.openMail = function ()
/**
* ask for a download of the email
*
* @return {Array} array of [filename, EML (base64)]
*/
Email.prototype.downloadEML = function ()
{
......@@ -211,7 +213,7 @@ Email.prototype.downloadEML = function ()
}
/**
* returns a eml as (base64 encoded)
* @return {String} RFC mail (base64 encoded)
*/
Email.prototype.getEML = function()
{
......
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