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

Relation lookup erweitern

parent 0ec45bc5
No related branches found
No related tags found
No related merge requests found
Showing
with 153 additions and 4 deletions
......@@ -159,6 +159,32 @@ Usually this is used for filtering COMM-entires by a specified contact or creati
<mandatory v="false" />
<description>PARAMETER</description>
</entityParameter>
<entityIncomingField>
<name>RelationCommEmail_dfi</name>
<fieldType>DEPENDENCY_IN</fieldType>
<recordContainer>db</recordContainer>
<dependencies>
<entityDependency>
<name>6aaf2f88-6b5b-46ea-8b73-2a46643a70da</name>
<entityName>Relation_entity</entityName>
<fieldName>RelationCommEmail_dfo</fieldName>
<isOutgoing v="false" />
</entityDependency>
</dependencies>
</entityIncomingField>
<entityIncomingField>
<name>RelationCommPhone_dfi</name>
<fieldType>DEPENDENCY_IN</fieldType>
<recordContainer>db</recordContainer>
<dependencies>
<entityDependency>
<name>e2a645cf-ac79-4fb7-a706-ec853730c88f</name>
<entityName>Relation_entity</entityName>
<fieldName>RelationCommPhone_dfo</fieldName>
<isOutgoing v="false" />
</entityDependency>
</dependencies>
</entityIncomingField>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
......@@ -96,7 +96,7 @@ See RelationUtils.getRelationTypeByPersOrg for possible values</description>
<recordContainer>db</recordContainer>
<dependencies>
<entityDependency>
<name>ad58b5da-132a-46a8-abee-0671bfd2e006</name>
<name>2537ae2b-ee99-41bd-9cd5-ec482cb20a56</name>
<entityName>Product_entity</entityName>
<fieldName>ProductRelation_dfo</fieldName>
<isOutgoing v="false" />
......@@ -154,6 +154,57 @@ See RelationUtils.getRelationTypeByPersOrg for possible values</description>
</entityDependency>
</dependencies>
</entityIncomingField>
<entityField>
<name>IMAGE</name>
<contentType>IMAGE</contentType>
<valueProcess>%aditoprj%/entity/Relation_entity/entityfields/image/valueProcess.js</valueProcess>
</entityField>
<entityOutgoingField>
<name>RelationCommEmail_dfo</name>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
<entityName>Comm_entity</entityName>
<fieldName>RelationCommEmail_dfi</fieldName>
</dependency>
<children>
<entityParameter>
<name>CommCategory_param</name>
<code>%aditoprj%/entity/Relation_entity/entityfields/relationcommemail_dfo/children/commcategory_param/code.js</code>
</entityParameter>
<entityParameter>
<name>RelId_param</name>
<code>%aditoprj%/entity/Relation_entity/entityfields/relationcommemail_dfo/children/relid_param/code.js</code>
</entityParameter>
</children>
</entityOutgoingField>
<entityOutgoingField>
<name>RelationCommPhone_dfo</name>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
<entityName>Comm_entity</entityName>
<fieldName>RelationCommPhone_dfi</fieldName>
</dependency>
<children>
<entityParameter>
<name>CommCategory_param</name>
<code>%aditoprj%/entity/Relation_entity/entityfields/relationcommphone_dfo/children/commcategory_param/code.js</code>
</entityParameter>
<entityParameter>
<name>RelId_param</name>
<code>%aditoprj%/entity/Relation_entity/entityfields/relationcommphone_dfo/children/relid_param/code.js</code>
</entityParameter>
</children>
</entityOutgoingField>
<entityField>
<name>STANDARD_EMAIL_COMM</name>
<title>standard email</title>
</entityField>
<entityField>
<name>STANDARD_PHONE_COMM</name>
<title>Phone</title>
</entityField>
</entityFields>
<recordContainers>
<dbRecordContainer>
......@@ -243,6 +294,14 @@ See RelationUtils.getRelationTypeByPersOrg for possible values</description>
<name>PERS_LASTNAME.value</name>
<recordfield>PERS.LASTNAME</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>STANDARD_EMAIL_COMM.value</name>
<expression>%aditoprj%/entity/Relation_entity/recordcontainers/db/recordfieldmappings/standard_email_comm.value/expression.js</expression>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>STANDARD_PHONE_COMM.value</name>
<expression>%aditoprj%/entity/Relation_entity/recordcontainers/db/recordfieldmappings/standard_phone_comm.value/expression.js</expression>
</dbRecordFieldMapping>
</recordFieldMappings>
</dbRecordContainer>
</recordContainers>
......
import("system.result");
import("system.neon");
import("system.vars");
import("Pers_lib");
import("Org_lib");
import("Relation_lib");
if (vars.get("$field.relationType") == 1) // 1 == org, 2 == pers, 3 == pers
{
result.string(OrgUtils.getImage(vars.get("$field.ORG_ID"), vars.getString("$field.ORG_NAME")));
}
else
{
result.string(PersUtils.getImage(vars.get("$field.PERS_ID"), (vars.getString("$field.PERS_FIRSTNAME") + " " + vars.getString("$field.PERS_LASTNAME")).trim()));
}
\ No newline at end of file
import("system.result");
result.string("EMAIL");
\ No newline at end of file
import("system.vars");
import("system.result");
result.string(vars.get("$field.RELATIONID"));
\ No newline at end of file
import("system.result");
result.string("PHONE");
\ No newline at end of file
import("system.vars");
import("system.result");
result.string(vars.get("$field.RELATIONID"));
\ No newline at end of file
import("system.result");
import("Comm_lib");
var res = CommUtil.getStandardSubSqlMail();
result.string(res);
\ No newline at end of file
import("system.result");
import("Comm_lib");
var res = CommUtil.getStandardSubSqlPhone();
result.string(res);
\ No newline at end of file
......@@ -2,6 +2,7 @@
<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.0.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.0.0">
<name>Relation_context</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<lookupview>RelationLookup_view</lookupview>
<entity>Relation_entity</entity>
<references>
<neonViewReference>
......
......@@ -24,6 +24,14 @@
<name>fb150402-a576-4e21-855c-91dd7574f353</name>
<entityField>LASTNAME</entityField>
</neonTableColumn>
<neonTableColumn>
<name>768f2294-2c4e-4c71-9992-ee9cea299041</name>
<entityField>STANDARD_PHONE_COMM</entityField>
</neonTableColumn>
<neonTableColumn>
<name>eb778e57-1f2d-436e-b22a-e92f7a190606</name>
<entityField>STANDARD_EMAIL_COMM</entityField>
</neonTableColumn>
</columns>
</tableViewTemplate>
</children>
......
......@@ -12,6 +12,10 @@
<name>relationLookupList_template</name>
<entityField>#ENTITY</entityField>
<columns>
<neonTableColumn>
<name>5a0d38bb-bfa5-4abc-86e7-fac65804bb5c</name>
<entityField>IMAGE</entityField>
</neonTableColumn>
<neonTableColumn>
<name>ca59a64a-adce-49c3-93ad-2978c81809f8</name>
<entityField>ORG_NAME</entityField>
......@@ -26,6 +30,14 @@
<width v="75" />
<expandRatio v="100" />
</neonTableColumn>
<neonTableColumn>
<name>2ee5838b-e0ff-4f21-bf57-e41d0766fdec</name>
<entityField>STANDARD_PHONE_COMM</entityField>
</neonTableColumn>
<neonTableColumn>
<name>16174be3-c8fb-46a8-8f73-f6b8d8fad963</name>
<entityField>STANDARD_EMAIL_COMM</entityField>
</neonTableColumn>
</columns>
</tableViewTemplate>
</children>
......
......@@ -113,7 +113,7 @@ CommUtil.getStandardSubSqlForCategory = function(pCategory, pRelationField)
if (pRelationField == undefined)
cond.and("COMM.RELATION_ID = RELATION.RELATIONID");
else if (typeof(pRelationField) == "string")
cond.and("COMM.RELATION_ID = " + pRelationField);
cond.andPrepare("COMM.RELATION_ID", pRelationField);
else if (typeof(pRelationField) == "object")
{
//you may want to sepcify a concrete value
......@@ -126,10 +126,16 @@ CommUtil.getStandardSubSqlForCategory = function(pCategory, pRelationField)
if (mediumIds.length == 0)
return "''";
cond.and("COMM.MEDIUM_ID in (" + mediumIds.join(", ") + ")");
var anyMediumIdCond = SqlCondition.begin();
mediumIds.forEach(function(pMediumId)
{
anyMediumIdCond.orPrepare("COMM.MEDIUM_ID", pMediumId);
});
cond.andSqlCondition(anyMediumIdCond, "1=0");
cond.and("COMM.STANDARD = 1");
var res = "select max(COMM.ADDR) from COMM" + cond.toWhereString();
var res = db.translateStatement(cond.buildSelect("select max(COMM.ADDR) from COMM", "1=0"));
return res;
};
......
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