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

removed unnecessary displayValueProcesses.

Remaining runtime now gets calculated
parent 311fd64a
No related branches found
No related tags found
No related merge requests found
......@@ -55,7 +55,6 @@
<mandatory v="true" />
<valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/date_start/valueProcess.js</valueProcess>
<onValidation>%aditoprj%/entity/CampaignStep_entity/entityfields/date_start/onValidation.js</onValidation>
<onValueChange>%aditoprj%/entity/CampaignStep_entity/entityfields/date_start/onValueChange.js</onValueChange>
</entityField>
<entityField>
<name>DATE_END</name>
......
......@@ -8,7 +8,3 @@ var cEnd = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.DATE_END")
if (DateUtils.validateBeginnBeforeEnd(vars.get("$field.DATE_START"), cEnd) === false)
result.string(DateUtils.getValidationFailString());
else
{
neon.refresh(["$field.DATE_START"]);
}
\ No newline at end of file
......@@ -8,7 +8,3 @@ var cStart = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.DATE_STA
if (DateUtils.validateBeginnBeforeEnd(cStart, vars.get("$field.DATE_END")) === false)
result.string(DateUtils.getValidationFailString());
else
{
neon.refresh(["$field.DATE_END"]);
}
\ No newline at end of file
import("system.logging");
logging.log("date start on value change -> ");
\ No newline at end of file
......@@ -37,7 +37,7 @@
<resolution>DAY</resolution>
<outputFormat>dd.MM.YYYY</outputFormat>
<state>READONLY</state>
<displayValueProcess>%aditoprj%/entity/Campaign_entity/entityfields/date_start/displayValueProcess.js</displayValueProcess>
<valueProcess>%aditoprj%/entity/Campaign_entity/entityfields/date_start/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>DATE_END</name>
......@@ -46,7 +46,7 @@
<resolution>DAY</resolution>
<outputFormat>dd.MM.YYYY</outputFormat>
<state>READONLY</state>
<displayValueProcess>%aditoprj%/entity/Campaign_entity/entityfields/date_end/displayValueProcess.js</displayValueProcess>
<valueProcess>%aditoprj%/entity/Campaign_entity/entityfields/date_end/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>EMPLOYEE_CONTACT_ID</name>
......
import("Date_lib");
import("system.datetime");
import("system.logging");
import("system.vars");
import("system.result");
result.string("4");
\ No newline at end of file
var startDate = vars.get("$field.DATE_START");
var endDate = vars.get("$field.DATE_END");
var currentDate = datetime.date();
/*
* 1: Today is before startDate
* -> Full remaining runtime
*
* 2: Today is after endDate
* -> Campaign has been finished. No runtime remaining
*
* 3: Today is between startDate and EndDate
* -> Remaining days between Today and EndDate
*/
if(currentDate < startDate)
{
let fullRuntime = DateUtils.getDayDifference(startDate, endDate);
result.string(fullRuntime);
}
else if(currentDate > endDate)
{
result.string("0");
}
else if(currentDate >= startDate && currentDate <= endDate)
{
//todo workaround: getDayDifference ignores one day so we add one on top.
let remainingRuntime = DateUtils.getDayDifference(currentDate, endDate) + 1;
result.string(remainingRuntime);
}
\ 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