diff --git a/.liquibase/Data_alias/basic/2019.3.2/changelog.xml b/.liquibase/Data_alias/basic/2019.3.2/changelog.xml new file mode 100644 index 0000000000000000000000000000000000000000..a4e00d6824c9fbe532099617b191660e34e23908 --- /dev/null +++ b/.liquibase/Data_alias/basic/2019.3.2/changelog.xml @@ -0,0 +1,6 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + + <include relativeToChangelogFile="true" file="insert_TicketType_attributes_usages.xml"/> +</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2019.3.2/insert_TicketType_attributes_usages.xml b/.liquibase/Data_alias/basic/2019.3.2/insert_TicketType_attributes_usages.xml new file mode 100644 index 0000000000000000000000000000000000000000..42261d82209d9b9a2498f3dbacbbecbf3028da88 --- /dev/null +++ b/.liquibase/Data_alias/basic/2019.3.2/insert_TicketType_attributes_usages.xml @@ -0,0 +1,42 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet author="j.hoermann" id="d6a614bf-8eed-41cb-967d-2c85b6bdf380"> + <insert tableName="AB_ATTRIBUTEUSAGE"> + <column name="AB_ATTRIBUTEUSAGEID" value="dd509e10-65c9-48c0-92de-31895b69a7aa"/> + <column name="AB_ATTRIBUTE_ID" value="753d9c44-58d2-40b5-b981-cd0ab15dddc2"/> + <column name="OBJECT_TYPE" value="SupportTicket"/> + </insert> + <insert tableName="AB_ATTRIBUTEUSAGE"> + <column name="AB_ATTRIBUTEUSAGEID" value="dfe58279-a0a1-4179-be7d-9fb18ae920ab"/> + <column name="AB_ATTRIBUTE_ID" value="ff8b1caf-cf30-4edb-b5ca-a9a219ba8399"/> + <column name="OBJECT_TYPE" value="SupportTicket"/> + </insert> + <insert tableName="AB_ATTRIBUTEUSAGE"> + <column name="AB_ATTRIBUTEUSAGEID" value="8d3a5dfb-5270-4cac-a132-55df49e78fc9"/> + <column name="AB_ATTRIBUTE_ID" value="92dde095-1b3a-4e90-9a90-1947d3e5d734"/> + <column name="MIN_COUNT" valueNumeric="1"/> + <column name="OBJECT_TYPE" value="SupportTicket"/> + </insert> + <insert tableName="AB_ATTRIBUTEUSAGE"> + <column name="AB_ATTRIBUTEUSAGEID" value="25084dbf-038e-4475-8d4e-b2f8cc7c4af5"/> + <column name="AB_ATTRIBUTE_ID" value="1881ffcd-bbf1-443c-b379-a08f7bb92b88"/> + <column name="OBJECT_TYPE" value="SupportTicket"/> + </insert> + <insert tableName="AB_ATTRIBUTEUSAGE"> + <column name="AB_ATTRIBUTEUSAGEID" value="410391c9-d39c-421b-9685-9514249b0c5a"/> + <column name="AB_ATTRIBUTE_ID" value="af312508-8a9b-4b8f-88f3-6b98005c749e"/> + <column name="OBJECT_TYPE" value="SupportTicket"/> + </insert> + <insert tableName="AB_ATTRIBUTEUSAGE"> + <column name="AB_ATTRIBUTEUSAGEID" value="05ec83af-90d3-482e-a9ed-522cf83cfd0f"/> + <column name="AB_ATTRIBUTE_ID" value="0b6d18e3-f6c8-488f-80e0-267364e444da"/> + <column name="OBJECT_TYPE" value="SupportTicket"/> + </insert> + <insert tableName="AB_ATTRIBUTEUSAGE"> + <column name="AB_ATTRIBUTEUSAGEID" value="c1feb7d1-954a-4f18-838b-ab886d230dc0"/> + <column name="AB_ATTRIBUTE_ID" value="a4c2bcc5-5a3d-4a70-b936-9a330329c63a"/> + <column name="MAX_COUNT" valueNumeric="1"/> + <column name="OBJECT_TYPE" value="SupportTicket"/> + </insert> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2019.3.2/insert_TicketTypes.xml b/.liquibase/Data_alias/basic/2019.3.2/insert_TicketTypes.xml new file mode 100644 index 0000000000000000000000000000000000000000..108d9589a5a9fffd21508f87264191dc57b08de6 --- /dev/null +++ b/.liquibase/Data_alias/basic/2019.3.2/insert_TicketTypes.xml @@ -0,0 +1,32 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet author="j.hoermann" id="aaa7c634-9196-42e7-a65b-954c2a0bed5b"> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="32aea6bb-6b54-4341-8bf5-6b5b67c004a1"/> + <column name="KEYID" value="TESTTICKET"/> + <column name="TITLE" value="Testticket"/> + <column name="CONTAINER" value="TicketType"/> + <column name="SORTING" valueNumeric="1"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> + <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="9fd26b1e-1bdd-4ec0-8a4c-d2943232c194"/> + <column name="AB_KEYWORD_ENTRY_ID" value="32aea6bb-6b54-4341-8bf5-6b5b67c004a1"/> + <column name="AB_KEYWORD_ATTRIBUTE_ID" value="af6a0af9-0102-426b-a1f7-c8abfea79793"/> + <column name="LONG_CHAR_VALUE" value="["0b6d18e3-f6c8-488f-80e0-267364e444da"]"/> + </insert> + <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> + <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="3946449e-d3f1-40c4-80c0-d38ad2cd586e"/> + <column name="AB_KEYWORD_ENTRY_ID" value="32aea6bb-6b54-4341-8bf5-6b5b67c004a1"/> + <column name="AB_KEYWORD_ATTRIBUTE_ID" value="6f10015d-b7ee-43aa-99f9-87960ec2e4fd"/> + <column name="LONG_CHAR_VALUE" value="["UNASSIGNED","ASSIGNED","IN-PROGRESS","ENDED-DONE","ENDED-ABANDONED","WAITING","STILL-INCORRECT","CUSTOMER-CHECKS"]"/> + </insert> + <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> + <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="6f4e5ec5-6de8-47c1-a70e-d55b84f071e0"/> + <column name="AB_KEYWORD_ENTRY_ID" value="32aea6bb-6b54-4341-8bf5-6b5b67c004a1"/> + <column name="AB_KEYWORD_ATTRIBUTE_ID" value="729a41d1-0463-480d-bf7b-0eb6c2e96f37"/> + <column name="CHAR_VALUE" value="IN-PROGRESS"/> + </insert> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/changelog.xml b/.liquibase/Data_alias/changelog.xml index a47583e5bf0827fc20a65afb7eb140eb16afeb7f..7243b91d0a98fb1fd6edb7c86638fcce22d9c7fc 100644 --- a/.liquibase/Data_alias/changelog.xml +++ b/.liquibase/Data_alias/changelog.xml @@ -5,6 +5,7 @@ <include relativeToChangelogFile="true" file="basic/2019.2.1/changelog.xml"/> <include relativeToChangelogFile="true" file="basic/2019.3.0/changelog.xml"/> <include relativeToChangelogFile="true" file="basic/2019.3.1/changelog.xml"/> + <include relativeToChangelogFile="true" file="basic/2019.3.2/changelog.xml"/> <include relativeToChangelogFile="true" file="basic/2020.0.0/changelog.xml"/> <include relativeToChangelogFile="true" file="basic/_demoData/changelog.xml" context="example"/> diff --git a/entity/SupportTicket_entity/SupportTicket_entity.aod b/entity/SupportTicket_entity/SupportTicket_entity.aod index 99b313b2f6c735c3b1571b0e8ee130515d708d7a..e33a22e1ef8026c36bbc8ee886860cebe79d79a1 100644 --- a/entity/SupportTicket_entity/SupportTicket_entity.aod +++ b/entity/SupportTicket_entity/SupportTicket_entity.aod @@ -231,10 +231,16 @@ </entityConsumer> <entityField> <name>TICKETTYPE</name> + <title>Ticket type</title> <consumer>KeywordTickettype</consumer> <mandatory v="true" /> - <state>READONLY</state> + <stateProcess>%aditoprj%/entity/SupportTicket_entity/entityfields/tickettype/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/SupportTicket_entity/entityfields/tickettype/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/SupportTicket_entity/entityfields/tickettype/displayValueProcess.js</displayValueProcess> + <onValueChange>%aditoprj%/entity/SupportTicket_entity/entityfields/tickettype/onValueChange.js</onValueChange> + <onValueChangeTypes> + <element>MASK</element> + </onValueChangeTypes> </entityField> <entityField> <name>TICKETID</name> @@ -391,7 +397,6 @@ <conditionProcess>%aditoprj%/entity/SupportTicket_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/SupportTicket_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> <onDBInsert>%aditoprj%/entity/SupportTicket_entity/recordcontainers/db/onDBInsert.js</onDBInsert> - <onDBDelete>%aditoprj%/entity/SupportTicket_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> <name>512c662b-33f6-4491-bd24-a8b862f2de84</name> diff --git a/entity/SupportTicket_entity/afterUiInit.js b/entity/SupportTicket_entity/afterUiInit.js index 65e0a8edc2c8f96cf8ba2714f0ecba08a6c98927..0e588e61aa69e7aa2ff720affb4992b4ab8b4d84 100644 --- a/entity/SupportTicket_entity/afterUiInit.js +++ b/entity/SupportTicket_entity/afterUiInit.js @@ -1,3 +1,4 @@ +import("Ticket_lib"); import("Context_lib"); import("Attribute_lib"); import("system.neon"); @@ -7,5 +8,5 @@ import("ActivityTask_lib"); if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) { TaskUtils.addLinkRecords("$param.ObjectId_param", "$param.RowId_param", "$param.PresetLinks_param", "$field.TASK_PARENT_CONTEXT", "$field.TASK_PARENT_ID"); - AttributeRelationUtils.presetMandatoryAttributes(ContextUtils.getCurrentContextId(), "Attributes"); + AttributeRelationUtils.presetMandatoryAttributes(ContextUtils.getCurrentContextId(), "Attributes", TicketUtils.begin(vars.get("$field.TICKETTYPE")).getTypeAttributes()); } \ No newline at end of file diff --git a/entity/SupportTicket_entity/entityfields/attributes/children/objecttype_param/valueProcess.js b/entity/SupportTicket_entity/entityfields/attributes/children/objecttype_param/valueProcess.js index 2466d02a342a0ff203950856c2c9944299c5a942..6f0153b04fc8c8d5a96fd136bdc438f35169d787 100644 --- a/entity/SupportTicket_entity/entityfields/attributes/children/objecttype_param/valueProcess.js +++ b/entity/SupportTicket_entity/entityfields/attributes/children/objecttype_param/valueProcess.js @@ -1,4 +1,4 @@ import("system.result"); import("Context_lib") -result.string("Ticket"); \ No newline at end of file +result.string(ContextUtils.getCurrentContextId()); \ No newline at end of file diff --git a/entity/SupportTicket_entity/entityfields/attributes/children/showempty_param/valueProcess.js b/entity/SupportTicket_entity/entityfields/attributes/children/showempty_param/valueProcess.js index 40effa0178464da0c7850912345f19c7fa95975a..93506ad062ef2dc5716d8300c83e8823b4e221be 100644 --- a/entity/SupportTicket_entity/entityfields/attributes/children/showempty_param/valueProcess.js +++ b/entity/SupportTicket_entity/entityfields/attributes/children/showempty_param/valueProcess.js @@ -1,3 +1,4 @@ import("system.result"); -result.string(true); \ No newline at end of file +// disabled because the preset attributes through this way cannot be deleted automatically on TicketType change. +//result.string(true); \ No newline at end of file diff --git a/entity/SupportTicket_entity/entityfields/attributes/onValidation.js b/entity/SupportTicket_entity/entityfields/attributes/onValidation.js index 3b4aec6cadd157e128244b1f1105c9828d71056d..28345dd054b1ad07e1aedda3690db21eebc0a357 100644 --- a/entity/SupportTicket_entity/entityfields/attributes/onValidation.js +++ b/entity/SupportTicket_entity/entityfields/attributes/onValidation.js @@ -1,6 +1,11 @@ +import("Ticket_lib"); import("Context_lib"); import("system.vars"); import("Attribute_lib"); import("system.result"); -result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$field.TICKETID"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file +result.string(AttributeRelationUtils.validateAttributeCount( + vars.get("$field.TICKETID"), + ContextUtils.getCurrentContextId(), + "Attributes", + TicketUtils.begin(vars.get("$field.TICKETTYPE")).getTypeAttributes())); \ No newline at end of file diff --git a/entity/SupportTicket_entity/entityfields/tickettype/displayValueProcess.js b/entity/SupportTicket_entity/entityfields/tickettype/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..393924b5724450070f5a567675ef43d2f83f9602 --- /dev/null +++ b/entity/SupportTicket_entity/entityfields/tickettype/displayValueProcess.js @@ -0,0 +1,6 @@ +import("KeywordRegistry_basic"); +import("system.vars"); +import("system.result"); +import("Keyword_lib"); + +result.string(KeywordUtils.getViewValue($KeywordRegistry.ticketType(), vars.get("$field.TICKETTYPE"))); \ No newline at end of file diff --git a/entity/SupportTicket_entity/entityfields/tickettype/onValueChange.js b/entity/SupportTicket_entity/entityfields/tickettype/onValueChange.js new file mode 100644 index 0000000000000000000000000000000000000000..1045620771ec71e6646e8a610be35f65c30c92ef --- /dev/null +++ b/entity/SupportTicket_entity/entityfields/tickettype/onValueChange.js @@ -0,0 +1,15 @@ +import("Ticket_lib"); +import("system.neon"); +import("system.vars"); +import("Context_lib"); +import("Attribute_lib"); +import("ActivityTask_lib"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +{ + AttributeRelationUtils.clearAttributes("Attributes"); + AttributeRelationUtils.presetMandatoryAttributes(ContextUtils.getCurrentContextId(), "Attributes", TicketUtils.begin(vars.get("$local.value")).getTypeAttributes()); + + vars.set("$field.TASK_STATUS", null); +} + \ No newline at end of file diff --git a/entity/SupportTicket_entity/entityfields/tickettype/stateProcess.js b/entity/SupportTicket_entity/entityfields/tickettype/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..0927a8bff6602b420724831de5c2e77e06375942 --- /dev/null +++ b/entity/SupportTicket_entity/entityfields/tickettype/stateProcess.js @@ -0,0 +1,13 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + +// allow changing the type only if it is not already given by parameter +if ((vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$param.TicketType_param")) || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) +{ + result.string(neon.COMPONENTSTATE_INVISIBLE); +} +else +{ + result.string(neon.COMPONENTSTATE_AUTO); +} \ No newline at end of file diff --git a/neonContext/SupportTicket/SupportTicket.aod b/neonContext/SupportTicket/SupportTicket.aod index 16bee8dd6946e6ed33cd8d6a43afd10e36a4afd6..7b344e12e124ec3bd11efdd85ad1249234fe0d7d 100644 --- a/neonContext/SupportTicket/SupportTicket.aod +++ b/neonContext/SupportTicket/SupportTicket.aod @@ -3,6 +3,7 @@ <name>SupportTicket</name> <title>Support Ticket</title> <majorModelMode>DISTRIBUTED</majorModelMode> + <documentation>%aditoprj%/neonContext/SupportTicket/documentation.adoc</documentation> <mainView>SupportTicketMain_view</mainView> <filterView>SupportTicketFilter_view</filterView> <editView>SupportTicketEdit_view</editView> diff --git a/neonView/SupportTicketEdit_view/SupportTicketEdit_view.aod b/neonView/SupportTicketEdit_view/SupportTicketEdit_view.aod index 3fd462970eeffdc9f4c03ffe22ba0705a8384a49..c92ea607293112acd4258db5f8cc76cc2e2a23e0 100644 --- a/neonView/SupportTicketEdit_view/SupportTicketEdit_view.aod +++ b/neonView/SupportTicketEdit_view/SupportTicketEdit_view.aod @@ -13,6 +13,10 @@ <editMode v="true" /> <entityField>#ENTITY</entityField> <fields> + <entityFieldLink> + <name>e7f23b42-fb12-41c5-9fec-5a7fae466b15</name> + <entityField>TICKETTYPE</entityField> + </entityFieldLink> <entityFieldLink> <name>46ef8d86-47fc-495d-bd33-9cb43ea29b25</name> <entityField>TASK_SUBJECT</entityField> diff --git a/process/Attribute_lib/process.js b/process/Attribute_lib/process.js index 85e49b6d032ffa2c1e6c172d7e4abb32249b95dc..85d6b54fec65d1ffcb63635ac7901b50680bd961 100644 --- a/process/Attribute_lib/process.js +++ b/process/Attribute_lib/process.js @@ -556,19 +556,29 @@ AttributeRelationUtils.insertAttribute = function (pRowId, pObjectType, pAttribu * * @param {String} pObjectType the object type * @param {String} pConsumer the name of the attribute relation consumer + * @param {String[]} pFiltered array of attributeId's which act as a whitelist. */ -AttributeRelationUtils.presetMandatoryAttributes = function (pObjectType, pConsumer) +AttributeRelationUtils.presetMandatoryAttributes = function (pObjectType, pConsumer, pFiltered) { - var mandatoryAttributes = newSelect("AB_ATTRIBUTE_ID, MIN_COUNT") + var mandatoryAttributesSelect = newSelect("AB_ATTRIBUTE_ID, MIN_COUNT") .from("AB_ATTRIBUTEUSAGE") .join("AB_ATTRIBUTE", "AB_ATTRIBUTE_ID = AB_ATTRIBUTEID") .where("AB_ATTRIBUTEUSAGE.OBJECT_TYPE", pObjectType) .and("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.COMBOVALUE, "# <> ?") .and("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.GROUP, "# <> ?") .and("ATTRIBUTE_ACTIVE = 1") - .and("MIN_COUNT > 0") - .table(); + .and("MIN_COUNT > 0"); + if (pFiltered) + { + var possibleIds = AttributeUtil.getPossibleAttributes(pObjectType, false, pFiltered); + if (possibleIds.length > 0) + mandatoryAttributesSelect.and("AB_ATTRIBUTE.AB_ATTRIBUTEID", possibleIds, SqlBuilder.IN()) + else + return; + } + + var mandatoryAttributes = mandatoryAttributesSelect.table(); mandatoryAttributes.forEach(function (usage) { //adding an attribute more than 20 times would be too much (having a min_count > 20 is very unlikely) @@ -579,6 +589,23 @@ AttributeRelationUtils.presetMandatoryAttributes = function (pObjectType, pConsu }); } +/** + * clears rows of attribute + * + * @param {String} pConsumer the name of the attribute relation consumer + */ +AttributeRelationUtils.clearAttributes = function (pConsumer) +{ + var insertedLinks = vars.get("$field." + pConsumer + ".insertedRows"); + var updatedLinks = vars.get("$field." + pConsumer + ".changedRows"); + + insertedLinks.concat(updatedLinks).forEach(function (link) + { + if (link["AB_ATTRIBUTE_ID"]) + neon.deleteRecord(pConsumer, link["#UID"]); + }); +} + /** * Checks if the count of the used attributes is valid and returns a message if it's not. *