From 423bc49809aaacbf269b2e460f6ac90a6fa2ff05 Mon Sep 17 00:00:00 2001 From: Johannes Hoermann <j.hoermann@adito.de> Date: Thu, 28 Nov 2019 10:33:38 +0100 Subject: [PATCH] =?UTF-8?q?#1045399=20360=C2=B0=20add=20campaign:=20same?= =?UTF-8?q?=20same=20function=20as=20for=20all=20other=20add=20campaigns.?= =?UTF-8?q?=20->=20Better=20=20validation=20if=20the=20contact=20can=20be?= =?UTF-8?q?=20added=20to=20the=20campaign?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../newcampaignparticipant/onActionProcess.js | 7 ++++++- process/Campaign_lib/process.js | 12 +----------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/entity/360Degree_entity/entityfields/newmodule/children/newcampaignparticipant/onActionProcess.js b/entity/360Degree_entity/entityfields/newmodule/children/newcampaignparticipant/onActionProcess.js index 2da9bd242b..47f9f4bce2 100644 --- a/entity/360Degree_entity/entityfields/newmodule/children/newcampaignparticipant/onActionProcess.js +++ b/entity/360Degree_entity/entityfields/newmodule/children/newcampaignparticipant/onActionProcess.js @@ -1,4 +1,9 @@ import("system.vars"); import("Campaign_lib"); -CampaignUtils.addParticipant(vars.getString("$param.ObjectRowId_param")); \ No newline at end of file +if (vars.get("$param.BaseContextId_param") == "Person" || vars.get("$param.BaseContextId_param") == "Organisation") +{ + // Note: this only works if the BaseContextId_param is also the correct Tablename. If not you have to add a context - tablename mapping somewhere... + // for person / organisation this should work + CampaignUtils.addParticipantsByRowIds(JSON.stringify([vars.getString("$param.ObjectRowId_param")]), vars.get("$param.BaseContextId_param").toUpperCase()); +} \ No newline at end of file diff --git a/process/Campaign_lib/process.js b/process/Campaign_lib/process.js index 4021c65e1c..211174c647 100644 --- a/process/Campaign_lib/process.js +++ b/process/Campaign_lib/process.js @@ -15,20 +15,10 @@ import("Neon_lib"); */ function CampaignUtils() {} -/** - * Add one Contact (Person or Organistaion) to a Campaign - * - * @param {String} pContactId req ContactId - */ -CampaignUtils.addParticipant = function(pContactId) -{ - _CampaignUtils._openAddParticipantContext("CampaignParticipant", pContactId, "ContactId_param", "CampaignParticipantEdit_view"); -} - /** * Add many Contacts (Person or Organistaion) to a Campaign * - * @param {String} pRowIds req ContactIds + * @param {String} pRowIds ContactIds as JSON array * @param {String} pSourceTableName req */ CampaignUtils.addParticipantsByRowIds = function(pRowIds, pSourceTableName) -- GitLab