diff --git a/entity/BulkMailAddRecipients_entity/recordcontainers/jdito/onInsert.js b/entity/BulkMailAddRecipients_entity/recordcontainers/jdito/onInsert.js index e1544b133d51a8aa459dc86d1135c68d29ad18f1..cce82d39abe4867c83b6b4289e6d5dfe284ace9a 100644 --- a/entity/BulkMailAddRecipients_entity/recordcontainers/jdito/onInsert.js +++ b/entity/BulkMailAddRecipients_entity/recordcontainers/jdito/onInsert.js @@ -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 diff --git a/entity/PermissionAction_entity/entityfields/action/dropDownProcess.js b/entity/PermissionAction_entity/entityfields/action/dropDownProcess.js index 371de4f973263f8e8f350776ff042bf5390c5877..6d764649337c7a3450a15a2957868ff37cd96dbf 100644 --- a/entity/PermissionAction_entity/entityfields/action/dropDownProcess.js +++ b/entity/PermissionAction_entity/entityfields/action/dropDownProcess.js @@ -20,7 +20,7 @@ switch (accesstype) { break; case "F": actions = [ - ["read", "read"], + ["view", "view"], ["update", "update"] ] } diff --git a/entity/SerialLetterAddRecipients_entity/SerialLetterAddRecipients_entity.aod b/entity/SerialLetterAddRecipients_entity/SerialLetterAddRecipients_entity.aod index e29e0663fbc93dd601d4b3db8f2c7e6e098b6f3d..66768fb7f3e15a14ba0ddc984d193e7e7b88c4f7 100644 --- a/entity/SerialLetterAddRecipients_entity/SerialLetterAddRecipients_entity.aod +++ b/entity/SerialLetterAddRecipients_entity/SerialLetterAddRecipients_entity.aod @@ -11,6 +11,7 @@ <name>SERIALLETTER_ID</name> <title>Serial letter</title> <consumer>SerialLetters</consumer> + <mandatory v="true" /> </entityField> <entityField> <name>UID</name> diff --git a/entity/SerialLetterAddRecipients_entity/recordcontainers/jdito/onInsert.js b/entity/SerialLetterAddRecipients_entity/recordcontainers/jdito/onInsert.js index 3afb7c68f28e9a1ca239132f704d76ceece13f40..e5d6b8596f1c2451faed96bf983c0993a864faee 100644 --- a/entity/SerialLetterAddRecipients_entity/recordcontainers/jdito/onInsert.js +++ b/entity/SerialLetterAddRecipients_entity/recordcontainers/jdito/onInsert.js @@ -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 diff --git a/process/Bulkmail_lib/process.js b/process/Bulkmail_lib/process.js index 25c4071b35da671f1d2907f69577f0515a542ba7..f7a62e3785104f2c08651246f26d992b91297432 100644 --- a/process/Bulkmail_lib/process.js +++ b/process/Bulkmail_lib/process.js @@ -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 diff --git a/process/DocumentTemplate_lib/process.js b/process/DocumentTemplate_lib/process.js index 2bfd37dd64c8f609a694c4b96b5c4eaa797e0cb5..4434b77bb3e6fbd8198be854e22aa20dc211f42f 100644 --- a/process/DocumentTemplate_lib/process.js +++ b/process/DocumentTemplate_lib/process.js @@ -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 = { diff --git a/process/Email_lib/process.js b/process/Email_lib/process.js index 4c6a8af91fcab499c751f8c99be77487dbb4623d..5bb71a3a699572a3336cd6913155d7c9eb7852b9 100644 --- a/process/Email_lib/process.js +++ b/process/Email_lib/process.js @@ -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() {