Skip to content
Snippets Groups Projects
Commit 6819666e authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

Classification fixes

parent 2b3ce20c
No related branches found
No related tags found
No related merge requests found
Showing
with 47 additions and 26 deletions
......@@ -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>
......
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
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;
......
import("system.logging");
logging.log("huii")
\ No newline at end of file
......@@ -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>
......
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
......@@ -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
import("system.vars");
import("system.result");
result.string(vars.get("$field.CLASSIFICATIONTYPE"))
\ No newline at end of file
......@@ -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
......@@ -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
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"),
......
import("JditoFilter_lib");
import("system.logging");
import("Classification_lib");
import("system.vars");
import("Sql_lib");
......
......@@ -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"),
......
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)
......
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