diff --git a/entity/Activity_entity/Activity_entity.aod b/entity/Activity_entity/Activity_entity.aod index d36eaed13bcc242571e4dc90f7ee9f9cf93d7921..dd35a551d18fc065b89f00b1220978c4719507b1 100644 --- a/entity/Activity_entity/Activity_entity.aod +++ b/entity/Activity_entity/Activity_entity.aod @@ -627,6 +627,14 @@ <stateProcess>%aditoprj%/entity/Activity_entity/entityfields/filteractions/children/observe/stateProcess.js</stateProcess> <titleProcess>%aditoprj%/entity/Activity_entity/entityfields/filteractions/children/observe/titleProcess.js</titleProcess> </entityActionField> + <entityActionField> + <name>addAttributeToSelection</name> + <title>Set attribute (use filter result)</title> + <onActionProcess>%aditoprj%/entity/Activity_entity/entityfields/filteractions/children/addattributetoselection/onActionProcess.js</onActionProcess> + <isObjectAction v="false" /> + <iconId>VAADIN:TAGS</iconId> + <titleProcess>%aditoprj%/entity/Activity_entity/entityfields/filteractions/children/addattributetoselection/titleProcess.js</titleProcess> + </entityActionField> </children> </entityActionGroup> <entityActionField> diff --git a/entity/Activity_entity/entityfields/filteractions/children/addattributetoselection/onActionProcess.js b/entity/Activity_entity/entityfields/filteractions/children/addattributetoselection/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7f18e32eb51f3d1d6e33f1f00f8b8526adb4710e --- /dev/null +++ b/entity/Activity_entity/entityfields/filteractions/children/addattributetoselection/onActionProcess.js @@ -0,0 +1,26 @@ +import("system.translate"); +import("system.neon"); +import("Context_lib"); +import("FilterViewAction_lib"); +import("system.vars"); + +var ids; +var currentContext = ContextUtils.getCurrentContextId(); + +if (vars.get("$sys.selection").length > 0) +{ + ids = vars.get("$sys.selection"); +} +else +{ + ids = FilterViewActionUtils.getUidsByEntityFilter(currentContext, vars.get("$sys.filter")); +} + +var params = { + "DataUIDs_param": JSON.stringify(ids), + "ContextId_param": currentContext, + "Datalength_param": ids.length, + "ContextTitlePlural_param": translate.text("Activities") +} + +neon.openContext("AddAttributesToSelection", "AddAttributesToSelectionEdit_view", null, neon.OPERATINGSTATE_NEW, params, null); \ No newline at end of file diff --git a/entity/Activity_entity/entityfields/filteractions/children/addattributetoselection/titleProcess.js b/entity/Activity_entity/entityfields/filteractions/children/addattributetoselection/titleProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..f5b266e73f872e682e54a918083f14883f9dc415 --- /dev/null +++ b/entity/Activity_entity/entityfields/filteractions/children/addattributetoselection/titleProcess.js @@ -0,0 +1,8 @@ +import("system.translate"); +import("system.result"); +import("system.vars"); + +if (vars.get("$sys.selection").length > 0) +{ + result.string(translate.text("set attribute (selected data)")) +} \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/AddAttributesToSelectionMulti_entity.aod b/entity/AddAttributesToSelectionMulti_entity/AddAttributesToSelectionMulti_entity.aod new file mode 100644 index 0000000000000000000000000000000000000000..e8e6ffe6774f873312dce1e0ed7da96b6c8db015 --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/AddAttributesToSelectionMulti_entity.aod @@ -0,0 +1,119 @@ +<?xml version="1.0" encoding="UTF-8"?> +<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.21" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.21"> + <name>AddAttributesToSelectionMulti_entity</name> + <title>Add Attributes </title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <documentation>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/documentation.adoc</documentation> + <recordContainer>jDito</recordContainer> + <entityFields> + <entityProvider> + <name>#PROVIDER</name> + </entityProvider> + <entityProvider> + <name>#PROVIDER_AGGREGATES</name> + <useAggregates v="true" /> + </entityProvider> + <entityConsumer> + <name>SpecificAttributes</name> + <dependency> + <name>dependency</name> + <entityName>Attribute_entity</entityName> + <fieldName>SpecificAttribute</fieldName> + </dependency> + <children> + <entityParameter> + <name>ObjectType_param</name> + <valueProcess>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/entityfields/specificattributes/children/objecttype_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityField> + <name>AB_ATTRIBUTE_ID</name> + <title>Attribute</title> + <consumer>SpecificAttributes</consumer> + <state>EDITABLE</state> + <displayValueProcess>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/entityfields/ab_attribute_id/displayValueProcess.js</displayValueProcess> + <onValueChange>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/entityfields/ab_attribute_id/onValueChange.js</onValueChange> + <onValueChangeTypes> + <element>MASK</element> + </onValueChangeTypes> + <onValidation>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/entityfields/ab_attribute_id/onValidation.js</onValidation> + </entityField> + <entityField> + <name>VALUE</name> + <title>Value</title> + <contentTypeProcess>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/entityfields/value/contentTypeProcess.js</contentTypeProcess> + <mandatory v="true" /> + <mandatoryProcess>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/entityfields/value/mandatoryProcess.js</mandatoryProcess> + <dropDownProcess>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/entityfields/value/dropDownProcess.js</dropDownProcess> + <state>EDITABLE</state> + <stateProcess>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/entityfields/value/stateProcess.js</stateProcess> + <valueProcess>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/entityfields/value/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/entityfields/value/displayValueProcess.js</displayValueProcess> + <onValidation>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/entityfields/value/onValidation.js</onValidation> + </entityField> + <entityField> + <name>VALUE_LOOKUP</name> + <title>Value</title> + <consumer>Objects</consumer> + <contentTypeProcess>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/entityfields/value_lookup/contentTypeProcess.js</contentTypeProcess> + <state>EDITABLE</state> + <stateProcess>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/entityfields/value_lookup/stateProcess.js</stateProcess> + <displayValueProcess>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/entityfields/value_lookup/displayValueProcess.js</displayValueProcess> + <onValidation>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/entityfields/value_lookup/onValidation.js</onValidation> + </entityField> + <entityField> + <name>UID</name> + </entityField> + <entityProvider> + <name>AddAttributeToSelectionMulti</name> + </entityProvider> + <entityParameter> + <name>ContextId_param</name> + <expose v="true" /> + </entityParameter> + <entityField> + <name>DROPDOWNDEFINITION</name> + <valueProcess>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/entityfields/dropdowndefinition/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>VALIDATIONPARAMETERS</name> + <valueProcess>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/entityfields/validationparameters/valueProcess.js</valueProcess> + </entityField> + <entityConsumer> + <name>Objects</name> + <dependency> + <name>dependency</name> + <entityName>ObjectProxy_entity</entityName> + <fieldName>FilteredObjects</fieldName> + </dependency> + <children> + <entityParameter> + <name>Entity_param</name> + <valueProcess>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/entityfields/objects/children/entity_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>Filter_param</name> + <valueProcess>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/entityfields/objects/children/filter_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityField> + <name>DROPDOWNFILTER</name> + <valueProcess>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/entityfields/dropdownfilter/valueProcess.js</valueProcess> + </entityField> + </entityFields> + <recordContainers> + <jDitoRecordContainer> + <name>jDito</name> + <jDitoRecordAlias>Data_alias</jDitoRecordAlias> + <contentProcess>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/recordcontainers/jdito/contentProcess.js</contentProcess> + <onInsert>%aditoprj%/entity/AddAttributesToSelectionMulti_entity/recordcontainers/jdito/onInsert.js</onInsert> + <recordFieldMappings> + <jDitoRecordFieldMapping> + <name>UID.value</name> + </jDitoRecordFieldMapping> + </recordFieldMappings> + </jDitoRecordContainer> + </recordContainers> +</entity> diff --git a/entity/AddAttributesToSelectionMulti_entity/documentation.adoc b/entity/AddAttributesToSelectionMulti_entity/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..0668168bc35b66d626f7d27c23079f1117c0a243 --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/documentation.adoc @@ -0,0 +1,3 @@ += AddAttributesToSelectionMulti_entity + +this entity is for the MultiEdit in the small editview when the action "addAttributeToSelection" is run, e. g. in the Organisation_entity \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/entityfields/ab_attribute_id/displayValueProcess.js b/entity/AddAttributesToSelectionMulti_entity/entityfields/ab_attribute_id/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..5799483f236c39e242f04b9108477d2e007c8815 --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_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"), false)); diff --git a/entity/AddAttributesToSelectionMulti_entity/entityfields/ab_attribute_id/onValidation.js b/entity/AddAttributesToSelectionMulti_entity/entityfields/ab_attribute_id/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..631f60c6856de3d7275ae173252d9ccbd005025e --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/entityfields/ab_attribute_id/onValidation.js @@ -0,0 +1,10 @@ +import("system.translate"); +import("Attribute_lib"); +import("system.result"); +import("system.vars"); + +var attributeId = vars.get("$field.AB_ATTRIBUTE_ID"); +if (AttributeUtil.getAttributeType(attributeId) == AttributeTypes.GROUP()) +{ + result.string(translate.text("Attribute groups can't be selected")); +} \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/entityfields/ab_attribute_id/onValueChange.js b/entity/AddAttributesToSelectionMulti_entity/entityfields/ab_attribute_id/onValueChange.js new file mode 100644 index 0000000000000000000000000000000000000000..8dbda5e2706f46ff0cb0e708726967f425660d98 --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/entityfields/ab_attribute_id/onValueChange.js @@ -0,0 +1,8 @@ +import("system.vars"); +import("system.neon"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT || + vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +{ + neon.setFieldValue("$field.VALUE", ""); +} \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/entityfields/dropdowndefinition/valueProcess.js b/entity/AddAttributesToSelectionMulti_entity/entityfields/dropdowndefinition/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..90791f083a5f0ed3c402568f287d9fd6b4ddbc0f --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/entityfields/dropdowndefinition/valueProcess.js @@ -0,0 +1,9 @@ +import("Sql_lib"); +import("system.result"); + +var definition = newSelect("DROPDOWNDEFINITION") + .from("AB_ATTRIBUTE") + .where("AB_ATTRIBUTE.AB_ATTRIBUTEID", "$field.AB_ATTRIBUTE_ID") + .cell(); + +result.string(definition); \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/entityfields/dropdownfilter/valueProcess.js b/entity/AddAttributesToSelectionMulti_entity/entityfields/dropdownfilter/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9b3220d760394173115bcad8054fa40f013d7f4e --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/entityfields/dropdownfilter/valueProcess.js @@ -0,0 +1,7 @@ +import("system.result"); +import("Sql_lib"); + +result.string(newSelect("DROPDOWNFILTER") + .from("AB_ATTRIBUTE") + .where("AB_ATTRIBUTE.AB_ATTRIBUTEID", "$field.AB_ATTRIBUTE_ID") + .cell()); \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/entityfields/objects/children/entity_param/valueProcess.js b/entity/AddAttributesToSelectionMulti_entity/entityfields/objects/children/entity_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9a66beb565183ad3e211bdfbd7ad879fe15a96e7 --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/entityfields/objects/children/entity_param/valueProcess.js @@ -0,0 +1,13 @@ +import("Attribute_lib"); +import("system.vars"); +import("system.result"); + +var attrType = AttributeTypes.get(AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID"))); +if (AttributeTypeUtil.useLookup(attrType)) +{ + result.string(vars.get("$field.DROPDOWNDEFINITION")); +} +else +{ + result.string(""); +} \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/entityfields/objects/children/filter_param/valueProcess.js b/entity/AddAttributesToSelectionMulti_entity/entityfields/objects/children/filter_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e43c27b88457b28c872cd1e8287c837935387014 --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/entityfields/objects/children/filter_param/valueProcess.js @@ -0,0 +1,9 @@ +import("system.vars"); +import("system.result"); + +var filter = vars.get("$field.DROPDOWNFILTER"); +if (filter) +{ + filter = JSON.parse(filter); + result.string(JSON.stringify(filter.filter)); +} \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/entityfields/specificattributes/children/objecttype_param/valueProcess.js b/entity/AddAttributesToSelectionMulti_entity/entityfields/specificattributes/children/objecttype_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e1e9102c925c2244aee2aaa14e5159d2a99097d6 --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/entityfields/specificattributes/children/objecttype_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$param.ContextId_param")); \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/entityfields/validationparameters/valueProcess.js b/entity/AddAttributesToSelectionMulti_entity/entityfields/validationparameters/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..cbe6395dcd16ab1a50d4dfb04fb7f17ddeec8594 --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/entityfields/validationparameters/valueProcess.js @@ -0,0 +1,9 @@ +import("system.result"); +import("Sql_lib"); + +var validationparameters = newSelect("VALIDATIONPARAMETERS") +.from("AB_ATTRIBUTE") +.where("AB_ATTRIBUTE.AB_ATTRIBUTEID", "$field.AB_ATTRIBUTE_ID") +.cell(); + +result.string(validationparameters); \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/entityfields/value/contentTypeProcess.js b/entity/AddAttributesToSelectionMulti_entity/entityfields/value/contentTypeProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..55d32c91b7003e4a973558a6460268ef5b6d962b --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/entityfields/value/contentTypeProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("system.result"); +import("Attribute_lib"); + +var attributeType = AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID")); +result.string(AttributeTypeUtil.getContentType(attributeType)); \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/entityfields/value/displayValueProcess.js b/entity/AddAttributesToSelectionMulti_entity/entityfields/value/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..6b25a939f7fa92ce4436432ef360e944bce781b3 --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/entityfields/value/displayValueProcess.js @@ -0,0 +1,14 @@ +import("system.translate"); +import("system.result"); +import("system.vars"); +import("Attribute_lib"); + +var attrType = AttributeTypes.get(AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID"))); +var viewValue = AttributeTypeUtil.getAttributeViewValue(attrType, vars.get("$field.VALUE"), vars.get("$field.DROPDOWNDEFINITION")); + +if (viewValue == null) +{ + viewValue = translate.text("Object not found"); +} + +result.string(viewValue); \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/entityfields/value/dropDownProcess.js b/entity/AddAttributesToSelectionMulti_entity/entityfields/value/dropDownProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..3d42d5351068fa6d01962523f67d796825cbd117 --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/entityfields/value/dropDownProcess.js @@ -0,0 +1,17 @@ +import("Context_lib"); +import("system.translate"); +import("system.db"); +import("system.result"); +import("system.vars"); +import("Attribute_lib"); +import("Sql_lib"); + +var attributeId = vars.get("$field.AB_ATTRIBUTE_ID"); +var attrType = AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID")); + +var res = null; +if (!AttributeTypeUtil.useLookup(attrType)) +{ + res = AttributeUtil.getPossibleListValues(attributeId, attrType); +} +result.object(res); \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/entityfields/value/mandatoryProcess.js b/entity/AddAttributesToSelectionMulti_entity/entityfields/value/mandatoryProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c1e4a1066426d45906e795751aec0b3f5f67b90d --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/entityfields/value/mandatoryProcess.js @@ -0,0 +1,7 @@ +import("system.vars"); +import("system.result"); +import("Attribute_lib"); + +var attributeType = AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID")); +var contentType = AttributeTypeUtil.getContentType(attributeType); +result.string(!AttributeTypeUtil.useLookup(attributeType) && contentType != null && contentType != "BOOLEAN"); \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/entityfields/value/onValidation.js b/entity/AddAttributesToSelectionMulti_entity/entityfields/value/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..abdfea0858b29cde0e2f1652fe7dc8af54f45760 --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/entityfields/value/onValidation.js @@ -0,0 +1,14 @@ +import("Util_lib"); +import("system.result"); +import("system.vars"); +import("Attribute_lib"); + +var attributeType = AttributeTypes.get(AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID"))); +if (attributeType && !attributeType.useLookup) +{ + var validationResult = attributeType.validateValue(vars.get("$local.value"), Utils.parseJSON(vars.get("$field.VALIDATIONPARAMETERS"))); + if (validationResult && validationResult !== true) + { + result.string(validationResult); + } +} \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/entityfields/value/stateProcess.js b/entity/AddAttributesToSelectionMulti_entity/entityfields/value/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..8d66a122ca92f72bae08ff4a3ea3730c373f96c3 --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/entityfields/value/stateProcess.js @@ -0,0 +1,22 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); +import("Attribute_lib"); + +var attributeType = AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID")); + +var fieldState; +if (AttributeTypeUtil.useLookup(attributeType) && vars.get("$sys.recordstate") != neon.OPERATINGSTATE_VIEW) +{ + fieldState = neon.COMPONENTSTATE_INVISIBLE; +} +else if(AttributeTypeUtil.getContentType(attributeType) != null) +{ + fieldState = neon.COMPONENTSTATE_EDITABLE; +} +else +{ + fieldState = neon.COMPONENTSTATE_READONLY; +} + +result.string(fieldState); \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/entityfields/value/valueProcess.js b/entity/AddAttributesToSelectionMulti_entity/entityfields/value/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..07b7cb49dbfbf048ccdb8c4aad5ffb4ac5e85dbd --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/entityfields/value/valueProcess.js @@ -0,0 +1,14 @@ +import("Attribute_lib"); +import("system.vars"); +import("system.result"); + +var attributeType = AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID")); +var contentType = AttributeTypeUtil.getContentType(attributeType); +if (vars.get("$this.value") == null && contentType == "BOOLEAN") +{ + result.string("0"); +} +else if (!contentType) +{ + result.string(""); +} diff --git a/entity/AddAttributesToSelectionMulti_entity/entityfields/value_lookup/contentTypeProcess.js b/entity/AddAttributesToSelectionMulti_entity/entityfields/value_lookup/contentTypeProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..362932db9590d908f5ba4ce74b1647c41e2415cd --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/entityfields/value_lookup/contentTypeProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("system.result"); +import("Attribute_lib"); + +var attributeType = AttributeTypes.get(AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID"))); +result.string(AttributeTypeUtil.getContentType(attributeType)); \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/entityfields/value_lookup/displayValueProcess.js b/entity/AddAttributesToSelectionMulti_entity/entityfields/value_lookup/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..b62c875e2c53bf54dcd2180e8803cd8033f0dd5d --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/entityfields/value_lookup/displayValueProcess.js @@ -0,0 +1,13 @@ +import("system.translate"); +import("system.result"); +import("system.vars"); +import("Attribute_lib"); + +var attrType = AttributeTypes.get(AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID"))); +var viewValue = AttributeTypeUtil.getAttributeViewValue(attrType, vars.get("$field.VALUE_LOOKUP"), vars.get("$field.DROPDOWNDEFINITION")); + +if (viewValue == null) { + viewValue = translate.text("Object not found"); +} + +result.string(viewValue); \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/entityfields/value_lookup/onValidation.js b/entity/AddAttributesToSelectionMulti_entity/entityfields/value_lookup/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..4af31289545a4781425933f5475da688e5f9a8bf --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/entityfields/value_lookup/onValidation.js @@ -0,0 +1,15 @@ +import("system.result"); +import("Util_lib"); +import("system.vars"); +import("Attribute_lib"); +import("Sql_lib"); + +var attributeType = AttributeTypes.get(AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID"))); +if (attributeType && attributeType.useLookup) +{ + var validationResult = attributeType.validateValue(vars.get("$local.value"), Utils.parseJSON(vars.get("$field.VALIDATIONPARAMETERS"))); + if (validationResult && validationResult !== true) + { + result.string(validationResult); + } +} \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/entityfields/value_lookup/stateProcess.js b/entity/AddAttributesToSelectionMulti_entity/entityfields/value_lookup/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d9c85e6816a83f56eb98f9e5c96c26bf41a5a8a5 --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/entityfields/value_lookup/stateProcess.js @@ -0,0 +1,17 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); +import("Attribute_lib"); + +var fieldState; +if ((vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) + && AttributeTypeUtil.useLookup(AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID")))) +{ + fieldState = neon.COMPONENTSTATE_EDITABLE; +} +else +{ + fieldState = neon.COMPONENTSTATE_INVISIBLE; +} + +result.string(fieldState); \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/recordcontainers/jdito/contentProcess.js b/entity/AddAttributesToSelectionMulti_entity/recordcontainers/jdito/contentProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..fe136ec30bdf4885bfb0c7160cdde9abccb011de --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/recordcontainers/jdito/contentProcess.js @@ -0,0 +1,7 @@ +import("system.result"); +import("system.vars"); + +if(vars.get("$local.idvalues")) +{ +result.object([vars.get("$local.idvalues")]); +} \ No newline at end of file diff --git a/entity/AddAttributesToSelectionMulti_entity/recordcontainers/jdito/onInsert.js b/entity/AddAttributesToSelectionMulti_entity/recordcontainers/jdito/onInsert.js new file mode 100644 index 0000000000000000000000000000000000000000..23c6a232066cf953ee98a5a8e9b3a00bc3d93f37 --- /dev/null +++ b/entity/AddAttributesToSelectionMulti_entity/recordcontainers/jdito/onInsert.js @@ -0,0 +1,2 @@ +""; +//dont delete this!! for the multi edit to be editable something has to be in the onInsert process. \ No newline at end of file diff --git a/entity/AddAttributesToSelection_entity/AddAttributesToSelection_entity.aod b/entity/AddAttributesToSelection_entity/AddAttributesToSelection_entity.aod new file mode 100644 index 0000000000000000000000000000000000000000..bc1965b57d3e81af135638d5896db1962a78dfc9 --- /dev/null +++ b/entity/AddAttributesToSelection_entity/AddAttributesToSelection_entity.aod @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.21" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.21"> + <name>AddAttributesToSelection_entity</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <documentation>%aditoprj%/entity/AddAttributesToSelection_entity/documentation.adoc</documentation> + <recordContainer>jDito</recordContainer> + <entityFields> + <entityProvider> + <name>#PROVIDER</name> + </entityProvider> + <entityProvider> + <name>#PROVIDER_AGGREGATES</name> + <useAggregates v="true" /> + </entityProvider> + <entityField> + <name>UID</name> + </entityField> + <entityField> + <name>affectedData</name> + <state>DISABLED</state> + <displayValueProcess>%aditoprj%/entity/AddAttributesToSelection_entity/entityfields/affecteddata/displayValueProcess.js</displayValueProcess> + </entityField> + <entityParameter> + <name>ContextId_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>DataUIDs_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>Datalength_param</name> + <expose v="true" /> + </entityParameter> + <entityConsumer> + <name>AddAttributeToSelectionMultiEdit</name> + <onValidation>%aditoprj%/entity/AddAttributesToSelection_entity/entityfields/addattributetoselectionmultiedit/onValidation.js</onValidation> + <dependency> + <name>dependency</name> + <entityName>AddAttributesToSelectionMulti_entity</entityName> + <fieldName>AddAttributeToSelectionMulti</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContextId_param</name> + <valueProcess>%aditoprj%/entity/AddAttributesToSelection_entity/entityfields/addattributetoselectionmultiedit/children/contextid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityParameter> + <name>ContextTitlePlural_param</name> + <expose v="true" /> + </entityParameter> + </entityFields> + <recordContainers> + <jDitoRecordContainer> + <name>jDito</name> + <jDitoRecordAlias>Data_alias</jDitoRecordAlias> + <contentProcess>%aditoprj%/entity/AddAttributesToSelection_entity/recordcontainers/jdito/contentProcess.js</contentProcess> + <onInsert>%aditoprj%/entity/AddAttributesToSelection_entity/recordcontainers/jdito/onInsert.js</onInsert> + <recordFieldMappings> + <jDitoRecordFieldMapping> + <name>UID.value</name> + </jDitoRecordFieldMapping> + </recordFieldMappings> + </jDitoRecordContainer> + </recordContainers> +</entity> diff --git a/entity/AddAttributesToSelection_entity/documentation.adoc b/entity/AddAttributesToSelection_entity/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..b5632466e83b8641169856dafb9262cb24b7deb5 --- /dev/null +++ b/entity/AddAttributesToSelection_entity/documentation.adoc @@ -0,0 +1,3 @@ += AddAttributesToSelection_entity + +this entity is for the small editview when the action "addAttributeToSelection" is run, e. g. in the Organisation_entity \ No newline at end of file diff --git a/entity/AddAttributesToSelection_entity/entityfields/addattributetoselectionmultiedit/children/contextid_param/valueProcess.js b/entity/AddAttributesToSelection_entity/entityfields/addattributetoselectionmultiedit/children/contextid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e1e9102c925c2244aee2aaa14e5159d2a99097d6 --- /dev/null +++ b/entity/AddAttributesToSelection_entity/entityfields/addattributetoselectionmultiedit/children/contextid_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$param.ContextId_param")); \ No newline at end of file diff --git a/entity/AddAttributesToSelection_entity/entityfields/addattributetoselectionmultiedit/onValidation.js b/entity/AddAttributesToSelection_entity/entityfields/addattributetoselectionmultiedit/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..0d5beb0739f7070cfe8ee0048d104d5deab00a8c --- /dev/null +++ b/entity/AddAttributesToSelection_entity/entityfields/addattributetoselectionmultiedit/onValidation.js @@ -0,0 +1,75 @@ +import("system.translate"); +import("Sql_lib"); +import("system.neon"); +import("Context_lib"); +import("system.vars"); +import("Attribute_lib"); +import("system.result"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +{ + var data = JSON.parse(vars.get("$param.DataUIDs_param")); + var dataCount = vars.get("$param.Datalength_param"); + var resAttrCount = ""; + var resDoubleAttr = ""; + var resCount = 0; + var afterOnInsert = vars.exists("$context.afterOnInsert") ? vars.get("$context.afterOnInsert") : false; + var insertedRows = vars.get("$field.AddAttributeToSelectionMultiEdit.insertedRows"); + var valueArr = []; + var res = ""; + var doubleAttrs = []; + + data.forEach(function (singleData) + { + resAttrCount = AttributeRelationUtils.validateAttributeCount(singleData, vars.get("$param.ContextId_param"), "AddAttributeToSelectionMultiEdit") + "\n"; + + if (resAttrCount != "" && !resAttrCount.includes("1")) + { + resCount++; + } + }); + + if (resCount == dataCount && afterOnInsert != true) + { + res += resAttrCount; + } + + if (insertedRows["AB_ATTRIBUTE_ID"] != "") + { + insertedRows.forEach(function(attribute){ + let attr = newSelect([ + "AB_ATTRIBUTE.ATTRIBUTE_TYPE", + "AB_ATTRIBUTE.ATTRIBUTE_NAME" + ]) + .from("AB_ATTRIBUTE") + .join("AB_ATTRIBUTEUSAGE", "AB_ATTRIBUTE.AB_ATTRIBUTEID = AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID") + .where("AB_ATTRIBUTE.AB_ATTRIBUTEID", attribute["AB_ATTRIBUTE_ID"]) + .arrayRow(); + let attributeType = attr[0]; + + let value = AttributeTypeUtil.useLookup(attributeType) ? attribute["VALUE_LOOKUP"] : attribute["VALUE"]; + if (value != "") + { + if (valueArr.includes(value)) + { + doubleAttrs.push(translate.text(attr[1])); + } + else + { + valueArr.push(value); + } + } + }); + } + if (doubleAttrs.length > 0) + { + resDoubleAttr = translate.withArguments("Attribute \"%0\" can only be inserted once with the same value.", [doubleAttrs.join("\", \"")]) + "\n"; + res += resDoubleAttr; + } + + if (res != "") + { + result.string(res); + } + +} \ No newline at end of file diff --git a/entity/AddAttributesToSelection_entity/entityfields/affecteddata/displayValueProcess.js b/entity/AddAttributesToSelection_entity/entityfields/affecteddata/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..07e52aa6c0d1850bd5ae108e6db373166807a3de --- /dev/null +++ b/entity/AddAttributesToSelection_entity/entityfields/affecteddata/displayValueProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("system.translate"); +import("system.result"); + +result.string(translate.text("affected rows:") + " " + parseInt(vars.get("$param.Datalength_param"), "#0")); \ No newline at end of file diff --git a/entity/AddAttributesToSelection_entity/recordcontainers/jdito/contentProcess.js b/entity/AddAttributesToSelection_entity/recordcontainers/jdito/contentProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..fe136ec30bdf4885bfb0c7160cdde9abccb011de --- /dev/null +++ b/entity/AddAttributesToSelection_entity/recordcontainers/jdito/contentProcess.js @@ -0,0 +1,7 @@ +import("system.result"); +import("system.vars"); + +if(vars.get("$local.idvalues")) +{ +result.object([vars.get("$local.idvalues")]); +} \ No newline at end of file diff --git a/entity/AddAttributesToSelection_entity/recordcontainers/jdito/onInsert.js b/entity/AddAttributesToSelection_entity/recordcontainers/jdito/onInsert.js new file mode 100644 index 0000000000000000000000000000000000000000..08cbcfb7e28ecc101a06756805575f9385fa23b4 --- /dev/null +++ b/entity/AddAttributesToSelection_entity/recordcontainers/jdito/onInsert.js @@ -0,0 +1,202 @@ +import("Context_lib"); +import("system.translate"); +import("system.question"); +import("system.util"); +import("system.db"); +import("Sql_lib"); +import("Attribute_lib"); +import("system.vars"); + +var sqlUtil = new SqlMaskingUtils(); +var attributes = vars.get("$field.AddAttributeToSelectionMultiEdit.insertedRows"); +var ids = JSON.parse(vars.get("$param.DataUIDs_param")); +var objectType = vars.get("$param.ContextId_param"); +var contextTitlePlural = vars.get("$param.ContextTitlePlural_param"); +var contextTitle = ContextUtils.getTitle(objectType, true); +var dateNew = vars.get("$sys.date"); +var userNew = vars.get("$sys.user"); +var inserts = []; +var updates = []; +var table = "AB_ATTRIBUTERELATION"; +var cols = +[ +"AB_ATTRIBUTERELATIONID", +"AB_ATTRIBUTE_ID", +"OBJECT_ROWID", +"OBJECT_TYPE", +"DATE_NEW", +"USER_NEW" +]; +var updateCols = []; +var valueField; +var cond; + +var attributeId; +var value; +var attr; +var maxCount; +var attrCount = 0; +var singleAttrCount; +var attributeType; +var insertCount = 0; +var insertCountPerAttr = 0; +var failedInsert = false; +var failedInsertArray = []; +var attrFailedReason; +var maxAttrsFailedCount = 0; +var sameAttrCount = 0; +var sameAttr = ""; +var attrTypeVoid = AttributeTypes.VOID(); +var insertCountArr = []; + +attributes.forEach(function(attribute) +{ + //set values for each attribute + attributeId = attribute["AB_ATTRIBUTE_ID"]; + maxCount = newSelect([ + sqlUtil.isNull("AB_ATTRIBUTEUSAGE.MAX_COUNT", 0) + ]) + .from("AB_ATTRIBUTE") + .join("AB_ATTRIBUTEUSAGE", "AB_ATTRIBUTE.AB_ATTRIBUTEID = AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID") + .where("AB_ATTRIBUTE.AB_ATTRIBUTEID", attributeId) + .cell(); + attributeType = AttributeTypes.get(AttributeUtil.getAttributeType(attributeId)); + + value = AttributeTypeUtil.useLookup(attributeType) ? attribute["VALUE_LOOKUP"] : attribute["VALUE"]; + valueField = AttributeTypeUtil.getDatabaseField(attributeType); + insertCountPerAttr = 0; + + ids.forEach(function (id) //go through each dataset to check if the attribute can be inserted + { + cols = cols.slice(-1) == "USER_NEW" ? cols : cols.slice(0, -1); + updateCols = []; + singleAttrCount = 0; + cond = ""; + values = []; + + singleAttrCount = newSelect("count(AB_ATTRIBUTERELATION.AB_ATTRIBUTERELATIONID)") + .from("AB_ATTRIBUTERELATION") + .where("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID", attributeId) + .and("AB_ATTRIBUTERELATION.OBJECT_ROWID", id) + .cell(); + + if (valueField && attributeType != attrTypeVoid) + { + sameAttr = newSelect("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID") + .from("AB_ATTRIBUTERELATION") + .where("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID", attributeId) + .and("AB_ATTRIBUTERELATION.OBJECT_ROWID", id) + .and("AB_ATTRIBUTERELATION." + valueField, value) + .cell(); + } + + if (maxCount == 1 && singleAttrCount == maxCount && sameAttr == "") //check if the max amount of the attribute is 1 and the count already existing is 1 as well + { + if (valueField) + { + cond = newWhere("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID", attributeId) + .and("AB_ATTRIBUTERELATION.OBJECT_ROWID", id).toString(); + updateCols.push(valueField); + values = [value]; + updates.push([table, updateCols, null, values, cond]); //push into updates array instead of inserts to update the already existing attributerelation + insertCountPerAttr++; + } + } + else if (((maxCount < 1 || maxCount == null) || singleAttrCount < maxCount) && sameAttr == "") //check if the max count is reached / exists + { + if (valueField && attributeType != attrTypeVoid) + { + cols.push(valueField); + values = [util.getNewUUID(), attributeId, id, objectType, dateNew, userNew, value]; + inserts.push([table, cols, null, values]); //push into insert array + insertCountPerAttr++; + } + else if (attributeType == attrTypeVoid) + { + values = [util.getNewUUID(), attributeId, id, objectType, dateNew, userNew]; + inserts.push([table, cols, null, values]); //push into insert array + insertCountPerAttr++; + } + } + else //the else part is for ids where the attributes cant be inserted or updated + { + //add condition of an failed insert to the if condition + if (singleAttrCount == maxCount) //checks if the max attribute count is reached + { + failedInsert = true; //sets failedInsert to true -> this has to be done for every reason + maxAttrsFailedCount++; //create a counter for every reason -> the amount of failed ids are shown in the failed insert message + attrFailedReason = "maxAttr"; //write the reason in a short form then add the string to the switch case below + } + if (sameAttr != "") + { + failedInsert = true; + sameAttrCount++; + attrFailedReason = "sameAttr"; + } + } + }); + attrCount++; + + if (insertCountPerAttr == ids.length) + { + insertCountArr.push([attributeId]); + } + + if (attrCount == attributes.length) + { + switch(attrFailedReason){ + case "maxAttr": + failedInsertArray.push([ + translate.text("the max amount of this attribute has been reached"), + AttributeUtil.getFullAttributeName(attributeId, false, true), + maxAttrsFailedCount + ]); + break; + case "sameAttr": + failedInsertArray.push([ + translate.text("this attribute with the same value exists already"), + AttributeUtil.getFullAttributeName(attributeId, false, true), + sameAttrCount + ]); + break; + //add failed insert reasons as new cases + //push into the failedInsertArray like [reason, attributeName, failedIdCount] + } + } +}); + +if (insertCountArr.length == attributes.length) +{ + insertCount = ids.length; +} + +if (inserts != "") +{ + db.inserts(inserts); +} + +if (updates != "") +{ + db.updates(updates); +} + +if (failedInsertArray.length > 0) //messages for failed inserts +{ + failedInsertArray.forEach(function(failedInsert){ + question.showMessage(translate.withArguments("The attribute \"%0\" couldn't be set for %1 %2, because %3.", [failedInsert[1], failedInsert[2], failedInsert[2] == 1 ? contextTitle : contextTitlePlural, failedInsert[0]]), question.INFORMATION, translate.text("Hint")); + }); +} + +if (insertCount > 0) //message for successful insert +{ + if (attributes.length == 1) + { + question.showMessage(translate.withArguments("The chosen attribute was successfully set for %0 %1", [insertCount, insertCount == 1 ? contextTitle : contextTitlePlural]), question.INFORMATION, translate.text("Hint")); + } + else + { + question.showMessage(translate.withArguments("The chosen attributes were successfully set for %0 %1", [insertCount, insertCount == 1 ? contextTitle : contextTitlePlural]), question.INFORMATION, translate.text("Hint")); + } +} + +vars.set("$context.afterOnInsert", true); \ No newline at end of file diff --git a/entity/AttributeRelation_entity/AttributeRelation_entity.aod b/entity/AttributeRelation_entity/AttributeRelation_entity.aod index 46767f5f58a0a82f759143a7cc2119410272ef4c..bcffd16ce9484546ea10a4ddab545537259968ff 100644 --- a/entity/AttributeRelation_entity/AttributeRelation_entity.aod +++ b/entity/AttributeRelation_entity/AttributeRelation_entity.aod @@ -48,6 +48,7 @@ <title>Attribute</title> <consumer>SpecificAttribute</consumer> <mandatory v="false" /> + <state>EDITABLE</state> <stateProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/ab_attribute_id/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/ab_attribute_id/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/ab_attribute_id/displayValueProcess.js</displayValueProcess> @@ -65,6 +66,7 @@ <mandatory v="true" /> <mandatoryProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/value/mandatoryProcess.js</mandatoryProcess> <dropDownProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/value/dropDownProcess.js</dropDownProcess> + <state>EDITABLE</state> <stateProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/value/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/value/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/value/displayValueProcess.js</displayValueProcess> @@ -173,6 +175,7 @@ <consumer>Objects</consumer> <contentTypeProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/value_lookup/contentTypeProcess.js</contentTypeProcess> <mandatoryProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/value_lookup/mandatoryProcess.js</mandatoryProcess> + <state>EDITABLE</state> <stateProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/value_lookup/stateProcess.js</stateProcess> <displayValueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/value_lookup/displayValueProcess.js</displayValueProcess> <onValidation>%aditoprj%/entity/AttributeRelation_entity/entityfields/value_lookup/onValidation.js</onValidation> diff --git a/entity/AttributeRelation_entity/entityfields/value_lookup/contentTypeProcess.js b/entity/AttributeRelation_entity/entityfields/value_lookup/contentTypeProcess.js index e67d19d3de3d5cff26269573eb67d37da0891d69..362932db9590d908f5ba4ce74b1647c41e2415cd 100644 --- a/entity/AttributeRelation_entity/entityfields/value_lookup/contentTypeProcess.js +++ b/entity/AttributeRelation_entity/entityfields/value_lookup/contentTypeProcess.js @@ -2,5 +2,5 @@ import("system.vars"); import("system.result"); import("Attribute_lib"); -var attributeType = vars.get("$field.ATTRIBUTE_TYPE"); +var attributeType = AttributeTypes.get(AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID"))); result.string(AttributeTypeUtil.getContentType(attributeType)); \ No newline at end of file diff --git a/entity/Attribute_entity/Attribute_entity.aod b/entity/Attribute_entity/Attribute_entity.aod index 4fb51c046e550c4b0ded4094d02ffcbae2188e5c..1f9f14da106252d157ece588abe609cdc9a7cc7c 100644 --- a/entity/Attribute_entity/Attribute_entity.aod +++ b/entity/Attribute_entity/Attribute_entity.aod @@ -123,6 +123,14 @@ <name>SpecificAttribute</name> <lookupIdfield>UID</lookupIdfield> <documentation>%aditoprj%/entity/Attribute_entity/entityfields/specificattribute/documentation.adoc</documentation> + <dependencies> + <entityDependency> + <name>1882f958-ffd9-4353-8f8d-ef85fe55b5d3</name> + <entityName>AddAttributesToSelectionMulti_entity</entityName> + <fieldName>SpecificAttributes</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> <children> <entityParameter> <name>ObjectType_param</name> diff --git a/entity/ObjectProxy_entity/ObjectProxy_entity.aod b/entity/ObjectProxy_entity/ObjectProxy_entity.aod index 1e633cfb90637ff024ff9356586b2a7a3a9cda52..be99ada57d9e28ebc28c8c413dcc84134dcfd2b6 100644 --- a/entity/ObjectProxy_entity/ObjectProxy_entity.aod +++ b/entity/ObjectProxy_entity/ObjectProxy_entity.aod @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.21" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.21"> +<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.18" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.18"> <name>ObjectProxy_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/ObjectProxy_entity/documentation.adoc</documentation> @@ -19,6 +19,14 @@ <name>FilteredObjects</name> <targetConsumerProcess>%aditoprj%/entity/ObjectProxy_entity/entityfields/filteredobjects/targetConsumerProcess.js</targetConsumerProcess> <documentation>%aditoprj%/entity/ObjectProxy_entity/entityfields/filteredobjects/documentation.adoc</documentation> + <dependencies> + <entityDependency> + <name>6a35801c-2e7c-4f5f-a4c2-f7fb6ddea7df</name> + <entityName>AddAttributesToSelectionMulti_entity</entityName> + <fieldName>Objects</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> </entityProvider> <entityParameter> <name>Filter_param</name> diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod index a528d24fef8d4ebc674a0f97ef1e2bb3bd8ce083..539360851e27cc97de40bf25776fc1635f9f4ebb 100644 --- a/entity/Organisation_entity/Organisation_entity.aod +++ b/entity/Organisation_entity/Organisation_entity.aod @@ -1187,6 +1187,14 @@ <selectionType>UNBOUND</selectionType> <iconId>VAADIN:MONEY</iconId> </entityActionField> + <entityActionField> + <name>addAttributeToSelection</name> + <title>Set attribute (use filter result)</title> + <onActionProcess>%aditoprj%/entity/Organisation_entity/entityfields/filterviewactiongroup/children/addattributetoselection/onActionProcess.js</onActionProcess> + <isObjectAction v="false" /> + <iconId>VAADIN:TAGS</iconId> + <titleProcess>%aditoprj%/entity/Organisation_entity/entityfields/filterviewactiongroup/children/addattributetoselection/titleProcess.js</titleProcess> + </entityActionField> </children> </entityActionGroup> <entityActionField> diff --git a/entity/Organisation_entity/entityfields/filterviewactiongroup/children/addattributetoselection/onActionProcess.js b/entity/Organisation_entity/entityfields/filterviewactiongroup/children/addattributetoselection/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..eab6cf6af945d1665311b84d3cc88f1109548c46 --- /dev/null +++ b/entity/Organisation_entity/entityfields/filterviewactiongroup/children/addattributetoselection/onActionProcess.js @@ -0,0 +1,26 @@ +import("system.translate"); +import("system.neon"); +import("Context_lib"); +import("FilterViewAction_lib"); +import("system.vars"); + +var ids; +var currentContext = ContextUtils.getCurrentContextId(); + +if (vars.get("$sys.selection").length > 0) +{ + ids = vars.get("$sys.selection"); +} +else +{ + ids = FilterViewActionUtils.getUidsByEntityFilter(currentContext, vars.get("$sys.filter")); +} + +var params = { + "DataUIDs_param": JSON.stringify(ids), + "ContextId_param": currentContext, + "Datalength_param": ids.length, + "ContextTitlePlural_param": translate.text("Companies") +} + +neon.openContext("AddAttributesToSelection", "AddAttributesToSelectionEdit_view", null, neon.OPERATINGSTATE_NEW, params, null); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/filterviewactiongroup/children/addattributetoselection/titleProcess.js b/entity/Organisation_entity/entityfields/filterviewactiongroup/children/addattributetoselection/titleProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e31afb5e6b090c7196698da50c995e4f04521387 --- /dev/null +++ b/entity/Organisation_entity/entityfields/filterviewactiongroup/children/addattributetoselection/titleProcess.js @@ -0,0 +1,8 @@ +import("system.translate"); +import("system.result"); +import("system.vars"); + +if (vars.get("$sys.selection").length > 0) +{ + result.string(translate.text("set attribute (selected data)")); +} \ No newline at end of file diff --git a/entity/Person_entity/Person_entity.aod b/entity/Person_entity/Person_entity.aod index baffc3d882433ac2f6eaff09dcceaa9e39280ea9..d4b5f5d1b7cf9e33fb4e66ee979e718361133801 100644 --- a/entity/Person_entity/Person_entity.aod +++ b/entity/Person_entity/Person_entity.aod @@ -1144,6 +1144,14 @@ <iconId>NEON:RECURRING_APPOINTMENT_MOVED</iconId> <state>AUTO</state> </entityActionField> + <entityActionField> + <name>addAttributeToSelection</name> + <title>Set attribute (use filter result)</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/addattributetoselection/onActionProcess.js</onActionProcess> + <isObjectAction v="false" /> + <iconId>VAADIN:TAGS</iconId> + <titleProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/addattributetoselection/titleProcess.js</titleProcess> + </entityActionField> </children> </entityActionGroup> <entityActionField> diff --git a/entity/Person_entity/entityfields/filterviewactiongroup/children/addattributetoselection/onActionProcess.js b/entity/Person_entity/entityfields/filterviewactiongroup/children/addattributetoselection/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..f4ab243e9813a5b1b186a161f8889a8cfef4d4be --- /dev/null +++ b/entity/Person_entity/entityfields/filterviewactiongroup/children/addattributetoselection/onActionProcess.js @@ -0,0 +1,26 @@ +import("system.translate"); +import("system.neon"); +import("Context_lib"); +import("FilterViewAction_lib"); +import("system.vars"); + +var ids; +var currentContext = ContextUtils.getCurrentContextId(); + +if (vars.get("$sys.selection").length > 0) +{ + ids = vars.get("$sys.selection"); +} +else +{ + ids = FilterViewActionUtils.getUidsByEntityFilter(currentContext, vars.get("$sys.filter")); +} + +var params = { + "DataUIDs_param": JSON.stringify(ids), + "ContextId_param": currentContext, + "Datalength_param": ids.length, + "ContextTitlePlural_param": translate.text("Contacts") +} + +neon.openContext("AddAttributesToSelection", "AddAttributesToSelectionEdit_view", null, neon.OPERATINGSTATE_NEW, params, null); \ No newline at end of file diff --git a/entity/Person_entity/entityfields/filterviewactiongroup/children/addattributetoselection/titleProcess.js b/entity/Person_entity/entityfields/filterviewactiongroup/children/addattributetoselection/titleProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..f5b266e73f872e682e54a918083f14883f9dc415 --- /dev/null +++ b/entity/Person_entity/entityfields/filterviewactiongroup/children/addattributetoselection/titleProcess.js @@ -0,0 +1,8 @@ +import("system.translate"); +import("system.result"); +import("system.vars"); + +if (vars.get("$sys.selection").length > 0) +{ + result.string(translate.text("set attribute (selected data)")) +} \ No newline at end of file diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index b01bf74d086d054fbfdd07be828d8a3b9c2fc239..a61138c9897040cb778a62c2ba6853bf3a80cb05 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -190,6 +190,14 @@ <key>Organisation Zip</key> <value>Firma PLZ</value> </entry> + <entry> + <key>add Attributes</key> + <value>Attribute setzen</value> + </entry> + <entry> + <key>Attribute \"%0\" can only be inserted once with the same value.</key> + <value>Eigenschaft \"%0\" kann nur einmal mit dem selben Wert ausgewählt werden.</value> + </entry> <entry> <key>EML files can't be edited here. You can download, edit and reupload the template to change the content.</key> <value>Das Bearbeiten von EML-Dateien ist hier nicht möglich. Um den Inhalt zu ändern, können Sie die Vorlage herunterladen, bearbeiten und erneut hochladen.</value> @@ -210,6 +218,10 @@ <key>Organisation Classification</key> <value>Firma Klassifizierung</value> </entry> + <entry> + <key>set attribute (selected data)</key> + <value>Eigenschaften setzen (markierte Datensätze)</value> + </entry> <entry> <key>Checklist entries</key> <value>Checklisteneinträge</value> @@ -254,6 +266,10 @@ <key>descending</key> <value>absteigend</value> </entry> + <entry> + <key>affected rows:</key> + <value>Betroffene Datensätze: </value> + </entry> <entry> <key>Recipient filter</key> <value>Empfänger Filter</value> @@ -4787,6 +4803,10 @@ <key>Successful</key> <value>Erfolgreich</value> </entry> + <entry> + <key>The chosen attributes were successfully set for %0 %1</key> + <value>Es wurden für %0 %1 die ausgewählten Eigenschaften erfolgreich gesetzt</value> + </entry> <entry> <key>Enable relation type 2</key> <value>Beziehungstyp 2 aktiv</value> @@ -9119,6 +9139,10 @@ Bitte Datumseingabe prüfen</value> <key>add new User Permission</key> <value>neue Userberechtigung hinzufügen</value> </entry> + <entry> + <key>Set attribute (use filter result)</key> + <value>Eigenschaften setzen (verwende Filterergebnis)</value> + </entry> <entry> <key>show all offers with first approval</key> <value>Alle Angebote mit 1. Freigabe anzeigen</value> @@ -10085,6 +10109,10 @@ Bitte Datumseingabe prüfen</value> <key>Child Attributes</key> <value>Untergeordnete Eigenschaften</value> </entry> + <entry> + <key>this attribute with the same value exists already</key> + <value>das Attribut mit dem selben Wert bereits existiert</value> + </entry> <entry> <key>Recalculate all Classifications</key> <value>Alle Klassifizierungen neuberechnen</value> @@ -10133,6 +10161,10 @@ Bitte Datumseingabe prüfen</value> <key>Test Recipients</key> <value>Test Empfänger</value> </entry> + <entry> + <key>The chosen attribute was successfully set for %0 %1</key> + <value>Es wurde für %0 %1 die ausgewählte Eigenschaft erfolgreich gesetzt</value> + </entry> <entry> <key>Parent Filter</key> <value>Übergeordneter Filter</value> @@ -10153,10 +10185,18 @@ Bitte Datumseingabe prüfen</value> <key>Responsibles</key> <value>Verantwortliche</value> </entry> + <entry> + <key>the max amount of this attribute has been reached</key> + <value>die maximale Anzahl der Attribute für diesen Datensatz bereits erreicht wurde</value> + </entry> <entry> <key>Districts</key> <value>Gebiete</value> </entry> + <entry> + <key>The attribute \"%0\" couldn't be set for %1 %2, because %3.</key> + <value>Es konnte für %1 %2 die Eigenschaft %0 nicht gesetzt werden, weil %3.</value> + </entry> <entry> <key>{$DISTRICTNUMBER}</key> <value>Gebietsnummer</value> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index 4c01584f1e3659dda7173085a8b5482097d1ba95..c24efd611d2943e822f600ba0efefb04ff5a317f 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -8768,6 +8768,33 @@ <entry> <key>Global Cases </key> </entry> + <entry> + <key>The chosen attributes were successfully set for %0 %1</key> + </entry> + <entry> + <key>The attribute \"%0\" couldn't be set for %1 %2, because %3.</key> + </entry> + <entry> + <key>the max amount of this attribute has been reached</key> + </entry> + <entry> + <key>set attribute (use filter result)</key> + </entry> + <entry> + <key>add Attributes</key> + </entry> + <entry> + <key>set attribute (selected data)</key> + </entry> + <entry> + <key>affected rows:</key> + </entry> + <entry> + <key>this attribute with the same value exists already</key> + </entry> + <entry> + <key>The chosen attribute was successfully set for %0 %1</key> + </entry> <entry> <key>Attributes of attribute group \"%0\" have to be used at least %1.</key> </entry> diff --git a/neonContext/AddAttributesToSelection/AddAttributesToSelection.aod b/neonContext/AddAttributesToSelection/AddAttributesToSelection.aod new file mode 100644 index 0000000000000000000000000000000000000000..7b302a28ba3b3ac62000517d460b9f1281951f8d --- /dev/null +++ b/neonContext/AddAttributesToSelection/AddAttributesToSelection.aod @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.1"> + <name>AddAttributesToSelection</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <editView>AddAttributesToSelectionEdit_view</editView> + <entity>AddAttributesToSelection_entity</entity> + <references> + <neonViewReference> + <name>d38ffc80-7de7-45ba-8453-abc98efee495</name> + <view>AddAttributesToSelectionEdit_view</view> + </neonViewReference> + </references> +</neonContext> diff --git a/neonContext/AddAttributesToSelectionMulti/AddAttributesToSelectionMulti.aod b/neonContext/AddAttributesToSelectionMulti/AddAttributesToSelectionMulti.aod new file mode 100644 index 0000000000000000000000000000000000000000..4198b4a726827c4279ee898a71e06ad2921e724f --- /dev/null +++ b/neonContext/AddAttributesToSelectionMulti/AddAttributesToSelectionMulti.aod @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.1"> + <name>AddAttributesToSelectionMulti</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <editView>AddAttributesToSelectionMultiEdit_view</editView> + <entity>AddAttributesToSelectionMulti_entity</entity> + <references> + <neonViewReference> + <name>4d0e04fb-a4fa-4d15-9314-d1bafa3934ae</name> + <view>AddAttributesToSelectionMultiEdit_view</view> + </neonViewReference> + </references> +</neonContext> diff --git a/neonView/AddAttributesToSelectionEdit_view/AddAttributesToSelectionEdit_view.aod b/neonView/AddAttributesToSelectionEdit_view/AddAttributesToSelectionEdit_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..1ca7472528be1c2d93acf675d8bc581a38ccb70e --- /dev/null +++ b/neonView/AddAttributesToSelectionEdit_view/AddAttributesToSelectionEdit_view.aod @@ -0,0 +1,30 @@ +<?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.1.8" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.8"> + <name>AddAttributesToSelectionEdit_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <size>SMALL</size> + <layout> + <headerFooterLayout> + <name>layout</name> + <footer>Generic</footer> + </headerFooterLayout> + </layout> + <children> + <neonViewReference> + <name>3f715b52-ef4b-4b62-916c-0a23833bc2da</name> + <entityField>AddAttributeToSelectionMultiEdit</entityField> + <view>AddAttributesToSelectionMultiEdit_view</view> + </neonViewReference> + <genericViewTemplate> + <name>Generic</name> + <hideLabels v="true" /> + <isEditable v="false" /> + <fields> + <entityFieldLink> + <name>93ffcf34-83ee-4200-a711-1be6aef880b6</name> + <entityField>affectedData</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/AddAttributesToSelectionMultiEdit_view/AddAttributesToSelectionMultiEdit_view.aod b/neonView/AddAttributesToSelectionMultiEdit_view/AddAttributesToSelectionMultiEdit_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..f41018c3cba53de71962a3d5585b388ec811c70c --- /dev/null +++ b/neonView/AddAttributesToSelectionMultiEdit_view/AddAttributesToSelectionMultiEdit_view.aod @@ -0,0 +1,29 @@ +<?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.1.8" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.8"> + <name>AddAttributesToSelectionMultiEdit_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <noneLayout> + <name>layout</name> + </noneLayout> + </layout> + <children> + <genericMultipleViewTemplate> + <name>MultiEdit</name> + <columns> + <neonGenericMultipleTableColumn> + <name>0a19137b-c5da-4011-a219-f859867c012c</name> + <entityField>AB_ATTRIBUTE_ID</entityField> + </neonGenericMultipleTableColumn> + <neonGenericMultipleTableColumn> + <name>49061bca-ea9a-4fb5-a399-50d89961decb</name> + <entityField>VALUE</entityField> + </neonGenericMultipleTableColumn> + <neonGenericMultipleTableColumn> + <name>a2556bf0-d65d-458e-8f3e-e1b775956235</name> + <entityField>VALUE_LOOKUP</entityField> + </neonGenericMultipleTableColumn> + </columns> + </genericMultipleViewTemplate> + </children> +</neonView>