From 85182f2fdcd91469697e9754a8feaf713b8b51a7 Mon Sep 17 00:00:00 2001
From: Johannes Hoermann <j.hoermann@adito.de>
Date: Fri, 31 May 2019 13:53:23 +0200
Subject: [PATCH] Buttons for Ticket-creation

---
 .../Ticketmanagement/insert_TaskType_Task.xml |  4 ++--
 entity/Task_entity/Task_entity.aod            | 19 +++++++++++++++++++
 .../children/newbugticket/onActionProcess.js  |  7 +++++++
 .../newsupportticket/onActionProcess.js       |  7 +++++++
 neonView/TaskFilter_view/TaskFilter_view.aod  |  2 ++
 process/ActivityTask_lib/process.js           | 10 +++++++---
 process/KeywordRegistry_basic/process.js      |  3 ++-
 7 files changed, 46 insertions(+), 6 deletions(-)
 create mode 100644 entity/Task_entity/entityfields/tableactions/children/newbugticket/onActionProcess.js
 create mode 100644 entity/Task_entity/entityfields/tableactions/children/newsupportticket/onActionProcess.js

diff --git a/.liquibase/Data_alias/basic/2019.2/Ticketmanagement/insert_TaskType_Task.xml b/.liquibase/Data_alias/basic/2019.2/Ticketmanagement/insert_TaskType_Task.xml
index 06961462da..86cbe99543 100644
--- a/.liquibase/Data_alias/basic/2019.2/Ticketmanagement/insert_TaskType_Task.xml
+++ b/.liquibase/Data_alias/basic/2019.2/Ticketmanagement/insert_TaskType_Task.xml
@@ -46,7 +46,7 @@
             <column name="CONTAINER" value="TaskType"/>
             <column name="SORTING" valueNumeric="1"/>
             <column name="ISACTIVE" valueNumeric="1"/>
-            <column name="ISESSENTIAL" valueNumeric="0"/>
+            <column name="ISESSENTIAL" valueNumeric="1"/>
         </insert>
         <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
             <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="ca8e16d4-0bae-45e7-a288-0f8a846193f1"/>
@@ -74,7 +74,7 @@
             <column name="CONTAINER" value="TaskType"/>
             <column name="SORTING" valueNumeric="2"/>
             <column name="ISACTIVE" valueNumeric="1"/>
-            <column name="ISESSENTIAL" valueNumeric="0"/>
+            <column name="ISESSENTIAL" valueNumeric="1"/>
         </insert>
         <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
             <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="6e54c8f3-f24b-411f-a3e3-eba878fdaa1b"/>
diff --git a/entity/Task_entity/Task_entity.aod b/entity/Task_entity/Task_entity.aod
index bac03653b3..e768b571bf 100644
--- a/entity/Task_entity/Task_entity.aod
+++ b/entity/Task_entity/Task_entity.aod
@@ -480,6 +480,25 @@
       <valueProcess>%aditoprj%/entity/Task_entity/entityfields/type_param/valueProcess.js</valueProcess>
       <expose v="true" />
     </entityParameter>
+    <entityActionGroup>
+      <name>tableActions</name>
+      <children>
+        <entityActionField>
+          <name>newBugTicket</name>
+          <title>New Bugticket</title>
+          <onActionProcess>%aditoprj%/entity/Task_entity/entityfields/tableactions/children/newbugticket/onActionProcess.js</onActionProcess>
+          <iconId>VAADIN:PUZZLE_PIECE</iconId>
+          <tooltip>New Bugticket</tooltip>
+        </entityActionField>
+        <entityActionField>
+          <name>newSupportTicket</name>
+          <title>New Supportticket</title>
+          <onActionProcess>%aditoprj%/entity/Task_entity/entityfields/tableactions/children/newsupportticket/onActionProcess.js</onActionProcess>
+          <iconId>VAADIN:QUESTION</iconId>
+          <tooltip>New Supportticket</tooltip>
+        </entityActionField>
+      </children>
+    </entityActionGroup>
   </entityFields>
   <recordContainers>
     <dbRecordContainer>
diff --git a/entity/Task_entity/entityfields/tableactions/children/newbugticket/onActionProcess.js b/entity/Task_entity/entityfields/tableactions/children/newbugticket/onActionProcess.js
new file mode 100644
index 0000000000..5a967a8105
--- /dev/null
+++ b/entity/Task_entity/entityfields/tableactions/children/newbugticket/onActionProcess.js
@@ -0,0 +1,7 @@
+import("system.vars");
+import("ActivityTask_lib");
+import("KeywordRegistry_basic");
+import("Context_lib");
+
+// no parentid as tickets do not use them
+TaskUtils.createNewTask(undefined, undefined, ContextUtils.getCurrentContextId(), undefined, {Type_param: $KeywordRegistry.taskType$bugTicket()});
\ No newline at end of file
diff --git a/entity/Task_entity/entityfields/tableactions/children/newsupportticket/onActionProcess.js b/entity/Task_entity/entityfields/tableactions/children/newsupportticket/onActionProcess.js
new file mode 100644
index 0000000000..56a663ad51
--- /dev/null
+++ b/entity/Task_entity/entityfields/tableactions/children/newsupportticket/onActionProcess.js
@@ -0,0 +1,7 @@
+import("system.vars");
+import("ActivityTask_lib");
+import("KeywordRegistry_basic");
+import("Context_lib");
+
+// no parentid as tickets do not use them
+TaskUtils.createNewTask(undefined, undefined, ContextUtils.getCurrentContextId(), undefined, {Type_param: $KeywordRegistry.taskType$supportTicket()});
\ No newline at end of file
diff --git a/neonView/TaskFilter_view/TaskFilter_view.aod b/neonView/TaskFilter_view/TaskFilter_view.aod
index a732fde154..9898867388 100644
--- a/neonView/TaskFilter_view/TaskFilter_view.aod
+++ b/neonView/TaskFilter_view/TaskFilter_view.aod
@@ -42,6 +42,7 @@
     </timelineViewTemplate>
     <tableViewTemplate>
       <name>TasksTable</name>
+      <favoriteActionGroup1>tableActions</favoriteActionGroup1>
       <entityField>#ENTITY</entityField>
       <title></title>
       <columns>
@@ -70,6 +71,7 @@
     </tableViewTemplate>
     <treeTableViewTemplate>
       <name>TasksTreeTable</name>
+      <favoriteActionGroup1>tableActions</favoriteActionGroup1>
       <entityField>#ENTITY</entityField>
       <columns>
         <neonTableColumn>
diff --git a/process/ActivityTask_lib/process.js b/process/ActivityTask_lib/process.js
index 1baa70ca7f..545d8bb176 100644
--- a/process/ActivityTask_lib/process.js
+++ b/process/ActivityTask_lib/process.js
@@ -79,9 +79,9 @@ function TaskUtils () {}
 /**
  * Create a new task
  */
-TaskUtils.createNewTask = function(pRowId, pAdditionalLinks, pParentContext, pParentId)
+TaskUtils.createNewTask = function(pRowId, pAdditionalLinks, pParentContext, pParentId, pParams)
 {
-    _ActivityTaskUtils._createNew("Task", pRowId, pAdditionalLinks, pParentContext, pParentId)
+    _ActivityTaskUtils._createNew("Task", pRowId, pAdditionalLinks, pParentContext, pParentId, pParams)
 }
 
 /**
@@ -172,12 +172,16 @@ function _ActivityTaskUtils() {}
  * Create a new task
  * @ignore
  */
-_ActivityTaskUtils._createNew = function(pContext, pRowId, pAdditionalLinks, pParentContext, pParentId)
+_ActivityTaskUtils._createNew = function(pContext, pRowId, pAdditionalLinks, pParentContext, pParentId, pParams)
 {
     if (pAdditionalLinks == undefined)
         pAdditionalLinks = [];
     
     var params = {};
+    
+    if (pParams)
+        params = pParams
+    
     if (pRowId)
     {
         params["ObjectId_param"] = ContextUtils.getCurrentContextId();
diff --git a/process/KeywordRegistry_basic/process.js b/process/KeywordRegistry_basic/process.js
index a7c6e865b3..d3bea02248 100644
--- a/process/KeywordRegistry_basic/process.js
+++ b/process/KeywordRegistry_basic/process.js
@@ -48,7 +48,8 @@ $KeywordRegistry.taskStatus$ended = function(){return "7c9d6681-6cf5-4395-b276-3
 
 $KeywordRegistry.taskType = function(){return "TaskType";};
 $KeywordRegistry.taskType$Task = function(){return "4dee8727-8299-422e-ae41-6cdf9de2dfd7";};
-$KeywordRegistry.taskType$Ticket = function(){return "f3da0edd-49d9-4061-98c1-8fda8631be7e";};
+$KeywordRegistry.taskType$bugTicket = function(){return "f3da0edd-49d9-4061-98c1-8fda8631be7e";};
+$KeywordRegistry.taskType$supportTicket = function(){return "7bf77721-470f-4cdf-a6af-452bf05a405b";};
 
 $KeywordRegistry.productPricelist = function(){return "ProductPricelist";};
 $KeywordRegistry.productPricelist$standardList = function(){return "02553fc7-4611-4914-8ff5-0b7c4e7531c9";};
-- 
GitLab