Skip to content
Snippets Groups Projects
Commit 50b3739a authored by Sebastian Listl's avatar Sebastian Listl :speech_balloon:
Browse files

Objectselection attributes with lookup

parent 9c9704ce
No related branches found
No related tags found
No related merge requests found
Showing
with 191 additions and 30 deletions
......@@ -79,6 +79,14 @@
<entityProvider>
<name>#PROVIDER</name>
<recordContainer>db</recordContainer>
<dependencies>
<entityDependency>
<name>3ea70130-21b0-42ec-88e2-1a898059dcff</name>
<entityName>ObjectProxy_entity</entityName>
<fieldName>Activities</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
</entityProvider>
<entityField>
<name>ICON</name>
......
......@@ -69,6 +69,12 @@
<fieldName>Contacts</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>60518a9f-eaa5-4af8-8cd6-4276047f4371</name>
<entityName>ObjectProxy_entity</entityName>
<fieldName>Contacts</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
</entityProvider>
<entityField>
......
......@@ -298,6 +298,41 @@
<name>GetTheme_param</name>
<expose v="true" />
</entityParameter>
<entityField>
<name>VALUE_LOOKUP</name>
<title>Value</title>
<consumer>Objects</consumer>
<contentTypeProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/value_lookup/contentTypeProcess.js</contentTypeProcess>
<mandatoryProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/value_lookup/mandatoryProcess.js</mandatoryProcess>
<stateProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/value_lookup/stateProcess.js</stateProcess>
<displayValueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/value_lookup/displayValueProcess.js</displayValueProcess>
</entityField>
<entityConsumer>
<name>Objects</name>
<dependency>
<name>dependency</name>
<entityName>ObjectProxy_entity</entityName>
<fieldName>FilteredObjects</fieldName>
</dependency>
<children>
<entityParameter>
<name>Entity_param</name>
<valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/objects/children/entity_param/valueProcess.js</valueProcess>
</entityParameter>
<entityParameter>
<name>Filter_param</name>
<valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/objects/children/filter_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityField>
<name>DROPDOWNDEFINITION</name>
<valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/dropdowndefinition/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>DROPDOWNFILTER</name>
<valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/dropdownfilter/valueProcess.js</valueProcess>
</entityField>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
......@@ -344,6 +379,18 @@
<jDitoRecordFieldMapping>
<name>USER_EDIT.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>VALUE_LOOKUP.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>VALUE_LOOKUP.displayValue</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>DROPDOWNDEFINITION.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>DROPDOWNFILTER.value</name>
</jDitoRecordFieldMapping>
</recordFieldMappings>
</jDitoRecordContainer>
</recordContainers>
......
import("system.result");
import("Sql_lib");
result.string(newSelect("DROPDOWNDEFINITION")
.from("AB_ATTRIBUTE")
.where("AB_ATTRIBUTE.AB_ATTRIBUTEID", "$field.AB_ATTRIBUTE_ID")
.cell());
\ No newline at end of file
import("system.result");
import("Sql_lib");
result.string(newSelect("DROPDOWNFILTER")
.from("AB_ATTRIBUTE")
.where("AB_ATTRIBUTE.AB_ATTRIBUTEID", "$field.AB_ATTRIBUTE_ID")
.cell());
\ No newline at end of file
import("Attribute_lib");
import("system.vars");
import("system.result");
if (AttributeTypeUtil.useLookup(vars.get("$field.ATTRIBUTE_TYPE")))
result.string(vars.get("$field.DROPDOWNDEFINITION"));
else
result.string("");
\ No newline at end of file
import("system.vars");
import("system.result");
var filter = vars.get("$field.DROPDOWNFILTER");
if (filter)
{
filter = JSON.parse(filter);
result.string(JSON.stringify(filter.filter));
}
\ No newline at end of file
import("Context_lib");
import("system.db");
import("system.result");
import("system.vars");
import("Attribute_lib");
import("Keyword_lib");
import("system.tools");
import("Sql_lib");
var attrType = vars.get("$field.ATTRIBUTE_TYPE");
var dropDownDef = db.cell(
SqlCondition.begin()
.andPrepareVars("AB_ATTRIBUTE.AB_ATTRIBUTEID", "$field.AB_ATTRIBUTE_ID")
.buildSql("select DROPDOWNDEFINITION from AB_ATTRIBUTE")
);
result.string(AttributeTypeUtil.getAttributeViewValue(attrType, vars.get("$field.VALUE"), dropDownDef));
result.string(AttributeTypeUtil.getAttributeViewValue(vars.get("$field.ATTRIBUTE_TYPE"), vars.get("$field.VALUE"), vars.get("$field.DROPDOWNDEFINITION")));
......@@ -9,5 +9,7 @@ import("Sql_lib");
var attributeId = vars.get("$field.AB_ATTRIBUTE_ID");
var attrType = vars.get("$field.ATTRIBUTE_TYPE");
var res = AttributeUtil.getPossibleListValues(attributeId, attrType);
var res = null;
if (!AttributeTypeUtil.useLookup(attrType))
res = AttributeUtil.getPossibleListValues(attributeId, attrType);
result.object(res);
\ No newline at end of file
......@@ -4,4 +4,4 @@ import("Attribute_lib");
var attributeType = vars.get("$field.ATTRIBUTE_TYPE");
var contentType = AttributeTypeUtil.getContentType(attributeType);
result.string(contentType != null && contentType != "BOOLEAN");
\ No newline at end of file
result.string(!AttributeTypeUtil.useLookup(attributeType) && contentType != null && contentType != "BOOLEAN");
\ No newline at end of file
......@@ -4,9 +4,11 @@ import("system.result");
import("Attribute_lib");
var attributeType = vars.get("$field.ATTRIBUTE_TYPE");
result.string(AttributeTypeUtil.getContentType(attributeType));
var fieldState;
if (AttributeTypeUtil.getContentType(attributeType) != null)
if (AttributeTypeUtil.useLookup(attributeType) && vars.get("$sys.recordstate") != neon.OPERATINGSTATE_VIEW)
fieldState = neon.COMPONENTSTATE_INVISIBLE;
else if (AttributeTypeUtil.getContentType(attributeType) != null)
fieldState = neon.COMPONENTSTATE_EDITABLE;
else
fieldState = neon.COMPONENTSTATE_READONLY;
......
import("system.vars");
import("system.result");
import("Attribute_lib");
var attributeType = vars.get("$field.ATTRIBUTE_TYPE");
result.string(AttributeTypeUtil.getContentType(attributeType));
\ No newline at end of file
import("system.result");
import("system.vars");
import("Attribute_lib");
result.string(AttributeTypeUtil.getAttributeViewValue(vars.get("$field.ATTRIBUTE_TYPE"), vars.get("$field.VALUE_LOOKUP"), vars.get("$field.DROPDOWNDEFINITION")));
import("system.vars");
import("system.result");
import("Attribute_lib");
result.string(AttributeTypeUtil.useLookup(vars.get("$field.ATTRIBUTE_TYPE")));
\ No newline at end of file
import("system.neon");
import("system.vars");
import("system.result");
import("Attribute_lib");
var fieldState;
if (AttributeTypeUtil.useLookup(vars.get("$field.ATTRIBUTE_TYPE")))
fieldState = neon.COMPONENTSTATE_EDITABLE;
else
fieldState = neon.COMPONENTSTATE_INVISIBLE;
result.string(fieldState);
\ No newline at end of file
......@@ -28,7 +28,8 @@ var defaultFields = [
"AB_ATTRIBUTERELATION.DATE_NEW",
"AB_ATTRIBUTERELATION.USER_NEW",
"AB_ATTRIBUTERELATION.DATE_EDIT",
"AB_ATTRIBUTERELATION.USER_EDIT"
"AB_ATTRIBUTERELATION.USER_EDIT",
"AB_ATTRIBUTE.DROPDOWNFILTER"
];
//these fields hold the attributeRelation value, depending on the attribute type
......@@ -137,7 +138,7 @@ if (getTree)
var attrRelations = db.table(attributeSql.build()).map(
function (row)
{
var [attrRelId, attrId, attrParentId, attrType, attrName, dropDownDef, comboViewVal, dateNew, userNew, dateEdit, userEdit] = row;
var [attrRelId, attrId, attrParentId, attrType, attrName, dropDownDef, comboViewVal, dateNew, userNew, dateEdit, userEdit, dropDownFilter] = row;
attrName = translate.text(attrName);
attrType = attrType.trim();
if (!getTree && !displaySimpleName && attrParentId)
......@@ -169,7 +170,11 @@ var attrRelations = db.table(attributeSql.build()).map(
dateNew,
userNew,
dateEdit,
userEdit
userEdit,
value,
viewValue,
dropDownDef,
dropDownFilter
];
}
);
......
......@@ -29,7 +29,10 @@ var valueField = AttributeTypeUtil.getDatabaseField(type);
if (valueField)
{
columns.push(valueField);
values.push(rowdata["VALUE.value"]);
if (AttributeTypeUtil.useLookup(type))
values.push(rowdata["VALUE_LOOKUP.value"])
else
values.push(rowdata["VALUE.value"]);
}
db.insertData("AB_ATTRIBUTERELATION", columns, null, values);
......
......@@ -31,10 +31,13 @@ if (uid.length === 1)
columns.push(row);
values.push(""); //set every field but the correct value field to null
});
values[AttributeTypeUtil.getTypeColumnIndex(type) + 3] = rowdata["VALUE.value"];
if (AttributeTypeUtil.useLookup(type))
values[AttributeTypeUtil.getTypeColumnIndex(type) + 3] = rowdata["VALUE_LOOKUP.value"];
else
values[AttributeTypeUtil.getTypeColumnIndex(type) + 3] = rowdata["VALUE.value"];
db.updateData("AB_ATTRIBUTERELATION", columns, null, values,
SqlCondition.equals("AB_ATTRIBUTERELATION.AB_ATTRIBUTERELATIONID", uid[0], "1=2"));
newWhere("AB_ATTRIBUTERELATION.AB_ATTRIBUTERELATIONID", "$local.uid")
.updateData(true, "AB_ATTRIBUTERELATION", columns, null, values);
}
else
{
......@@ -59,7 +62,10 @@ else
if (valueField)
{
columns.push(valueField);
values.push(vars.get("$field.VALUE"));
if (AttributeTypeUtil.useLookup(type))
values.push(rowdata["VALUE_LOOKUP.value"])
else
values.push(rowdata["VALUE.value"]);
}
db.insertData("AB_ATTRIBUTERELATION", columns, null, values);
}
......
......@@ -20,6 +20,12 @@
<fieldName>ActivityAtrributes</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>42e6f528-8452-4262-97bd-68e8cbe99c74</name>
<entityName>ObjectProxy_entity</entityName>
<fieldName>Attributes</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
</entityProvider>
<entityField>
......
<?xml version="1.0" encoding="UTF-8"?>
<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.12" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.12">
<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.13" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.13">
<name>BulkMail_entity</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<documentation>%aditoprj%/entity/BulkMail_entity/documentation.adoc</documentation>
......@@ -7,6 +7,7 @@
<title>Bulk mail</title>
<grantUpdateProcess>%aditoprj%/entity/BulkMail_entity/grantUpdateProcess.js</grantUpdateProcess>
<contentTitleProcess>%aditoprj%/entity/BulkMail_entity/contentTitleProcess.js</contentTitleProcess>
<afterUiInit>%aditoprj%/entity/BulkMail_entity/afterUiInit.js</afterUiInit>
<iconId>VAADIN:AT</iconId>
<titlePlural>Bulk mails</titlePlural>
<recordContainer>db</recordContainer>
......@@ -15,16 +16,15 @@
<name>#PROVIDER</name>
<dependencies>
<entityDependency>
<name>88f8ded7-fe8f-41ef-8e01-030bae0867ee</name>
<entityName>BulkMailAddRecipients_entity</entityName>
<fieldName>BulkMails</fieldName>
<name>4ef3e311-d2b2-45bf-8f82-7f9ae7e107a9</name>
<entityName>ObjectProxy_entity</entityName>
<fieldName>Bulkmails</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
</entityProvider>
<entityField>
<name>BULKMAILID</name>
<valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/bulkmailid/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>NAME</name>
......@@ -121,6 +121,7 @@
</entityConsumer>
<entityField>
<name>bindata</name>
<title>Custom template</title>
<contentType>FILE</contentType>
<valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/bindata/valueProcess.js</valueProcess>
<onValueChange>%aditoprj%/entity/BulkMail_entity/entityfields/bindata/onValueChange.js</onValueChange>
......@@ -294,12 +295,35 @@
<name>CopyBulkMailId_param</name>
<expose v="true" />
</entityParameter>
<entityProvider>
<name>BulkMailsNotSent</name>
<dependencies>
<entityDependency>
<name>16cdf326-0b43-4d72-bf19-21434e047e85</name>
<entityName>BulkMailAddRecipients_entity</entityName>
<fieldName>BulkMails</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
<children>
<entityParameter>
<name>BulkMailStatus_param</name>
<valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/bulkmailsnotsent/children/bulkmailstatus_param/valueProcess.js</valueProcess>
<expose v="false" />
</entityParameter>
</children>
</entityProvider>
<entityParameter>
<name>BulkMailStatus_param</name>
<expose v="true" />
</entityParameter>
</entityFields>
<recordContainers>
<dbRecordContainer>
<name>db</name>
<alias>Data_alias</alias>
<fromClauseProcess>%aditoprj%/entity/BulkMail_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess>
<conditionProcess>%aditoprj%/entity/BulkMail_entity/recordcontainers/db/conditionProcess.js</conditionProcess>
<onDBInsert>%aditoprj%/entity/BulkMail_entity/recordcontainers/db/onDBInsert.js</onDBInsert>
<onDBUpdate>%aditoprj%/entity/BulkMail_entity/recordcontainers/db/onDBUpdate.js</onDBUpdate>
<onDBDelete>%aditoprj%/entity/BulkMail_entity/recordcontainers/db/onDBDelete.js</onDBDelete>
......@@ -328,6 +352,7 @@
<name>DESCRIPTION.value</name>
<recordfield>BULKMAIL.DESCRIPTION</recordfield>
<isFilterable v="true" />
<isLookupFilter v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>DOCUMENTTEMPLATE_ID.value</name>
......@@ -337,16 +362,19 @@
<name>NAME.value</name>
<recordfield>BULKMAIL.NAME</recordfield>
<isFilterable v="true" />
<isLookupFilter v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>SUBJECT.value</name>
<recordfield>BULKMAIL.SUBJECT</recordfield>
<isFilterable v="true" />
<isLookupFilter v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>SENDER.value</name>
<recordfield>BULKMAIL.SENDER</recordfield>
<isFilterable v="true" />
<isLookupFilter v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>DOCUMENTTEMPLATE_ID.displayValue</name>
......@@ -356,6 +384,7 @@
<name>STATUS.value</name>
<recordfield>BULKMAIL.STATUS</recordfield>
<isFilterable v="true" />
<isLookupFilter v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>STATUS.displayValue</name>
......
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