Skip to content
Snippets Groups Projects
Commit 322f0d46 authored by Johannes Goderbauer's avatar Johannes Goderbauer
Browse files

[Projekt: Entwicklung - Neon][TicketNr.: 1066621][Kontakte - Serienaktion - zu...

[Projekt: Entwicklung - Neon][TicketNr.: 1066621][Kontakte - Serienaktion - zu Kampagne hinzufügen - Kontakte werden fehlerhaft in Kampagne angezeigt, Anzahl Teilnehmer fehlerhaf]
parent 5470178b
No related branches found
No related tags found
No related merge requests found
......@@ -19,10 +19,10 @@ var colNamesCampaignParticipantLog = CampaignUtils.getParticipantLogInsertColumn
if(participantRowIds != null && participantRowIds.length > 0)
{
let contactIdsToHandle = participantRowIds;
var contactIdsToHandle = participantRowIds;
if(isUpdate == "false")
contactIdsToHandle = vars.get("$field.campaignparticipantContactIds");
contactIdsToHandle = JSON.parse(vars.get("$field.campaignparticipantContactIds"));
_handleRowIds(contactIdsToHandle, campaignId);
}
......@@ -37,9 +37,9 @@ if (!vars.exists("$param.currentCampaignId_param") || !vars.get("$param.currentC
function _handleCondition(pCampaignId, pTargetTableName, pCondition)
{
let contactIdsToHandle = [];
var contactIdsToHandle = [];
let useRightJoinToGetOrgs = "false";
var useRightJoinToGetOrgs = "false";
if(pTargetTableName == "ORGANISATION")
{
useRightJoinToGetOrgs = "true";
......@@ -75,7 +75,7 @@ function _handleRowIds(pParticipantRowIds, pCampaignId)
"DATE_EDIT"
];
let oldSteps = newSelect("CAMPAIGNPARTICIPANTID, CAMPAIGNSTEP_ID")
var oldSteps = newSelect("CAMPAIGNPARTICIPANTID, CAMPAIGNSTEP_ID")
.from("CAMPAIGNPARTICIPANT")
.whereIfSet("CAMPAIGNPARTICIPANT.CONTACT_ID", pParticipantRowIds, SqlBuilder.IN())
.and("CAMPAIGNPARTICIPANT.CAMPAIGN_ID", pCampaignId)
......@@ -98,28 +98,28 @@ function _handleRowIds(pParticipantRowIds, pCampaignId)
];
}
let statementArray = [];
let logArray = [];
var statementArray = [];
var logArray = [];
for (let participant in pParticipantRowIds)
for (var participant in pParticipantRowIds)
{
let campaignParticipantLogId = util.getNewUUID();
var campaignParticipantLogId = util.getNewUUID();
var valsCampaignParticipantLog;
if(isUpdate == "true")
{
let oldCampaignStepId = oldStepIds[pParticipantRowIds[participant]] || "";
var oldCampaignStepId = oldStepIds[pParticipantRowIds[participant]] || "";
let updatedValues = [
var updatedValues = [
newCampaignStepId,
vars.get("$sys.user"),
vars.get("$sys.date")
];
let condition = newWhere("CAMPAIGNPARTICIPANT.CONTACT_ID", pParticipantRowIds[participant])
var condition = newWhere("CAMPAIGNPARTICIPANT.CONTACT_ID", pParticipantRowIds[participant])
.and("CAMPAIGNPARTICIPANT.CAMPAIGN_ID", pCampaignId)
.or("CAMPAIGNPARTICIPANT.CAMPAIGNPARTICIPANTID", pParticipantRowIds[participant]);
let valsCampaignParticipantLog = [
valsCampaignParticipantLog = [
campaignParticipantLogId,
campaignId,
newCampaignStepId,
......@@ -134,9 +134,9 @@ function _handleRowIds(pParticipantRowIds, pCampaignId)
}
else
{
let campaignParticipantId = util.getNewUUID();
var campaignParticipantId = util.getNewUUID();
let valsCampaignParticipant = [
var valsCampaignParticipant = [
campaignParticipantId,
pParticipantRowIds[participant],
campaignId,
......@@ -145,7 +145,7 @@ function _handleRowIds(pParticipantRowIds, pCampaignId)
vars.get("$sys.date")
];
let valsCampaignParticipantLog = [
valsCampaignParticipantLog = [
campaignParticipantLogId,
campaignId,
newCampaignStepId,
......
......@@ -29,8 +29,10 @@ if(vars.get("$field.CAMPAIGN_ID"))
if (vars.get("$param.campaignParticipantsCondition_param"))
{
contactIds = CampaignUtils.GetContactIdsInCampaignByCondition(vars.get("$field.CAMPAIGN_ID"), JSON.parse(vars.get("$param.campaignParticipantsCondition_param")).condition, false);
} else{
contactIds = CampaignUtils.GetContactIdsNotInCampaignByCondition(vars.get("$field.CAMPAIGN_ID"), JSON.parse(vars.get("$param.campaignParticipantsCondition_param")).condition, false);
}
else
{
contactIds = selection;
}
}
......
......@@ -520,8 +520,7 @@ CampaignUtils.GetContactIdsNotInCampaignByRowIds = function(pCampaignId, pPartic
* @param {String} pCampaignId <p>
* The id of the campaign.<br>
* @param {String} pCondition (optional) <p>
* An condition which could used to<br>
* limit the search result.<br>
* An condition which is used to limit the search contact results.<br>
* @param {Boolean} pRightJoinContacts <p>
* Case if its true, a prefix will used<br>
* to do a right join.<br>
......@@ -540,11 +539,6 @@ CampaignUtils.GetContactIdsNotInCampaignByCondition = function(pCampaignId, pCon
else
query.join("CONTACT", "CONTACT.PERSON_ID = PERSON.PERSONID");
if(pCondition != "")
subselect = newSelect("CAMPAIGNPARTICIPANT.CONTACT_ID")
.from("CAMPAIGNPARTICIPANT")
.where(pCondition);
query.join("ORGANISATION", "ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID")
.leftJoin("ADDRESS", "ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID")
.where("CONTACT.CONTACTID",
......@@ -552,6 +546,10 @@ CampaignUtils.GetContactIdsNotInCampaignByCondition = function(pCampaignId, pCon
, SqlBuilder.NOT_IN()
);
//pCondition is always a contact related condition string and not a campaignparticipant related condition
if(pCondition != "")
query.and(pCondition);
return query.arrayColumn();
}
......
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