diff --git a/entity/ClassificationScore_entity/ClassificationScore_entity.aod b/entity/ClassificationScore_entity/ClassificationScore_entity.aod index 3bd2db1f8211ac06e44b87abf06a7f78884e099f..748971c33316fb7e4e79cd3ef519ec58679575fa 100644 --- a/entity/ClassificationScore_entity/ClassificationScore_entity.aod +++ b/entity/ClassificationScore_entity/ClassificationScore_entity.aod @@ -54,11 +54,19 @@ <name>ClassificationGroup_param</name> <expose v="true" /> <triggerRecalculation v="true" /> + <mandatory v="true" /> </entityParameter> <entityParameter> <name>ClassificationTypeId_param</name> <expose v="true" /> <triggerRecalculation v="true" /> + <mandatory v="true" /> + </entityParameter> + <entityParameter> + <name>ClassificationType_param</name> + <expose v="true" /> + <triggerRecalculation v="true" /> + <mandatory v="true" /> </entityParameter> </children> </entityProvider> @@ -78,6 +86,11 @@ <triggerRecalculation v="true" /> <description>PARAMETER</description> </entityParameter> + <entityParameter> + <name>ClassificationType_param</name> + <expose v="true" /> + <description>PARAMETER</description> + </entityParameter> </entityFields> <recordContainers> <dbRecordContainer> @@ -85,6 +98,7 @@ <alias>Data_alias</alias> <conditionProcess>%aditoprj%/entity/ClassificationScore_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/ClassificationScore_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> + <onDBInsert>%aditoprj%/entity/ClassificationScore_entity/recordcontainers/db/onDBInsert.js</onDBInsert> <onDBDelete>%aditoprj%/entity/ClassificationScore_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> diff --git a/entity/ClassificationScore_entity/entityfields/classificationtype_id/valueProcess.js b/entity/ClassificationScore_entity/entityfields/classificationtype_id/valueProcess.js index 419fe78a30db83fdeda7d426e0f4083b914a555e..750e480506fd4856282e5c9c44ed32d4dde15183 100644 --- a/entity/ClassificationScore_entity/entityfields/classificationtype_id/valueProcess.js +++ b/entity/ClassificationScore_entity/entityfields/classificationtype_id/valueProcess.js @@ -1,3 +1,4 @@ +import("system.logging"); import("system.result"); import("system.neon"); import("system.vars"); @@ -5,4 +6,7 @@ import("system.vars"); if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) { result.string(vars.get("$param.ClassificationTypeId_param")); + logging.log("group: " + vars.get("$param.ClassificationGroup_param")) + logging.log("typeid: " + vars.get("$param.ClassificationTypeId_param")) + logging.log("pype: " + vars.get("$param.ClassificationType_param")) } \ No newline at end of file diff --git a/entity/ClassificationScore_entity/entityfields/maxvalue/valueProcess.js b/entity/ClassificationScore_entity/entityfields/maxvalue/valueProcess.js index f8c6c86bc47be666687a18dd369c8c91c67655e3..a368d02dabd1465499a153eb927c79ebf4789a3e 100644 --- a/entity/ClassificationScore_entity/entityfields/maxvalue/valueProcess.js +++ b/entity/ClassificationScore_entity/entityfields/maxvalue/valueProcess.js @@ -1,3 +1,4 @@ +import("system.logging"); import("system.vars"); import("system.result"); import("system.db"); @@ -10,10 +11,20 @@ if (!vars.get("$this.value")) SqlCondition.begin() .andPrepare("CLASSIFICATIONTYPE.CLASSIFICATIONTYPEID", classificationTypeId, "# <> ?") .andPrepare("CLASSIFICATIONTYPE.CLASSIFICATIONGROUP", vars.get("$param.ClassificationGroup_param")) + .andPrepare("CLASSIFICATIONTYPE.CLASSIFICATIONTYPE", vars.get("$param.ClassificationType_param")) .buildSql("select 100.0 - sum(maxScore) from ( \n\ select max(SCORE) maxScore from CLASSIFICATIONTYPE \n\ join CLASSIFICATIONSCORE on CLASSIFICATIONSCORE.CLASSIFICATIONTYPE_ID = CLASSIFICATIONTYPE.CLASSIFICATIONTYPEID", "1=2", "group by CLASSIFICATIONTYPE.SCORETYPE) maxScores")); + logging.log(db.translateStatement(SqlCondition.begin() + .andPrepare("CLASSIFICATIONTYPE.CLASSIFICATIONTYPEID", classificationTypeId, "# <> ?") + .andPrepare("CLASSIFICATIONTYPE.CLASSIFICATIONGROUP", vars.get("$param.ClassificationGroup_param")) + .andPrepare("CLASSIFICATIONTYPE.CLASSIFICATIONTYPE", vars.get("$param.ClassificationType_param")) + .buildSql("select 100.0 - sum(maxScore) from ( \n\ + select max(SCORE) maxScore from CLASSIFICATIONTYPE \n\ + join CLASSIFICATIONSCORE on CLASSIFICATIONSCORE.CLASSIFICATIONTYPE_ID = CLASSIFICATIONTYPE.CLASSIFICATIONTYPEID", "1=2", "group by CLASSIFICATIONTYPE.SCORETYPE) maxScores"))) + logging.log(maxValue) + if (maxValue == "") maxValue = 100; diff --git a/entity/ClassificationScore_entity/recordcontainers/db/onDBInsert.js b/entity/ClassificationScore_entity/recordcontainers/db/onDBInsert.js new file mode 100644 index 0000000000000000000000000000000000000000..b0b4d112acee139064ffb2d118c6cf1d71287298 --- /dev/null +++ b/entity/ClassificationScore_entity/recordcontainers/db/onDBInsert.js @@ -0,0 +1,2 @@ +import("system.logging"); +logging.log("huii") \ No newline at end of file diff --git a/entity/Classification_entity/Classification_entity.aod b/entity/Classification_entity/Classification_entity.aod index e827da07cfa4cbdbeee7b7406fd62e9ba21b1a82..bd478be5cb7b65e7fdd2a44bd6dddc6afadc6b55 100644 --- a/entity/Classification_entity/Classification_entity.aod +++ b/entity/Classification_entity/Classification_entity.aod @@ -54,10 +54,6 @@ </entityDependency> </dependencies> <children> - <entityParameter> - <name>ScoreType_param</name> - <expose v="false" /> - </entityParameter> <entityParameter> <name>IsAdminMode_param</name> <valueProcess>%aditoprj%/entity/Classification_entity/entityfields/classifications/children/isadminmode_param/valueProcess.js</valueProcess> @@ -121,6 +117,10 @@ <name>ClassificationTypeId_param</name> <valueProcess>%aditoprj%/entity/Classification_entity/entityfields/classificationscores/children/classificationtypeid_param/valueProcess.js</valueProcess> </entityParameter> + <entityParameter> + <name>ClassificationType_param</name> + <valueProcess>%aditoprj%/entity/Classification_entity/entityfields/classificationscores/children/classificationtype_param/valueProcess.js</valueProcess> + </entityParameter> </children> </entityConsumer> <entityActionField> @@ -128,15 +128,11 @@ <fieldType>ACTION</fieldType> <onActionProcess>%aditoprj%/entity/Classification_entity/entityfields/edit/onActionProcess.js</onActionProcess> </entityActionField> - <entityParameter> - <name>ScoreType_param</name> - <expose v="true" /> - <description>PARAMETER</description> - </entityParameter> <entityField> <name>CLASSIFICATIONTYPE</name> <title>Usage</title> <consumer>KeywordClassificationTypes</consumer> + <mandatory v="true" /> <searchable v="true" /> <groupable v="true" /> <stateProcess>%aditoprj%/entity/Classification_entity/entityfields/classificationtype/stateProcess.js</stateProcess> @@ -160,10 +156,6 @@ <valueProcess>%aditoprj%/entity/Classification_entity/entityfields/classificationsadministration/children/isadminmode_param/valueProcess.js</valueProcess> <expose v="false" /> </entityParameter> - <entityParameter> - <name>ScoreType_param</name> - <expose v="false" /> - </entityParameter> </children> </entityProvider> <entityParameter> @@ -202,6 +194,7 @@ <entityField> <name>SCORETYPE</name> <title>Score type</title> + <mandatory v="true" /> <displayValueProcess>%aditoprj%/entity/Classification_entity/entityfields/scoretype/displayValueProcess.js</displayValueProcess> </entityField> </entityFields> diff --git a/entity/Classification_entity/entityfields/classificationgroup/dropDownProcess.js b/entity/Classification_entity/entityfields/classificationgroup/dropDownProcess.js index dba2ecaa5178ad1e389f7bf58077fca54098f670..455cfc292bc5fe32b0cf1ad7bef2b704999517dc 100644 --- a/entity/Classification_entity/entityfields/classificationgroup/dropDownProcess.js +++ b/entity/Classification_entity/entityfields/classificationgroup/dropDownProcess.js @@ -1,4 +1,3 @@ -import("system.logging"); import("Classification_lib"); import("system.neon"); import("system.vars"); @@ -8,8 +7,6 @@ if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$par { // use param if available or current selectionRows var classificationType = vars.get("$field.CLASSIFICATIONTYPE") - logging.log("asdf " + vars.get("$field.CLASSIFICATIONTYPE")) - if (classificationType) result.object(ClassificationUtils.getAllGroups(classificationType, true)); } \ No newline at end of file diff --git a/entity/Classification_entity/entityfields/classificationgroup/mandatoryProcess.js b/entity/Classification_entity/entityfields/classificationgroup/mandatoryProcess.js index 52b7a0751a53c352e422b4d53b084429a951e423..2fff19b7702bb8390724ad175031c22a0b7d1df9 100644 --- a/entity/Classification_entity/entityfields/classificationgroup/mandatoryProcess.js +++ b/entity/Classification_entity/entityfields/classificationgroup/mandatoryProcess.js @@ -2,4 +2,4 @@ import("system.neon"); import("system.result"); import("system.vars"); -result.object(vars.get("$param.IsAdminMode_param") == 1 && vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW); \ No newline at end of file +result.object(vars.get("$param.IsAdminMode_param") == 1 && (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT)); \ No newline at end of file diff --git a/entity/Classification_entity/entityfields/classificationscores/children/classificationtype_param/valueProcess.js b/entity/Classification_entity/entityfields/classificationscores/children/classificationtype_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d3275a8eaa916bbbb9604617cb2fb5385bc01cfe --- /dev/null +++ b/entity/Classification_entity/entityfields/classificationscores/children/classificationtype_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.CLASSIFICATIONTYPE")) \ No newline at end of file diff --git a/entity/Classification_entity/entityfields/classificationtype_id/valueProcess.js b/entity/Classification_entity/entityfields/classificationtype_id/valueProcess.js index e49c8fad1ac02b78443eda6f571e2589b11afc7c..3886bb2dbefafdfd50c83b824fe2c1efd190f31e 100644 --- a/entity/Classification_entity/entityfields/classificationtype_id/valueProcess.js +++ b/entity/Classification_entity/entityfields/classificationtype_id/valueProcess.js @@ -2,7 +2,7 @@ import("system.result"); import("system.neon"); import("system.vars"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT && !vars.get("$this.value")) +if ((vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) && !vars.get("$this.value")) { result.string(vars.get("$field.CLASSIFICATIONTYPEID")); } \ No newline at end of file diff --git a/entity/Classification_entity/entityfields/classificationtypeid/valueProcess.js b/entity/Classification_entity/entityfields/classificationtypeid/valueProcess.js index 20cd6706484d99085c2cb18d81000ebdf00f883a..16c47d8b58490ac63829673a531ffce4e6896745 100644 --- a/entity/Classification_entity/entityfields/classificationtypeid/valueProcess.js +++ b/entity/Classification_entity/entityfields/classificationtypeid/valueProcess.js @@ -5,5 +5,6 @@ import("system.vars"); if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) { - result.string(util.getNewUUID()); + var newId = util.getNewUUID(); + result.string(newId); } \ No newline at end of file diff --git a/entity/Classification_entity/entityfields/edit/onActionProcess.js b/entity/Classification_entity/entityfields/edit/onActionProcess.js index 84060934fa289bee4a46a25942809558de10bbc6..8d018fd74f148d59d904106aacd47f1877ad01d5 100644 --- a/entity/Classification_entity/entityfields/edit/onActionProcess.js +++ b/entity/Classification_entity/entityfields/edit/onActionProcess.js @@ -1,4 +1,3 @@ -import("system.logging"); import("system.vars"); import("system.neon"); import("KeywordRegistry_basic"); @@ -6,7 +5,6 @@ import("KeywordRegistry_basic"); var selection = vars.get("$sys.selectionRows"); if (selection.length > 0) { - logging.log(selection.toSource()) var params = { "ClassificationType_param" : vars.get("$param.ClassificationType_param"), "ObjectType_param" : vars.get("$param.ObjectType_param"), diff --git a/entity/Classification_entity/recordcontainers/jdito/contentProcess.js b/entity/Classification_entity/recordcontainers/jdito/contentProcess.js index 71b3cab9ca3a467dd513b49dd3aa14674f3116f0..0fe1bb3c8113eb67c1d54c1cdf56c0cd11f73f3f 100644 --- a/entity/Classification_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Classification_entity/recordcontainers/jdito/contentProcess.js @@ -1,5 +1,4 @@ import("JditoFilter_lib"); -import("system.logging"); import("Classification_lib"); import("system.vars"); import("Sql_lib"); diff --git a/entity/Classification_entity/recordcontainers/jdito/onInsert.js b/entity/Classification_entity/recordcontainers/jdito/onInsert.js index 5bd556063e97e5faee7015205d08bcd619b9ee4d..5abae8836df8a9065da11605f54e2ca73902aa91 100644 --- a/entity/Classification_entity/recordcontainers/jdito/onInsert.js +++ b/entity/Classification_entity/recordcontainers/jdito/onInsert.js @@ -2,9 +2,8 @@ import("system.db"); import("system.util"); import("system.vars"); -var newId = util.getNewUUID(); db.insertData("CLASSIFICATIONTYPE", ["CLASSIFICATIONTYPEID", "CLASSIFICATIONTYPE", "SCORETYPE", "CLASSIFICATIONGROUP"], null, [ - newId, + vars.get("$field.CLASSIFICATIONTYPEID"), vars.get("$field.CLASSIFICATIONTYPE"), vars.get("$field.SCORETYPE"), vars.get("$field.CLASSIFICATIONGROUP"), diff --git a/entity/Classification_entity/recordcontainers/jdito/onUpdate.js b/entity/Classification_entity/recordcontainers/jdito/onUpdate.js index af0584bcb5268ca9c3e92123987221eeb9014824..3bd1eec53459f57a6efc73fb26a8c10d38dd4467 100644 --- a/entity/Classification_entity/recordcontainers/jdito/onUpdate.js +++ b/entity/Classification_entity/recordcontainers/jdito/onUpdate.js @@ -1,5 +1,4 @@ import("Classification_lib"); -import("system.logging"); import("system.neon"); import("system.util"); import("Sql_lib"); @@ -36,7 +35,7 @@ else if (vars.get("$field.CLASSIFICATIONSCORE_ID")) neon.setFieldValue("$field.CLASSIFICATIONID", newId); } -// update classificationgroup-name if it was changed (only in admin) +// update classificationgroup-name and scoretype-name if they were changed (only in admin) if (vars.exists("$param.IsAdminMode_param") && vars.exists("$param.IsAdminMode_param") == "1") { changed.forEach(function(change)