diff --git a/entity/SalesprojectClassificationEntry_entity/SalesprojectClassificationEntry_entity.aod b/entity/SalesprojectClassificationEntry_entity/SalesprojectClassificationEntry_entity.aod index a83e91383114e4ba375c37de526ea220a01a0470..9219e338c0efa1601517d312ec0acddcf5a554ed 100644 --- a/entity/SalesprojectClassificationEntry_entity/SalesprojectClassificationEntry_entity.aod +++ b/entity/SalesprojectClassificationEntry_entity/SalesprojectClassificationEntry_entity.aod @@ -2,14 +2,19 @@ <entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.0.5" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.0.5"> <name>SalesprojectClassificationEntry_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> + <grantCreate v="false" /> + <grantDelete v="false" /> <recordContainerType>JDITO</recordContainerType> + <titleProcess>%aditoprj%/entity/SalesprojectClassificationEntry_entity/titleProcess.js</titleProcess> <jDitoRecordAlias>Data_alias</jDitoRecordAlias> <fields> <element>UID</element> + <element>TYPE</element> <element>NAME</element> <element>VALUE</element> </fields> <contentProcess>%aditoprj%/entity/SalesprojectClassificationEntry_entity/contentProcess.js</contentProcess> + <onUpdate>%aditoprj%/entity/SalesprojectClassificationEntry_entity/onUpdate.js</onUpdate> <entityFields> <entityIncomingField> <name>#INCOMING</name> @@ -17,6 +22,8 @@ <entityIncomingField> <name>SalesprojectClassificatonEntry_dfi</name> <fieldType>DEPENDENCY_IN</fieldType> + <title>kkkkkkkkkkkkkkk</title> + <titleProcess>%aditoprj%/entity/SalesprojectClassificationEntry_entity/entityfields/salesprojectclassificatonentry_dfi/titleProcess.js</titleProcess> <dependencies> <entityDependency> <name>a7414022-56d3-4ca0-b15f-33601b655d78</name> @@ -30,25 +37,37 @@ <name>SalesprojectId_param</name> <expose v="true" /> <triggerRecalculation v="true" /> + <mandatory v="true" /> <description>PARAMETER</description> </entityParameter> <entityParameter> <name>ClassId_param</name> <expose v="true" /> <triggerRecalculation v="true" /> + <mandatory v="true" /> <description>PARAMETER</description> </entityParameter> <entityField> <name>UID</name> + <title>Uid</title> <fieldName>UID</fieldName> </entityField> <entityField> <name>NAME</name> + <title>Name</title> <fieldName>NAME</fieldName> </entityField> <entityField> <name>VALUE</name> + <title>Value</title> <fieldName>VALUE</fieldName> + <possibleItemsProcess>%aditoprj%/entity/SalesprojectClassificationEntry_entity/entityfields/value/possibleItemsProcess.js</possibleItemsProcess> + </entityField> + <entityField> + <name>TYPE</name> + <title>Type</title> + <fieldName>TYPE</fieldName> + <state>INVISIBLE</state> </entityField> </entityFields> </entity> diff --git a/entity/SalesprojectClassificationEntry_entity/contentProcess.js b/entity/SalesprojectClassificationEntry_entity/contentProcess.js index 1d2439cfe7f978043d6b0904d3ab3b77c3847b93..c66d2c551d7442f910b0e520dfe5127a72a01eaa 100644 --- a/entity/SalesprojectClassificationEntry_entity/contentProcess.js +++ b/entity/SalesprojectClassificationEntry_entity/contentProcess.js @@ -4,49 +4,103 @@ import("system.db"); import("Keyword_lib"); import("Sql_lib"); -var allOldTypesCondition, allOldTypes, typesCondition, classId, salesprojectId, entryKeywords; - + +var allOldTypesCondition, allOldTypes, classificationsCondition, classifications, classId, salesprojectId, entryKeywords; + +classifications = []; + if (vars.exists("$param.ClassId_param") && vars.exists("$param.SalesprojectId_param")) { classId = vars.getString("$param.ClassId_param"); salesprojectId = vars.getString("$param.SalesprojectId_param"); - entryKeywords = KeywordUtils.get("SALESPROJECT.CLASS", classId)[2].keywords; - - if (entryKeywords && classId && salesprojectId) { - // correct db if kewords changed - allOldTypesCondition = new SqlCondition(); - allOldTypesCondition.andPrepare("SALESPROJECT_CLASSIFICATION.SALESPROJECT_ID", salesprojectId) - .andPrepare("SALESPROJECT_CLASSIFICATION.CLASS", classId); - - entryKeywords.forEach(function(entry) { - allOldTypesCondition.andPrepare("SALESPROJECT_CLASSIFICATION.TYPE", entry, "# <> ?") - }); - - allOldTypes = db.array(db.COLUMN, allOldTypesCondition.buildSelect("select TYPE from SALESPROJECT_CLASSIFICATION", "1 = 0", "group by TYPE")); - - if (allOldTypes.length > 0) { - // TODO maybe ask user????!!!!! - db.deleteData("SALESPROJECT_CLASSIFICATION", allOldTypesCondition.build("1 = 0")) - } - - //typesCondition = - /* - <column name="CLASS" type="CHAR(1)"/> - <column name="TYPE" type="VARCHAR(50)"/> - <column name="VALUE" type="INTEGER"/>*/ - } + + if (classId && salesprojectId) { + -/* - entries = []; - entryKeywords.forEach(function(entryKeyword) { - entry = kwUtils.getStandardArray(entryKeyword) - entries.push([entry[0], entry[1]]) - });*/ + entryKeywords = KeywordUtils.get("SALESPROJECT.CLASS", classId)[2].keywords; -} + if (entryKeywords && classId && salesprojectId) { + // correct db if kewords changed + allOldTypesCondition = _getClassificationCondition(false); + allOldTypes = db.array(db.COLUMN, allOldTypesCondition.buildSelect("select TYPE from SALESPROJECT_CLASSIFICATION", "1 = 0", "group by TYPE")); + if (allOldTypes.length > 0) { + // TODO maybe ask user????!!!!! + 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) { + for (i = 0; i < classifications.length; i++) { + if (classifications[i][1] == entryKeyword[0]) { + return [classifications[i][0], entryKeyword[0], entryKeyword[1], classifications[i][2]] + } + } + + // if not found create new: + var values = [ + util.getNewUUID(), + salesprojectId, + classId, + entryKeyword[0], + "1", + vars.get("$sys.user"), + vars.get("$sys.date") + ]; + + db.insertData( + "SALESPROJECT_CLASSIFICATION", + [ + "SALESPROJECT_CLASSIFICATIONID", + "SALESPROJECT_ID", + "CLASS", + "TYPE", + "VALUE", + "USER_NEW", + "DATE_NEW" + ], + 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]] + }); +*/ + } + } +} +logging.log(classifications.toSource()) +result.object(classifications); +/** + * creates a SqlCondition() to get the classification items + * + * @param include if true the condition includes all types of the class else it excludes them and selects all other types + * @return the condition object + */ +function _getClassificationCondition(include) { + var resultingCondition = new SqlCondition(); + resultingCondition.andPrepare("SALESPROJECT_CLASSIFICATION.SALESPROJECT_ID", salesprojectId) + .andPrepare("SALESPROJECT_CLASSIFICATION.CLASS", classId); + var typeCondition = new SqlCondition(); -result.object([]); \ No newline at end of file + entryKeywords.forEach(function(entry) { + if (include) { + typeCondition.orPrepare("SALESPROJECT_CLASSIFICATION.TYPE", entry[0], "# = ?"); + } else { + typeCondition.andPrepare("SALESPROJECT_CLASSIFICATION.TYPE", entry[0], "# <> ?"); + } + }); + + resultingCondition.andSqlCondition(typeCondition, "1 = 0"); + return resultingCondition; +} \ No newline at end of file diff --git a/entity/SalesprojectClassificationEntry_entity/entityfields/salesprojectclassificatonentry_dfi/titleProcess.js b/entity/SalesprojectClassificationEntry_entity/entityfields/salesprojectclassificatonentry_dfi/titleProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..15ccfbd453825ebb783af25b1826c20833588db1 --- /dev/null +++ b/entity/SalesprojectClassificationEntry_entity/entityfields/salesprojectclassificatonentry_dfi/titleProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.NAME") + "123") \ No newline at end of file diff --git a/entity/SalesprojectClassificationEntry_entity/entityfields/value/possibleItemsProcess.js b/entity/SalesprojectClassificationEntry_entity/entityfields/value/possibleItemsProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..3ac051217610743a25e09ef1e23c3ad2c5d71c90 --- /dev/null +++ b/entity/SalesprojectClassificationEntry_entity/entityfields/value/possibleItemsProcess.js @@ -0,0 +1,10 @@ +import("system.result"); +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)); +} \ No newline at end of file diff --git a/entity/SalesprojectClassificationEntry_entity/onUpdate.js b/entity/SalesprojectClassificationEntry_entity/onUpdate.js new file mode 100644 index 0000000000000000000000000000000000000000..18be8137a5a70e1cd9e2b4d1c0298554b471e916 --- /dev/null +++ b/entity/SalesprojectClassificationEntry_entity/onUpdate.js @@ -0,0 +1,28 @@ +import("system.db"); +import("system.vars"); +import("system.logging"); +import("Sql_lib"); + +logging.log(vars.get("$local.changed").toSource()) + + +var condition = new SqlCondition(); +condition.andPrepare("SALESPROJECT_CLASSIFICATION.SALESPROJECT_CLASSIFICATIONID", vars.getString("$field.UID")); + +var values = [ + vars.getString("$field.VALUE"), + vars.get("$sys.user"), + vars.get("$sys.date") +]; + +db.updateData( + "SALESPROJECT_CLASSIFICATION", + [ + "VALUE", + "USER_EDIT", + "DATE_EDIT" + ], + null, + values, + condition.build("1 = 0") +); \ No newline at end of file diff --git a/entity/SalesprojectClassificationEntry_entity/titleProcess.js b/entity/SalesprojectClassificationEntry_entity/titleProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..dffd0bd73b994f31efe37f60430ab35fe4150c02 --- /dev/null +++ b/entity/SalesprojectClassificationEntry_entity/titleProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.NAME")) \ No newline at end of file diff --git a/entity/SalesprojectClassification_entity/SalesprojectClassification_entity.aod b/entity/SalesprojectClassification_entity/SalesprojectClassification_entity.aod index abb49eb621d5e60f093161cd50483b85525967d9..b501f4cebb8a7aea19b91f73eaf340cdb1064a2c 100644 --- a/entity/SalesprojectClassification_entity/SalesprojectClassification_entity.aod +++ b/entity/SalesprojectClassification_entity/SalesprojectClassification_entity.aod @@ -31,10 +31,12 @@ <entityParameter> <name>ClassId_param</name> <code>%aditoprj%/entity/SalesprojectClassification_entity/entityfields/salesprojectclassificationentry_dfo/children/classid_param/code.js</code> + <triggerRecalculation v="true" /> </entityParameter> <entityParameter> <name>SalesprojectId_param</name> <code>%aditoprj%/entity/SalesprojectClassification_entity/entityfields/salesprojectclassificationentry_dfo/children/salesprojectid_param/code.js</code> + <triggerRecalculation v="true" /> </entityParameter> </children> </entityOutgoingField> diff --git a/entity/SalesprojectClassification_entity/contentProcess.js b/entity/SalesprojectClassification_entity/contentProcess.js index bea2285dbb08f69578f93490064fe2485a273f78..ac02906b90201d9bed32a268416e5050d7e07023 100644 --- a/entity/SalesprojectClassification_entity/contentProcess.js +++ b/entity/SalesprojectClassification_entity/contentProcess.js @@ -1,7 +1,20 @@ import("system.result"); import("system.logging"); +import("system.vars"); import("Keyword_lib"); -result.object(KeywordUtils.getStandardArray("SALESPROJECT.CLASS")); +var keyword = KeywordUtils.createKeyword("SALESPROJECT.CLASS"); -//TODO correct db if kewords changed \ No newline at end of file +if (vars.exists("$local.idvalues")) { + var idValues = vars.get("$local.idvalues"); + + if (idValues.length > 0) { + keyword.filter(function(id) { + return id == idValues[0]; + }); + } +} +result.object(keyword.toArray(["id", "name"])); + + +//TODO correct db if kewords changed diff --git a/entity/SalesprojectClassification_entity/entityfields/salesprojectclassificationentry_dfo/children/classid_param/code.js b/entity/SalesprojectClassification_entity/entityfields/salesprojectclassificationentry_dfo/children/classid_param/code.js index 6df5509e9bfdc33c963a7b63c97faf42a8b303f6..a5632992f1eb801942517498616c86a95f49b737 100644 --- a/entity/SalesprojectClassification_entity/entityfields/salesprojectclassificationentry_dfo/children/classid_param/code.js +++ b/entity/SalesprojectClassification_entity/entityfields/salesprojectclassificationentry_dfo/children/classid_param/code.js @@ -1,6 +1,4 @@ import("system.result"); import("system.vars"); -import("system.logging"); -logging.log("Parameter 1 gesetzt") result.string(vars.getString("$field.UID")); \ No newline at end of file diff --git a/entity/SalesprojectClassification_entity/entityfields/salesprojectclassificationentry_dfo/children/salesprojectid_param/code.js b/entity/SalesprojectClassification_entity/entityfields/salesprojectclassificationentry_dfo/children/salesprojectid_param/code.js index 81e77557b8cc3ca55193c111f645e929c7d0f5d2..098d87cfa55579898b8da11975f3fb345672247f 100644 --- a/entity/SalesprojectClassification_entity/entityfields/salesprojectclassificationentry_dfo/children/salesprojectid_param/code.js +++ b/entity/SalesprojectClassification_entity/entityfields/salesprojectclassificationentry_dfo/children/salesprojectid_param/code.js @@ -1,7 +1,4 @@ import("system.result"); import("system.vars"); -import("system.logging"); - -logging.log("Parameter 2 gesetzt") result.string(vars.getString("$param.SalesprojectId_param")); \ No newline at end of file diff --git a/entity/SalesprojectClassification_entity/onUpdate.js b/entity/SalesprojectClassification_entity/onUpdate.js index 784a7e0075233eda2742855d06e147552b624573..c0b643664fa18b8b927790a3c087615fc9122d43 100644 --- a/entity/SalesprojectClassification_entity/onUpdate.js +++ b/entity/SalesprojectClassification_entity/onUpdate.js @@ -1 +1,4 @@ -//f \ No newline at end of file +import("system.vars") +import("system.logging") + +logging.log(vars.get("$local.changed").toSource()) \ No newline at end of file diff --git a/entity/SalesprojectCycle_entity/conditionProcess.js b/entity/SalesprojectCycle_entity/conditionProcess.js index 4048fcb70b060f211a8f89dfa13360b3a08ffd6a..be87512e0c943b8c20fe1f1e80875e199fbf8c5d 100644 --- a/entity/SalesprojectCycle_entity/conditionProcess.js +++ b/entity/SalesprojectCycle_entity/conditionProcess.js @@ -1,11 +1,9 @@ import("system.db"); import("system.result"); import("system.vars"); -import("system.logging"); import("Sql_lib"); var cond = new SqlCondition(); -logging.log(vars.get("$param.SalesprojectId_param")) cond.andPrepareVars("SALESPROJECT_CYCLE.SALESPROJECT_ID", "$param.SalesprojectId_param"); //TODO: use a preparedCondition when available diff --git a/entity/SalesprojectCycle_entity/entityfields/type/possibleItemsProcess.js b/entity/SalesprojectCycle_entity/entityfields/type/possibleItemsProcess.js index ca7ec2ba2613657ca68da7bb446b478e7202b167..e6aa09f49925845d789231c634ef54264ee95674 100644 --- a/entity/SalesprojectCycle_entity/entityfields/type/possibleItemsProcess.js +++ b/entity/SalesprojectCycle_entity/entityfields/type/possibleItemsProcess.js @@ -1,8 +1,6 @@ import("system.result"); import("system.vars"); -import("system.logging"); import("Keyword_lib"); var items = KeywordUtils.getStandardArray("SALESPROJECT.CYCLE.TYPE"); -logging.log(items.toSource()) result.object(items); \ No newline at end of file diff --git a/entity/SalesprojectCycle_entity/entityfields/value/possibleItemsProcess.js b/entity/SalesprojectCycle_entity/entityfields/value/possibleItemsProcess.js index a3310ce62f2aa727a6a43c90109e7611eadddb46..43fe214e3317823dd707f4381e16ed008c972b78 100644 --- a/entity/SalesprojectCycle_entity/entityfields/value/possibleItemsProcess.js +++ b/entity/SalesprojectCycle_entity/entityfields/value/possibleItemsProcess.js @@ -1,6 +1,5 @@ import("system.result"); import("system.vars"); -import("system.logging"); import("Keyword_lib"); var items, keyword, type; @@ -8,7 +7,6 @@ var items, keyword, type; items = []; type = vars.getString("$field.TYPE"); -logging.log(type.toSource()) // load the possible values based on the type. if (type) { diff --git a/entity/Salesproject_entity/entityfields/phase/possibleItemsProcess.js b/entity/Salesproject_entity/entityfields/phase/possibleItemsProcess.js index 74024580c2b03083504fc8be4fa522b282feb056..fcb07176fb9d188e414146908f117a226dd4b454 100644 --- a/entity/Salesproject_entity/entityfields/phase/possibleItemsProcess.js +++ b/entity/Salesproject_entity/entityfields/phase/possibleItemsProcess.js @@ -1,7 +1,4 @@ import("system.result"); import("Keyword_lib"); -var items; - -items = KeywordUtils.getStandardArray("SALESPROJECT.PHASE"); -result.object(items); \ No newline at end of file +result.object(KeywordUtils.getStandardArray("SALESPROJECT.PHASE")); \ No newline at end of file diff --git a/entity/Salesproject_entity/onDBUpdate.js b/entity/Salesproject_entity/onDBUpdate.js index 927e80d477dda26508f0e77a16da88127cc1ff71..aeffbb32c2e40dc8932b2cf12d7d9223ad5ccfd9 100644 --- a/entity/Salesproject_entity/onDBUpdate.js +++ b/entity/Salesproject_entity/onDBUpdate.js @@ -1,5 +1,4 @@ import("system.vars"); -import("system.logging"); import("Salesproject_lib"); var typeValue, fieldVar diff --git a/neonContext/SalesprojectClassificationEntry_context/SalesprojectClassificationEntry_context.aod b/neonContext/SalesprojectClassificationEntry_context/SalesprojectClassificationEntry_context.aod index e8adc3fa03037a1b661575a3ebb06ad2e249c250..513be574430b1e06c35fa5fe32fa3b0d29a3aa93 100644 --- a/neonContext/SalesprojectClassificationEntry_context/SalesprojectClassificationEntry_context.aod +++ b/neonContext/SalesprojectClassificationEntry_context/SalesprojectClassificationEntry_context.aod @@ -2,6 +2,9 @@ <neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.0.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.0.0"> <name>SalesprojectClassificationEntry_context</name> <majorModelMode>DISTRIBUTED</majorModelMode> + <mainview>SalesprojectClassificationEntryPreview_view</mainview> + <filterview>SalesprojectClassificationEntryPreview_view</filterview> + <editview>SalesprojectClassificationEntryEdit_view</editview> <preview>SalesprojectClassificationEntryPreview_view</preview> <entity>SalesprojectClassificationEntry_entity</entity> <references> @@ -9,5 +12,9 @@ <name>7cddda68-3dcb-4daf-84a4-1546298cabb6</name> <view>SalesprojectClassificationEntryPreview_view</view> </neonViewReference> + <neonViewReference> + <name>80205380-7785-43a3-af7b-73ef8112ca38</name> + <view>SalesprojectClassificationEntryEdit_view</view> + </neonViewReference> </references> </neonContext> diff --git a/neonView/SalesprojectClassificationEntryEdit_view/SalesprojectClassificationEntryEdit_view.aod b/neonView/SalesprojectClassificationEntryEdit_view/SalesprojectClassificationEntryEdit_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..a5016e5a1e3deace8869b7846aa49d5020157f8b --- /dev/null +++ b/neonView/SalesprojectClassificationEntryEdit_view/SalesprojectClassificationEntryEdit_view.aod @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.0.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.0.0"> + <name>SalesprojectClassificationEntryEdit_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>SalesprojectClassificationEntryData_template</name> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>003f3304-b8fb-4009-ba55-b56d005191e3</name> + <entityField>NAME</entityField> + </entityFieldLink> + <entityFieldLink> + <name>90630f8e-8e32-4743-9b79-a1faa6e26414</name> + <entityField>VALUE</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/SalesprojectClassificationEntryPreview_view/SalesprojectClassificationEntryPreview_view.aod b/neonView/SalesprojectClassificationEntryPreview_view/SalesprojectClassificationEntryPreview_view.aod index 0c6e070dfb856d373bf0b5ae42dbb102330ead5f..5504cee35e6c55d284f23f8dece7ca250ded50f2 100644 --- a/neonView/SalesprojectClassificationEntryPreview_view/SalesprojectClassificationEntryPreview_view.aod +++ b/neonView/SalesprojectClassificationEntryPreview_view/SalesprojectClassificationEntryPreview_view.aod @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.0.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.0.0"> <name>SalesprojectClassificationEntryPreview_view</name> + <title>asdf</title> <majorModelMode>DISTRIBUTED</majorModelMode> <layout> <boxLayout> @@ -8,23 +9,23 @@ </boxLayout> </layout> <children> - <tableViewTemplate> + <titledListViewTemplate> <name>SalesprojectClassificationEntryData_template</name> <entityField>#ENTITY</entityField> <columns> <neonTableColumn> - <name>2de7d794-3c72-42a1-ab5b-1eaf7608b0f3</name> - <entityField>UID</entityField> + <name>91aa4685-98f7-40e9-87be-877583a91143</name> + <entityField>NAME</entityField> </neonTableColumn> <neonTableColumn> - <name>e4ae9891-2db2-427e-9f28-0d07ad4dcc4c</name> - <entityField>NAME</entityField> + <name>88105c9a-fdf8-4d2b-ac96-d57ef4f41aa4</name> + <entityField>TYPE</entityField> </neonTableColumn> <neonTableColumn> - <name>7a61d1ed-3359-4c74-b598-f09b69cc6f75</name> + <name>b862235e-6595-4ae0-8bd0-5f942d975c67</name> <entityField>VALUE</entityField> </neonTableColumn> </columns> - </tableViewTemplate> + </titledListViewTemplate> </children> </neonView> diff --git a/neonView/SalesprojectClassificationPreview_view/SalesprojectClassificationPreview_view.aod b/neonView/SalesprojectClassificationPreview_view/SalesprojectClassificationPreview_view.aod index 05147ac8652734848775c275b6e6672fbff3c02c..558507fb7b982ae25d0ca068cc5fd38ced3b0e27 100644 --- a/neonView/SalesprojectClassificationPreview_view/SalesprojectClassificationPreview_view.aod +++ b/neonView/SalesprojectClassificationPreview_view/SalesprojectClassificationPreview_view.aod @@ -8,8 +8,26 @@ </boxLayout> </layout> <children> + <genericViewTemplate> + <name>rfff</name> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>51712a19-9a8c-4967-bd15-a448b5bffb77</name> + <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> + </entityFieldLink> + </fields> + </genericViewTemplate> <neonViewReference> - <name>ee9b0c38-f2f9-4e5e-9ab8-2c4658ffca83</name> + <name>c6c26fdd-3812-495f-bd30-d3a6cdcd4eb0</name> <entityField>SalesprojectClassificationEntry_dfo</entityField> <view>SalesprojectClassificationEntryPreview_view</view> </neonViewReference> diff --git a/others/db_changes/data/example_salesproject/SALESPROJECT_gfk.xml b/others/db_changes/data/example_salesproject/SALESPROJECT_gfk.xml index db97bcf7d48a1d21d17a69cd578520faf8670d04..49d73913e795ae76b5921dc0bb4c9e18dafe740b 100644 --- a/others/db_changes/data/example_salesproject/SALESPROJECT_gfk.xml +++ b/others/db_changes/data/example_salesproject/SALESPROJECT_gfk.xml @@ -57,7 +57,7 @@ </insert> <insert tableName="SALESPROJECT_COMPETITION"> - <column name="SALESPROJECT_COMPETITIONID" value="SALESPROJECT_COMPETITIONID"/> + <column name="SALESPROJECT_COMPETITIONID" value="a3ae9702-a3da-4d5f-a3ab-e386c8a0ac40"/> <column name="USER_NEW" value="admin"/> <column name="DATE_NEW" valueDate="2018-06-13T09:03:43"/> <column name="SALESPROJECT_ID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> @@ -69,7 +69,7 @@ </insert> <insert tableName="SALESPROJECT_MEMBER"> - <column name="SALESPROJECT_MEMBERID" value="SALESPROJECT_MEMBERID"/> + <column name="SALESPROJECT_MEMBERID" value="f9dc15c0-91b8-43d3-ba98-80ca581db3a3"/> <column name="USER_NEW" value="admin"/> <column name="DATE_NEW" valueDate="2018-06-13T09:03:43"/> <column name="SALESPROJECT_ID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> @@ -77,6 +77,17 @@ <column name="SALESPROJECT_ROLE" valueNumeric="1"/> </insert> + <insert tableName="SALESPROJECT_CLASSIFICATION"> + <column name="SALESPROJECT_CLASSIFICATIONID" value="77da9dcb-b49a-4608-9c7d-68545b0ec29b"/> + <column name="USER_NEW" value="admin"/> + <column name="DATE_NEW" valueDate="2018-06-13T09:03:43"/> + <column name="SALESPROJECT_ID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> + + <column name="CLASS" valueNumeric="1"/> + <column name="TYPE" value="CLASS.BRANCHE"/> + <column name="VALUE" valueNumeric="2"/> + </insert> + <rollback> <delete tableName="SALESPROJECT"> <where>SALESPROJECTID = ?</where> @@ -114,6 +125,12 @@ <param value="0833465c-8851-4fbb-b7e3-8c1d73c903da" /> </whereParams> </delete> + <delete tableName="SALESPROJECT_CLASSIFICATION"> + <where>SALESPROJECT_ID = ?</where> + <whereParams> + <param value="0833465c-8851-4fbb-b7e3-8c1d73c903da" /> + </whereParams> + </delete> </rollback> </changeSet> </databaseChangeLog> diff --git a/process/Keyword_lib/process.js b/process/Keyword_lib/process.js index ca80a4a47d7544f51de5891769e50b1b8bbefee6..a74aaf463dd533ebea23eae1db48b50962e40d7a 100644 --- a/process/Keyword_lib/process.js +++ b/process/Keyword_lib/process.js @@ -287,16 +287,54 @@ function KeywordUtils(){ break; case "SALESPROJECT.CLASS": valueContainer = _createKeywordEntriesContainer([ - _createKeywordEntry("1", translate.text("Class A"), null, {keywords: ["CLASS.BRANCHE", "CLASS.BASED", "CLASS.USERS"]}) - ,_createKeywordEntry("2", translate.text("Class B"), null, {keywords: ["CLASS.BUDGET", "CLASS.STANDARD", "CLASS.CUSTOMIZING"]}) - ,_createKeywordEntry("3", translate.text("Class C"), null, {keywords: ["CLASS.POSITION", "CLASS.PROJSTART", "CLASS.CLOUD", "CLASSES.DEPARTMENT"]}) + _createKeywordEntry("1", translate.text("Class A"), null, { + keywords: + [["CLASS.BRANCHE", translate.text("Branche")], + ["CLASS.BASED", translate.text("Base")]] + }) + ,_createKeywordEntry("2", translate.text("Class B"), null, { + keywords: + [["CLASS.BUDGET", translate.text("Budget (Project)")], + ["CLASS.STANDARD", translate.text("Standard / Individual")]] + }) + ,_createKeywordEntry("3", translate.text("Class C"), null, { + keywords: + [["CLASS.PROJSTART", translate.text("Projectstart")]] + }) ]); break; case "CLASS.BRANCHE": valueContainer = _createKeywordEntriesContainer([ - _createKeywordEntry("1", translate.text("Branche 1"), null) - ,_createKeywordEntry("2", translate.text("Branche 2"), null) - ,_createKeywordEntry("3", translate.text("Branche 3"), null) + _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}) + ]); + 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}) + ]); + 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}) + ]); + break; + case "CLASS.STANDARD": + valueContainer = _createKeywordEntriesContainer([ + _createKeywordEntry("1", translate.text("Individual"), null, {value: 25}) + ,_createKeywordEntry("2", translate.text("Standard"), null, {value: 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}) ]); break; case "OFFER.PROBABILITY": diff --git a/process/Sql_lib/process.js b/process/Sql_lib/process.js index c58c9ba1b7540e6d83d9df85168576251d6a696f..a69021b68b88f080d645a21d6104bd424139ee94 100644 --- a/process/Sql_lib/process.js +++ b/process/Sql_lib/process.js @@ -22,6 +22,7 @@ function SqlCondition(alias){ this._init();//the properties are initalized in an extra function because init is nearly the same as resetting (clearing) the SqlConditions this.alias = alias; this.cachedTypes = {}; + this.lastWasOr = false; } /** * append with SQL-and; no paranthesize of existing conditions is done @@ -64,10 +65,34 @@ SqlCondition.prototype.andPrepare = function(field, value, cond, fieldType){ SqlCondition.prototype.or = function(cond){ if (!cond) return this; - if (this._sqlStorage) + + if (this._sqlStorage && !this.lastWasOr) { this._sqlStorage = "(" + this._sqlStorage + ") or (" + cond + ")"; - else + this.lastWasOr = true; + + } else if (this._sqlStorage && this.lastWasOr) { + this._sqlStorage = this._sqlStorage + " or (" + cond + ")"; + this.lastWasOr = true; + + } else { this._sqlStorage = cond; + } + return this; +} + +SqlCondition.prototype.orSqlCondition = function(cond, alternativeCond) { + this.or(" ( " + cond.toString(alternativeCond) + " ) "); + if (cond.preparedValues) { + this.preparedValues = this.preparedValues.concat(cond.preparedValues); + } + return this; +} + +SqlCondition.prototype.andSqlCondition = function(cond, alternativeCond) { + this.and(" ( " + cond.toString(alternativeCond) + " ) "); + if (cond.preparedValues) { + this.preparedValues = this.preparedValues.concat(cond.preparedValues); + } return this; }