Skip to content
Snippets Groups Projects
Commit 2e1b5bf4 authored by Daniel Tran's avatar Daniel Tran Committed by Sebastian Pongratz
Browse files

Cm dt 1074525 kampagnenteilnehmer hinzufügen

parent 2e17a8ec
No related branches found
No related tags found
No related merge requests found
......@@ -3,13 +3,20 @@ import("system.result");
import("system.vars");
if (vars.get("$sys.validationerrors"))
{
result.string(neon.COMPONENTSTATE_DISABLED);
else
}
else if(vars.get("$field.campaignparticipantContactIds") != null && vars.get("$field.campaignparticipantContactIds") != "")
{
var contactCount = JSON.parse(vars.get("$field.campaignparticipantContactIds")).length;
if (contactCount == 0)
{
result.string(neon.COMPONENTSTATE_DISABLED);
}
else
{
result.string(neon.COMPONENTSTATE_EDITABLE);
}
}
\ No newline at end of file
......@@ -3,17 +3,22 @@ import("system.result");
import("Sql_lib");
import("system.translate");
let participants = JSON.parse(vars.get("$param.campaignParticipantsRowIds_param"));
if(participants.length > 0)
if (vars.get("$param.campaignParticipantsRowIds_param") != null && vars.get("$param.campaignParticipantsRowIds_param") != "")
{
let thisParticipantCount = newSelect("count('')").from("CAMPAIGNPARTICIPANT")
.where("CAMPAIGNPARTICIPANT.CAMPAIGN_ID", vars.get("$field.CAMPAIGN_ID"))
.and(
"CAMPAIGNPARTICIPANT.CONTACT_ID",
participants,
SqlBuilder.IN()
).cell();
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"));
if(parseInt(thisParticipantCount) > 0)
{
result.string(translate.text("Participant is already participating"));
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment