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

1036518 - Start/Enddatum einer Kampagne berechnet sich nun anahdn der Stufen....

1036518 - Start/Enddatum einer Kampagne berechnet sich nun anahdn der Stufen. Diese Daten werden nun nicht mehr in der Datenbank abgelegt. Wurde auch im Liquibasescript angepasst.
Nicht relevante Änderungen
parent 18b74f1c
No related branches found
No related tags found
No related merge requests found
Showing
with 130 additions and 32 deletions
......@@ -23,6 +23,7 @@
<entityField>
<name>NAME</name>
<title>Name</title>
<mandatory v="true" />
</entityField>
<entityField>
<name>DATE_START</name>
......@@ -30,6 +31,7 @@
<contentType>DATE</contentType>
<resolution>DAY</resolution>
<outputFormat>dd.MM.yyyy</outputFormat>
<mandatory v="true" />
</entityField>
<entityField>
<name>DATE_END</name>
......@@ -37,14 +39,18 @@
<contentType>DATE</contentType>
<resolution>DAY</resolution>
<outputFormat>dd.MM.yyyy</outputFormat>
<mandatory v="true" />
</entityField>
<entityField>
<name>STATE</name>
<title>Status</title>
<mandatory v="true" />
</entityField>
<entityField>
<name>SORTING</name>
<title>Reihenfolge</title>
<contentType>NUMBER</contentType>
<mandatory v="true" />
</entityField>
<entityField>
<name>USER_NEW</name>
......@@ -89,6 +95,7 @@
</entityParameter>
<entityConsumer>
<name>CampaignParticipantsConsumer</name>
<title>Teilnehmer</title>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
......@@ -99,15 +106,11 @@
<entityParameter>
<name>CampaignIdParameter</name>
<valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignparticipantsconsumer/children/campaignidparameter/valueProcess.js</valueProcess>
<expose v="false" />
<mandatory v="true" />
</entityParameter>
<entityParameter>
<name>CampaignStepIdParameter</name>
<title></title>
<valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignparticipantsconsumer/children/campaignstepidparameter/valueProcess.js</valueProcess>
<expose v="false" />
<mandatory v="true" />
</entityParameter>
</children>
</entityConsumer>
......@@ -117,6 +120,7 @@
<name>db</name>
<alias>Data_alias</alias>
<conditionProcess>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/conditionProcess.js</conditionProcess>
<orderClauseProcess>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess>
<linkInformation>
<linkInformation>
<name>0199eaa2-5fc5-4f91-a1ec-a9bc77117f69</name>
......
import("system.logging");
import("system.result");
import("system.vars");
loggin.log("______CampaignStep_Campaign_ID_valueProcess: -> " + vars.get("$param.campaignId_param"));
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
......@@ -2,5 +2,6 @@ import("system.logging");
import("system.result");
import("system.vars");
logging.log("CampaignStep_ParameterValueProcess_CAMPAIGN_ID_" + vars.getString("$field.CAMPAIGN_ID"));
result.string(vars.getString("$field.CAMPAIGN_ID"));
\ No newline at end of file
logging.log("CampaignStep_ParameterValueProcess_CAMPAIGN_ID_field_" + vars.getString("$field.CAMPAIGN_ID"));
logging.log("CampaignStep_ParameterValueProcess_CAMPAIGN_ID_param " + vars.get("$param.campaignId_param"));
result.string(vars.get("$param.campaignId_param"));
\ No newline at end of file
import("system.result");
import("system.db");
result.object({"CAMPAIGNSTEP.SORTING": db.ASCENDING});
\ No newline at end of file
......@@ -16,23 +16,27 @@
<entityField>
<name>NAME</name>
<title>Name</title>
<mandatory v="true" />
</entityField>
<entityField>
<name>DATE_START</name>
<title>Beginn</title>
<contentType>DATE</contentType>
<resolution>DAY</resolution>
<outputFormat>dd.MM.yyyy</outputFormat>
<outputFormat>dd.MM.YYYY</outputFormat>
<displayValueProcess>%aditoprj%/entity/Campaign_entity/entityfields/date_start/displayValueProcess.js</displayValueProcess>
</entityField>
<entityField>
<name>DATE_END</name>
<title>Ende</title>
<contentType>DATE</contentType>
<resolution>DAY</resolution>
<displayValueProcess>%aditoprj%/entity/Campaign_entity/entityfields/date_end/displayValueProcess.js</displayValueProcess>
</entityField>
<entityField>
<name>EMPLOYEE_CONTACT_ID</name>
<title>Zuständiger</title>
<mandatory v="true" />
<valueProcess>%aditoprj%/entity/Campaign_entity/entityfields/employee_contact_id/valueProcess.js</valueProcess>
</entityField>
<entityField>
......@@ -59,6 +63,7 @@
</entityField>
<entityConsumer>
<name>CampaignSteps</name>
<title>Schritte</title>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
......@@ -82,10 +87,10 @@
<alias>Data_alias</alias>
<linkInformation>
<linkInformation>
<name>ca43f87d-8396-4ce2-bcd6-c0eac74359b3</name>
<name>10e20295-ac9e-4faf-bd30-fa560784e44e</name>
<tableName>CAMPAIGN</tableName>
<primaryKey>CAMPAIGNID</primaryKey>
<isUIDTable v="true" />
<isUIDTable v="false" />
<readonly v="false" />
</linkInformation>
</linkInformation>
......@@ -94,18 +99,10 @@
<name>DATE_EDIT.value</name>
<recordfield>CAMPAIGN.DATE_EDIT</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>DATE_END.value</name>
<recordfield>CAMPAIGN.DATE_END</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>DATE_NEW.value</name>
<recordfield>CAMPAIGN.DATE_NEW</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>DATE_START.value</name>
<recordfield>CAMPAIGN.DATE_START</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>DESCRIPTION.value</name>
<recordfield>CAMPAIGN.DESCRIPTION</recordfield>
......
import("system.result");
import("system.vars");
import("Campaign_lib");
if(vars.exists("$field.CAMPAIGN_ID") &&
vars.get("$field.CAMPAIGN_ID") != "" && vars.get("$field.CAMPAIGN_ID") != null)
{
var capmaignId = vars.get("$field.CAMPAIGN_ID");
var campaignStepEndDate = getCampaignEndDate(capmaignId);
result.string(campaignStepEndDate);
}
\ No newline at end of file
import("system.result");
import("system.vars");
import("Campaign_lib");
if(vars.exists("$field.CAMPAIGN_ID") &&
vars.get("$field.CAMPAIGN_ID") != "" && vars.get("$field.CAMPAIGN_ID") != null)
{
var capmaignId = vars.get("$field.CAMPAIGN_ID");
var campaignStepStartDate = getCampaignStartDate(capmaignId);
result.string(campaignStepStartDate);
}
\ No newline at end of file
......@@ -22,14 +22,6 @@
<name>8471feb0-7688-4c69-96b0-f731bb87718a</name>
<entityField>NAME</entityField>
</entityFieldLink>
<entityFieldLink>
<name>337a6bbd-8e1f-443c-991d-8c4ac44c928a</name>
<entityField>DATE_START</entityField>
</entityFieldLink>
<entityFieldLink>
<name>6097ccbb-e0a5-43c0-af3f-258b03b35149</name>
<entityField>DATE_END</entityField>
</entityFieldLink>
<entityFieldLink>
<name>83a486a0-3297-4d6d-85bd-77f0f42b80d6</name>
<entityField>EMPLOYEE_CONTACT_ID</entityField>
......
......@@ -8,12 +8,6 @@
<column name="NAME" type="NVARCHAR(50)">
<constraints nullable="false"/>
</column>
<column name="DATE_START" type="DATE">
<constraints nullable="false"/>
</column>
<column name="DATE_END" type="DATE">
<constraints nullable="false"/>
</column>
<column name="EMPLOYEE_CONTACT_ID" type="CHAR(36)">
<constraints nullable="false"/>
</column>
......
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.0">
<name>Campaign_lib</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<process>%aditoprj%/process/Campaign_lib/process.js</process>
<variants>
<element>LIBRARY</element>
</variants>
</process>
import("system.db");
/*
* Fügt Mitglieder zu einer Kampagne hinzu.
*
* @param {String []} pParticipants req die RELATIONID
* @param {String} pCampaignID opt die ID der Kampagne
* @param {String} pStepID opt ID des Schritts
*
* @return {integer} Anzahl keine Email vorhanden
*/
function addParticipants( pParticipants, pCampaignID, pStepID )
{
if ( pStepID == undefined )
pStepID = selectCampaignStep(pCampaignID);
if ( pCampaignID == "" || pStepID == null)
return 0;
var count = 0;
// aktuelle Anzahl - maximale Anzahl
var iscount = Number(db.cell("select count(*) from campaignparticipant where campaign_id = '" + pCampaignID + "'"));
var maxcount = db.cell("select max_participants from campaign where campaignid = '" + pCampaignID + "'");
if ( maxcount != "") maxcount = Number(maxcount); else maxcount = 9999999;
var actdate = vars.getString("$sys.date");
var user = vars.getString("$sys.user");
var spalten = new Array("CAMPAIGNPARTICIPANTID", "RELATION_ID", "USER_NEW", "DATE_NEW", "CAMPAIGNSTEP_ID", "CAMPAIGN_ID");
var typen = db.getColumnTypes("CAMPAIGNPARTICIPANT", spalten);
var logcol = new Array("CAMPAIGN_ID", "STEP_ID", "RELATION_ID", "CAMPAIGNPARTICIPANT_ID", "DATE_NEW", "USER_NEW");
var logtyp = db.getColumnTypes("CAMPAIGNLOG", logcol);
var logvalue = new Array(pCampaignID, pStepID, 0, 0, actdate, user );
for ( var i = 0; i < pParticipants.length; i++ )
{
if ( iscount < maxcount )
{
var newID = util.getNewUUID()
var werte = [ newID, pParticipants[i] , user, actdate, pStepID, pCampaignID ];
count += db.insertData("CAMPAIGNPARTICIPANT", spalten, typen, werte);
logvalue[2] = pParticipants[i];
logvalue[3] = newID;
db.insertData("CAMPAIGNLOG", logcol, logtyp, logvalue);
iscount++;
}
else
{
question.showMessage(translate.text("Die maximale Anzahl Teilnehmer ist erreicht!"));
break;
}
}
return count;
}
/**
* todo
*/
function getCampaignStartDate(pCapmaignId)
{
var dateStartQuery = "SELECT DATE_START, SORTING FROM ADITO.CAMPAIGNSTEP where CAMPAIGN_ID = '"+ pCapmaignId +"' order by SORTING ASC FETCH FIRST 1 ROWS ONLY";
return db.cell(dateStartQuery);
}
/**
* todo
*/
function getCampaignEndDate(pCapmaignId)
{
var dateEndQuery = "SELECT DATE_END, SORTING FROM ADITO.CAMPAIGNSTEP where CAMPAIGN_ID = '"+ pCapmaignId +"' order by SORTING DESC FETCH FIRST 1 ROWS ONLY";
return db.cell(dateEndQuery);
}
\ No newline at end of file
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