diff --git a/entity/AttributeRelation_entity/AttributeRelation_entity.aod b/entity/AttributeRelation_entity/AttributeRelation_entity.aod index 120de00f7c8fa9bcfa04cf2968cb0938e7411352..b585ba84eb837f511a4ad2d5bc57a7635328092d 100644 --- a/entity/AttributeRelation_entity/AttributeRelation_entity.aod +++ b/entity/AttributeRelation_entity/AttributeRelation_entity.aod @@ -16,9 +16,10 @@ <entityField> <name>AB_ATTRIBUTE_ID</name> <title>Attribute</title> + <consumer>SpecificAttribute</consumer> <mandatory v="true" /> - <possibleItemsProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/ab_attribute_id/possibleItemsProcess.js</possibleItemsProcess> <groupable v="true" /> + <displayValueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/ab_attribute_id/displayValueProcess.js</displayValueProcess> <onValueChange>%aditoprj%/entity/AttributeRelation_entity/entityfields/ab_attribute_id/onValueChange.js</onValueChange> </entityField> <entityField> @@ -160,6 +161,29 @@ <expose v="true" /> <description>PARAMETER</description> </entityParameter> + <entityConsumer> + <name>SpecificAttribute</name> + <fieldType>DEPENDENCY_OUT</fieldType> + <dependency> + <name>dependency</name> + <entityName>Attribute_entity</entityName> + <fieldName>SpecificAttribute</fieldName> + </dependency> + <children> + <entityParameter> + <name>objectType_param</name> + <code>%aditoprj%/entity/AttributeRelation_entity/entityfields/specificattribute/children/objecttype_param/code.js</code> + <expose v="true" /> + <triggerRecalculation v="true" /> + </entityParameter> + <entityParameter> + <name>filteredAttributeIds_param</name> + <code>%aditoprj%/entity/AttributeRelation_entity/entityfields/specificattribute/children/filteredattributeids_param/code.js</code> + <expose v="true" /> + <triggerRecalculation v="true" /> + </entityParameter> + </children> + </entityConsumer> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/AttributeRelation_entity/entityfields/ab_attribute_id/displayValueProcess.js b/entity/AttributeRelation_entity/entityfields/ab_attribute_id/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7375ee03d22b48d48e19926a0ad891be06cc2aec --- /dev/null +++ b/entity/AttributeRelation_entity/entityfields/ab_attribute_id/displayValueProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("system.result"); +import("Attribute_lib"); + +result.string(AttributeUtil.getFullAttributeName(vars.get("$field.AB_ATTRIBUTE_ID"))); \ No newline at end of file diff --git a/entity/AttributeRelation_entity/entityfields/ab_attribute_id/onValueChange.js b/entity/AttributeRelation_entity/entityfields/ab_attribute_id/onValueChange.js index e641c892888d2ee12cdbf69f722f489e30af0f93..9347efa6c0caed251cd27fdabf8e94710302e365 100644 --- a/entity/AttributeRelation_entity/entityfields/ab_attribute_id/onValueChange.js +++ b/entity/AttributeRelation_entity/entityfields/ab_attribute_id/onValueChange.js @@ -8,4 +8,5 @@ if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT || neon.setFieldValue("$field.DATE_VALUE", null); neon.setFieldValue("$field.ID_VALUE", null); neon.setFieldValue("$field.NUMBER_VALUE", null); + neon.setFieldValue("$field.MEMO_VALUE", null); } \ No newline at end of file diff --git a/entity/AttributeRelation_entity/entityfields/ab_attribute_id/possibleItemsProcess.js b/entity/AttributeRelation_entity/entityfields/ab_attribute_id/possibleItemsProcess.js deleted file mode 100644 index 6f6c5532b03f7d39ee87f3c8ed4f318705ccf847..0000000000000000000000000000000000000000 --- a/entity/AttributeRelation_entity/entityfields/ab_attribute_id/possibleItemsProcess.js +++ /dev/null @@ -1,11 +0,0 @@ -import("system.vars"); -import("system.result"); -import("Attribute_lib"); - -var filteredAttributes = []; -if (vars.exists("$param.filteredAttributeIds_param") && vars.get("$param.filteredAttributeIds_param")) -{ - filteredAttributes = JSON.parse(vars.get("$param.filteredAttributeIds_param")); -} - -result.object(AttributeUtil.getPossibleAttributes(vars.get("$param.objectType_param"), undefined, filteredAttributes)); diff --git a/entity/AttributeRelation_entity/entityfields/attributerelation_value/valueProcess.js b/entity/AttributeRelation_entity/entityfields/attributerelation_value/valueProcess.js index 4895956380293de93b3a437d1ab0e2e156d6e7ee..f1d1025828f4a7c554dd525a6f8ed38fc3551b2f 100644 --- a/entity/AttributeRelation_entity/entityfields/attributerelation_value/valueProcess.js +++ b/entity/AttributeRelation_entity/entityfields/attributerelation_value/valueProcess.js @@ -3,39 +3,19 @@ import("system.result"); import("system.vars"); import("Attribute_lib"); +"$field.CHAR_VALUE"; +"$field.DATE_VALUE"; +"$field.NUMBER_VALUE"; +"$field.BOOL_VALUE"; +"$field.ID_VALUE"; +"$field.MEMO_VALUE"; + if(vars.get("$sys.recordstate") != neon.OPERATINGSTATE_NEW) { - var attrType = AttributeHandler.begin(vars.get("$field.AB_ATTRIBUTE_ID")).getAttributeType(); + var attrField = AttributeHandler.begin(vars.get("$field.AB_ATTRIBUTE_ID")).getAttributeField(); var value = null; - if (attrType != null) //load the value from the correct field for the type - { - switch (attrType) - { - case $AttributeTypes.TEXT.toString(): - value = vars.get("$field.CHAR_VALUE"); - break; - case $AttributeTypes.DATE.toString(): - value = vars.get("$field.DATE_VALUE"); - break; - case $AttributeTypes.NUMBER.toString(): - value = vars.get("$field.NUMBER_VALUE"); - break; - case $AttributeTypes.BOOLEAN.toString(): - value = vars.get("$field.BOOL_VALUE"); - break; - case $AttributeTypes.COMBO.toString(): - case $AttributeTypes.KEYWORD.toString(): - value = vars.get("$field.ID_VALUE"); - break; - case $AttributeTypes.MEMO.toString(): - value = vars.get("$field.MEMO_VALUE"); - break; - } - } - //var attrField = AttributeHandler.begin(vars.get("$field.AB_ATTRIBUTE_ID")).getAttributeField(); - //var value = null; - //if (attrField != null) //load the value from the correct field for the type - // value = vars.get("$field." + attrField); + if (attrField != null) //load the value from the correct field for the type + value = vars.get("$field." + attrField); if(value != null && value != "") result.string(value); diff --git a/entity/AttributeRelation_entity/entityfields/specificattribute/children/filteredattributeids_param/code.js b/entity/AttributeRelation_entity/entityfields/specificattribute/children/filteredattributeids_param/code.js new file mode 100644 index 0000000000000000000000000000000000000000..823de404382c671455ed572865742aabb9d50ee7 --- /dev/null +++ b/entity/AttributeRelation_entity/entityfields/specificattribute/children/filteredattributeids_param/code.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.exists("$param.filteredAttributeIds_param") ? vars.get("$param.filteredAttributeIds_param") : ""); \ No newline at end of file diff --git a/entity/AttributeRelation_entity/entityfields/specificattribute/children/objecttype_param/code.js b/entity/AttributeRelation_entity/entityfields/specificattribute/children/objecttype_param/code.js new file mode 100644 index 0000000000000000000000000000000000000000..987f30bf1e3214329ff1c5a07c18abca106f0a10 --- /dev/null +++ b/entity/AttributeRelation_entity/entityfields/specificattribute/children/objecttype_param/code.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.exists("$param.objectType_param") ? vars.get("$param.objectType_param") : ""); \ No newline at end of file diff --git a/entity/Attribute_entity/Attribute_entity.aod b/entity/Attribute_entity/Attribute_entity.aod index bbd6bd8fab6534ad15d19e6c59c1362197974c22..5bfa6074a61696279c275fb486a20291b69144ea 100644 --- a/entity/Attribute_entity/Attribute_entity.aod +++ b/entity/Attribute_entity/Attribute_entity.aod @@ -29,6 +29,7 @@ </entityField> <entityField> <name>AB_ATTRIBUTEID</name> + <searchable v="false" /> <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/ab_attributeid/valueProcess.js</valueProcess> </entityField> <entityField> @@ -56,6 +57,11 @@ <triggerRecalculation v="true" /> <mandatory v="false" /> </entityParameter> + <entityParameter> + <name>attrParentType_param</name> + <code>%aditoprj%/entity/Attribute_entity/entityfields/attributechildren/children/attrparenttype_param/code.js</code> + <triggerRecalculation v="true" /> + </entityParameter> </children> </entityConsumer> <entityProvider> @@ -135,6 +141,48 @@ <state>AUTO</state> <stateProcess>%aditoprj%/entity/Attribute_entity/entityfields/keyword_container/stateProcess.js</stateProcess> </entityField> + <entityParameter> + <name>attrParentType_param</name> + <expose v="true" /> + <description>PARAMETER</description> + </entityParameter> + <entityParameter> + <name>objectType_param</name> + <expose v="true" /> + <description>PARAMETER</description> + </entityParameter> + <entityProvider> + <name>SpecificAttribute</name> + <fieldType>DEPENDENCY_IN</fieldType> + <lookupIdfield>AB_ATTRIBUTEID</lookupIdfield> + <dependencies> + <entityDependency> + <name>342e8ba6-db61-411b-9f79-e9271335b00f</name> + <entityName>AttributeRelation_entity</entityName> + <fieldName>SpecificAttribute</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> + <children> + <entityParameter> + <name>objectType_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>filteredAttributeIds_param</name> + <expose v="true" /> + </entityParameter> + </children> + </entityProvider> + <entityField> + <name>FULL_ATTRIBUTE_NAME</name> + <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/full_attribute_name/valueProcess.js</valueProcess> + </entityField> + <entityParameter> + <name>filteredAttributeIds_param</name> + <expose v="true" /> + <description>PARAMETER</description> + </entityParameter> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/Attribute_entity/entityfields/attribute_name/displayValueProcess.js b/entity/Attribute_entity/entityfields/attribute_name/displayValueProcess.js index bb5f44d124ef66e4da13d4e661679b6e1b003a11..e55588aa4fb9dea4ee26b065951ab47b1ad43256 100644 --- a/entity/Attribute_entity/entityfields/attribute_name/displayValueProcess.js +++ b/entity/Attribute_entity/entityfields/attribute_name/displayValueProcess.js @@ -1,5 +1,4 @@ import("system.vars"); import("system.result"); -import("Attribute_lib"); -result.string(AttributeUtil.getFullAttributeName(vars.get("$field.AB_ATTRIBUTEID"))); +result.string(vars.get("$field.FULL_ATTRIBUTE_NAME")); \ No newline at end of file diff --git a/entity/Attribute_entity/entityfields/attributechildren/children/attrparentid_param/code.js b/entity/Attribute_entity/entityfields/attributechildren/children/attrparentid_param/code.js index b63cf032dd51caa4b6896e89b5bdaafcf4d01a07..b0b8a8a60f836bf10861191025d415dcd27122b8 100644 --- a/entity/Attribute_entity/entityfields/attributechildren/children/attrparentid_param/code.js +++ b/entity/Attribute_entity/entityfields/attributechildren/children/attrparentid_param/code.js @@ -1,9 +1,4 @@ import("system.vars"); import("system.result"); -import("Attribute_lib"); -var type = vars.getString("$field.ATTRIBUTE_TYPE").trim(); -if (type == $AttributeTypes.GROUP || type == $AttributeTypes.COMBO) - result.string(vars.getString("$field.AB_ATTRIBUTEID")); -else - result.string(""); +result.string(vars.getString("$field.AB_ATTRIBUTEID")); \ No newline at end of file diff --git a/entity/Attribute_entity/entityfields/attributechildren/children/attrparenttype_param/code.js b/entity/Attribute_entity/entityfields/attributechildren/children/attrparenttype_param/code.js new file mode 100644 index 0000000000000000000000000000000000000000..cbb5a62f5fedf49496fd6787ba7671c936bc24c0 --- /dev/null +++ b/entity/Attribute_entity/entityfields/attributechildren/children/attrparenttype_param/code.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.getString("$field.ATTRIBUTE_TYPE").trim()); \ No newline at end of file diff --git a/entity/Attribute_entity/entityfields/full_attribute_name/valueProcess.js b/entity/Attribute_entity/entityfields/full_attribute_name/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..bb5f44d124ef66e4da13d4e661679b6e1b003a11 --- /dev/null +++ b/entity/Attribute_entity/entityfields/full_attribute_name/valueProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("system.result"); +import("Attribute_lib"); + +result.string(AttributeUtil.getFullAttributeName(vars.get("$field.AB_ATTRIBUTEID"))); diff --git a/entity/Attribute_entity/recordcontainers/db/conditionProcess.js b/entity/Attribute_entity/recordcontainers/db/conditionProcess.js index 909e2e15bb63eabf093a4a524105bfe5d32955d5..3ed5587eb64e97091d33e3297dc1eb785b7d0c6a 100644 --- a/entity/Attribute_entity/recordcontainers/db/conditionProcess.js +++ b/entity/Attribute_entity/recordcontainers/db/conditionProcess.js @@ -4,11 +4,37 @@ import("system.result"); import("Sql_lib"); import("Attribute_lib"); -var condition = "AB_ATTRIBUTE.ATTRIBUTE_TYPE = '" + $AttributeTypes.GROUP + "'"; +var condition = "1 = 2"; -if (vars.exists("$param.attrParentId_param") && vars.get("$param.attrParentId_param")) - condition = "AB_ATTRIBUTE.AB_ATTRIBUTEID in ('" + AttributeUtil.getAllChildren(vars.getString("$param.attrParentId_param")).join("','") + "')"; -else if (vars.exists("$param.attrParentId_param") && vars.get("$param.attrParentId_param") !== "") - condition = ""; +var objectType = vars.exists("$param.objectType_param") && vars.get("$param.objectType_param"); +if (objectType) //if there's an objectType, it comes from the AttributeRelation entity +{ + var filteredAttributes = []; + if (vars.exists("$param.filteredAttributeIds_param") && vars.get("$param.filteredAttributeIds_param")) + filteredAttributes = JSON.parse(vars.get("$param.filteredAttributeIds_param")); + + var ids = AttributeUtil.getPossibleAttributes(objectType, false, filteredAttributes); + condition = "AB_ATTRIBUTE.AB_ATTRIBUTEID in ('" + ids.join("','") + "')"; +} +else +{ + var type = vars.exists("$param.attrParentType_param") && vars.get("$param.attrParentType_param"); + if (type != $AttributeTypes.COMBOVALUE) + condition = SqlCondition.begin() + .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.GROUP) + .build(); + + if (type == $AttributeTypes.COMBO) + condition = SqlCondition.begin() + .andPrepareVars("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID", "$param.attrParentId_param") + .build(); + + var parentId = vars.exists("$param.attrParentId_param") && vars.get("$param.attrParentId_param"); + if (parentId) + condition = "AB_ATTRIBUTE.AB_ATTRIBUTEID in ('" + AttributeUtil.getAllChildren(vars.getString("$param.attrParentId_param")).join("','") + "')"; + else if (!type) + condition = ""; + +} result.string(condition); diff --git a/entity/Attribute_entity/titleProcess.js b/entity/Attribute_entity/titleProcess.js index bbb15f2a7f35c157449854b9c7fbeecd7550756d..e55588aa4fb9dea4ee26b065951ab47b1ad43256 100644 --- a/entity/Attribute_entity/titleProcess.js +++ b/entity/Attribute_entity/titleProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("system.result"); -result.string(vars.get("$field.ATTRIBUTE_NAME")); \ No newline at end of file +result.string(vars.get("$field.FULL_ATTRIBUTE_NAME")); \ No newline at end of file diff --git a/entity/Document_entity/Document_entity.aod b/entity/Document_entity/Document_entity.aod index a2760d94b9e9fa63f40d7530dc57c8ca2fc7a793..cefdd4bdbb06f909dbcb10356eac9669ace50d3c 100644 --- a/entity/Document_entity/Document_entity.aod +++ b/entity/Document_entity/Document_entity.aod @@ -39,7 +39,7 @@ <name>DATE_EDIT</name> <title>Datum</title> <contentType>DATE</contentType> - <outputFormat>yyyy-MM-dd HH:mm:ss</outputFormat> + <resolution>MINUTE</resolution> <state>READONLY</state> </entityField> <entityField> diff --git a/neonContext/Attribute/Attribute.aod b/neonContext/Attribute/Attribute.aod index 3504918a02b55108b0a0b0d7985b65676c4551c4..490a8f162c38c09ff9745b63ddff2f9f3edb30d2 100644 --- a/neonContext/Attribute/Attribute.aod +++ b/neonContext/Attribute/Attribute.aod @@ -8,7 +8,6 @@ <filterview>AttributeFilter_view</filterview> <editview>AttributeEdit_view</editview> <preview>AttributePreview_view</preview> - <lookupview>AttributeFilter_view</lookupview> <entity>Attribute_entity</entity> <references> <neonViewReference> diff --git a/neonDashboard/Home/Home.aod b/neonDashboard/Home/Home.aod index c5f89ec119a76d74b445df7c34bf1b1c17df2951..beae892d0e6a0845711ed569185bca3d4a276061 100644 --- a/neonDashboard/Home/Home.aod +++ b/neonDashboard/Home/Home.aod @@ -3,6 +3,7 @@ <name>Home</name> <title>My Dashboard</title> <majorModelMode>DISTRIBUTED</majorModelMode> + <icon>VAADIN:HOME</icon> <dashboardType>PRIVATE</dashboardType> <editRoles /> <defaultDashlets> diff --git a/neonDashboard/Vertriebsdashboard/Vertriebsdashboard.aod b/neonDashboard/Vertriebsdashboard/Vertriebsdashboard.aod index b401b585bd726d843dad69d6482bebf8551eb5a7..2b42818bb7d9df37fcd3656865c3a41450027e7f 100644 --- a/neonDashboard/Vertriebsdashboard/Vertriebsdashboard.aod +++ b/neonDashboard/Vertriebsdashboard/Vertriebsdashboard.aod @@ -3,7 +3,7 @@ <name>Vertriebsdashboard</name> <title>Salesdashboard</title> <majorModelMode>DISTRIBUTED</majorModelMode> - <icon>NEON:LOGO_A</icon> + <icon>VAADIN:CHART_GRID</icon> <dashboardType>PUBLIC</dashboardType> <editRoles> <element>INTERNAL_ADMINISTRATOR</element> diff --git a/process/Attribute_lib/process.js b/process/Attribute_lib/process.js index 7ff090a79cafe4ed5d21437329e794273a08f823..010f064aef2e1a8bfc867c756aae7b2065b5b58a 100644 --- a/process/Attribute_lib/process.js +++ b/process/Attribute_lib/process.js @@ -1,4 +1,3 @@ -import("system.logging"); import("system.translate"); import("system.neon"); import("system.vars"); @@ -15,14 +14,14 @@ import("Sql_lib"); function AttributeUtil () {} /** - * Gives a list of all available attributes for a context. This is used in the possibleItems + * Gives an array of all available attributes for a context. This is used in the possibleItems * process for the attribute id in AttributeRelation * * @param {String} pObjectType the object type (= context) * @param {boolean} [pIncludeGroups=false] * @param {String[]} [pFilteredAttributeIds=[]] Whitleist of attribute ids * - * @return {String[][]} two-dimensional array of attributeIds and names + * @return {String[]} array of attributeIds */ AttributeUtil.getPossibleAttributes = function (pObjectType, pIncludeGroups, pFilteredAttributeIds) { @@ -51,10 +50,8 @@ AttributeUtil.getPossibleAttributes = function (pObjectType, pIncludeGroups, pFi if (!pIncludeGroups) attrCond.and("ATTRIBUTE_TYPE != '" + $AttributeTypes.GROUP + "'"); - var attributes = db.array(db.COLUMN, attrCond.buildSql(attrSql)).map(function (id) - { - return [id, AttributeUtil.getFullAttributeName(id)]; - }); + var attributes = db.array(db.COLUMN, attrCond.buildSql(attrSql)); + return attributes; }