From ea885b4ea76dad9c7227c4aadbb98c5930fd393f Mon Sep 17 00:00:00 2001 From: Markus Escher <m.escher@adito.de> Date: Wed, 12 Dec 2018 14:00:03 +0100 Subject: [PATCH] add Lookup for Contract, Offer, Salesproject relationfields --- entity/Contract_entity/Contract_entity.aod | 45 +++++++++++++++-- .../relation_id/linkedContextProcess.js | 8 +-- .../entityfields/relation_id/valueProcess.js | 9 ---- .../recordcontainers/db/fromClauseProcess.js | 3 ++ entity/Offer_entity/Offer_entity.aod | 50 ++++++++++++++++--- .../relation_id/linkedContextProcess.js | 18 +++++++ .../entityfields/relation_id/stateProcess.js | 16 ------ .../recordcontainers/db/fromClauseProcess.js | 3 ++ entity/Relation_entity/Relation_entity.aod | 23 +++++++++ .../Salesproject_entity.aod | 24 +++++++-- .../recordcontainers/db/fromClauseProcess.js | 4 ++ 11 files changed, 156 insertions(+), 47 deletions(-) create mode 100644 entity/Contract_entity/recordcontainers/db/fromClauseProcess.js create mode 100644 entity/Offer_entity/entityfields/relation_id/linkedContextProcess.js delete mode 100644 entity/Offer_entity/entityfields/relation_id/stateProcess.js create mode 100644 entity/Offer_entity/recordcontainers/db/fromClauseProcess.js create mode 100644 entity/Salesproject_entity/recordcontainers/db/fromClauseProcess.js diff --git a/entity/Contract_entity/Contract_entity.aod b/entity/Contract_entity/Contract_entity.aod index 45f820ea628..a72928fe660 100644 --- a/entity/Contract_entity/Contract_entity.aod +++ b/entity/Contract_entity/Contract_entity.aod @@ -173,21 +173,44 @@ <entityIncomingField> <name>#INCOMING</name> </entityIncomingField> + <entityOutgoingField> + <name>ContractRelation_dfo</name> + <fieldType>DEPENDENCY_OUT</fieldType> + <dependency> + <name>dependency</name> + <entityName>Relation_entity</entityName> + <fieldName>ContractRelation_dfi</fieldName> + </dependency> + </entityOutgoingField> + <entityField> + <name>RELATION_ORG_ID</name> + </entityField> + <entityField> + <name>RELATION_PERS_ID</name> + </entityField> </entityFields> <recordContainers> <dbRecordContainer> <name>db</name> <alias>Data_alias</alias> <maximumDbRows v="0" /> + <fromClauseProcess>%aditoprj%/entity/Contract_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess> <conditionProcess>%aditoprj%/entity/Contract_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <linkInformation> <linkInformation> - <name>c0a3abee-1dd3-4a57-8a73-bb97ad5a286f</name> + <name>99139e0f-3074-4c07-8998-bd83676e5a58</name> <tableName>CONTRACT</tableName> <primaryKey>CONTRACTID</primaryKey> <isUIDTable v="true" /> <readonly v="false" /> </linkInformation> + <linkInformation> + <name>2c5a2300-594b-46ee-8234-eaafb49a9a1e</name> + <tableName>RELATION</tableName> + <primaryKey>RELATIONID</primaryKey> + <isUIDTable v="false" /> + <readonly v="true" /> + </linkInformation> </linkInformation> <recordFieldMappings> <dbRecordFieldMapping> @@ -230,10 +253,6 @@ <name>PAYMENT.value</name> <recordfield>CONTRACT.PAYMENT</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>RELATION_ID.value</name> - <recordfield>CONTRACT.RELATION_ID</recordfield> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>REMARK.value</name> <recordfield>CONTRACT.REMARK</recordfield> @@ -246,6 +265,22 @@ <name>USER_NEW.value</name> <recordfield>CONTRACT.USER_NEW</recordfield> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>RELATION_ID.displayValue</name> + <recordfield>RELATION.RELATIONID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>RELATION_ID.value</name> + <recordfield>CONTRACT.RELATION_ID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>RELATION_ORG_ID.value</name> + <recordfield>RELATION.ORG_ID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>RELATION_PERS_ID.value</name> + <recordfield>RELATION.PERS_ID</recordfield> + </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> </recordContainers> diff --git a/entity/Contract_entity/entityfields/relation_id/linkedContextProcess.js b/entity/Contract_entity/entityfields/relation_id/linkedContextProcess.js index 3a69957e898..114e4bd36cc 100644 --- a/entity/Contract_entity/entityfields/relation_id/linkedContextProcess.js +++ b/entity/Contract_entity/entityfields/relation_id/linkedContextProcess.js @@ -1,11 +1,11 @@ import("system.result"); import("system.vars"); -import("Relation_lib") +import("Relation_lib"); -if(!vars.get("$field.RELATION_ID")) +if(!vars.get("$field.RELATION_PERS_ID") && !vars.get("$field.RELATION_ORG_ID")) result.string(""); else { - switch (RelationUtils.getRelationTypeByRelation(vars.get("$field.RELATION_ID"))) + switch (RelationUtils.getRelationTypeByPersOrg(vars.get("$field.RELATION_PERS_ID"), vars.get("$field.RELATION_ORG_ID"))) { case 1: // Org result.string("Org_context") @@ -15,4 +15,4 @@ else { result.string("Pers_context") default: } -} \ No newline at end of file +} diff --git a/entity/Contract_entity/entityfields/relation_id/valueProcess.js b/entity/Contract_entity/entityfields/relation_id/valueProcess.js index af9f2a0e2fe..e69de29bb2d 100644 --- a/entity/Contract_entity/entityfields/relation_id/valueProcess.js +++ b/entity/Contract_entity/entityfields/relation_id/valueProcess.js @@ -1,9 +0,0 @@ -import("system.result"); -import("system.neon"); -import("system.vars"); - -if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW) -{ - if(vars.exists("$param.RelId_param") && vars.get("$param.RelId_param")) - result.string(vars.getString("$param.RelId_param")); -} diff --git a/entity/Contract_entity/recordcontainers/db/fromClauseProcess.js b/entity/Contract_entity/recordcontainers/db/fromClauseProcess.js new file mode 100644 index 00000000000..f3c2fc90df2 --- /dev/null +++ b/entity/Contract_entity/recordcontainers/db/fromClauseProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string("CONTRACT left join RELATION on RELATIONID = RELATION_ID left join ORG on ORGID = ORG_ID"); \ No newline at end of file diff --git a/entity/Offer_entity/Offer_entity.aod b/entity/Offer_entity/Offer_entity.aod index d01ba8ec062..3722cf0e142 100644 --- a/entity/Offer_entity/Offer_entity.aod +++ b/entity/Offer_entity/Offer_entity.aod @@ -60,10 +60,9 @@ <name>RELATION_ID</name> <documentation>%aditoprj%/entity/Offer_entity/entityfields/relation_id/documentation.adoc</documentation> <title>Contact / Company</title> + <linkedContextProcess>%aditoprj%/entity/Offer_entity/entityfields/relation_id/linkedContextProcess.js</linkedContextProcess> <mandatory v="true" /> - <state>INVISIBLE</state> - <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/relation_id/stateProcess.js</stateProcess> - <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/relation_id/valueProcess.js</valueProcess> + <outgoingField>OfferRelation_dfo</outgoingField> <onValueChange>%aditoprj%/entity/Offer_entity/entityfields/relation_id/onValueChange.js</onValueChange> </entityField> <entityField> @@ -246,22 +245,45 @@ <title>Offer report</title> <onActionProcess>%aditoprj%/entity/Offer_entity/entityfields/offerreport/onActionProcess.js</onActionProcess> </entityActionField> + <entityField> + <name>RELATION_ORG_ID</name> + </entityField> + <entityField> + <name>RELATION_PERS_ID</name> + </entityField> + <entityOutgoingField> + <name>OfferRelation_dfo</name> + <fieldType>DEPENDENCY_OUT</fieldType> + <dependency> + <name>dependency</name> + <entityName>Relation_entity</entityName> + <fieldName>OfferRelation_dfi</fieldName> + </dependency> + </entityOutgoingField> </entityFields> <recordContainers> <dbRecordContainer> <name>db</name> <alias>Data_alias</alias> <maximumDbRows v="0" /> + <fromClauseProcess>%aditoprj%/entity/Offer_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess> <conditionProcess>%aditoprj%/entity/Offer_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <onDBDelete>%aditoprj%/entity/Offer_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> - <name>9b11e19c-bc84-4848-9fe8-b3081292d74f</name> + <name>ab8d856d-4776-4373-b675-37a1a672a7a6</name> <tableName>OFFER</tableName> <primaryKey>OFFERID</primaryKey> <isUIDTable v="true" /> <readonly v="false" /> </linkInformation> + <linkInformation> + <name>0580b93e-94bf-4a52-a4c0-3746733e559c</name> + <tableName>RELATION</tableName> + <primaryKey>RELATIONID</primaryKey> + <isUIDTable v="false" /> + <readonly v="true" /> + </linkInformation> </linkInformation> <recordFieldMappings> <dbRecordFieldMapping> @@ -308,10 +330,6 @@ <name>PROBABILITY.value</name> <recordfield>OFFER.PROBABILITY</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>RELATION_ID.value</name> - <recordfield>OFFER.RELATION_ID</recordfield> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>SALESPROJECT_ID.value</name> <recordfield>OFFER.SALESPROJECT_ID</recordfield> @@ -336,6 +354,22 @@ <name>VERSNR.value</name> <recordfield>OFFER.VERSNR</recordfield> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>RELATION_ID.value</name> + <recordfield>OFFER.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> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>RELATION_PERS_ID.value</name> + <recordfield>RELATION.PERS_ID</recordfield> + </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> </recordContainers> diff --git a/entity/Offer_entity/entityfields/relation_id/linkedContextProcess.js b/entity/Offer_entity/entityfields/relation_id/linkedContextProcess.js new file mode 100644 index 00000000000..3a6e4491a59 --- /dev/null +++ b/entity/Offer_entity/entityfields/relation_id/linkedContextProcess.js @@ -0,0 +1,18 @@ +import("system.result"); +import("system.vars"); +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 diff --git a/entity/Offer_entity/entityfields/relation_id/stateProcess.js b/entity/Offer_entity/entityfields/relation_id/stateProcess.js deleted file mode 100644 index d4e696f145b..00000000000 --- a/entity/Offer_entity/entityfields/relation_id/stateProcess.js +++ /dev/null @@ -1,16 +0,0 @@ -import("system.neon"); -import("system.result"); -import("system.vars"); - - -switch (vars.get("$sys.operatingstate")) -{ - case neon.OPERATINGSTATE_NEW: - result.object(neon.COMPONENTSTATE_EDITABLE); - break; - case neon.OPERATINGSTATE_EDIT: - result.object(neon.COMPONENTSTATE_INVISIBLE); - break; - default: - result.object(neon.COMPONENTSTATE_READONLY); -} \ No newline at end of file diff --git a/entity/Offer_entity/recordcontainers/db/fromClauseProcess.js b/entity/Offer_entity/recordcontainers/db/fromClauseProcess.js new file mode 100644 index 00000000000..6c711bf4ba7 --- /dev/null +++ b/entity/Offer_entity/recordcontainers/db/fromClauseProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string("OFFER left join RELATION on RELATIONID = RELATION_ID left join ORG on ORGID = ORG_ID"); \ No newline at end of file diff --git a/entity/Relation_entity/Relation_entity.aod b/entity/Relation_entity/Relation_entity.aod index 8551476fcd3..8f233a5ca4c 100644 --- a/entity/Relation_entity/Relation_entity.aod +++ b/entity/Relation_entity/Relation_entity.aod @@ -118,15 +118,38 @@ See RelationUtils.getRelationTypeByPersOrg for possible values</description> <entityIncomingField> <name>ContractRelation_dfi</name> <fieldType>DEPENDENCY_IN</fieldType> +<<<<<<< HEAD <dependencies> <entityDependency> <name>b0e92b19-d9b3-4217-a2fc-9348230efb8c</name> +======= + <recordContainer>db</recordContainer> + <dependencies> + <entityDependency> + <name>c57332c1-19c2-466d-a59f-35f78ecb47af</name> +>>>>>>> add Lookup for Contract, Offer, Salesproject relationfields <entityName>Contract_entity</entityName> <fieldName>ContractRelation_dfo</fieldName> <isOutgoing v="false" /> </entityDependency> </dependencies> </entityIncomingField> +<<<<<<< HEAD +======= + <entityIncomingField> + <name>OfferRelation_dfi</name> + <fieldType>DEPENDENCY_IN</fieldType> + <recordContainer>db</recordContainer> + <dependencies> + <entityDependency> + <name>26d3e9ec-5a60-4108-b699-b8ba566f4832</name> + <entityName>Offer_entity</entityName> + <fieldName>OfferRelation_dfo</fieldName> + <isOutgoing v="false" /> + </entityDependency> + </dependencies> + </entityIncomingField> +>>>>>>> add Lookup for Contract, Offer, Salesproject relationfields </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/Salesproject_entity/Salesproject_entity.aod b/entity/Salesproject_entity/Salesproject_entity.aod index f7b30b503f4..f5b759c0c81 100644 --- a/entity/Salesproject_entity/Salesproject_entity.aod +++ b/entity/Salesproject_entity/Salesproject_entity.aod @@ -65,7 +65,9 @@ <entityField> <name>RELATION_ID</name> <title>Company</title> + <linkedContext>Org_context</linkedContext> <mandatory v="true" /> + <outgoingField>SalesprojectOrg_dfo</outgoingField> </entityField> <entityField> <name>SALESPROJECTID</name> @@ -276,16 +278,24 @@ <dbRecordContainer> <name>db</name> <alias>Data_alias</alias> + <fromClauseProcess>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess> <onDBInsert>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/onDBInsert.js</onDBInsert> <onDBUpdate>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/onDBUpdate.js</onDBUpdate> <linkInformation> <linkInformation> - <name>e6ff59f5-7012-428f-ab85-626781774379</name> + <name>4c96cc1e-fe7f-4f7f-93c8-5ceeb9e0a56b</name> <tableName>SALESPROJECT</tableName> <primaryKey>SALESPROJECTID</primaryKey> <isUIDTable v="true" /> <readonly v="false" /> </linkInformation> + <linkInformation> + <name>701d5159-3b17-4ba9-879f-fce34375411e</name> + <tableName>ORG</tableName> + <primaryKey>ORGID</primaryKey> + <isUIDTable v="false" /> + <readonly v="true" /> + </linkInformation> </linkInformation> <recordFieldMappings> <dbRecordFieldMapping> @@ -324,10 +334,6 @@ <name>PROJECTTITLE.value</name> <recordfield>SALESPROJECT.PROJECTTITLE</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>RELATION_ID.value</name> - <recordfield>SALESPROJECT.RELATION_ID</recordfield> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>SALESPROJECTID.value</name> <recordfield>SALESPROJECT.SALESPROJECTID</recordfield> @@ -356,6 +362,14 @@ <name>ESTIMATIONVALUE.value</name> <recordfield>SALESPROJECT.ESTIMATIONVALUE</recordfield> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>RELATION_ID.value</name> + <recordfield>SALESPROJECT.RELATION_ID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>RELATION_ID.displayValue</name> + <recordfield>ORG.NAME</recordfield> + </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> </recordContainers> diff --git a/entity/Salesproject_entity/recordcontainers/db/fromClauseProcess.js b/entity/Salesproject_entity/recordcontainers/db/fromClauseProcess.js new file mode 100644 index 00000000000..487d17c5867 --- /dev/null +++ b/entity/Salesproject_entity/recordcontainers/db/fromClauseProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string("SALESPROJECT join ORG on RELATION_ID = ORGID "); \ No newline at end of file -- GitLab