From 6cc39cc80e31dda5feb6b03ab3c31f68c415b19a Mon Sep 17 00:00:00 2001 From: "b.ulrich" <b.ulrich@adito.de> Date: Wed, 13 Jan 2021 16:27:45 +0100 Subject: [PATCH] 1071582 ClassificationAdmin fixes --- .../ClassificationAdmin_entity.aod | 2 ++ .../onValueChange.js | 16 ++++++++++++++++ .../entityfields/sorting/stateProcess.js | 2 +- .../entityfields/sorting/valueProcess.js | 12 +++++++++++- .../entityfields/minpercent/onValidation.js | 13 ++++++++++--- .../ClassificationScore_entity.aod | 1 + .../entityfields/scorepercent/onValidation.js | 10 ++++++++++ .../recordcontainers/jdito/contentProcess.js | 4 ++-- .../_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod | 9 +++++++++ language/_____LANGUAGE_de/_____LANGUAGE_de.aod | 8 ++++++++ language/_____LANGUAGE_en/_____LANGUAGE_en.aod | 9 +++++++++ 11 files changed, 79 insertions(+), 7 deletions(-) create mode 100644 entity/ClassificationAdmin_entity/entityfields/classificationgroupdisplayvalue/onValueChange.js create mode 100644 entity/ClassificationScore_entity/entityfields/scorepercent/onValidation.js diff --git a/entity/ClassificationAdmin_entity/ClassificationAdmin_entity.aod b/entity/ClassificationAdmin_entity/ClassificationAdmin_entity.aod index ce749baea12..12ecb462d6b 100644 --- a/entity/ClassificationAdmin_entity/ClassificationAdmin_entity.aod +++ b/entity/ClassificationAdmin_entity/ClassificationAdmin_entity.aod @@ -136,10 +136,12 @@ <textInputAllowed v="true" /> <stateProcess>%aditoprj%/entity/ClassificationAdmin_entity/entityfields/classificationgroupdisplayvalue/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/ClassificationAdmin_entity/entityfields/classificationgroupdisplayvalue/valueProcess.js</valueProcess> + <onValueChange>%aditoprj%/entity/ClassificationAdmin_entity/entityfields/classificationgroupdisplayvalue/onValueChange.js</onValueChange> </entityField> <entityField> <name>SCOREPOINTS</name> <title>Max Points</title> + <contentType>NUMBER</contentType> <mandatory v="true" /> <mandatoryProcess>%aditoprj%/entity/ClassificationAdmin_entity/entityfields/scorepoints/mandatoryProcess.js</mandatoryProcess> <stateProcess>%aditoprj%/entity/ClassificationAdmin_entity/entityfields/scorepoints/stateProcess.js</stateProcess> diff --git a/entity/ClassificationAdmin_entity/entityfields/classificationgroupdisplayvalue/onValueChange.js b/entity/ClassificationAdmin_entity/entityfields/classificationgroupdisplayvalue/onValueChange.js new file mode 100644 index 00000000000..ea41f9b7326 --- /dev/null +++ b/entity/ClassificationAdmin_entity/entityfields/classificationgroupdisplayvalue/onValueChange.js @@ -0,0 +1,16 @@ +import("system.neon"); +import("system.vars"); +import("Sql_lib"); + +if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW) +{ + var sorting = newSelect("CLASSIFICATIONGROUP.SORTING") + .from("CLASSIFICATIONGROUP") + .where("CLASSIFICATIONGROUP.CLASSIFICATIONGROUPID", vars.get("$this.value")) + .cell(); + + if(sorting) + { + neon.setFieldValue("$field.SORTING", sorting) + } +} \ No newline at end of file diff --git a/entity/ClassificationAdmin_entity/entityfields/sorting/stateProcess.js b/entity/ClassificationAdmin_entity/entityfields/sorting/stateProcess.js index 2cd13f04b8e..759b36de7c3 100644 --- a/entity/ClassificationAdmin_entity/entityfields/sorting/stateProcess.js +++ b/entity/ClassificationAdmin_entity/entityfields/sorting/stateProcess.js @@ -9,7 +9,7 @@ var recordCategory = vars.get("$field.recordCategory"); if(recordCategory == $ClassificationRecordCategories.CLASSIFICATION_CLASSIFICATION_TYPE()) state = neon.COMPONENTSTATE_INVISIBLE; else if(recordCategory == $ClassificationRecordCategories.CLASSIFICATION_GROUP_EXISTS()) - state = neon.COMPONENTSTATE_DISABLED; + state = neon.COMPONENTSTATE_EDITABLE; else state = neon.COMPONENTSTATE_EDITABLE; diff --git a/entity/ClassificationAdmin_entity/entityfields/sorting/valueProcess.js b/entity/ClassificationAdmin_entity/entityfields/sorting/valueProcess.js index c59d575fa67..2a00907372c 100644 --- a/entity/ClassificationAdmin_entity/entityfields/sorting/valueProcess.js +++ b/entity/ClassificationAdmin_entity/entityfields/sorting/valueProcess.js @@ -1,3 +1,4 @@ +import("Classification_lib"); import("system.neon"); import("system.vars"); import("system.result"); @@ -33,7 +34,16 @@ var sorting = newSelect("CLASSIFICATIONGROUP.SORTING") .from("CLASSIFICATIONGROUP") .where("CLASSIFICATIONGROUP.CLASSIFICATIONGROUPID", id) .cell(); -if(sorting) +var fieldValue = vars.get("$this.value"); +if((!fieldValue || fieldValue == "") && sorting) +{ result.string(sorting); +} +else if(fieldValue) +{ + result.string(fieldValue); +} else +{ result.string("1"); +} diff --git a/entity/ClassificationGrading_entity/entityfields/minpercent/onValidation.js b/entity/ClassificationGrading_entity/entityfields/minpercent/onValidation.js index 01fcc4024ce..244e89b0433 100644 --- a/entity/ClassificationGrading_entity/entityfields/minpercent/onValidation.js +++ b/entity/ClassificationGrading_entity/entityfields/minpercent/onValidation.js @@ -1,3 +1,4 @@ +import("system.translate"); import("system.result"); import("system.vars"); @@ -6,10 +7,16 @@ if(val) { var res; if(!Number.isInteger(Number(val))) - res = "Only Integers allowed"; + { + res = translate.text("Only Integers allowed"); + } else if(val < 0 || val > 100) - res = "The Value has to be in the 0-100% range"; - + { + res = translate.text("The Value has to be in the 0-100% range"); + } + if(res) + { result.string(res); + } } \ No newline at end of file diff --git a/entity/ClassificationScore_entity/ClassificationScore_entity.aod b/entity/ClassificationScore_entity/ClassificationScore_entity.aod index 1a55247ab44..e10c62fade2 100644 --- a/entity/ClassificationScore_entity/ClassificationScore_entity.aod +++ b/entity/ClassificationScore_entity/ClassificationScore_entity.aod @@ -86,6 +86,7 @@ <name>SCOREPERCENT</name> <title>Percent</title> <contentType>NUMBER</contentType> + <onValidation>%aditoprj%/entity/ClassificationScore_entity/entityfields/scorepercent/onValidation.js</onValidation> </entityField> <entityField> <name>scoreInPoints</name> diff --git a/entity/ClassificationScore_entity/entityfields/scorepercent/onValidation.js b/entity/ClassificationScore_entity/entityfields/scorepercent/onValidation.js new file mode 100644 index 00000000000..fe95642377c --- /dev/null +++ b/entity/ClassificationScore_entity/entityfields/scorepercent/onValidation.js @@ -0,0 +1,10 @@ +import("system.translate"); +import("system.result"); +import("system.vars"); + +var val = vars.get("$this.value"); +if(val) +{ + if(val < 0 || val > 100) + result.string(translate.text("The Value has to be in the 0-100% range")); +} \ No newline at end of file diff --git a/entity/Classification_entity/recordcontainers/jdito/contentProcess.js b/entity/Classification_entity/recordcontainers/jdito/contentProcess.js index f9ef4620aaa..9012ad499cb 100644 --- a/entity/Classification_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Classification_entity/recordcontainers/jdito/contentProcess.js @@ -534,8 +534,8 @@ function _buildTreeFromPersistetData() achievedGroupScoresObj[groupId] = 0 classificationGroups.push(groupId) } - if(classificationScorePoints != undefined) - achievedGroupScoresObj[groupId] = eMath.addInt(Number(achievedGroupScoresObj[groupId]), Number(classificationScorePoints)); + if(classificationScorePoints != undefined || classificationScorePoints != "") + achievedGroupScoresObj[groupId] = eMath.addDec(Number(achievedGroupScoresObj[groupId]), Number(classificationScorePoints)); treeBuilt = true; resultSet.push([uid, typeId, classificationId, groupId, classificationGroupTitle, classificationTypeScoreType, diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index c1fa3d52f8c..db50962c44a 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -7662,6 +7662,15 @@ <entry> <key>without Vat</key> </entry> + <entry> + <key>Site visit</key> + </entry> + <entry> + <key>The Value has to be in the 0-100% range</key> + </entry> + <entry> + <key>Only Integers allowed</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 c775a6fdeb8..745a63fc2cd 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -10100,6 +10100,14 @@ Bitte Datumseingabe prüfen</value> <key>Filter set</key> <value>Filter gesetzt</value> </entry> + <entry> + <key>The Value has to be in the 0-100% range</key> + <value>Der Wert muss sich zwischen 0 und 100% liegen</value> + </entry> + <entry> + <key>Only Integers allowed</key> + <value>Nur ganze Zahlen erlaubt</value> + </entry> <entry> <key>Sent Offers</key> </entry> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index f42c439be86..125dc9894ba 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -7743,6 +7743,15 @@ <entry> <key>without Vat</key> </entry> + <entry> + <key>Site visit</key> + </entry> + <entry> + <key>The Value has to be in the 0-100% range</key> + </entry> + <entry> + <key>Only Integers allowed</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> -- GitLab