From 841d79c822bd3b95336f7bfa0c5c3ece4e2fe812 Mon Sep 17 00:00:00 2001 From: "p.neub" <p.neub@adito.de> Date: Thu, 14 Jan 2021 09:40:08 +0100 Subject: [PATCH] =?UTF-8?q?[Projekt:=20Entwicklung=20-=20xRM][TicketNr.:?= =?UTF-8?q?=201068743][Kontakt=20-=20Filterview=20=20und=20Mainview/360=20?= =?UTF-8?q?Grad/=20Kampagne/Mainview/TN=20-=20Kontakte=20mehrfach=20zu=20e?= =?UTF-8?q?iner=20Kampagne=20hinzugef=C3=BCgt=20werden]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CampaignAddParticipants_entity.aod | 11 ++++++----- .../entityfields/campaign_id/onValidation.js | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 entity/CampaignAddParticipants_entity/entityfields/campaign_id/onValidation.js diff --git a/entity/CampaignAddParticipants_entity/CampaignAddParticipants_entity.aod b/entity/CampaignAddParticipants_entity/CampaignAddParticipants_entity.aod index 339e6914d5..81f16aeb72 100644 --- a/entity/CampaignAddParticipants_entity/CampaignAddParticipants_entity.aod +++ b/entity/CampaignAddParticipants_entity/CampaignAddParticipants_entity.aod @@ -28,6 +28,7 @@ <element>PROCESS_SETVALUE</element> <element>RECORD</element> </onValueChangeTypes> + <onValidation>%aditoprj%/entity/CampaignAddParticipants_entity/entityfields/campaign_id/onValidation.js</onValidation> </entityField> <entityField> <name>CAMPAIGNSTEP_ID</name> @@ -60,11 +61,6 @@ </entityConsumer> <entityConsumer> <name>CampaignStepConsumer</name> - <dependency> - <name>dependency</name> - <entityName>CampaignStep_entity</entityName> - <fieldName>CampaignSteps</fieldName> - </dependency> <children> <entityParameter> <name>campaignId_param</name> @@ -72,6 +68,11 @@ <expose v="true" /> </entityParameter> </children> + <dependency> + <name>dependency</name> + <entityName>CampaignStep_entity</entityName> + <fieldName>CampaignSteps</fieldName> + </dependency> </entityConsumer> <entityField> <name>UID</name> diff --git a/entity/CampaignAddParticipants_entity/entityfields/campaign_id/onValidation.js b/entity/CampaignAddParticipants_entity/entityfields/campaign_id/onValidation.js new file mode 100644 index 0000000000..c84027b8fe --- /dev/null +++ b/entity/CampaignAddParticipants_entity/entityfields/campaign_id/onValidation.js @@ -0,0 +1,19 @@ +import("system.vars"); +import("system.result"); +import("Sql_lib"); +import("system.translate"); + +let participants = JSON.parse(vars.get("$param.campaignParticipantsRowIds_param")); +if(participants.length > 0) +{ + let thisParticipantCount = newSelect("count('')").from("CAMPAIGNPARTICIPANT") + .where("CAMPAIGNPARTICIPANT.CAMPAIGN_ID", vars.get("$field.CAMPAIGN_ID")) + .and( + "CAMPAIGNPARTICIPANT.CONTACT_ID", + participants, + SqlBuilder.IN() + ).cell(); + + if(parseInt(thisParticipantCount) > 0) + result.string(translate.text("Participant is already participating")); +} -- GitLab