From 0da12c1eef09e81da9187478fa92835de71cde77 Mon Sep 17 00:00:00 2001 From: Johannes Hoermann <j.hoermann@adito.de> Date: Wed, 3 Apr 2019 15:12:05 +0200 Subject: [PATCH] offer use consumer for possible addresses --- entity/Address_entity/Address_entity.aod | 10 ++++++++++ entity/Offer_entity/Offer_entity.aod | 17 ++++++++++++++++- .../chosenaddress/possibleItemsProcess.js | 5 ----- .../children/contactid_param/valueProcess.js | 4 ++++ entity/Person_entity/Person_entity.aod | 4 ---- .../organisationid_param/valueProcess.js | 4 ---- 6 files changed, 30 insertions(+), 14 deletions(-) delete mode 100644 entity/Offer_entity/entityfields/chosenaddress/possibleItemsProcess.js create mode 100644 entity/Offer_entity/entityfields/possibleaddresses/children/contactid_param/valueProcess.js delete mode 100644 entity/Person_entity/entityfields/contactandorganisationaddresses/children/organisationid_param/valueProcess.js diff --git a/entity/Address_entity/Address_entity.aod b/entity/Address_entity/Address_entity.aod index 334ba18c64..3feac2b6cf 100644 --- a/entity/Address_entity/Address_entity.aod +++ b/entity/Address_entity/Address_entity.aod @@ -141,6 +141,10 @@ <name>DefaultAddressId_param</name> <expose v="true" /> </entityParameter> + <entityParameter> + <name>OrganisationId_param</name> + <expose v="false" /> + </entityParameter> </children> </entityProvider> <entityProvider> @@ -210,6 +214,12 @@ <fieldName>ContactAndOrganisationAddresses</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>daa41953-8e95-46f2-b08a-6c843ab87985</name> + <entityName>Offer_entity</entityName> + <fieldName>PossibleAddresses</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> diff --git a/entity/Offer_entity/Offer_entity.aod b/entity/Offer_entity/Offer_entity.aod index 64409fcaa9..2e9ed00405 100644 --- a/entity/Offer_entity/Offer_entity.aod +++ b/entity/Offer_entity/Offer_entity.aod @@ -357,7 +357,7 @@ <entityField> <name>ChosenAddress</name> <title>Choose address</title> - <possibleItemsProcess>%aditoprj%/entity/Offer_entity/entityfields/chosenaddress/possibleItemsProcess.js</possibleItemsProcess> + <consumer>PossibleAddresses</consumer> <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/chosenaddress/stateProcess.js</stateProcess> <onValueChange>%aditoprj%/entity/Offer_entity/entityfields/chosenaddress/onValueChange.js</onValueChange> <onValueChangeTypes> @@ -700,6 +700,21 @@ <state>READONLY</state> <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/fulloffercode/valueProcess.js</valueProcess> </entityField> + <entityConsumer> + <name>PossibleAddresses</name> + <fieldType>DEPENDENCY_OUT</fieldType> + <dependency> + <name>dependency</name> + <entityName>Address_entity</entityName> + <fieldName>OrganisationAndContactAddresses</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContactId_param</name> + <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/possibleaddresses/children/contactid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/Offer_entity/entityfields/chosenaddress/possibleItemsProcess.js b/entity/Offer_entity/entityfields/chosenaddress/possibleItemsProcess.js deleted file mode 100644 index c45999248f..0000000000 --- a/entity/Offer_entity/entityfields/chosenaddress/possibleItemsProcess.js +++ /dev/null @@ -1,5 +0,0 @@ -import("system.vars"); -import("system.result"); -import("PostalAddress_lib"); - -result.object(AddressUtils.getAllPossibleAddresses(vars.get("$field.CONTACT_ID"))); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/possibleaddresses/children/contactid_param/valueProcess.js b/entity/Offer_entity/entityfields/possibleaddresses/children/contactid_param/valueProcess.js new file mode 100644 index 0000000000..7e0951d02b --- /dev/null +++ b/entity/Offer_entity/entityfields/possibleaddresses/children/contactid_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("system.vars"); + +result.string(vars.get("$field.CONTACT_ID")); \ No newline at end of file diff --git a/entity/Person_entity/Person_entity.aod b/entity/Person_entity/Person_entity.aod index 44bc063e4a..10a779eccd 100644 --- a/entity/Person_entity/Person_entity.aod +++ b/entity/Person_entity/Person_entity.aod @@ -698,10 +698,6 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact <name>ContactId_param</name> <valueProcess>%aditoprj%/entity/Person_entity/entityfields/contactandorganisationaddresses/children/contactid_param/valueProcess.js</valueProcess> </entityParameter> - <entityParameter> - <name>OrganisationId_param</name> - <valueProcess>%aditoprj%/entity/Person_entity/entityfields/contactandorganisationaddresses/children/organisationid_param/valueProcess.js</valueProcess> - </entityParameter> </children> </entityConsumer> <entityField> diff --git a/entity/Person_entity/entityfields/contactandorganisationaddresses/children/organisationid_param/valueProcess.js b/entity/Person_entity/entityfields/contactandorganisationaddresses/children/organisationid_param/valueProcess.js deleted file mode 100644 index a3b647281e..0000000000 --- a/entity/Person_entity/entityfields/contactandorganisationaddresses/children/organisationid_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.vars"); -import("system.result"); - -result.string(vars.get("$field.ORGANISATION_ID")); \ No newline at end of file -- GitLab