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

If the max participants value is changed it now gets validated against the...

If the max participants value is changed it now gets validated against the current participants. It is required to be maxParticipants >= currentParticipants
parent df898d6f
No related branches found
No related tags found
No related merge requests found
import("system.neon"); //import("system.neon");
import("system.result"); //import("system.result");
import("system.vars"); //import("system.vars");
//
if(vars.exists("$param.CampaignId_param") && vars.get("$param.CampaignId_param") != null) //if(vars.exists("$param.CampaignId_param") && vars.get("$param.CampaignId_param") != null)
result.string(neon.COMPONENTSTATE_READONLY); // result.string(neon.COMPONENTSTATE_READONLY);
else //else
result.string(neon.COMPONENTSTATE_EDITABLE); // result.string(neon.COMPONENTSTATE_EDITABLE);
\ No newline at end of file //todo campaignllokup readonly?
\ No newline at end of file
...@@ -162,6 +162,7 @@ ...@@ -162,6 +162,7 @@
<title>Max participants</title> <title>Max participants</title>
<contentType>NUMBER</contentType> <contentType>NUMBER</contentType>
<mandatory v="true" /> <mandatory v="true" />
<onValidation>%aditoprj%/entity/CampaignStep_entity/entityfields/maxparticipants/onValidation.js</onValidation>
</entityField> </entityField>
<entityConsumer> <entityConsumer>
<name>CampaignParticipantsConsumer</name> <name>CampaignParticipantsConsumer</name>
......
import("Campaign_lib");
import("system.result");
import("Entity_lib");
import("system.vars");
var currentParticipantsCount = parseInt(vars.get("$field.CurrentMaxParticipantsInfo")[0]);
var newMaxParticipantsCount = parseInt(ProcessHandlingUtils.getOnValidationValue(vars.get("$field.MAXPARTICIPANTS")));
if(newMaxParticipantsCount < currentParticipantsCount)
result.string(CampaignUtils.getMaxParticipantsValidationMessage());
\ No newline at end of file
...@@ -3087,6 +3087,9 @@ ...@@ -3087,6 +3087,9 @@
<entry> <entry>
<key>per</key> <key>per</key>
</entry> </entry>
<entry>
<key>The max participants count has to be equal or greater than the count of the current participants!</key>
</entry>
</keyValueMap> </keyValueMap>
<font name="Dialog" style="0" size="11" /> <font name="Dialog" style="0" size="11" />
<sqlModels> <sqlModels>
......
...@@ -3939,6 +3939,10 @@ ...@@ -3939,6 +3939,10 @@
<key>per</key> <key>per</key>
<value>pro</value> <value>pro</value>
</entry> </entry>
<entry>
<key>The max participants count has to be equal or greater than the count of the current participants!</key>
<value>Die maximale Teilnehmerzahl muss gleich oder größer der aktuellen Teilnehmerzahl sein!</value>
</entry>
</keyValueMap> </keyValueMap>
<font name="Dialog" style="0" size="11" /> <font name="Dialog" style="0" size="11" />
</language> </language>
...@@ -3121,6 +3121,9 @@ ...@@ -3121,6 +3121,9 @@
<entry> <entry>
<key>per</key> <key>per</key>
</entry> </entry>
<entry>
<key>The max participants count has to be equal or greater than the count of the current participants!</key>
</entry>
</keyValueMap> </keyValueMap>
<font name="Dialog" style="0" size="11" /> <font name="Dialog" style="0" size="11" />
</language> </language>
import("system.translate");
import("system.logging"); import("system.logging");
import("system.vars"); import("system.vars");
import("system.db"); import("system.db");
...@@ -195,6 +196,15 @@ CampaignUtils.getCampaignEndDate = function(pCapmaignId) ...@@ -195,6 +196,15 @@ CampaignUtils.getCampaignEndDate = function(pCapmaignId)
return db.cell(campaignIdCondition.buildSql("SELECT DATE_END, SORTING FROM CAMPAIGNSTEP", "1=2", "order by SORTING ASC FETCH FIRST 1 ROWS ONLY")); return db.cell(campaignIdCondition.buildSql("SELECT DATE_END, SORTING FROM CAMPAIGNSTEP", "1=2", "order by SORTING ASC FETCH FIRST 1 ROWS ONLY"));
} }
/**
* todo
*/
CampaignUtils.getMaxParticipantsValidationMessage = function()
{
//todo how/where should this text be stored?
return translate.text("The max participants count has to be equal or greater than the count of the current participants!");
}
/** /**
* Methods for campaignmanagement. * Methods for campaignmanagement.
* Do not create an instance of this! * Do not create an instance of this!
......
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