Skip to content
Snippets Groups Projects
Commit 0f102ee8 authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

Bulkmail attachments count & Bugfixes

parent 29b78fe9
No related branches found
No related tags found
No related merge requests found
Showing
with 66 additions and 7 deletions
......@@ -93,6 +93,7 @@
<name>SENDER</name>
<title>Sender address</title>
<mandatory v="true" />
<valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/sender/valueProcess.js</valueProcess>
<onValidation>%aditoprj%/entity/BulkMail_entity/entityfields/sender/onValidation.js</onValidation>
</entityField>
<entityField>
......@@ -270,6 +271,13 @@
<contentType>BOOLEAN</contentType>
<dropDownProcess>%aditoprj%/entity/BulkMail_entity/entityfields/use_template_attachments/dropDownProcess.js</dropDownProcess>
<stateProcess>%aditoprj%/entity/BulkMail_entity/entityfields/use_template_attachments/stateProcess.js</stateProcess>
<valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/use_template_attachments/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>CountAttachments</name>
<title>Count template attachments</title>
<stateProcess>%aditoprj%/entity/BulkMail_entity/entityfields/countattachments/stateProcess.js</stateProcess>
<valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/countattachments/valueProcess.js</valueProcess>
</entityField>
</entityFields>
<recordContainers>
......
......@@ -7,7 +7,6 @@ import("system.vars");
if(vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET)
{
[content, type] = DocumentTemplateUtils.getTemplateContent(vars.get("$field.DOCUMENTTEMPLATE_ID"), new FileUpload(vars.get("$local.value")));
vars.set("$field.DOCUMENTTEMPLATE_ID", "");
vars.set("$field.content", content);
vars.set("$context.currentTemplateType", type);
}
import("system.vars");
import("system.neon");
import("system.result");
if (vars.get("$field.USE_TEMPLATE_ATTACHMENTS") == "1")
result.string(neon.COMPONENTSTATE_EDITABLE);
else
result.string(neon.COMPONENTSTATE_INVISIBLE);
\ No newline at end of file
import("system.vars");
import("DocumentTemplate_lib");
import("system.result");
var template = DocumentTemplateUtils.getTemplate(vars.get("$field.DOCUMENTTEMPLATE_ID"), false);
if (template)
result.string(template.getAttachments().length);
\ No newline at end of file
......@@ -12,7 +12,6 @@ if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.re
[content, type] = DocumentTemplateUtils.getTemplateContent(vars.get("$local.value"), new FileUpload(vars.get("$field.bindata")));
vars.set("$context.currentTemplateType", type);
vars.set("$field.content", content);
vars.set("$field.USE_TEMPLATE_ATTACHMENTS", "0");
// TODO: load subject without loadTemplate again... maybe return with getTemplateContent() above?
var templateId = vars.get("local.value");
......
......@@ -2,6 +2,12 @@ import("Bulkmail_lib");
import("system.neon");
import("system.vars");
var template = BulkMailUtils.getBulkMailTemplate(vars.get("$field.BULKMAILID"), vars.get("$field.DOCUMENTTEMPLATE_ID"), false)
// only in view mode it should use the extra uploaded file. In New and Edit mode it should only serve the original template file.
var bulkmailId = "";
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW)
bulkmailId = vars.get("$field.BULKMAILID");
var template = BulkMailUtils.getBulkMailTemplate(bulkmailId, vars.get("$field.DOCUMENTTEMPLATE_ID"), false)
if (template.content)
neon.download(template.content, template.filename);
\ No newline at end of file
import("Communication_lib");
import("system.result");
import("Employee_lib");
result.string(CommUtil.getStandardMail(EmployeeUtils.getCurrentContactId()));
\ No newline at end of file
import("system.neon");
import("system.result");
import("system.vars");
if (!vars.get("$this.value") && vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$field.DOCUMENTTEMPLATE_ID"))
{
result.string("1");
}
\ No newline at end of file
......@@ -27,18 +27,35 @@
<entityField>#ENTITY</entityField>
</actionsViewTemplate>
<genericViewTemplate>
<name>BulkMail</name>
<name>upload</name>
<editMode v="true" />
<entityField>#ENTITY</entityField>
<fields>
<entityFieldLink>
<name>40628318-2c0e-4324-b676-f7bda2740166</name>
<name>e85baf03-5847-4306-afe5-35e53c967260</name>
<entityField>bindata</entityField>
</entityFieldLink>
<entityFieldLink>
<name>43c6f2d8-7e3b-4367-8b61-3c9fe8e21637</name>
<name>9c24c14a-a8ff-4387-83c9-cc0f8188dd24</name>
<entityField>USE_TEMPLATE_ATTACHMENTS</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
<genericViewTemplate>
<name>countAttachments</name>
<entityField>#ENTITY</entityField>
<fields>
<entityFieldLink>
<name>a2e781e3-31c6-4035-a81c-3114ec04a979</name>
<entityField>CountAttachments</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
<genericViewTemplate>
<name>BulkMail</name>
<editMode v="true" />
<entityField>#ENTITY</entityField>
<fields>
<entityFieldLink>
<name>e363bda2-d8bf-456e-bcae-d1870408022a</name>
<entityField>NAME</entityField>
......
import("system.logging");
import("system.translate");
import("ActivityTask_lib");
import("system.util");
......@@ -218,6 +219,7 @@ BulkMailUtils.addRecipients = function (pBulkMailId, pContactIds)
*/
BulkMailUtils.getBulkMailTemplate = function (pBulkMailId, pDocumentTemplateId, pResolveSubtemplates, pUseTemplateAttachments)
{
logging.log(JSON.stringify([pBulkMailId, pDocumentTemplateId, pResolveSubtemplates, pUseTemplateAttachments], null, "\t"))
var bulkTemplate = DocumentTemplate.loadTemplate(pBulkMailId, "BULKMAIL", pResolveSubtemplates);
var documentTemplate = DocumentTemplate.loadTemplate(pDocumentTemplateId, undefined, pResolveSubtemplates);
......
......@@ -149,7 +149,7 @@ Email.getReplacedBulkEmails = function(pTemplate, pContactIds)
emailObjects[contactId] = new Email(emailContents[contactId]);
}
// adding the templates to each mail should be no merory-problem as it is only a reference to pTemplate._attachmentCache
// adding the templates to each mail should be no memory-problem as it is only a reference to pTemplate._attachmentCache, so no problem here
emailObjects[contactId].attachmentTemplates = pTemplate.getAttachments();
}
return emailObjects;
......
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