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

SupportTicket Bugfixes to enable use of Simple, additional ticket types

parent af0ca81d
No related branches found
No related tags found
No related merge requests found
Showing
with 169 additions and 10 deletions
<?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>
<?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
<?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="[&quot;0b6d18e3-f6c8-488f-80e0-267364e444da&quot;]"/>
</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="[&quot;UNASSIGNED&quot;,&quot;ASSIGNED&quot;,&quot;IN-PROGRESS&quot;,&quot;ENDED-DONE&quot;,&quot;ENDED-ABANDONED&quot;,&quot;WAITING&quot;,&quot;STILL-INCORRECT&quot;,&quot;CUSTOMER-CHECKS&quot;]"/>
</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
......@@ -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"/>
......
......@@ -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>
......
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
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
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
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
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
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
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
......@@ -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>
......
......@@ -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>
......
......@@ -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.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment