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

Attribute fixes

parent 66f11d55
No related branches found
No related tags found
No related merge requests found
Showing
with 115 additions and 38 deletions
......@@ -64,11 +64,9 @@ else if (showEmpty || rowId)
subCondition.clear();
let filteredIdChildren = AttributeUtil.getAllChildren(filteredIds);
filteredIds.concat(filteredIdChildren).forEach(function(id)
{
this.orPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", id);
}, subCondition);
subCondition.andIn("AB_ATTRIBUTE.AB_ATTRIBUTEID", filteredIdChildren);
subCondition.andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.COMBOVALUE, "# != ?")
// return nothing if filteredAttributeIds is an empty array. (--> and 1=2)
sqlCondition.andSqlCondition(subCondition, "1=2");
......
......@@ -3,8 +3,9 @@ import("system.vars");
import("Sql_lib");
import("system.db");
if (vars.get("$field.AB_ATTRIBUTE_ID") && vars.get("$field.VALUE"))
var rowData = vars.get("$local.rowdata");
if (rowData["AB_ATTRIBUTE_ID.value"] && rowData["VALUE.value"])
{
db.deleteData("AB_ATTRIBUTERELATION", SqlCondition.equals("AB_ATTRIBUTERELATION.AB_ATTRIBUTERELATIONID", vars.get("$field.UID"), "1=2"));
db.deleteData("AB_ATTRIBUTERELATION", SqlCondition.equals("AB_ATTRIBUTERELATION.AB_ATTRIBUTERELATIONID", vars.get("$local.uid"), "1=2"));
}
neon.refresh();
\ No newline at end of file
......@@ -8,7 +8,7 @@ var type = AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID"));
var columns, values;
// if first char is "," it is a newly generated UUID
if (vars.get("$field.UID")[0] != "," && !(vars.exists("$param.IsNew_param") && vars.getString("$param.IsNew_param") == "true"))
if (vars.get("$local.uid")[0] != "," && !(vars.exists("$param.IsNew_param") && vars.getString("$param.IsNew_param") == "true"))
{
columns = [
"AB_ATTRIBUTE_ID",
......@@ -43,7 +43,7 @@ else
"USER_NEW"
];
var uid = vars.get("$field.UID");
var uid = vars.get("$local.uid");
values = [
uid[0] == "," ? uid.substr(1) : uid, // if first char is "," it is a newly generated UUID
vars.get("$field.AB_ATTRIBUTE_ID"),
......
......@@ -215,7 +215,7 @@
</entityProvider>
<entityField>
<name>FULL_ATTRIBUTE_NAME</name>
<title>Name</title>
<title>Title</title>
<searchable v="false" />
<state>READONLY</state>
<valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/full_attribute_name/valueProcess.js</valueProcess>
......@@ -317,6 +317,14 @@
<expose v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityFieldGroup>
<name>attributeName</name>
<valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/attributename/valueProcess.js</valueProcess>
<title>Name</title>
<fields>
<element>ATTRIBUTE_NAME</element>
</fields>
</entityFieldGroup>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
......
import("system.vars");
import("system.result");
result.string(vars.get("$field.FULL_ATTRIBUTE_NAME"));
\ No newline at end of file
......@@ -3,4 +3,4 @@ import("system.result");
import("system.neon");
if (vars.getString("$field.ATTRIBUTE_ACTIVE") != "1")
result.string(neon.PRIORITY_LOW_COLOR);
result.string(neon.PRIORITY_LOW_COLOR); //TODO: disabled color
......@@ -4,6 +4,7 @@
<majorModelMode>DISTRIBUTED</majorModelMode>
<icon>VAADIN:ENVELOPES</icon>
<title>Bulk mail</title>
<contentTitleProcess>%aditoprj%/entity/BulkMail_entity/contentTitleProcess.js</contentTitleProcess>
<recordContainer>db</recordContainer>
<entityFields>
<entityProvider>
......@@ -52,6 +53,16 @@
<entityName>DocumentTemplate_entity</entityName>
<fieldName>DocumentTemplateProvider</fieldName>
</dependency>
<children>
<entityParameter>
<name>DocumentTemplateType_param</name>
<valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/templates/children/documenttemplatetype_param/valueProcess.js</valueProcess>
</entityParameter>
<entityParameter>
<name>DocumentTemplateTypeClassification_param</name>
<valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/templates/children/documenttemplatetypeclassification_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityField>
<name>STATUS</name>
......@@ -72,6 +83,12 @@
<contentType>IMAGE</contentType>
<valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/icon/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>PREVIEW</name>
<contentType>HTML</contentType>
<state>READONLY</state>
<displayValueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/preview/displayValueProcess.js</displayValueProcess>
</entityField>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import("system.vars");
import("system.result");
result.string(vars.get("$field.NAME"));
\ No newline at end of file
import("Employee_lib");
import("system.vars");
import("system.result");
import("DocumentTemplate_lib");
var preview = DocumentTemplate.loadTemplate(vars.get("$field.DOCUMENTTEMPLATE_ID"))
.getReplacedContentByContactId(EmployeeUtils.getCurrentContactId());
result.string(preview);
\ No newline at end of file
import("KeywordRegistry_basic");
import("system.result");
result.string($KeywordRegistry.documentTemplateType$mail());
\ No newline at end of file
import("KeywordRegistry_basic");
import("system.result");
result.string($KeywordRegistry.documentTemplateTypeCategory$serial());
\ No newline at end of file
......@@ -3,7 +3,7 @@ import("system.vars");
import("system.tools");
var userTitle = vars.exists("$param.UserTitle_param") && vars.get("$param.UserTitle_param");
var role = vars.get("$field.UID");
var role = vars.get("$local.uid");
if (userTitle)
{
......
......@@ -3,7 +3,7 @@ import("system.vars");
import("system.tools");
var userTitle = vars.exists("$param.UserTitle_param") && vars.get("$param.UserTitle_param");
var role = vars.get("$field.ROLE");
var newRole = vars.get("$local.rowdata")["ROLE.value"];
if (userTitle && tools.existUsers(userTitle))
{
......
......@@ -3,8 +3,8 @@ import("system.vars");
import("system.tools");
var userTitle = vars.exists("$param.UserTitle_param") && vars.get("$param.UserTitle_param");
var oldRole = vars.get("$field.UID");
var newRole = vars.get("$field.ROLE");
var oldRole = vars.get("$local.uid");
var newRole = vars.get("$local.rowdata")["ROLE.value"];
if (userTitle && oldRole != newRole)
{
......
......@@ -25,5 +25,9 @@
<name>d9462c8d-f0ad-4d9f-9c0c-80bca19cbb7f</name>
<view>BulkMailFilter_view</view>
</neonViewReference>
<neonViewReference>
<name>6b057fb0-94ac-4bca-88b2-c97fdfcf9d6e</name>
<view>BulkMailTest_view</view>
</neonViewReference>
</references>
</neonContext>
......@@ -12,7 +12,7 @@
<cardViewTemplate>
<name>Head</name>
<iconField>ICON</iconField>
<titleField>FULL_ATTRIBUTE_NAME</titleField>
<titleField>attributeName</titleField>
<subtitleField>ATTRIBUTE_TYPE</subtitleField>
<entityField>#ENTITY</entityField>
</cardViewTemplate>
......
......@@ -19,5 +19,10 @@
<entityField>Recipients</entityField>
<view>BulkMailRecipientFilter_view</view>
</neonViewReference>
<neonViewReference>
<name>3222ace8-c6d6-4dab-ada1-1f50b983e7e7</name>
<entityField>#ENTITY</entityField>
<view>BulkMailTest_view</view>
</neonViewReference>
</children>
</neonView>
......@@ -13,7 +13,6 @@
<name>Card</name>
<iconField>ICON</iconField>
<titleField>NAME</titleField>
<subtitleField>STATUS</subtitleField>
<descriptionField>SUBJECT</descriptionField>
<entityField>#ENTITY</entityField>
</cardViewTemplate>
......@@ -29,6 +28,10 @@
<name>9ef1ecd4-063a-4c18-9def-d395f59a64dc</name>
<entityField>SENDER</entityField>
</entityFieldLink>
<entityFieldLink>
<name>8bb72d39-3348-4bd6-b57d-f7f5ae573e73</name>
<entityField>DESCRIPTION</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
</children>
......
<?xml version="1.0" encoding="UTF-8"?>
<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.1">
<name>BulkMailTest_view</name>
<title>Preview</title>
<majorModelMode>DISTRIBUTED</majorModelMode>
<layout>
<noneLayout>
<name>layout</name>
</noneLayout>
</layout>
<children>
<genericViewTemplate>
<name>Generic</name>
<entityField>#ENTITY</entityField>
<fields>
<entityFieldLink>
<name>481f729b-08c1-442f-bd6c-037ed50e2c4c</name>
<entityField>PREVIEW</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
</children>
</neonView>
......@@ -144,7 +144,7 @@ DocumentTemplate.prototype.getReplacedContent = function (pReplacements)
}
/**
* replaces the placeholders with data from the contact and returns the result
* replaces the placeholders with data from one contact and returns the result
*/
DocumentTemplate.prototype.getReplacedContentByContactId = function (pContactId)
{
......@@ -171,11 +171,12 @@ DocumentTemplate.prototype.getReplacedContentByContactIds = function (pContactId
}
/**
* replaces the placeholders with data from the contacts and returns the result
* Replaces the placeholders with data from the contacts and returns the resulting Emails.
*
* @param {Array} pContactIds contact ids
*
* @return {Object} emails for every contactId
* @return {Object} Object containing the contact ids as keys and the corresponding Email
* objects as values
*/
DocumentTemplate.prototype.getReplacedEmailsByContactIds = function (pContactIds)
{
......@@ -184,7 +185,10 @@ DocumentTemplate.prototype.getReplacedEmailsByContactIds = function (pContactIds
for (let contactId in replacements)
{
if (this.type == DocumentTemplate.types.EML)
{
//use the special function for EML to also fill subject and sender
emailObj[contactId] = this._getReplacedEML(replacements[contactId], true);
}
else
{
let body = this.getReplacedContent(replacements[contactId]);
......@@ -195,6 +199,12 @@ DocumentTemplate.prototype.getReplacedEmailsByContactIds = function (pContactIds
}
/**
* Builds an object with the placeholder data for multiple contacts
*
* @param {Array} pContactIds contact ids
*
* @return {Object} Object containing the data. The structure is like {contactId : {placeholderName : replacementValue, ...}, ...}
*
* @private
*/
DocumentTemplate.prototype._getReplacementsByContactIds = function (pContactIds)
......@@ -223,7 +233,7 @@ DocumentTemplate.prototype._getReplacementsByContactIds = function (pContactIds)
* Replaces placeholders for EML
*
* @param {Object} pReplacements mapping with replacements for every placeholder
* @param {boolean} [pGetEmail] if true, return Email object
* @param {boolean} [pGetEmail] if true, return an Email object (use this if the sender and subject are required)
*
* @return {String|Email} the replaced content
*
......@@ -344,23 +354,6 @@ DocumentTemplate.prototype._getReplacedDOCX = function (pReplacements)
return documentData;
}
/**
* Provides functions for document templates
*/
function DocumentTemplateUtils () {}
/**
* loads a document template and replaces the placeholders
*
* @param {String} pTemplateId id of the document template
* @param {String} pContactId the contact whose address data is used
*/
DocumentTemplateUtils.getSingleReplacedDocument = function (pTemplateId, pContactId)
{
var template = DocumentTemplate.loadTemplate(pTemplateId);
return template.getReplacedTextByContactId(pContactId);
}
/**
* functions for working with letters
*/
......
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