From 6184461ede649875dd375d8201afe45a988baee4 Mon Sep 17 00:00:00 2001
From: Pascal Neub <p.neub@adito.de>
Date: Tue, 25 May 2021 13:51:18 +0000
Subject: [PATCH] [Projekt: xRM-Sales][TicketNr.: 1078650][Project Member List-
 inaktive Gebietsverantwortliche werden angezeigt]

---
 .../DistrictResponsible_entity.aod                    |  4 ++++
 .../recordcontainers/db/conditionProcess.js           | 11 +++++++++++
 .../recordcontainers/jdito/contentProcess.js          |  1 +
 language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod  |  6 ++++++
 language/_____LANGUAGE_de/_____LANGUAGE_de.aod        |  1 +
 language/_____LANGUAGE_en/_____LANGUAGE_en.aod        |  6 ++++++
 6 files changed, 29 insertions(+)

diff --git a/entity/DistrictResponsible_entity/DistrictResponsible_entity.aod b/entity/DistrictResponsible_entity/DistrictResponsible_entity.aod
index 8cf24770c49..928ca8eb812 100644
--- a/entity/DistrictResponsible_entity/DistrictResponsible_entity.aod
+++ b/entity/DistrictResponsible_entity/DistrictResponsible_entity.aod
@@ -229,6 +229,10 @@
       <name>DistrictResponsibleAdvisers</name>
       <lookupIdfield>EMPLOYEE_CONTACT_ID</lookupIdfield>
     </entityProvider>
+    <entityParameter>
+      <name>OnlyActive_param</name>
+      <expose v="true" />
+    </entityParameter>
   </entityFields>
   <recordContainers>
     <dbRecordContainer>
diff --git a/entity/DistrictResponsible_entity/recordcontainers/db/conditionProcess.js b/entity/DistrictResponsible_entity/recordcontainers/db/conditionProcess.js
index d6118964901..e9c5a40572f 100644
--- a/entity/DistrictResponsible_entity/recordcontainers/db/conditionProcess.js
+++ b/entity/DistrictResponsible_entity/recordcontainers/db/conditionProcess.js
@@ -2,6 +2,7 @@ import("system.entities");
 import("system.result");
 import("system.vars");
 import("Sql_lib");
+import("KeywordRegistry_basic");
 
 var districtId = vars.get("$param.DistrictId_param");
 var orgUid = vars.get("$param.OrgUid_param");
@@ -22,4 +23,14 @@ else if(orgUid)
     }
 }
 
+if(vars.exists("$param.OnlyActive_param") && vars.get("$param.OnlyActive_param"))
+{
+    // not equal on null is undefined behavior
+    cond.and(newWhere(
+        "DISTRICTRESPONSIBLE.ADVISER_STATUS",
+        $KeywordRegistry.contactStatus$inactive(),
+        SqlBuilder.NOT_EQUAL()
+    ).or("DISTRICTRESPONSIBLE.ADVISER_STATUS is null"));
+}
+
 result.string(cond.toString());
\ No newline at end of file
diff --git a/entity/Member_entity/recordcontainers/jdito/contentProcess.js b/entity/Member_entity/recordcontainers/jdito/contentProcess.js
index 707685adc1e..106d0d7c1fe 100644
--- a/entity/Member_entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/Member_entity/recordcontainers/jdito/contentProcess.js
@@ -75,6 +75,7 @@ if (Utils.isNullOrEmpty(idValues) || memberRows.length === 0)
             .entity("DistrictResponsible_entity")
             .provider("OrganisationResponsibles")
             .addParameter("OrgUid_param", orgContactId)
+            .addParameter("OnlyActive_param", true)
             .fields(["#UID","DISTRICTRESPONSIBLEID", "DISTRICT_ID", "EMPLOYEE_CONTACT_ID", 
                         "EMPLOYEE_CONTACT_ID.displayValue", "USER_EDIT", "USER_NEW", 
                         "departmentAttributeName", "DATE_EDIT", "DATE_NEW"]);
diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
index b94ce935a38..9313ed244f3 100644
--- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
+++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
@@ -8632,6 +8632,12 @@
     <entry>
       <key>Global Cases </key>
     </entry>
+    <entry>
+      <key>Attributes of attribute group \"%0\" have to be used at least %1.</key>
+    </entry>
+    <entry>
+      <key>Attributes of attribute group \"%0\" can't be used more than %1.</key>
+    </entry>
   </keyValueMap>
   <font name="Dialog" style="0" size="11" />
   <sqlModels>
diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
index 3226194b7c7..8305371866f 100644
--- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
+++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
@@ -11220,6 +11220,7 @@ Bitte Datumseingabe prüfen</value>
     </entry>
     <entry>
       <key>Buying center and internal project team</key>
+      <value>Vertriebscenter und internes Projektteam</value>
     </entry>
     <entry>
       <key>Starts the serverprocess manually, which will recalculate all (potentially) outdated classifications. Use this after changes to the configuration of classifications.</key>
diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
index 1464a7d2e29..6d4fd56a99a 100644
--- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
+++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
@@ -8717,6 +8717,12 @@
     <entry>
       <key>Global Cases </key>
     </entry>
+    <entry>
+      <key>Attributes of attribute group \"%0\" have to be used at least %1.</key>
+    </entry>
+    <entry>
+      <key>Attributes of attribute group \"%0\" can't be used more than %1.</key>
+    </entry>
   </keyValueMap>
   <font name="Dialog" style="0" size="11" />
 </language>
-- 
GitLab