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

Logs werden nun beim hinzufügen von Teilnehmern angelegt

Fehler: "Wenn Teilnehmer in Kampagnenstufe hinzugefügt wird soll zusätzlich zur vorausgewählten kampagne auch die aktuelle stufe vorausgewählt werden" wurde behoben
Diverse Logausgaben entfernt
parent d3f357c5
No related branches found
No related tags found
No related merge requests found
Showing
with 67 additions and 18 deletions
import("system.vars");
import("system.db");
import("system.util");
import("Campaign_lib");
var campaignId = vars.getString("$field.CAMPAIGN_ID");
var campaignStepId = vars.getString("$field.CAMPAIGNSTEP_ID");
var participants = JSON.parse(vars.getString("$param.campaignParticipants_param"));
var cols = [ "CAMPAIGNPARTICIPANTID"
var colNamesCampaignParticipantLog = CampaignUtils.getParticipantLogInsertColumnNames();
var colTypesCampaignParticipantLog = CampaignUtils.getParticipantLogInsertColumnTypes();
var colsCampaignParticipant = [ "CAMPAIGNPARTICIPANTID"
,"CONTACT_ID"
,"CAMPAIGN_ID"
,"CAMPAIGNSTEP_ID"
,"USER_NEW"
,"DATE_NEW"
];
var colTypes = db.getColumnTypes("CAMPAIGNPARTICIPANT", cols);
var colTypesCampaignParticipant = db.getColumnTypes("CAMPAIGNPARTICIPANT", colsCampaignParticipant);
var insertArray = [];
......@@ -21,15 +27,18 @@ for (participant in participants)
{
let campaignParticipantId = util.getNewUUID();
var vals = [ campaignParticipantId
var valsCampaignParticipant = [ campaignParticipantId
, participants[participant]
, campaignId
, campaignStepId
, vars.get("$sys.user")
, vars.get("$sys.date")
];
var valsCampaignParticipantLog = new Array(campaignId, campaignStepId, participants[participant], campaignParticipantId, vars.get("$sys.user"), vars.get("$sys.date"));
insertArray.push(["CAMPAIGNPARTICIPANT", cols, colTypes, vals]);
insertArray.push(["CAMPAIGNPARTICIPANT", colsCampaignParticipant, colTypesCampaignParticipant, valsCampaignParticipant]);
insertArray.push(["CAMPAIGNPARTICIPANTLOG", colNamesCampaignParticipantLog, colTypesCampaignParticipantLog, valsCampaignParticipantLog]);
}
db.inserts(insertArray);
\ No newline at end of file
......@@ -153,6 +153,7 @@
<name>ParticipantsDbRecordContainer</name>
<alias>Data_alias</alias>
<conditionProcess>%aditoprj%/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/conditionProcess.js</conditionProcess>
<onDBInsert>%aditoprj%/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/onDBInsert.js</onDBInsert>
<linkInformation>
<linkInformation>
<name>12b5bf2e-e376-4c40-9799-fb07961a455d</name>
......
......@@ -2,5 +2,8 @@ import("system.neon");
import("system.result");
import("system.vars");
if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.CampaignId_param") && vars.get("$param.CampaignId_param"))
result.string(vars.get("$param.CampaignId_param"));
\ No newline at end of file
if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW &&
vars.exists("$param.CampaignId_param") && vars.get("$param.CampaignId_param"))
{
result.string(vars.get("$param.CampaignId_param"));
}
\ No newline at end of file
......@@ -2,4 +2,4 @@ import("system.vars");
import("system.db");
import("system.result");
result.string(db.cell("select NAME from CAMPAIGNSTEP where CAMPAIGNSTEPID = '" + vars.get("$field.CAMPAIGNSTEP_ID") + "'"));
\ No newline at end of file
result.string(db.cell("select NAME from CAMPAIGNSTEP where CAMPAIGNSTEPID = '" + vars.get("$param.CampaignStepId_param") + "'"));
\ No newline at end of file
......@@ -3,8 +3,7 @@ import("system.result");
import("system.vars");
if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW &&
vars.exists("$param.CampaignStepId_param") &&
vars.get("$param.CampaignStepId_param"))
vars.exists("$param.CampaignStepId_param") && vars.get("$param.CampaignStepId_param"))
{
result.string(vars.get("$param.CampaignStepId_param"));
}
\ No newline at end of file
......@@ -3,5 +3,4 @@ import("system.vars");
import("system.result");
import("Contact_lib");
logging.log("CONTACT_ID -> getContextByContactId: " +ContactUtils.getContextByContactId(vars.getString("$field.CONTACT_ID")));
result.string(ContactUtils.getContextByContactId(vars.getString("$field.CONTACT_ID")));
\ No newline at end of file
import("system.logging");
import("system.vars");
import("system.result");
import("Contact_lib");
logging.log("getContextByContactId: " + ContactUtils.getContextByContactId(vars.getString("$field.CONTACT_ID")));
logging.log("vars.getString($field.CONTACT_ID: " + vars.getString("$field.CONTACT_ID"));
result.string(ContactUtils.getContextByContactId(vars.getString("$field.CONTACT_ID")));
\ No newline at end of file
import("system.vars");
import("Campaign_lib");
var campaignId = vars.get("$field.CAMPAIGN_ID");
var campaignStepId = vars.get("$field.CAMPAIGNSTEP_ID");
var contactId = vars.get("$field.CONTACT_ID");
var campaignParticipantId = vars.get("$field.CAMPAIGNPARTICIPANTID");
CampaignUtils.createLogEntry(campaignId, campaignStepId, contactId, campaignParticipantId);
\ No newline at end of file
......@@ -2,6 +2,5 @@ import("system.logging");
import("system.result");
import("system.vars");
logging.log("______CampaignStep_Campaign_ID_valueProcess: -> " + vars.get("$param.campaignId_param"));
if(vars.exists("$param.campaignId_param") && vars.get("$param.campaignId_param"))
result.string(vars.get("$param.campaignId_param"));
\ No newline at end of file
import("system.vars");
import("system.db");
import("system.neon");
import("Sql_lib");
......@@ -15,11 +16,11 @@ function CampaignUtils() {}
/**
* Add one Contact (Person or Organistaion) to a Campaign
*
* @param {String} pRowId req ContactId
* @param {String} pContactId req ContactId
*/
CampaignUtils.addParticipant = function(pRowId)
CampaignUtils.addParticipant = function(pContactId)
{
_CampaignUtils._openAddParticipantContext("CampaignParticipant", pRowId, "ContactId_param", "CampaignParticipantEdit_view");
_CampaignUtils._openAddParticipantContext("CampaignParticipant", pContactId, "ContactId_param", "CampaignParticipantEdit_view");
}
/**
......@@ -70,6 +71,36 @@ CampaignUtils.getCampaignStatusByCampaignId = function(pCampaignId)
return KeywordUtils.getViewValue(campaignState, statusId);
}
/**
* todo
*/
CampaignUtils.createLogEntry = function(pCampaignId, pCampaignStepId, pContactId, pCampaignParticipantId)
{
let colsCampaignParticipantLog = CampaignUtils.getParticipantLogInsertColumnNames();
let colTypesCampaignParticipantLog = CampaignUtils.getParticipantLogInsertColumnTypes();
let valsCampaignParticipantLog = new Array(pCampaignId, pCampaignStepId, pContactId, pCampaignParticipantId, vars.get("$sys.user"), vars.get("$sys.date"));
let rows = db.insertData("CAMPAIGNPARTICIPANTLOG", colsCampaignParticipantLog, colTypesCampaignParticipantLog, valsCampaignParticipantLog);
return (rows == 1);
}
/**
* todo
*/
CampaignUtils.getParticipantLogInsertColumnNames = function()
{
return new Array("CAMPAIGN_ID", "CAMPAIGNSTEP_ID", "CONTACT_ID", "CAMPAIGNPARTICIPANTLOGID", "USER_NEW", "DATE_NEW");
}
/**
* todo
*/
CampaignUtils.getParticipantLogInsertColumnTypes = function()
{
return db.getColumnTypes("CAMPAIGNPARTICIPANTLOG", CampaignUtils.getParticipantLogInsertColumnNames());
}
/**
* Methods for campaignmanagement.
* Do not create an instance of this!
......@@ -100,6 +131,9 @@ _CampaignUtils._openAddParticipantContext = function(pContext, pRowIds, pEntityP
neon.openContext(pContext, pView, null, neon.OPERATINGSTATE_NEW, params);
}
/**
* todo
*/
_CampaignUtils._loadSingleValueFromDb = function(pSelectQuery, pConditionField, pConditionValue, pDefaultValue)
{
let res = pDefaultValue;
......
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