Skip to content
Snippets Groups Projects
Commit f04551fe authored by S.Listl's avatar S.Listl
Browse files

CampaignPlanning filters added

parent d59265b0
No related branches found
No related tags found
No related merge requests found
......@@ -73,6 +73,25 @@
<name>NAME</name>
<title>Name</title>
</entityField>
<entityField>
<name>CAMPAIGN_STATUS</name>
<title>Campaign status</title>
<consumer>CampaignStatusKeyword</consumer>
</entityField>
<entityConsumer>
<name>CampaignStatusKeyword</name>
<dependency>
<name>dependency</name>
<entityName>KeywordEntry_entity</entityName>
<fieldName>SpecificContainerKeywords</fieldName>
</dependency>
<children>
<entityParameter>
<name>ContainerName_param</name>
<valueProcess>%aditoprj%/entity/CampaignPlanning_entity/entityfields/campaignstatuskeyword/children/containername_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
</entityFields>
<recordContainers>
<dbRecordContainer>
......@@ -152,6 +171,7 @@
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>NAME.value</name>
<isFilterable v="true" />
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>PREDECESSOR_STEP_ID.value</name>
......@@ -161,16 +181,23 @@
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>DATE_START.value</name>
<isFilterable v="true" />
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>DATE_END.value</name>
<isFilterable v="true" />
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>CAMPAIGN_ID.value</name>
<isFilterable v="true" />
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>targetContext.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>CAMPAIGN_STATUS.value</name>
<isFilterable v="true" />
</jDitoRecordFieldMapping>
</recordFieldMappings>
</jDitoRecordContainer>
</recordContainers>
......
import("system.result");
import("KeywordRegistry_basic");
result.string($KeywordRegistry.campaignState());
\ No newline at end of file
......@@ -6,51 +6,45 @@ import("system.vars");
import("Sql_lib");
import("Campaign_lib");
var stepCondition = JditoFilterUtils.getSqlCondition(vars.get("local.filter").filter, "CAMPAIGNSTEP");
var stepCondition = JditoFilterUtils.getSqlCondition(vars.get("local.filter").filter, "CAMPAIGNSTEP", null, {
"CAMPAIGN_STATUS" : "CAMPAIGN.STATUS",
"CAMPAIGN_ID" : "CAMPAIGN.NAME"
});
var UID = 0;
var CAMPAIGNNAME = 1;
var PREDECESSORSTEP_ID = 2;
var CAMPAIGNID = 6;
var TARGET_CONTEXT_ROOT_ELEMENT = "Campaign";
var TARGET_CONTEXT_ELEMENT = "CampaignStep";
var resultRay = [];
var campaignsRows = db.table("select CAMPAIGNID, CAMPAIGN.\"NAME\" from CAMPAIGN");
var campaignRows = {};
var stepIds = {};
var stepsRows = stepCondition.select("CAMPAIGNSTEPID, CAMPAIGNSTEP.\"NAME\", CAMPAIGNSTEP.PREDECESSORSTEP_ID,"
+ " CAMPAIGNSTEP.DESCRIPTION, CAMPAIGNSTEP.DATE_START, CAMPAIGNSTEP.DATE_END, CAMPAIGNID")
+ " CAMPAIGNSTEP.DESCRIPTION, CAMPAIGNSTEP.DATE_START, CAMPAIGNSTEP.DATE_END, CAMPAIGNID, CAMPAIGN.\"NAME\", CAMPAIGN.STATUS")
.from("CAMPAIGN")
.join("CAMPAIGNSTEP", "CAMPAIGN.CAMPAIGNID = CAMPAIGNSTEP.CAMPAIGN_ID")
.orderBy("SORTING")
.table();
//First add all Campaign Rows to the resultRay. These are the Root Rows in the Treetable
for (var campaignRowIndex in campaignsRows)
stepsRows = stepsRows.map(function ([stepId, stepName, predecessorId, desc, stepStartDate, stepEndDate, campaignId, campaignName, campaignStatus])
{
let campaignRow = campaignsRows[campaignRowIndex];
let startDate = CampaignUtils.getCampaignStartDate(campaignRow[UID]);
let endDate = CampaignUtils.getCampaignEndDate(campaignRow[UID]);
if (!campaignRows[campaignId])
{
let startDate = CampaignUtils.getCampaignStartDate(campaignId);
let endDate = CampaignUtils.getCampaignEndDate(campaignId);
campaignRows[campaignId] = [campaignId, campaignName, null, null, startDate, endDate, campaignId, TARGET_CONTEXT_ROOT_ELEMENT, campaignStatus];
}
stepIds[stepId] = true;
resultRay.push([campaignRow[UID], campaignRow[CAMPAIGNNAME], null, null, startDate, endDate, campaignRow[UID], TARGET_CONTEXT_ROOT_ELEMENT]);
}
/*
* Then, add all CampaignStep Rows. If a StepRow has no Predecessor it has to be connected to the
* respective CampaignRow which is at the Root Level. The target context gets added at the end of
* the array.
*/
for (var currentRowIndex in stepsRows)
{
let currentRow = stepsRows[currentRowIndex];
return [stepId, stepName, predecessorId || campaignId, desc, stepStartDate, stepEndDate, campaignId, TARGET_CONTEXT_ELEMENT, campaignStatus];
});
if(currentRow[PREDECESSORSTEP_ID] == "")
currentRow[PREDECESSORSTEP_ID] = currentRow[CAMPAIGNID];
//replace all predecessor ids that are not in the tree with the campaign id
stepsRows.forEach(function (row)
{
if (!(stepIds[row[2]]))
row[2] = row[6];
});
//Add the TargetContext
currentRow.splice(currentRow.length, 0, TARGET_CONTEXT_ELEMENT);
resultRay.push(currentRow);
}
//convert the object to an array
campaignRows = Object.keys(campaignRows).map(function (id) {return campaignRows[id];});
result.object(resultRay);
\ No newline at end of file
result.object(campaignRows.concat(stepsRows))
......@@ -553,6 +553,12 @@
<fieldName>TriggerKeyword</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>b25f4a3e-706b-43f5-b4d4-44249e8fa125</name>
<entityName>CampaignPlanning_entity</entityName>
<fieldName>CampaignStatusKeyword</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
<children>
<entityParameter>
......
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