From 10dcfd05d04a1af204693ca7fd9927f10443a385 Mon Sep 17 00:00:00 2001 From: Johannes Hoermann <j.hoermann@adito.de> Date: Tue, 26 Nov 2019 08:33:41 +0100 Subject: [PATCH] add comm restriction to company --- .../CampaignParticipant_entity.aod | 2 +- .../CommRestriction_Entity.aod | 8 ++++++- .../Organisation_entity.aod | 14 +++++++++++ .../children/contactid_param/valueProcess.js | 4 ++++ entity/Person_entity/Person_entity.aod | 2 +- .../recordcontainers/db/onDBInsert.js | 10 +++----- neonContext/Organisation/Organisation.aod | 4 ++++ .../OrganisationAttributeRestriction_view.aod | 23 +++++++++++++++++++ .../OrganisationMain_view.aod | 6 ++--- 9 files changed, 60 insertions(+), 13 deletions(-) create mode 100644 entity/Organisation_entity/entityfields/commrestrictions/children/contactid_param/valueProcess.js create mode 100644 neonView/OrganisationAttributeRestriction_view/OrganisationAttributeRestriction_view.aod diff --git a/entity/CampaignParticipant_entity/CampaignParticipant_entity.aod b/entity/CampaignParticipant_entity/CampaignParticipant_entity.aod index deb48c07a6..560c1dc549 100644 --- a/entity/CampaignParticipant_entity/CampaignParticipant_entity.aod +++ b/entity/CampaignParticipant_entity/CampaignParticipant_entity.aod @@ -197,7 +197,7 @@ <dependency> <name>dependency</name> <entityName>CommRestriction_Entity</entityName> - <fieldName>PersonsCommRestriction</fieldName> + <fieldName>CommRestrictions</fieldName> </dependency> </entityConsumer> <entityConsumer> diff --git a/entity/CommRestriction_Entity/CommRestriction_Entity.aod b/entity/CommRestriction_Entity/CommRestriction_Entity.aod index 1206a0b74a..eb0611da15 100644 --- a/entity/CommRestriction_Entity/CommRestriction_Entity.aod +++ b/entity/CommRestriction_Entity/CommRestriction_Entity.aod @@ -69,7 +69,7 @@ </children> </entityConsumer> <entityProvider> - <name>PersonsCommRestriction</name> + <name>CommRestrictions</name> <dependencies> <entityDependency> <name>b50e33cd-e20f-4bdf-b0ee-2ecdab921ffd</name> @@ -77,6 +77,12 @@ <fieldName>CommRestrictions</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>1108f15c-75e3-49a8-b1cd-03259bfbb8a0</name> + <entityName>Organisation_entity</entityName> + <fieldName>CommRestrictions</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> </entityProvider> <entityParameter> diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod index 49fe08a89b..045271f346 100644 --- a/entity/Organisation_entity/Organisation_entity.aod +++ b/entity/Organisation_entity/Organisation_entity.aod @@ -1070,6 +1070,20 @@ </entityParameter> </children> </entityConsumer> + <entityConsumer> + <name>CommRestrictions</name> + <dependency> + <name>dependency</name> + <entityName>CommRestriction_Entity</entityName> + <fieldName>CommRestrictions</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContactId_param</name> + <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/commrestrictions/children/contactid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/Organisation_entity/entityfields/commrestrictions/children/contactid_param/valueProcess.js b/entity/Organisation_entity/entityfields/commrestrictions/children/contactid_param/valueProcess.js new file mode 100644 index 0000000000..08da3b121c --- /dev/null +++ b/entity/Organisation_entity/entityfields/commrestrictions/children/contactid_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("system.vars"); + +result.string(vars.getString("$field.CONTACTID")); \ No newline at end of file diff --git a/entity/Person_entity/Person_entity.aod b/entity/Person_entity/Person_entity.aod index 9ccc4389cc..80ba6e1aea 100644 --- a/entity/Person_entity/Person_entity.aod +++ b/entity/Person_entity/Person_entity.aod @@ -801,7 +801,7 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact <dependency> <name>dependency</name> <entityName>CommRestriction_Entity</entityName> - <fieldName>PersonsCommRestriction</fieldName> + <fieldName>CommRestrictions</fieldName> </dependency> <children> <entityParameter> diff --git a/entity/Person_entity/recordcontainers/db/onDBInsert.js b/entity/Person_entity/recordcontainers/db/onDBInsert.js index ce609c6ee0..134d6e77fb 100644 --- a/entity/Person_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Person_entity/recordcontainers/db/onDBInsert.js @@ -1,12 +1,8 @@ -import("system.translate"); -import("Employee_lib"); import("system.util"); -import("system.logging"); -import("system.vars"); +import("Sql_lib"); +import("system.db"); import("DataPrivacy_lib"); -import("DuplicateScanner_lib"); -import("system.notification"); -import("system.project"); +import("system.vars"); //let targetEntity = "Person_entity"; let contactId = vars.get("$local.uid"); diff --git a/neonContext/Organisation/Organisation.aod b/neonContext/Organisation/Organisation.aod index bddc5f4e9d..59ce4ecbe8 100644 --- a/neonContext/Organisation/Organisation.aod +++ b/neonContext/Organisation/Organisation.aod @@ -47,5 +47,9 @@ <name>51a18051-fcb8-4d90-9075-802fdce12f9c</name> <view>OrganisationTaskAppointment_view</view> </neonViewReference> + <neonViewReference> + <name>c72caf13-37cf-4af9-811d-832f43801369</name> + <view>OrganisationAttributeRestriction_view</view> + </neonViewReference> </references> </neonContext> diff --git a/neonView/OrganisationAttributeRestriction_view/OrganisationAttributeRestriction_view.aod b/neonView/OrganisationAttributeRestriction_view/OrganisationAttributeRestriction_view.aod new file mode 100644 index 0000000000..d53d86c059 --- /dev/null +++ b/neonView/OrganisationAttributeRestriction_view/OrganisationAttributeRestriction_view.aod @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>OrganisationAttributeRestriction_view</name> + <title>Attributes</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <neonViewReference> + <name>8226fe7b-877b-4093-9fc4-dbe7d7f8a8ea</name> + <entityField>AttributeTree</entityField> + <view>AttributeRelationTree_view</view> + </neonViewReference> + <neonViewReference> + <name>2c260627-f087-4240-8a6d-e7aa25bbe812</name> + <entityField>CommRestrictions</entityField> + <view>CommRestrictionDrawer_view</view> + </neonViewReference> + </children> +</neonView> diff --git a/neonView/OrganisationMain_view/OrganisationMain_view.aod b/neonView/OrganisationMain_view/OrganisationMain_view.aod index b7faebeb14..ecf0ab98c9 100644 --- a/neonView/OrganisationMain_view/OrganisationMain_view.aod +++ b/neonView/OrganisationMain_view/OrganisationMain_view.aod @@ -46,9 +46,9 @@ <view>OrganisationTaskAppointment_view</view> </neonViewReference> <neonViewReference> - <name>ba50e069-06da-440e-b04a-5a686fcf5303</name> - <entityField>AttributeTree</entityField> - <view>AttributeRelationTree_view</view> + <name>486b4999-ac17-4560-9ce0-0f20a0028d02</name> + <entityField>#ENTITY</entityField> + <view>OrganisationAttributeRestriction_view</view> </neonViewReference> <neonViewReference> <name>eba90ed2-5e55-4cdb-9e0b-5a09feeb7536</name> -- GitLab