diff --git a/entity/Comm_entity/Comm_entity.aod b/entity/Comm_entity/Comm_entity.aod index ab82c3ff3c345f58ea7a9cbf0fd6a06831b8aa02..163c51cdc7f2b176c26c5d0adcc87d19b6d59284 100644 --- a/entity/Comm_entity/Comm_entity.aod +++ b/entity/Comm_entity/Comm_entity.aod @@ -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> diff --git a/entity/Relation_entity/Relation_entity.aod b/entity/Relation_entity/Relation_entity.aod index 71d2bc934d64cea768df10c60d2a97a0365c4ffb..a9b2399d5cbc4a10290c9bbc5630e590b5f50bc0 100644 --- a/entity/Relation_entity/Relation_entity.aod +++ b/entity/Relation_entity/Relation_entity.aod @@ -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> diff --git a/entity/Relation_entity/entityfields/image/valueProcess.js b/entity/Relation_entity/entityfields/image/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..16b1a89eb18a8be729c1712c10ecea497f3398e6 --- /dev/null +++ b/entity/Relation_entity/entityfields/image/valueProcess.js @@ -0,0 +1,15 @@ +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 diff --git a/entity/Relation_entity/entityfields/relationcommemail_dfo/children/commcategory_param/code.js b/entity/Relation_entity/entityfields/relationcommemail_dfo/children/commcategory_param/code.js new file mode 100644 index 0000000000000000000000000000000000000000..4c564fa3fa1bc95a442728b429c8f74300ff6d3a --- /dev/null +++ b/entity/Relation_entity/entityfields/relationcommemail_dfo/children/commcategory_param/code.js @@ -0,0 +1,2 @@ +import("system.result"); +result.string("EMAIL"); \ No newline at end of file diff --git a/entity/Relation_entity/entityfields/relationcommemail_dfo/children/relid_param/code.js b/entity/Relation_entity/entityfields/relationcommemail_dfo/children/relid_param/code.js new file mode 100644 index 0000000000000000000000000000000000000000..9517eee9df12cb0d7f101f8b3d284031228f5cf7 --- /dev/null +++ b/entity/Relation_entity/entityfields/relationcommemail_dfo/children/relid_param/code.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.RELATIONID")); \ No newline at end of file diff --git a/entity/Relation_entity/entityfields/relationcommphone_dfo/children/commcategory_param/code.js b/entity/Relation_entity/entityfields/relationcommphone_dfo/children/commcategory_param/code.js new file mode 100644 index 0000000000000000000000000000000000000000..9220a2c453485c81c29cf2d29ec7b68234d02e14 --- /dev/null +++ b/entity/Relation_entity/entityfields/relationcommphone_dfo/children/commcategory_param/code.js @@ -0,0 +1,2 @@ +import("system.result"); +result.string("PHONE"); \ No newline at end of file diff --git a/entity/Relation_entity/entityfields/relationcommphone_dfo/children/relid_param/code.js b/entity/Relation_entity/entityfields/relationcommphone_dfo/children/relid_param/code.js new file mode 100644 index 0000000000000000000000000000000000000000..9517eee9df12cb0d7f101f8b3d284031228f5cf7 --- /dev/null +++ b/entity/Relation_entity/entityfields/relationcommphone_dfo/children/relid_param/code.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.RELATIONID")); \ No newline at end of file diff --git a/entity/Relation_entity/recordcontainers/db/recordfieldmappings/standard_email_comm.value/expression.js b/entity/Relation_entity/recordcontainers/db/recordfieldmappings/standard_email_comm.value/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..a371c71fba377126f5fc2580cfd900b297f16767 --- /dev/null +++ b/entity/Relation_entity/recordcontainers/db/recordfieldmappings/standard_email_comm.value/expression.js @@ -0,0 +1,5 @@ +import("system.result"); +import("Comm_lib"); + +var res = CommUtil.getStandardSubSqlMail(); +result.string(res); \ No newline at end of file diff --git a/entity/Relation_entity/recordcontainers/db/recordfieldmappings/standard_phone_comm.value/expression.js b/entity/Relation_entity/recordcontainers/db/recordfieldmappings/standard_phone_comm.value/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..9b0174b05e7bcd2cf63f90d294fc74ecc76f7c44 --- /dev/null +++ b/entity/Relation_entity/recordcontainers/db/recordfieldmappings/standard_phone_comm.value/expression.js @@ -0,0 +1,5 @@ +import("system.result"); +import("Comm_lib"); + +var res = CommUtil.getStandardSubSqlPhone(); +result.string(res); \ No newline at end of file diff --git a/neonContext/Relation_context/Relation_context.aod b/neonContext/Relation_context/Relation_context.aod index 6b4088dbf9b486de17e58ccc63355cab2805b50d..3362a708b4a8193aea44306772515391c968cde9 100644 --- a/neonContext/Relation_context/Relation_context.aod +++ b/neonContext/Relation_context/Relation_context.aod @@ -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> diff --git a/neonView/PersLookup_view/PersLookup_view.aod b/neonView/PersLookup_view/PersLookup_view.aod index 7daae42d3a1bdcade360f81aa715c328ff4ac471..1c7fdd8c23d5e690b31a6b42974b9dd3ffddbf42 100644 --- a/neonView/PersLookup_view/PersLookup_view.aod +++ b/neonView/PersLookup_view/PersLookup_view.aod @@ -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> diff --git a/neonView/RelationLookup_view/RelationLookup_view.aod b/neonView/RelationLookup_view/RelationLookup_view.aod index 087c22f3a3c8925e07448a9f5cf771eabc98fada..1c221bc89797a7b89d3e14a1dcbef45f61eeb6f6 100644 --- a/neonView/RelationLookup_view/RelationLookup_view.aod +++ b/neonView/RelationLookup_view/RelationLookup_view.aod @@ -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> diff --git a/process/Comm_lib/process.js b/process/Comm_lib/process.js index 854e3aaace1b42b92a8c0dd38b34cb5e9929f385..08093abd9c9252c9fc3521ae8243b18c74f063d9 100644 --- a/process/Comm_lib/process.js +++ b/process/Comm_lib/process.js @@ -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; };