From e382b60eee6040e28d83b6f73b7bea9b05fc70e6 Mon Sep 17 00:00:00 2001 From: "m.escher" <m.escher@adito.de> Date: Thu, 20 Dec 2018 14:16:04 +0100 Subject: [PATCH] fix lookup for Order --- entity/Order_entity/Order_entity.aod | 26 ++++++++++++++----- .../relation_id/displayValueProcess.js | 6 +++++ .../relation_id/linkedContextProcess.js | 19 +++----------- .../salesproject_id/displayValueProcess.js | 5 ++++ 4 files changed, 33 insertions(+), 23 deletions(-) create mode 100644 entity/Order_entity/entityfields/relation_id/displayValueProcess.js create mode 100644 entity/Order_entity/entityfields/salesproject_id/displayValueProcess.js diff --git a/entity/Order_entity/Order_entity.aod b/entity/Order_entity/Order_entity.aod index d79ba832ff..1e7177a4be 100644 --- a/entity/Order_entity/Order_entity.aod +++ b/entity/Order_entity/Order_entity.aod @@ -57,6 +57,7 @@ <linkedContextProcess>%aditoprj%/entity/Order_entity/entityfields/relation_id/linkedContextProcess.js</linkedContextProcess> <mandatory v="true" /> <outgoingField>OrderRelation_dfo</outgoingField> + <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/relation_id/displayValueProcess.js</displayValueProcess> <onValueChange>%aditoprj%/entity/Order_entity/entityfields/relation_id/onValueChange.js</onValueChange> <onValueChangeTypes> <element>MASK</element> @@ -65,10 +66,11 @@ <entityField> <name>SALESPROJECT_ID</name> <title>Salesproject</title> + <linkedContext>Salesproject_context</linkedContext> <mandatory v="true" /> <state>INVISIBLE</state> <stateProcess>%aditoprj%/entity/Order_entity/entityfields/salesproject_id/stateProcess.js</stateProcess> - <valueProcess></valueProcess> + <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/salesproject_id/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>STATUS</name> @@ -301,19 +303,33 @@ <onDBDelete>%aditoprj%/entity/Order_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> - <name>ab8d856d-4776-4373-b675-37a1a672a7a6</name> + <name>f84d86a8-867d-44ea-bce5-3489bbee55a0</name> <tableName>SALESORDER</tableName> <primaryKey>SALESORDERID</primaryKey> <isUIDTable v="true" /> <readonly v="false" /> </linkInformation> <linkInformation> - <name>0580b93e-94bf-4a52-a4c0-3746733e559c</name> + <name>2c489a72-00ee-4bad-929f-25ef82dbc714</name> <tableName>RELATION</tableName> <primaryKey>RELATIONID</primaryKey> <isUIDTable v="false" /> <readonly v="true" /> </linkInformation> + <linkInformation> + <name>3888fb8c-6d2a-42e6-8abd-e4a9ac7a74ac</name> + <tableName>ORG</tableName> + <primaryKey>ORGID</primaryKey> + <isUIDTable v="false" /> + <readonly v="true" /> + </linkInformation> + <linkInformation> + <name>75470798-2097-41a2-95c2-22cf80d2f0c4</name> + <tableName>PERS</tableName> + <primaryKey>PERSID</primaryKey> + <isUIDTable v="false" /> + <readonly v="true" /> + </linkInformation> </linkInformation> <recordFieldMappings> <dbRecordFieldMapping> @@ -384,10 +400,6 @@ <name>RELATION_ID.value</name> <recordfield>SALESORDER.RELATION_ID</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>RELATION_ID.displayValue</name> - <recordfield>RELATION.RELATIONID</recordfield> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>RELATION_ORG_ID.value</name> <recordfield>RELATION.ORG_ID</recordfield> diff --git a/entity/Order_entity/entityfields/relation_id/displayValueProcess.js b/entity/Order_entity/entityfields/relation_id/displayValueProcess.js new file mode 100644 index 0000000000..5159f2ac23 --- /dev/null +++ b/entity/Order_entity/entityfields/relation_id/displayValueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("system.vars"); +import("Relation_lib"); +import("system.neon"); + +result.string(RelationUtils.getNameByPersOrgWithRelationId(vars.getString("$field.RELATION_ID"))); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/relation_id/linkedContextProcess.js b/entity/Order_entity/entityfields/relation_id/linkedContextProcess.js index 3a6e4491a5..2c8672f453 100644 --- a/entity/Order_entity/entityfields/relation_id/linkedContextProcess.js +++ b/entity/Order_entity/entityfields/relation_id/linkedContextProcess.js @@ -1,18 +1,5 @@ -import("system.result"); import("system.vars"); -import("Relation_lib") +import("system.result"); +import("Relation_lib"); -if(!vars.get("$field.RELATION_PERS_ID") && !vars.get("$field.RELATION_ORG_ID")) - result.string(""); -else { - switch (RelationUtils.getRelationTypeByPersOrg(vars.get("$field.RELATION_PERS_ID"), vars.get("$field.RELATION_ORG_ID"))) - { - case 1: // Org - result.string("Org_context") - break; - case 2: // private Pers - case 3: // Pers - result.string("Pers_context") - default: - } -} \ No newline at end of file +result.string(RelationUtils.getContextByRelationId(vars.getString("$field.RELATION_ID"))); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/salesproject_id/displayValueProcess.js b/entity/Order_entity/entityfields/salesproject_id/displayValueProcess.js new file mode 100644 index 0000000000..65afbf6e95 --- /dev/null +++ b/entity/Order_entity/entityfields/salesproject_id/displayValueProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("system.result"); +import("Salesproject_lib"); + +result.string(Salesproject.getSalesProjectTitleById(vars.getString("$field.SALESPROJECT_ID"))); \ No newline at end of file -- GitLab