diff --git a/entity/CampaignParticipant_entity/entityfields/campaign_id/stateProcess.js b/entity/CampaignParticipant_entity/entityfields/campaign_id/stateProcess.js index b9a78038b4f59fbb40401695266b1a40732a32e2..ca54a5bcb39a3129766916d2a18ffd04748bee80 100644 --- a/entity/CampaignParticipant_entity/entityfields/campaign_id/stateProcess.js +++ b/entity/CampaignParticipant_entity/entityfields/campaign_id/stateProcess.js @@ -1,8 +1,9 @@ -import("system.neon"); -import("system.result"); -import("system.vars"); - -if(vars.exists("$param.CampaignId_param") && vars.get("$param.CampaignId_param") != null) - result.string(neon.COMPONENTSTATE_READONLY); -else - result.string(neon.COMPONENTSTATE_EDITABLE); \ No newline at end of file +//import("system.neon"); +//import("system.result"); +//import("system.vars"); +// +//if(vars.exists("$param.CampaignId_param") && vars.get("$param.CampaignId_param") != null) +// result.string(neon.COMPONENTSTATE_READONLY); +//else +// result.string(neon.COMPONENTSTATE_EDITABLE); +//todo campaignllokup readonly? \ No newline at end of file diff --git a/entity/CampaignStep_entity/CampaignStep_entity.aod b/entity/CampaignStep_entity/CampaignStep_entity.aod index 1ad56f5df2a56013327f69b2f47d9aacb7ef9438..2d3064f2eeb27d5a97960f5e58cad0ec447e92e0 100644 --- a/entity/CampaignStep_entity/CampaignStep_entity.aod +++ b/entity/CampaignStep_entity/CampaignStep_entity.aod @@ -162,6 +162,7 @@ <title>Max participants</title> <contentType>NUMBER</contentType> <mandatory v="true" /> + <onValidation>%aditoprj%/entity/CampaignStep_entity/entityfields/maxparticipants/onValidation.js</onValidation> </entityField> <entityConsumer> <name>CampaignParticipantsConsumer</name> diff --git a/entity/CampaignStep_entity/entityfields/maxparticipants/onValidation.js b/entity/CampaignStep_entity/entityfields/maxparticipants/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..378e2a7a10e331996da72cd84e0bc1eb2b8d45b6 --- /dev/null +++ b/entity/CampaignStep_entity/entityfields/maxparticipants/onValidation.js @@ -0,0 +1,10 @@ +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 diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index 7d36afb0e90d471b736369839c52c5c941ce25c6..4f65c33c3a1cbb5c0358217daa7d8e1b51f46d14 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -3087,6 +3087,9 @@ <entry> <key>per</key> </entry> + <entry> + <key>The max participants count has to be equal or greater than the count of the current participants!</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> <sqlModels> diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index 7ea7f1384150ef17c94609a66acc6f642c821c46..e83bb5a1dfbe9ff67230869d97afbb9a0ce6294c 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -3939,6 +3939,10 @@ <key>per</key> <value>pro</value> </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> <font name="Dialog" style="0" size="11" /> </language> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index dc64f28a583dd8f7d2fd02de288030e3467f387a..b03d58b9b31cc3d6d62986edb6a4f117dc4b060c 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -3121,6 +3121,9 @@ <entry> <key>per</key> </entry> + <entry> + <key>The max participants count has to be equal or greater than the count of the current participants!</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/process/Campaign_lib/process.js b/process/Campaign_lib/process.js index d4932b0cc7df8f6d96b58e5e6588382503ed4d85..04d51f880ced746c95f99aabfd8bb614932a1587 100644 --- a/process/Campaign_lib/process.js +++ b/process/Campaign_lib/process.js @@ -1,3 +1,4 @@ +import("system.translate"); import("system.logging"); import("system.vars"); import("system.db"); @@ -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")); } +/** + * 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. * Do not create an instance of this!