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

salesproject Classification Points

parent 3ea96e75
No related branches found
No related tags found
No related merge requests found
Showing
with 55 additions and 43 deletions
......@@ -11,6 +11,7 @@
<element>TYPE</element>
<element>NAME</element>
<element>VALUE</element>
<element>POINTS</element>
</fields>
<contentProcess>%aditoprj%/entity/SalesprojectClassificationEntry_entity/contentProcess.js</contentProcess>
<onUpdate>%aditoprj%/entity/SalesprojectClassificationEntry_entity/onUpdate.js</onUpdate>
......@@ -66,5 +67,10 @@
<fieldName>TYPE</fieldName>
<state>INVISIBLE</state>
</entityField>
<entityField>
<name>POINTS</name>
<fieldName>POINTS</fieldName>
<contentType>NUMBER</contentType>
</entityField>
</entityFields>
</entity>
import("system.result");
import("system.vars");
import("system.util");
import("system.db");
import("system.vars");
import("Keyword_lib");
import("Sql_lib");
var allOldTypesCondition, allOldTypes, classificationsCondition, classifications, classId, salesprojectId, entryKeywords;
var allOldTypesCondition, allOldTypes, classificationsCondition, classifications, classId, salesprojectId, entryKeywords, points;
classifications = [];
......@@ -15,7 +15,7 @@ if (vars.exists("$param.ClassId_param") && vars.exists("$param.SalesprojectId_pa
if (classId && salesprojectId) {
// keywords which are part of the loaded class [[keyname, visibleName]]
entryKeywords = KeywordUtils.get("SALESPROJECT.CLASS", classId)[2].keywords;
if (entryKeywords && classId && salesprojectId) {
......@@ -25,18 +25,25 @@ if (vars.exists("$param.ClassId_param") && vars.exists("$param.SalesprojectId_pa
if (allOldTypes.length > 0) {
// TODO maybe ask user????!!!!!
db.deleteData("SALESPROJECT_CLASSIFICATION", allOldTypesCondition.build("1 = 0"))
db.deleteData("SALESPROJECT_CLASSIFICATION", allOldTypesCondition.build("1 = 0"));
}
// load classifications for the class
classificationsCondition = _getClassificationCondition(true);
classifications = db.table(classificationsCondition.buildSelect("select SALESPROJECT_CLASSIFICATIONID, TYPE, VALUE from SALESPROJECT_CLASSIFICATION", "1 = 0"));
logging.log(entryKeywords.toSource())
classifications = entryKeywords.map(function(entryKeyword) {
// return saved value
for (i = 0; i < classifications.length; i++) {
if (classifications[i][1] == entryKeyword[0]) {
return [classifications[i][0], entryKeyword[0], entryKeyword[1], classifications[i][2]]
// get points
if (classifications[i][2]) {
points = KeywordUtils.get(entryKeyword[0], classifications[i][2])[2].points;
} else {
points = 0;
}
return [classifications[i][0], entryKeyword[0], entryKeyword[1], classifications[i][2], points]
}
}
......@@ -46,11 +53,10 @@ if (vars.exists("$param.ClassId_param") && vars.exists("$param.SalesprojectId_pa
salesprojectId,
classId,
entryKeyword[0],
"1",
"",
vars.get("$sys.user"),
vars.get("$sys.date")
];
db.insertData(
"SALESPROJECT_CLASSIFICATION",
[
......@@ -65,19 +71,12 @@ if (vars.exists("$param.ClassId_param") && vars.exists("$param.SalesprojectId_pa
null,
values
);
return [values[0], values[3], values[3] , values[4]]
});
/*
classifications = classifications.map(function(entry) {
let entryKeyword = KeywordUtils.get(entry[1], entry[2]);
return [entry[0], entry[1], entryKeyword[1] , entry[2]]
return [values[0], values[3], values[3] , values[4], 0]
});
*/
}
}
}
logging.log(classifications.toSource())
result.object(classifications);
/**
......
......@@ -3,7 +3,6 @@ import("system.logging");
import("system.vars");
import("Keyword_lib");
logging.log(vars.get("$field.TYPE"))
var type = vars.get("$field.TYPE");
if (type) {
result.object(KeywordUtils.getStandardArray(type));
......
......@@ -64,5 +64,9 @@
<mandatory v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityField>
<name>POINTS</name>
<valueProcess>%aditoprj%/entity/SalesprojectClassification_entity/entityfields/points/valueProcess.js</valueProcess>
</entityField>
</entityFields>
</entity>
import("system.result");
// TODO: load from Entry. Currently this is not possible.
result.object(50); // return dummy value
\ No newline at end of file
......@@ -25,6 +25,10 @@
<name>b862235e-6595-4ae0-8bd0-5f942d975c67</name>
<entityField>VALUE</entityField>
</neonTableColumn>
<neonTableColumn>
<name>ff2b615b-5c98-4a21-bb71-34027711d5e7</name>
<entityField>POINTS</entityField>
</neonTableColumn>
</columns>
</titledListViewTemplate>
</children>
......
......@@ -12,14 +12,14 @@
<name>SalesprojectClassificationData_template</name>
<entityField>#ENTITY</entityField>
<columns>
<neonTableColumn>
<name>112f460a-759b-4127-a184-b580af6681d3</name>
<entityField>UID</entityField>
</neonTableColumn>
<neonTableColumn>
<name>4139f5bd-0273-4b43-99a7-9122f0322170</name>
<entityField>CLASSNAME</entityField>
</neonTableColumn>
<neonTableColumn>
<name>9d31832d-86e4-49a8-99a5-2129cd6a1994</name>
<entityField>POINTS</entityField>
</neonTableColumn>
</columns>
</tableViewTemplate>
</children>
......
......@@ -17,12 +17,8 @@
<entityField>CLASSNAME</entityField>
</entityFieldLink>
<entityFieldLink>
<name>48312725-e22d-4c13-ab92-7be9f7d477e7</name>
<entityField>UID</entityField>
</entityFieldLink>
<entityFieldLink>
<name>5f9a5d73-67e1-4dcd-b31d-70fe908fb74d</name>
<entityField>SalesprojectId_param</entityField>
<name>c3621e4e-53b0-4932-b943-e1c07fe16a24</name>
<entityField>POINTS</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
......
......@@ -325,36 +325,36 @@ function KeywordUtils(){
break;
case "CLASS.BRANCHE":
valueContainer = _createKeywordEntriesContainer([
_createKeywordEntry("1", translate.text("Branche 1"), null, {value: 50})
,_createKeywordEntry("2", translate.text("Branche 2"), null, {value: 16.6})
,_createKeywordEntry("3", translate.text("Branche 3"), null, {value: 50})
_createKeywordEntry("1", translate.text("Branche 1"), null, {points: 50})
,_createKeywordEntry("2", translate.text("Branche 2"), null, {points: 16.6})
,_createKeywordEntry("3", translate.text("Branche 3"), null, {points: 50})
]);
break;
case "CLASS.BASED":
valueContainer = _createKeywordEntriesContainer([
_createKeywordEntry("1", translate.text("Germany"), null, {value: 20})
,_createKeywordEntry("2", translate.text("Austria"), null, {value: 7.5})
,_createKeywordEntry("3", translate.text("Other"), null, {value: 0})
_createKeywordEntry("1", translate.text("Germany"), null, {points: 20})
,_createKeywordEntry("2", translate.text("Austria"), null, {points: 7.5})
,_createKeywordEntry("3", translate.text("Other"), null, {points: 0})
]);
break;
case "CLASS.BUDGET":
valueContainer = _createKeywordEntriesContainer([
_createKeywordEntry("1", translate.text("from") + "350T€", null, {value: 50})
,_createKeywordEntry("2", "200" + translate.text("to") + "349T€", null, {value: 30})
,_createKeywordEntry("2", "0" + translate.text("to") + "3199T€", null, {value: 0})
_createKeywordEntry("1", translate.text("from") + "350T€", null, {points: 50})
,_createKeywordEntry("2", "200" + translate.text("to") + "349T€", null, {points: 30})
,_createKeywordEntry("3", "0" + translate.text("to") + "3199T€", null, {points: 0})
]);
break;
case "CLASS.STANDARD":
valueContainer = _createKeywordEntriesContainer([
_createKeywordEntry("1", translate.text("Individual"), null, {value: 25})
,_createKeywordEntry("2", translate.text("Standard"), null, {value: 12.5})
_createKeywordEntry("1", translate.text("Individual"), null, {points: 25})
,_createKeywordEntry("2", translate.text("Standard"), null, {points: 12.5})
]);
break;
case "CLASS.PROJSTART":
valueContainer = _createKeywordEntriesContainer([
_createKeywordEntry("1", translate.text("in 6 Months"), null, {value: 30})
,_createKeywordEntry("2", translate.text("in 12 Months"), null, {value: 20})
,_createKeywordEntry("3", translate.text("no Project planned"), null, {value: 0})
_createKeywordEntry("1", translate.text("in 6 Months"), null, {points: 30})
,_createKeywordEntry("2", translate.text("in 12 Months"), null, {points: 20})
,_createKeywordEntry("3", translate.text("no Project planned"), null, {points: 0})
]);
break;
case "OFFER.PROBABILITY":
......
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