Skip to content
Snippets Groups Projects
Commit 350534ed authored by David Büchler's avatar David Büchler
Browse files

Condition + Selektion Serienaktion funktionieren nun bei den Personen und beim...

Condition + Selektion Serienaktion funktionieren nun bei den Personen und beim Updaten der Teilnehmer in der Teilnehmerliste.
Integrieren ORGANISATION begonnen, Serienaktion wurde angepasst.
parent 0adece9c
No related branches found
No related tags found
No related merge requests found
......@@ -68,9 +68,17 @@ if(selectedCampaignId != '')
else
{
participantCondition = JSON.parse(vars.getString("$param.campaignParticipantsCondition_param")).condition;
countParticipantsToAdd = CampaignUtils.GetContactCountByCondition(participantCondition);
logging.log("im isOperationValid -> ");
countParticipantsToAdd = CampaignUtils.GetContactCountByCondition(participantCondition, isUpdate);
logging.log("countParticipantsToAdd -> " + countParticipantsToAdd);
/*
* If the update mode is active, the goal is to move participants between steps.
* therefore the check if the affected participants already are added to a particluar step has to be on the step level.
*
* If not, participants are to be added. It has to be checked if a participant is in a campaign, regardless of the particular
* step because one participant can be in a campaign just once.
*/
if(isUpdate == "true")
whereCondition = "CAMPAIGNPARTICIPANT.CAMPAIGNSTEP_ID = '" + selectedCampaignStepId + "'";
else
......
......@@ -774,7 +774,7 @@
<title>Add to Campaign</title>
<onActionProcess>%aditoprj%/entity/Organisation_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/onActionProcess.js</onActionProcess>
<isObjectAction v="false" />
<isSelectionAction v="true" />
<isSelectionAction v="false" />
<iconId>NEON:GROUP_APPOINTMENT</iconId>
<tooltip>Add the selection to a campaign</tooltip>
<tooltipProcess>%aditoprj%/entity/Organisation_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/tooltipProcess.js</tooltipProcess>
......
......@@ -2,14 +2,20 @@ import("system.vars");
import("system.neon");
import("Campaign_lib");
var sysSelection = vars.getString("sys.selection");
var sysSelection = vars.get("$sys.selection");
/*
* If there's a selection only those are ought to be added.
* Otherwise the filter gets checked, if a filter has beed set, the condition
* is used to determine the objects to be added.
* If no selection has been set, all objects will be added.
*/
if(sysSelection.length > 0) //selektierte IDs als Array
{
CampaignUtils.addParticipantsByRowIds(sysSelection, "ORGANISATION");
CampaignUtils.addParticipantsByRowIds(JSON.stringify(sysSelection), "ORGANISATION");
}
else
{
let sysFilter = vars.get("$sys.filter");//todo change name
CampaignUtils.addParticipantsByCondition(sysFilter.condition, "ORGANISATION");
CampaignUtils.addParticipantsByCondition(JSON.stringify(sysFilter), "ORGANISATION");
}
\ No newline at end of file
......@@ -343,8 +343,10 @@ CampaignUtils.GetParticipantsAlreadyAddedCountByCondition = function(pWhereCondi
+ " left join ADDRESS on (ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID)"
+ " left join CAMPAIGNPARTICIPANT on CAMPAIGNPARTICIPANT.CONTACT_ID = CONTACT.CONTACTID"
+ " where " + pWhereCondition
+ " and " + pCondition;
if(pCondition != "")
query += " and " + pCondition;
logging.log("GetParticipantsAlreadyAddedCountByCondition query -> " + query);
return db.cell(query)
......@@ -369,11 +371,13 @@ CampaignUtils.GetContactIdsNotInCampaignByCondition = function(pCampaignId, pCon
+ " join CONTACT on (CONTACT.PERSON_ID = PERSON.PERSONID)"
+ " join ORGANISATION on (ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID)"
+ " left join ADDRESS on (ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID)"
+ " where " + pCondition
+ " and CONTACT.CONTACTID not in"
+ " where CONTACT.CONTACTID not in"
+ " (select CAMPAIGNPARTICIPANT.CONTACT_ID from CAMPAIGNPARTICIPANT where"
+ " CAMPAIGNPARTICIPANT.CAMPAIGN_ID = '" + pCampaignId + "')";
if(pCondition != "")
query += " and " + pCondition;
return db.array(db.COLUMN, query);
}
......@@ -390,13 +394,15 @@ CampaignUtils.GetContactIdsInCampaignByCondition = function(pCampaignId, pCondit
return db.array(db.COLUMN, query);
}
CampaignUtils.GetContactCountByCondition = function(pCondition)
CampaignUtils.GetContactCountByCondition = function(pCondition, pLookInCampaignOnly)
{
let query = "select count(*) from PERSON"
+ " join CONTACT on (CONTACT.PERSON_ID = PERSON.PERSONID)"
+ " join ORGANISATION on (ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID)"
+ " left join ADDRESS on (ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID)"
+ " left join CAMPAIGNPARTICIPANT on CAMPAIGNPARTICIPANT.CONTACT_ID = CONTACT.CONTACTID";
if(pLookInCampaignOnly == "true")
query += " left join CAMPAIGNPARTICIPANT on CAMPAIGNPARTICIPANT.CONTACT_ID = CONTACT.CONTACTID";
if(pCondition != "")
query += " where " + pCondition;
......
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