From 39de794bbef5af3b5d608de8c0c71f0d89ea2bd8 Mon Sep 17 00:00:00 2001
From: "b.ulrich" <b.ulrich@adito.de>
Date: Tue, 6 Jul 2021 15:57:10 +0200
Subject: [PATCH] [Projekt: xRM-Sales][TicketNr.: 1065539][Vertriebsprojekt:
 Mitglieder: Filter funktionieren ]

---
 entity/Member_entity/Member_entity.aod        |  87 ---------
 entity/Member_entity/documentation.adoc       |  13 +-
 .../recordcontainers/jdito/contentProcess.js  | 167 ------------------
 .../recordcontainers/jdito/onDelete.js        |  16 --
 .../recordcontainers/jdito/onInsert.js        |   1 -
 .../recordcontainers/jdito/onUpdate.js        |   1 -
 6 files changed, 1 insertion(+), 284 deletions(-)
 delete mode 100644 entity/Member_entity/recordcontainers/jdito/contentProcess.js
 delete mode 100644 entity/Member_entity/recordcontainers/jdito/onDelete.js
 delete mode 100644 entity/Member_entity/recordcontainers/jdito/onInsert.js
 delete mode 100644 entity/Member_entity/recordcontainers/jdito/onUpdate.js

diff --git a/entity/Member_entity/Member_entity.aod b/entity/Member_entity/Member_entity.aod
index 726c0a44ed..528283b768 100644
--- a/entity/Member_entity/Member_entity.aod
+++ b/entity/Member_entity/Member_entity.aod
@@ -207,7 +207,6 @@
     </entityProvider>
     <entityProvider>
       <name>WithDistrictResponsibles</name>
-      <recordContainer>jdito</recordContainer>
     </entityProvider>
     <entityField>
       <name>UID</name>
@@ -450,91 +449,5 @@
         </linkInformation>
       </linkInformation>
     </dbRecordContainer>
-    <jDitoRecordContainer>
-      <name>jdito</name>
-      <jDitoRecordAlias>Data_alias</jDitoRecordAlias>
-      <isFilterable v="true" />
-      <contentProcess>%aditoprj%/entity/Member_entity/recordcontainers/jdito/contentProcess.js</contentProcess>
-      <onInsert>%aditoprj%/entity/Member_entity/recordcontainers/jdito/onInsert.js</onInsert>
-      <onUpdate>%aditoprj%/entity/Member_entity/recordcontainers/jdito/onUpdate.js</onUpdate>
-      <onDelete>%aditoprj%/entity/Member_entity/recordcontainers/jdito/onDelete.js</onDelete>
-      <recordFieldMappings>
-        <jDitoRecordFieldMapping>
-          <name>UID.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>OBJECTMEMBERID.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>CONTACT_ID.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>CONTACT_ID.displayValue</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>CONTACTROLE.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>DEPARTMENT.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>ICON.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>IMAGE.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>MEMBERROLE.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>MEMBERROLE.displayValue</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>OBJECT_ROWID.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>OBJECT_TYPE.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>ORG_ORGID.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>ORGANISATION_NAME.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>PERSON_FIRSTNAME.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>PERSON_FULL_NAME.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>PERSON_LASTNAME.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>PERSON_PERSID.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>PERSON_SALUTATION.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>PERSON_TITLE.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>POSITION.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>TARGETCONTEXT.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>recordType.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>MST_MEMBERROLE.value</name>
-        </jDitoRecordFieldMapping>
-        <jDitoRecordFieldMapping>
-          <name>PERSON_ATTR_LOYALTY.value</name>
-        </jDitoRecordFieldMapping>
-      </recordFieldMappings>
-    </jDitoRecordContainer>
   </recordContainers>
 </entity>
diff --git a/entity/Member_entity/documentation.adoc b/entity/Member_entity/documentation.adoc
index 3ad972dcc8..575b84d329 100644
--- a/entity/Member_entity/documentation.adoc
+++ b/entity/Member_entity/documentation.adoc
@@ -1,14 +1,3 @@
 = Member_entity
 
-Manages the project team in the sales project and in the campaign
-
-This entity has two recordContainers:
-
-* db
-* jdito
-
-While for the must purposes the `db`-recordContainer is perfectly fine to use there is one case necessary for the `jdito`-recordContainer:
-
-Salesproject memebers are loaded via the ``-provider and therefor use the `jdito`-recodContainer. This recordContainer first collects the data from
-the `db`-rc and then loads additional memebers of the salesprojects district. The additional members are not modifyable, while those from the
-`db`-rc are.
\ No newline at end of file
+Manages the project team in the sales project and in the campaign
\ No newline at end of file
diff --git a/entity/Member_entity/recordcontainers/jdito/contentProcess.js b/entity/Member_entity/recordcontainers/jdito/contentProcess.js
deleted file mode 100644
index 674f7b5953..0000000000
--- a/entity/Member_entity/recordcontainers/jdito/contentProcess.js
+++ /dev/null
@@ -1,167 +0,0 @@
-import("AttributeRegistry_basic");
-import("Util_lib");
-import("system.translate");
-import("system.result");
-import("system.vars");
-import("system.entities");
-import("KeywordRegistry_basic");
-import("Sql_lib");
-
-var idValues = vars.get("$local.idvalues");
-var filter = vars.get("$local.filter");
-var memberLoadingConfig = entities.createConfigForLoadingRows()
-                                    .entity("Member_entity")
-                                    .provider("Links")
-                                    .addParameter("ObjectRowId_param", vars.get("$param.ObjectRowId_param"))
-                                    .addParameter("ObjectType_param", vars.get("$param.ObjectType_param"))
-                                    .fields(["#UID", "CONTACT_ID", "CONTACT_ID.displayValue", "CONTACTROLE", "DEPARTMENT", "ICON", "IMAGE", 
-                                                "MEMBERROLE", "MEMBERROLE.displayValue", "OBJECT_ROWID", "OBJECT_TYPE",
-                                                "OBJECTMEMBERID", "ORG_ORGID", "ORGANISATION_NAME", "PERSON_FIRSTNAME", "PERSON_FULL_NAME", 
-                                                "PERSON_LASTNAME", "PERSON_PERSID", "PERSON_SALUTATION", "PERSON_TITLE", "POSITION", "TARGETCONTEXT",
-                                                "recordType", "MST_MEMBERROLE", "PERSON_ATTR_LOYALTY"]);
-
-if (idValues)
-{
-    memberLoadingConfig.uids(idValues);
-}
-
-if (filter && filter.filter != null)
-{
-    memberLoadingConfig.filter(JSON.stringify(filter.filter));
-}
-
-var memberRows = entities.getRows(memberLoadingConfig);
-memberRows = memberRows.map(function(row)
-{
-    return [
-        row["#UID"], 
-        row["OBJECTMEMBERID"], 
-        row["CONTACT_ID"], 
-        row["CONTACT_ID.displayValue"], 
-        row["CONTACTROLE"], 
-        row["DEPARTMENT"], 
-        row["ICON"],
-        row["IMAGE"], 
-        row["MEMBERROLE"], 
-        row["MEMBERROLE.displayValue"], 
-        row["OBJECT_ROWID"], 
-        row["OBJECT_TYPE"], 
-        row["ORG_ORGID"], 
-        row["ORGANISATION_NAME"], 
-        row["PERSON_FIRSTNAME"], 
-        row["PERSON_FULL_NAME"], 
-        row["PERSON_LASTNAME"], 
-        row["PERSON_PERSID"], 
-        row["PERSON_SALUTATION"], 
-        row["PERSON_TITLE"], 
-        row["POSITION"], 
-        row["TARGETCONTEXT"], 
-        row["recordType"], 
-        row["MST_MEMBERROLE"],
-        row["PERSON_ATTR_LOYALTY"]
-    ];
-});
-
-if (Utils.isNullOrEmpty(idValues) || memberRows.length === 0)
-{
-    if (vars.get("$param.ObjectType_param") == "Salesproject" && vars.get("$param.ObjectRowId_param") != null)
-    {
-        var orgContactId = newSelect("SALESPROJECT.CONTACT_ID")
-                            .from("SALESPROJECT")
-                            .where("SALESPROJECT.SALESPROJECTID", "$param.ObjectRowId_param")
-                            .cell();
-
-        var districtLoadingConfig = entities.createConfigForLoadingRows()
-            .entity("DistrictResponsible_entity")
-            .provider("OrganisationResponsibles")
-            .addParameter("OrgUid_param", orgContactId)
-            .fields(["#UID","DISTRICTRESPONSIBLEID", "DISTRICT_ID", "EMPLOYEE_CONTACT_ID", 
-                        "EMPLOYEE_CONTACT_ID.displayValue", "USER_EDIT", "USER_NEW", 
-                        "departmentAttributeName", "DATE_EDIT", "DATE_NEW"]);
-
-        var districtRows = entities.getRows(districtLoadingConfig);
-
-        districtRows = districtRows.map(function(row)
-        {
-            return [
-                row["#UID"], 
-                row["DISTRICTRESPONSIBLEID"], 
-                row["DISTRICT_ID"], 
-                row["EMPLOYEE_CONTACT_ID"], 
-                row["EMPLOYEE_CONTACT_ID.displayValue"], 
-                row["USER_EDIT"],
-                row["USER_NEW"], 
-                row["departmentAttributeName"], 
-                row["DATE_EDIT"], 
-                row["DATE_NEW"]
-            ];
-        });
-    }
-
-    var responsibleUids = [];
-    
-    if(districtRows != undefined)
-    {
-        districtRows.forEach(function(row){
-            responsibleUids.push(row[3]);
-        });
-
-        var loadingConfPers = entities.createConfigForLoadingRows()
-                                            .entity("Person_entity")
-                                            .uids(responsibleUids)
-                                            .fields(["ORGANISATION_ID", "ORGANISATION_NAME", "CONTACTROLE", "POSITION", 
-                                                        "FIRSTNAME", "LASTNAME", "SALUTATION", "TITLE", "PERSONID", "CONTACTID"]);
-        var persRowsMap = {};
-        entities.getRows(loadingConfPers).forEach(function(item) {
-            persRowsMap[item["CONTACTID"]] = item;
-        });
-
-        var persRows = [];
-        responsibleUids.forEach(function(uid) {
-            persRows.push(persRowsMap[uid]);
-        });
-
-        persRows = persRows.map(function(row){
-            return [row["SALUTATION"], row["TITLE"], row["FIRSTNAME"], row["LASTNAME"],
-                        row["ORGANISATION_NAME"], row["ORGANISATION_ID"], row["CONTACTROLE"],
-                        row["POSITION"], row["PERSONID"]];
-        });
-
-
-        districtRows.forEach(function(row, counter){
-
-            memberRows.push(
-                [row[0],
-                null,
-                row[3],
-                row[4],
-                persRows[counter][6],
-                row[7],
-                "VAADIN:GLOBE",
-                "TEXT:" + row[4].substring(row[4].indexOf(" ", 0)+1, row[4].length),
-                "70cbad1b-eac6-4369-ba50-4946e0fbcb3a",
-                translate.text("District Responsible"),
-                vars.get("$param.ObjectRowId_param"),
-                vars.get("$param.ObjectType_param"),
-                persRows[counter][5],
-                persRows[counter][4],
-                persRows[counter][2],
-                row[4],
-                persRows[counter][3], 
-                persRows[counter][8], 
-                persRows[counter][0], 
-                persRows[counter][1], 
-                persRows[counter][7],
-                null, 
-                "DistrictResponsible",
-                "",
-                (new AttributeRelationQuery(
-                    row[3],
-                    $AttributeRegistry.loyalty()
-                ).includeDisplayValue().getSingleAttribute() || {displayValue: ""}).displayValue
-            ]);
-        });
-    }
-}
-
-result.object(memberRows);
\ No newline at end of file
diff --git a/entity/Member_entity/recordcontainers/jdito/onDelete.js b/entity/Member_entity/recordcontainers/jdito/onDelete.js
deleted file mode 100644
index 91caa64d3c..0000000000
--- a/entity/Member_entity/recordcontainers/jdito/onDelete.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import("system.vars");
-import("system.entities");
-
-//While there is no need to implement the insert or update process the delete process needs to be specified because the 
-//contexts viewmodeProvider for the editView only affect insert and update (delete has no view associated)
-//let's do the db-record container the job to remove the record (additional district records can never be removed):
-var rowData = vars.get("$local.rowdata");
-var memberId = rowData["OBJECTMEMBERID.value"];
-if (memberId)
-{
-    var config = entities.createConfigForDeletingRows().entity("Member_entity").uid(memberId);
-    entities.deleteRow(config);
-}
-else
-    throw new Error("Member_entity: Could not delete member entity because the given OBJECTMEMBERID was empty.");
-    
diff --git a/entity/Member_entity/recordcontainers/jdito/onInsert.js b/entity/Member_entity/recordcontainers/jdito/onInsert.js
deleted file mode 100644
index d86d21c988..0000000000
--- a/entity/Member_entity/recordcontainers/jdito/onInsert.js
+++ /dev/null
@@ -1 +0,0 @@
-//No insert code, because it is done in via the contexts viewmodeProvider for the editView
\ No newline at end of file
diff --git a/entity/Member_entity/recordcontainers/jdito/onUpdate.js b/entity/Member_entity/recordcontainers/jdito/onUpdate.js
deleted file mode 100644
index 1e04d32962..0000000000
--- a/entity/Member_entity/recordcontainers/jdito/onUpdate.js
+++ /dev/null
@@ -1 +0,0 @@
-//No update code, because it is done in via the contexts viewmodeProvider for the editView
\ No newline at end of file
-- 
GitLab