From 927516c7ef9e003cb63ab302a7f7d8c56fee7e4d Mon Sep 17 00:00:00 2001 From: Johannes Hoermann <j.hoermann@adito.de> Date: Mon, 4 Mar 2019 13:43:37 +0100 Subject: [PATCH] relations --- .../ObjectRelation_entity.aod | 7 ++++- .../relation_type/displayValueProcess.js | 11 ++++---- .../Organisation_entity.aod | 28 +++++++++++++++++++ .../children/objectrowid_param/code.js | 4 +++ .../children/objecttype_param/code.js | 4 +++ .../OrganisationMain_view.aod | 10 +++---- .../2019.2/add_ObjectRelationKeyword.xml | 2 +- 7 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 entity/Organisation_entity/entityfields/objectrelations/children/objectrowid_param/code.js create mode 100644 entity/Organisation_entity/entityfields/objectrelations/children/objecttype_param/code.js diff --git a/entity/ObjectRelation_entity/ObjectRelation_entity.aod b/entity/ObjectRelation_entity/ObjectRelation_entity.aod index 2e0f9056bd..8c87e6e747 100644 --- a/entity/ObjectRelation_entity/ObjectRelation_entity.aod +++ b/entity/ObjectRelation_entity/ObjectRelation_entity.aod @@ -109,7 +109,6 @@ <fieldType>DEPENDENCY_IN</fieldType> <targetContextField>OtherObjectType</targetContextField> <targetIdField>OtherObjectRowid</targetIdField> - <recordContainer>db</recordContainer> <dependencies> <entityDependency> <name>30a7c954-3127-4ceb-9838-a0b7b55d0c8c</name> @@ -117,6 +116,12 @@ <fieldName>ObjectRelations</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>3f268dec-4672-4de0-98b2-7616f344248f</name> + <entityName>Organisation_entity</entityName> + <fieldName>ObjectRelations</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> diff --git a/entity/ObjectRelation_entity/entityfields/relation_type/displayValueProcess.js b/entity/ObjectRelation_entity/entityfields/relation_type/displayValueProcess.js index b741df4852..5e306501b8 100644 --- a/entity/ObjectRelation_entity/entityfields/relation_type/displayValueProcess.js +++ b/entity/ObjectRelation_entity/entityfields/relation_type/displayValueProcess.js @@ -1,4 +1,3 @@ -import("system.logging"); import("system.db"); import("system.result"); import("system.vars"); @@ -10,18 +9,20 @@ if (vars.exists("$field.OtherObjectType") && vars.get("$field.OtherObjectType") { var attributes = KeywordUtils.getAttributeRelationsByKey(vars.get("$field.RELATION_TYPE"), $KeywordRegistry.objectRelationType()); var currentObjectNum = vars.get("$field.CurrentObjectNumber"); - logging.log(currentObjectNum.toSource()) var name = ""; + switch (currentObjectNum) { case "1": - name = attributes.Object2Title; + // if second title doesn't exist, it is same like the first one. + if (attributes.Object2Title == null) + name = attributes.Object1Title; + else + name = attributes.Object2Title; break; case "2": name = attributes.Object1Title; break; } - logging.log(attributes.toSource()) - logging.log(name.toSource()) result.string(name); } \ No newline at end of file diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod index c72fa0ec5c..9d6c0a092a 100644 --- a/entity/Organisation_entity/Organisation_entity.aod +++ b/entity/Organisation_entity/Organisation_entity.aod @@ -425,7 +425,19 @@ <fieldType>DEPENDENCY_OUT</fieldType> <dependency> <name>dependency</name> + <entityName>ObjectRelation_entity</entityName> + <fieldName>ObjectRelations</fieldName> </dependency> + <children> + <entityParameter> + <name>ObjectRowid_param</name> + <code>%aditoprj%/entity/Organisation_entity/entityfields/objectrelations/children/objectrowid_param/code.js</code> + </entityParameter> + <entityParameter> + <name>ObjectType_param</name> + <code>%aditoprj%/entity/Organisation_entity/entityfields/objectrelations/children/objecttype_param/code.js</code> + </entityParameter> + </children> </entityConsumer> <entityConsumer> <name>KeywordContactStates</name> @@ -527,6 +539,22 @@ <name>dependency</name> </dependency> </entityConsumer> + <entityConsumer> + <name>Salesprojects</name> + <title>Salesprojects</title> + <fieldType>DEPENDENCY_OUT</fieldType> + <dependency> + <name>dependency</name> + <entityName>Salesproject_entity</entityName> + <fieldName>Salesprojects</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContactId_param</name> + <code>%aditoprj%/entity/Organisation_entity/entityfields/salesprojects/children/contactid_param/code.js</code> + </entityParameter> + </children> + </entityConsumer> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/Organisation_entity/entityfields/objectrelations/children/objectrowid_param/code.js b/entity/Organisation_entity/entityfields/objectrelations/children/objectrowid_param/code.js new file mode 100644 index 0000000000..bcfda44fe7 --- /dev/null +++ b/entity/Organisation_entity/entityfields/objectrelations/children/objectrowid_param/code.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.ORGANISATIONID")); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/objectrelations/children/objecttype_param/code.js b/entity/Organisation_entity/entityfields/objectrelations/children/objecttype_param/code.js new file mode 100644 index 0000000000..008915f61d --- /dev/null +++ b/entity/Organisation_entity/entityfields/objectrelations/children/objecttype_param/code.js @@ -0,0 +1,4 @@ +import("system.result"); +import("Context_lib"); + +result.string(ContextUtils.getCurrentContextId()); \ No newline at end of file diff --git a/neonView/OrganisationMain_view/OrganisationMain_view.aod b/neonView/OrganisationMain_view/OrganisationMain_view.aod index ef3e97b5d0..8983facca3 100644 --- a/neonView/OrganisationMain_view/OrganisationMain_view.aod +++ b/neonView/OrganisationMain_view/OrganisationMain_view.aod @@ -40,16 +40,16 @@ <entityField>Contracts</entityField> <view>ContractFilter_view</view> </neonViewReference> + <neonViewReference> + <name>ee7395b9-b787-4662-9021-f6e2d486bd16</name> + <entityField>ObjectRelations</entityField> + <view>ObjectRelationFilter_view</view> + </neonViewReference> <neonViewReference> <name>39c98ccb-7f77-4df0-818f-1f302f69fec4</name> <entityField>Attributes</entityField> <view>AttributeRelationFilter_view</view> </neonViewReference> - <neonViewReference> - <name>ee7395b9-b787-4662-9021-f6e2d486bd16</name> - <entityField>ObjectRelations</entityField> - <view>AnyObjectRelationFilter_view</view> - </neonViewReference> <neonViewReference> <name>dc1aa0ca-d0bd-45fd-84dc-55cfcf3ca430</name> <entityField>Salesprojects</entityField> diff --git a/others/db_changes/data_alias/basic/2019.2/add_ObjectRelationKeyword.xml b/others/db_changes/data_alias/basic/2019.2/add_ObjectRelationKeyword.xml index 937b402f18..6f4fab3fe3 100644 --- a/others/db_changes/data_alias/basic/2019.2/add_ObjectRelationKeyword.xml +++ b/others/db_changes/data_alias/basic/2019.2/add_ObjectRelationKeyword.xml @@ -237,7 +237,7 @@ <insert tableName="AB_KEYWORD_ENTRY"> <column name="AB_KEYWORD_ENTRYID" value="ba666b30-27b0-46ba-8ea7-442518cb862f"/> - <column name="KEYID" value="600cd496-c7c1-4be0-a339-76f057711025"/> + <column name="KEYID" value="a19802ad-f5aa-47dc-abb3-02791a4aa7ac"/> <column name="TITLE" value="competitor"/> <column name="CONTAINER" value="ObjectRelationType"/> <column name="SORTING" valueNumeric="5"/> -- GitLab