From 1c69ab8170d82ca69fa1b61c5adb3a3bd6d51855 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexander=20V=C3=B6gl?= <a.voegl@adito.de>
Date: Fri, 24 Apr 2020 07:01:23 +0000
Subject: [PATCH] =?UTF-8?q?[Projekt:=20Entwicklung=20-=20Neon][TicketNr.:?=
 =?UTF-8?q?=201056678][Gruppierung=20der=20Aktivit=C3=A4ten,=20Telefonnumm?=
 =?UTF-8?q?er=20und=20.groupBy=20in=20360=C2=B0]?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../recordcontainers/jdito/contentProcess.js  |  9 +++++--
 entity/Employee_entity/Employee_entity.aod    |  7 +++++
 .../recordcontainers/jdito/contentProcess.js  |  3 ++-
 .../recordcontainers/jdito/onInsert.js        |  1 +
 .../recordcontainers/jdito/onUpdate.js        |  1 +
 .../ActivityFilter_view.aod                   | 26 +++++++++++++++++++
 .../EmployeeEdit_view/EmployeeEdit_view.aod   |  4 +++
 .../EmployeePreview_view.aod                  |  6 ++++-
 process/Context_lib/process.js                | 22 ++++++++++++++--
 9 files changed, 73 insertions(+), 6 deletions(-)

diff --git a/entity/360Degree_entity/recordcontainers/jdito/contentProcess.js b/entity/360Degree_entity/recordcontainers/jdito/contentProcess.js
index d2de93ae33..557b1ba4d8 100644
--- a/entity/360Degree_entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/360Degree_entity/recordcontainers/jdito/contentProcess.js
@@ -48,7 +48,7 @@ function _get360Data(pSelectMap, pContactId, pContextList, pActive)
     var resultList = [];
     pContextList.forEach(function (context) 
     {
-        var data = db.table(ContextUtils.getContextDataSql(context, JSON.parse(pContactId), true, pActive, true));
+        var data = db.table(ContextUtils.getContextDataSql(context, JSON.parse(pContactId), true, pActive, true, true));
         data.forEach(function (row) 
         {
             var active;
@@ -61,6 +61,11 @@ function _get360Data(pSelectMap, pContactId, pContextList, pActive)
                 else
                     active = translate.text("false");
             }
+            
+            var groupBy = row[4];
+            if(groupBy == "")
+                groupBy = ContextUtils.getEntityTitle(context, true);
+            
             resultList.push([
                 util.getNewUUID(), // UID
                 row[0], // TARGET_ID
@@ -68,7 +73,7 @@ function _get360Data(pSelectMap, pContactId, pContextList, pActive)
                 row[1], // TITLE
                 row[2], //DATE
                 active,
-                ContextUtils.getEntityTitle(context, true)
+                groupBy
                 ]); 
         });
     });  
diff --git a/entity/Employee_entity/Employee_entity.aod b/entity/Employee_entity/Employee_entity.aod
index 02dd23fc47..28fadf6e1d 100644
--- a/entity/Employee_entity/Employee_entity.aod
+++ b/entity/Employee_entity/Employee_entity.aod
@@ -336,6 +336,10 @@
         </entityDependency>
       </dependencies>
     </entityProvider>
+    <entityField>
+      <name>PHONE_ADDRESS</name>
+      <title>Phone</title>
+    </entityField>
   </entityFields>
   <recordContainers>
     <jDitoRecordContainer>
@@ -408,6 +412,9 @@
         <jDitoRecordFieldMapping>
           <name>SHORT_UID.value</name>
         </jDitoRecordFieldMapping>
+        <jDitoRecordFieldMapping>
+          <name>PHONE_ADDRESS.value</name>
+        </jDitoRecordFieldMapping>
       </recordFieldMappings>
     </jDitoRecordContainer>
   </recordContainers>
diff --git a/entity/Employee_entity/recordcontainers/jdito/contentProcess.js b/entity/Employee_entity/recordcontainers/jdito/contentProcess.js
index d5f8e7904a..5dce260a36 100644
--- a/entity/Employee_entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/Employee_entity/recordcontainers/jdito/contentProcess.js
@@ -36,7 +36,8 @@ users = users.map(function (user)
         "", //password
         "", //confirm_password
         user[tools.ROLENAMES], //for filtering
-        EmployeeUtils.sliceUserId(user[tools.NAME])
+        EmployeeUtils.sliceUserId(user[tools.NAME]),
+        user[tools.PARAMS][tools.PHONE_ADDRESS]
     ];
 });
 
diff --git a/entity/Employee_entity/recordcontainers/jdito/onInsert.js b/entity/Employee_entity/recordcontainers/jdito/onInsert.js
index 4b4b5af803..de0e6ff52d 100644
--- a/entity/Employee_entity/recordcontainers/jdito/onInsert.js
+++ b/entity/Employee_entity/recordcontainers/jdito/onInsert.js
@@ -15,6 +15,7 @@ params[tools.FIRSTNAME] = rowdata["FIRSTNAME.value"];
 params[tools.LASTNAME] = rowdata["LASTNAME.value"];
 params[tools.ISACTIVE] = rowdata["ISACTIVE.value"];
 params.department = rowdata["DEPARTMENT.value"];
+params[tools.PHONE_ADDRESS] = rowdata["PHONE_ADDRESS.value"];
 
 user[tools.TITLE] = rowdata["TITLE.value"];
 user[tools.PARAMS] = params;
diff --git a/entity/Employee_entity/recordcontainers/jdito/onUpdate.js b/entity/Employee_entity/recordcontainers/jdito/onUpdate.js
index fc86fe0666..81da83a2be 100644
--- a/entity/Employee_entity/recordcontainers/jdito/onUpdate.js
+++ b/entity/Employee_entity/recordcontainers/jdito/onUpdate.js
@@ -31,6 +31,7 @@ user[tools.PARAMS][tools.EMAIL] = rowdata["EMAIL_ADDRESS.value"];
 user[tools.PARAMS][tools.CALENDARID] = rowdata["EMAIL_ADDRESS.value"];
 user[tools.PARAMS][tools.CONTACTID] = rowdata["CONTACT_ID.value"];
 user[tools.PARAMS][tools.DESCRIPTION] = rowdata["DESCRIPTION.value"];
+user[tools.PARAMS][tools.PHONE_ADDRESS] = rowdata["PHONE_ADDRESS.value"];
 user[tools.PARAMS].department = rowdata["DEPARTMENT.value"];
 
 if (vars.exists("$param.PasswordChange_param") && vars.get("$param.PasswordChange_param") 
diff --git a/neonView/ActivityFilter_view/ActivityFilter_view.aod b/neonView/ActivityFilter_view/ActivityFilter_view.aod
index 9db95f37e7..4a33d82fe1 100644
--- a/neonView/ActivityFilter_view/ActivityFilter_view.aod
+++ b/neonView/ActivityFilter_view/ActivityFilter_view.aod
@@ -90,5 +90,31 @@
         </neonTableColumn>
       </columns>
     </tableViewTemplate>
+    <treeTableViewTemplate>
+      <name>ActivitiesTreeTable</name>
+      <entityField>#ENTITY</entityField>
+      <columns>
+        <neonTreeTableColumn>
+          <name>cdf48078-3766-4d45-8bfb-e17e472e32d6</name>
+          <entityField>entryDateDateFormat</entityField>
+        </neonTreeTableColumn>
+        <neonTreeTableColumn>
+          <name>eb7135af-53a3-4e8c-81d4-fa744a279021</name>
+          <entityField>#IMAGE</entityField>
+        </neonTreeTableColumn>
+        <neonTreeTableColumn>
+          <name>c397cb0e-3faa-4af6-a1ac-b96cdd74dda5</name>
+          <entityField>RESPONSIBLE</entityField>
+        </neonTreeTableColumn>
+        <neonTreeTableColumn>
+          <name>c0ca1925-9d79-4d75-afc1-12c1f19354af</name>
+          <entityField>SUBJECT</entityField>
+        </neonTreeTableColumn>
+        <neonTreeTableColumn>
+          <name>8e5a2dea-32ea-4312-b110-40b18b7ec34f</name>
+          <entityField>INFO</entityField>
+        </neonTreeTableColumn>
+      </columns>
+    </treeTableViewTemplate>
   </children>
 </neonView>
diff --git a/neonView/EmployeeEdit_view/EmployeeEdit_view.aod b/neonView/EmployeeEdit_view/EmployeeEdit_view.aod
index c53c63d9b3..f0ee708c45 100644
--- a/neonView/EmployeeEdit_view/EmployeeEdit_view.aod
+++ b/neonView/EmployeeEdit_view/EmployeeEdit_view.aod
@@ -33,6 +33,10 @@
           <name>9c030b62-bf17-4be1-bcc6-87b304a618c0</name>
           <entityField>TITLE</entityField>
         </entityFieldLink>
+        <entityFieldLink>
+          <name>7d64db57-7389-4ab5-9ea5-55fcf8738638</name>
+          <entityField>PHONE_ADDRESS</entityField>
+        </entityFieldLink>
         <entityFieldLink>
           <name>6155e6b7-ee2c-45b4-87f5-9e506ffc5775</name>
           <entityField>EMAIL_ADDRESS</entityField>
diff --git a/neonView/EmployeePreview_view/EmployeePreview_view.aod b/neonView/EmployeePreview_view/EmployeePreview_view.aod
index cee5d81aa5..915a62f7b3 100644
--- a/neonView/EmployeePreview_view/EmployeePreview_view.aod
+++ b/neonView/EmployeePreview_view/EmployeePreview_view.aod
@@ -31,9 +31,13 @@
           <entityField>CONTACT_ID</entityField>
         </entityFieldLink>
         <entityFieldLink>
-          <name>0bda9209-1437-49eb-98b7-6edea9c6836a</name>
+          <name>8d5f881b-3a53-453e-9d76-d3f611d99ca7</name>
           <entityField>DEPARTMENT</entityField>
         </entityFieldLink>
+        <entityFieldLink>
+          <name>ce1e22d6-658f-49b1-b9c6-4d46f439740b</name>
+          <entityField>PHONE_ADDRESS</entityField>
+        </entityFieldLink>
         <entityFieldLink>
           <name>d9786e3d-5364-4075-a08d-0d4ea91c4728</name>
           <entityField>EMAIL_ADDRESS</entityField>
diff --git a/process/Context_lib/process.js b/process/Context_lib/process.js
index 4fab04669c..c34bf0f914 100644
--- a/process/Context_lib/process.js
+++ b/process/Context_lib/process.js
@@ -330,7 +330,12 @@ function ContextSelector(pTableName, pIdField, pTitleExpression)
      */
     this.activeStates = null; ProtoPropertyUtils.makeSemiReadOnly(this, "activeStates");
     this.condition = null; ProtoPropertyUtils.makeSemiReadOnly(this, "condition");
-    
+    /**
+     * db-field that will be used as groubBy
+     * read-only property; set it with a matching setter
+     * @property groupBy
+     */
+    this.groupBy = null; ProtoPropertyUtils.makeSemiReadOnly(this, "groupBy");
     /**
      * an object which contains the subcontexts and the prepared select to get the contactIds of them.
      *                                                                                
@@ -477,6 +482,11 @@ ContextSelector.prototype.setSubContexts = function(pContexts)
     this._subContexts = pContexts;
     return this;
 };
+ContextSelector.prototype.setGroupBy = function(pValue)
+{
+    this._groupBy = pValue;
+    return this;
+};
 
 /**
  * TODO: !!!temporary function until you can get fields from another Entity!!!
@@ -652,7 +662,7 @@ ContextUtils.getContactId = function(pContextId, pRowId)
  * nur 360
  * 
  */
-ContextUtils.getContextDataSql = function(pContextId, pContactId, pWithDate, pActive, pWithState )
+ContextUtils.getContextDataSql = function(pContextId, pContactId, pWithDate, pActive, pWithState, pWithGroupBy)
 {
     var selectMap = ContextUtils.getSelectMap();
     var ownContextSelector = selectMap[pContextId];
@@ -668,6 +678,14 @@ ContextUtils.getContextDataSql = function(pContextId, pContactId, pWithDate, pAc
         else
             columns.push("''");
     }
+    
+    if (pWithGroupBy === true)
+    {
+        if (ownContextSelector.groupBy)
+            columns.push(ownContextSelector.getFullField(ownContextSelector.groupBy) || "''");
+        else
+            columns.push("''");
+    }
 
     var contextDataSelect = newSelect( columns.join(", ") )
                                 .from(ownContextSelector.getFullFromClause())
-- 
GitLab