From 3f14a4006c0a5bb2d3a63a20ed8ba1937a6de9a8 Mon Sep 17 00:00:00 2001
From: Johannes Hoermann <j.hoermann@adito.de>
Date: Tue, 28 May 2019 17:07:07 +0200
Subject: [PATCH] Task autogenerated code (only visible with Ticket-Type)

---
 entity/Task_entity/Task_entity.aod            |   1 +
 .../recordcontainers/db/onDBInsert.js         |   6 +
 .../TaskMainPreview_view.aod                  | 115 +++++++++---------
 3 files changed, 65 insertions(+), 57 deletions(-)
 create mode 100644 entity/Task_entity/recordcontainers/db/onDBInsert.js

diff --git a/entity/Task_entity/Task_entity.aod b/entity/Task_entity/Task_entity.aod
index e920655f2a..bea2f4c085 100644
--- a/entity/Task_entity/Task_entity.aod
+++ b/entity/Task_entity/Task_entity.aod
@@ -448,6 +448,7 @@
       <alias>Data_alias</alias>
       <conditionProcess>%aditoprj%/entity/Task_entity/recordcontainers/db/conditionProcess.js</conditionProcess>
       <orderClauseProcess>%aditoprj%/entity/Task_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess>
+      <onDBInsert>%aditoprj%/entity/Task_entity/recordcontainers/db/onDBInsert.js</onDBInsert>
       <onDBDelete>%aditoprj%/entity/Task_entity/recordcontainers/db/onDBDelete.js</onDBDelete>
       <linkInformation>
         <linkInformation>
diff --git a/entity/Task_entity/recordcontainers/db/onDBInsert.js b/entity/Task_entity/recordcontainers/db/onDBInsert.js
new file mode 100644
index 0000000000..041508a682
--- /dev/null
+++ b/entity/Task_entity/recordcontainers/db/onDBInsert.js
@@ -0,0 +1,6 @@
+import("system.vars");
+import("Sql_lib");
+import("system.db");
+
+var max = db.cell("select max(CODE) from TASK");
+db.updateData("TASK", ["CODE"], null, [parseInt(max)+1], SqlCondition.equals("TASK.TASKID", vars.get("$field.TASKID"), "1=2"));
\ No newline at end of file
diff --git a/neonView/TaskMainPreview_view/TaskMainPreview_view.aod b/neonView/TaskMainPreview_view/TaskMainPreview_view.aod
index 4adad92199..efa23f33b6 100644
--- a/neonView/TaskMainPreview_view/TaskMainPreview_view.aod
+++ b/neonView/TaskMainPreview_view/TaskMainPreview_view.aod
@@ -1,57 +1,58 @@
-<?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.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.1">
-  <name>TaskMainPreview_view</name>
-  <majorModelMode>DISTRIBUTED</majorModelMode>
-  <layout>
-    <headerFooterLayout>
-      <name>layout</name>
-      <header>Header</header>
-    </headerFooterLayout>
-  </layout>
-  <children>
-    <cardViewTemplate>
-      <name>Header</name>
-      <iconField>PRIORITY_ICON</iconField>
-      <titleField>SUBJECT</titleField>
-      <descriptionField>STATUS</descriptionField>
-      <favoriteAction1>newActivity</favoriteAction1>
-      <entityField>#ENTITY</entityField>
-    </cardViewTemplate>
-    <genericViewTemplate>
-      <name>Info</name>
-      <showDrawer v="true" />
-      <entityField>#ENTITY</entityField>
-      <fields>
-        <entityFieldLink>
-          <name>f988850e-53ed-443d-bd3d-16946eba656e</name>
-          <entityField>START_DATE</entityField>
-        </entityFieldLink>
-        <entityFieldLink>
-          <name>dda6aefc-9d4f-4d93-9a45-bc97a278c050</name>
-          <entityField>MATURITY_DATE</entityField>
-        </entityFieldLink>
-        <entityFieldLink>
-          <name>a2c82cd5-6dcd-42aa-b650-85369f4e8d39</name>
-          <entityField>PROGRESS</entityField>
-        </entityFieldLink>
-        <entityFieldLink>
-          <name>ebdffed8-4999-4ec1-ac4d-c22514dfed0c</name>
-          <entityField>PRIORITY</entityField>
-        </entityFieldLink>
-        <entityFieldLink>
-          <name>05de9afc-429e-46a8-8e3b-2ff689ed090e</name>
-          <entityField>REQUESTOR_CONTACT_ID</entityField>
-        </entityFieldLink>
-        <entityFieldLink>
-          <name>bbf1a736-acf9-4b41-9df9-5675fc6d8943</name>
-          <entityField>EDITOR_CONTACT_ID</entityField>
-        </entityFieldLink>
-      </fields>
-    </genericViewTemplate>
-    <neonViewReference>
-      <name>c4f66270-1d64-4243-9561-fb5642cff3f1</name>
-      <entityField>Links</entityField>
-      <view>TaskLinkPreviewList_view</view>
-    </neonViewReference>
-  </children>
-</neonView>
+<?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.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.1">
+  <name>TaskMainPreview_view</name>
+  <majorModelMode>DISTRIBUTED</majorModelMode>
+  <layout>
+    <headerFooterLayout>
+      <name>layout</name>
+      <header>Header</header>
+    </headerFooterLayout>
+  </layout>
+  <children>
+    <cardViewTemplate>
+      <name>Header</name>
+      <iconField>PRIORITY_ICON</iconField>
+      <titleField>SUBJECT</titleField>
+      <subtitleField>CODE</subtitleField>
+      <descriptionField>STATUS</descriptionField>
+      <favoriteAction1>newActivity</favoriteAction1>
+      <entityField>#ENTITY</entityField>
+    </cardViewTemplate>
+    <genericViewTemplate>
+      <name>Info</name>
+      <showDrawer v="true" />
+      <entityField>#ENTITY</entityField>
+      <fields>
+        <entityFieldLink>
+          <name>f988850e-53ed-443d-bd3d-16946eba656e</name>
+          <entityField>START_DATE</entityField>
+        </entityFieldLink>
+        <entityFieldLink>
+          <name>dda6aefc-9d4f-4d93-9a45-bc97a278c050</name>
+          <entityField>MATURITY_DATE</entityField>
+        </entityFieldLink>
+        <entityFieldLink>
+          <name>a2c82cd5-6dcd-42aa-b650-85369f4e8d39</name>
+          <entityField>PROGRESS</entityField>
+        </entityFieldLink>
+        <entityFieldLink>
+          <name>ebdffed8-4999-4ec1-ac4d-c22514dfed0c</name>
+          <entityField>PRIORITY</entityField>
+        </entityFieldLink>
+        <entityFieldLink>
+          <name>05de9afc-429e-46a8-8e3b-2ff689ed090e</name>
+          <entityField>REQUESTOR_CONTACT_ID</entityField>
+        </entityFieldLink>
+        <entityFieldLink>
+          <name>bbf1a736-acf9-4b41-9df9-5675fc6d8943</name>
+          <entityField>EDITOR_CONTACT_ID</entityField>
+        </entityFieldLink>
+      </fields>
+    </genericViewTemplate>
+    <neonViewReference>
+      <name>c4f66270-1d64-4243-9561-fb5642cff3f1</name>
+      <entityField>Links</entityField>
+      <view>TaskLinkPreviewList_view</view>
+    </neonViewReference>
+  </children>
+</neonView>
-- 
GitLab