From 93ce543b5edea3f7b4e3cb0805f9cbad978270fd Mon Sep 17 00:00:00 2001
From: Sebastian Pongratz <s.pongratz@adito.de>
Date: Wed, 30 Jun 2021 11:12:55 +0000
Subject: [PATCH] =?UTF-8?q?[Projekt:=20xRM-ContactManagement][TicketNr.:?=
 =?UTF-8?q?=201080106][Auskunftsbericht=20und=20Informationsbericht=20k?=
 =?UTF-8?q?=C3=B6nnen=20bei=20fehlenden=20Angaben=20zur=20Datenschutzerkl?=
 =?UTF-8?q?=C3=A4rung=20nicht=20erstellt=20werden]?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../Data_alias/basic/2021.1.1/changelog.xml   |  3 +-
 .../insert_AnonymisierungsOrganisation.xml    | 30 ++++++++++++++
 .../Data_alias/basic/_demoData/changelog.xml  |  1 +
 .../basic/_demoData/generatedData/contact.xml |  9 ++++
 .../generatedData/dsgvoconfiguration.xml      | 23 +++++++++++
 .../_demoData/generatedData/organisation.xml  |  7 ++++
 .../linkedContextProcess.js                   |  5 ++-
 .../DSGVOConfigurationAttribute_entity.aod    |  1 +
 .../DSGVOConfiguration_entity.aod             |  8 ++++
 .../alreadymarked/valueProcess.js             |  6 ++-
 .../entityfields/deletedelay/valueProcess.js  | 12 ++++++
 .../DSGVODeleteFlag_entity.aod                |  1 +
 .../recordcontainers/db/conditionProcess.js   |  5 ++-
 .../recordcontainers/index/query.js           |  3 +-
 entity/Person_entity/Person_entity.aod        |  8 ++++
 .../valueProcess.js                           |  5 ++-
 .../entityfields/orgaddresses/stateProcess.js |  3 +-
 .../linkedContextProcess.js                   |  6 ++-
 .../entityfields/pricelists/stateProcess.js   |  5 +--
 .../documentation.adoc                        |  1 +
 .../filterConditionProcess.js                 |  4 ++
 .../filterValuesProcess.js                    |  4 ++
 .../contracts/filterConditionProcess.js       |  2 +-
 .../recordcontainers/jdito/onInsert.js        |  3 +-
 .../_____LANGUAGE_EXTRA.aod                   |  9 ++++
 .../_____LANGUAGE_de/_____LANGUAGE_de.aod     | 12 ++++++
 .../_____LANGUAGE_en/_____LANGUAGE_en.aod     |  9 ++++
 .../DSGVOConfiguration/DSGVOConfiguration.aod |  8 +---
 ...DSGVOConfigurationFilterAttribute_view.aod | 20 +++++++++
 ...GVOConfigurationFilterDeleteFlag_view.aod} | 27 ++++++++----
 .../DSGVOConfigurationFilterHeader_view.aod   | 23 -----------
 .../DSGVOConfigurationFilter_view.aod         | 10 ++---
 .../DSGVODeleteFlagFilter_view.aod            |  4 ++
 process/ClassificationUpdate_lib/process.js   |  1 +
 process/Contact_lib/process.js                | 24 ++++++++---
 process/Contract_lib/process.js               | 41 +++++++++++++++++--
 .../DSGVOAnonymize_serverProcess/process.js   | 33 ++++++++++-----
 .../process.js                                | 12 ++++--
 process/DataPrivacy_lib/process.js            |  1 +
 process/Leadimport_lib/process.js             |  6 ++-
 process/Organisation_lib/process.js           | 14 ++++++-
 41 files changed, 327 insertions(+), 82 deletions(-)
 create mode 100644 .liquibase/Data_alias/basic/2021.1.1/insert_AnonymisierungsOrganisation.xml
 create mode 100644 .liquibase/Data_alias/basic/_demoData/generatedData/dsgvoconfiguration.xml
 create mode 100644 entity/DSGVOConfiguration_entity/entityfields/deletedelay/valueProcess.js
 create mode 100644 entity/Person_entity/recordcontainers/db/filterextensions/iscontactwithoutcontracts_filter/documentation.adoc
 create mode 100644 entity/Person_entity/recordcontainers/db/filterextensions/iscontactwithoutcontracts_filter/filterConditionProcess.js
 create mode 100644 entity/Person_entity/recordcontainers/db/filterextensions/iscontactwithoutcontracts_filter/filterValuesProcess.js
 create mode 100644 neonView/DSGVOConfigurationFilterAttribute_view/DSGVOConfigurationFilterAttribute_view.aod
 rename neonView/{DSGVOConfigurationFilterFooter_view/DSGVOConfigurationFilterFooter_view.aod => DSGVOConfigurationFilterDeleteFlag_view/DSGVOConfigurationFilterDeleteFlag_view.aod} (58%)
 delete mode 100644 neonView/DSGVOConfigurationFilterHeader_view/DSGVOConfigurationFilterHeader_view.aod

diff --git a/.liquibase/Data_alias/basic/2021.1.1/changelog.xml b/.liquibase/Data_alias/basic/2021.1.1/changelog.xml
index 1a0a00ce6e6..25d90225a90 100644
--- a/.liquibase/Data_alias/basic/2021.1.1/changelog.xml
+++ b/.liquibase/Data_alias/basic/2021.1.1/changelog.xml
@@ -1,9 +1,10 @@
 <?xml version="1.1" encoding="UTF-8" standalone="no"?>
 <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
-    <include relativeToChangelogFile="true" file="alter_Mst_Team.xml"/>
+    <include relativeToChangelogFile="true" file="CurrencyRate/changelog.xml"/>
     <include relativeToChangelogFile="true" file="EmailFilter/alter_emailFilterHandling.xml"/>
     <include relativeToChangelogFile="true" file="EmailFilter/insert_recipientStatusBounced.xml"/>
     <include relativeToChangelogFile="true" file="alterAttrDeliveryBlock.xml"/>
     <include relativeToChangelogFile="true" file="SalesorderToSalesorderLinking/changelog.xml"/>
+    <include relativeToChangelogFile="true" file="insert_AnonymisierungsOrganisation.xml"/>
 </databaseChangeLog>
\ No newline at end of file
diff --git a/.liquibase/Data_alias/basic/2021.1.1/insert_AnonymisierungsOrganisation.xml b/.liquibase/Data_alias/basic/2021.1.1/insert_AnonymisierungsOrganisation.xml
new file mode 100644
index 00000000000..cc4eeb1e5bf
--- /dev/null
+++ b/.liquibase/Data_alias/basic/2021.1.1/insert_AnonymisierungsOrganisation.xml
@@ -0,0 +1,30 @@
+<?xml version="1.1" encoding="UTF-8" standalone="no"?>
+<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
+<changeSet author="s.pongratz" id="c7337df0-1ce6-43a3-bef1-bd7da7fa5caf">
+	<insert tableName="ORGANISATION">
+            <column name="ORGANISATIONID" value="1"/>
+            <column name="NAME" value="DSGVO-Anonymisierung"/>
+            <column name="CUSTOMERCODE" value=""/>
+            <column name="KIND" value="ORGCUTOMER"/>
+            <column name="USER_NEW" value="Admin"/>
+            <column name="DATE_NEW" valueDate="2021-06-09T10:48:25"/>
+	</insert>
+        <insert tableName="CONTACT">
+            <column name="CONTACTID" value="1"/>
+            <column name="ORGANISATION_ID" value="1"/>
+            <column name="ISOLANGUAGE" value="deu"/>
+            <column name="STATUS" value="CONTACTSTATACTIVE"/>
+            <column name="ADDRESS_ID" value="0"/>
+            <column name="USER_NEW" value="Admin"/>
+            <column name="DATE_NEW" valueDate="2021-06-09T10:48:25"/>
+        </insert>
+	<rollback>
+		<delete tableName="ORGANISATION">
+			<where>ORGANISATIONID = ?</where>
+			<whereParams>
+				<param value="0" />
+			</whereParams>
+		</delete>
+	</rollback>
+</changeSet>
+</databaseChangeLog>
diff --git a/.liquibase/Data_alias/basic/_demoData/changelog.xml b/.liquibase/Data_alias/basic/_demoData/changelog.xml
index 391f71514be..1fea6e0c4c0 100644
--- a/.liquibase/Data_alias/basic/_demoData/changelog.xml
+++ b/.liquibase/Data_alias/basic/_demoData/changelog.xml
@@ -31,6 +31,7 @@
   <include file="generatedData/documenttemplatelink.xml" relativeToChangelogFile="true"/>
   <include file="generatedData/documenttemplateplaceofuse.xml" relativeToChangelogFile="true"/>
   <include file="generatedData/dsgvo.xml" relativeToChangelogFile="true"/>
+  <include file="generatedData/dsgvoconfiguration.xml" relativeToChangelogFile="true"/>
   <include file="generatedData/dsgvoinfo.xml" relativeToChangelogFile="true"/>
   <include file="generatedData/exporttemplate.xml" relativeToChangelogFile="true"/>
   <include file="generatedData/exporttemplatefield.xml" relativeToChangelogFile="true"/>
diff --git a/.liquibase/Data_alias/basic/_demoData/generatedData/contact.xml b/.liquibase/Data_alias/basic/_demoData/generatedData/contact.xml
index e9542e1036f..ed631799191 100644
--- a/.liquibase/Data_alias/basic/_demoData/generatedData/contact.xml
+++ b/.liquibase/Data_alias/basic/_demoData/generatedData/contact.xml
@@ -11,6 +11,15 @@
       <column name="ISOLANGUAGE" value="deu"/>
       <column name="STATUS" value="CONTACTSTATACTIVE"/>
     </insert>
+    <insert tableName="contact">
+      <column name="CONTACTID" value="1                                   "/>
+      <column name="ADDRESS_ID" value="0                                   "/>
+      <column name="USER_NEW" value="Admin"/>
+      <column name="DATE_NEW" valueDate="2021-06-09T10:48:25"/>
+      <column name="ORGANISATION_ID" value="1                                   "/>
+      <column name="ISOLANGUAGE" value="deu"/>
+      <column name="STATUS" value="CONTACTSTATACTIVE"/>
+    </insert>
     <insert tableName="contact">
       <column name="CONTACTID" value="019651a4-503e-4e06-aefd-e7e631bf3144"/>
       <column name="ADDRESS_ID" value="e1aef1b7-569b-46be-bc50-f02332a42ef1"/>
diff --git a/.liquibase/Data_alias/basic/_demoData/generatedData/dsgvoconfiguration.xml b/.liquibase/Data_alias/basic/_demoData/generatedData/dsgvoconfiguration.xml
new file mode 100644
index 00000000000..a9af486a870
--- /dev/null
+++ b/.liquibase/Data_alias/basic/_demoData/generatedData/dsgvoconfiguration.xml
@@ -0,0 +1,23 @@
+<?xml version="1.1" encoding="UTF-8" standalone="no"?>
+<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
+    <changeSet author="s.pongratz" id="b1b963a4-6697-4ef9-a381-20515c813f8e">
+        <insert tableName="DSGVOCONFIGURATION">
+            <column name="DSGVOCONFIGURATIONID" value="2831c008-d86a-4910-b358-be1bd25c299a"/>
+            <column name="FILTER" value="{&quot;entity&quot;:&quot;Person_entity&quot;,&quot;filter&quot;:{&quot;type&quot;:&quot;group&quot;,&quot;operator&quot;:&quot;AND&quot;,&quot;childs&quot;:[{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;#EXTENSION.NoActivity_filter.NoActivity_filter#DATE&quot;,&quot;operator&quot;:&quot;TIMEFRAME_PAST&quot;,&quot;value&quot;:&quot;3 Jahre&quot;,&quot;key&quot;:&quot;REL=FIXED;START=P-3Y&quot;,&quot;contenttype&quot;:&quot;DATE&quot;},{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;#EXTENSION.IsEmployee_filter.IsEmployee_filter#BOOLEAN&quot;,&quot;operator&quot;:&quot;EQUAL&quot;,&quot;value&quot;:&quot;Nein&quot;,&quot;key&quot;:&quot;false&quot;,&quot;contenttype&quot;:&quot;BOOLEAN&quot;}]}}"/>
+            <column name="REASON" value="980bf3ad-715d-4e2c-9f3b-ada996ced361"/>
+            <column name="USER_NEW" value="Admin"/>
+            <column name="DATE_NEW" valueDate="2021-06-17T07:50:56"/>
+            <column name="USER_EDIT" value="Admin"/>
+            <column name="DATE_EDIT" valueDate="2021-06-24T06:20:39"/>
+        </insert>
+        <insert tableName="DSGVOCONFIGURATION">
+            <column name="DSGVOCONFIGURATIONID" value="1ce9c4c9-b041-41c1-b2d8-8805a77c4729"/>
+            <column name="FILTER" value="{&quot;entity&quot;:&quot;Person_entity&quot;,&quot;filter&quot;:{&quot;type&quot;:&quot;group&quot;,&quot;operator&quot;:&quot;AND&quot;,&quot;childs&quot;:[{&quot;type&quot;:&quot;group&quot;,&quot;operator&quot;:&quot;OR&quot;,&quot;childs&quot;:[{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;#EXTENSION.IsContactWithoutContracts_filter.IsContactWithoutContracts_filter#BOOLEAN&quot;,&quot;operator&quot;:&quot;EQUAL&quot;,&quot;value&quot;:&quot;Ja&quot;,&quot;key&quot;:&quot;true&quot;,&quot;contenttype&quot;:&quot;BOOLEAN&quot;},{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;Contracts.CONTRACTSTATUS&quot;,&quot;operator&quot;:&quot;EQUAL&quot;,&quot;value&quot;:&quot;gekündigt&quot;,&quot;key&quot;:&quot;CONTRACTSTATRESIGN&quot;,&quot;contenttype&quot;:&quot;TEXT&quot;}]},{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;#EXTENSION.IsEmployee_filter.IsEmployee_filter#BOOLEAN&quot;,&quot;operator&quot;:&quot;EQUAL&quot;,&quot;value&quot;:&quot;Nein&quot;,&quot;key&quot;:&quot;false&quot;,&quot;contenttype&quot;:&quot;BOOLEAN&quot;}]}}"/>
+            <column name="REASON" value="e9928b0b-3a31-4dfc-9f9a-782ad78db290"/>
+            <column name="USER_NEW" value="Admin"/>
+            <column name="DATE_NEW" valueDate="2021-06-24T06:18:59"/>
+            <column name="USER_EDIT" value="Admin"/>
+            <column name="DATE_EDIT" valueDate="2021-06-24T06:20:31"/>
+        </insert>
+    </changeSet>
+</databaseChangeLog>
\ No newline at end of file
diff --git a/.liquibase/Data_alias/basic/_demoData/generatedData/organisation.xml b/.liquibase/Data_alias/basic/_demoData/generatedData/organisation.xml
index 02c3077b02a..8fccac757f4 100644
--- a/.liquibase/Data_alias/basic/_demoData/generatedData/organisation.xml
+++ b/.liquibase/Data_alias/basic/_demoData/generatedData/organisation.xml
@@ -9,6 +9,13 @@
       <column name="USER_NEW" value="Admin"/>
       <column name="DATE_NEW" valueDate="2019-08-29T02:43:16"/>
     </insert>
+    <insert tableName="organisation">
+      <column name="ORGANISATIONID" value="1                                   "/>
+      <column name="KIND" value="ORGCUTOMER"/>
+      <column name="NAME" value="DSGVO-Anonymisierung"/>
+      <column name="USER_NEW" value="Admin"/>
+      <column name="DATE_NEW" valueDate="2021-06-09T10:48:25"/>
+    </insert>
     <insert tableName="organisation">
       <column name="ORGANISATIONID" value="03e09527-21cc-489a-b37f-0dd7df553c20"/>
       <column name="KIND" value="ORGPROSPECT"/>
diff --git a/entity/Contact_entity/entityfields/organisation_contactid/linkedContextProcess.js b/entity/Contact_entity/entityfields/organisation_contactid/linkedContextProcess.js
index 8109a73904f..b4a48ee256c 100644
--- a/entity/Contact_entity/entityfields/organisation_contactid/linkedContextProcess.js
+++ b/entity/Contact_entity/entityfields/organisation_contactid/linkedContextProcess.js
@@ -1,7 +1,10 @@
+import("Organisation_lib");
 import("system.result");
 import("system.vars");
 
-if(vars.get("$field.ORGANISATION_ID").trim() != "0")
+if(!OrgUtils.isPrivateOrganisationId(vars.get("$field.ORGANISATION_ID")))
+{
     result.string("Organisation");
+}
 
 
diff --git a/entity/DSGVOConfigurationAttribute_entity/DSGVOConfigurationAttribute_entity.aod b/entity/DSGVOConfigurationAttribute_entity/DSGVOConfigurationAttribute_entity.aod
index 51a8dfdf877..a7ca143a3d6 100644
--- a/entity/DSGVOConfigurationAttribute_entity/DSGVOConfigurationAttribute_entity.aod
+++ b/entity/DSGVOConfigurationAttribute_entity/DSGVOConfigurationAttribute_entity.aod
@@ -3,6 +3,7 @@
   <name>DSGVOConfigurationAttribute_entity</name>
   <majorModelMode>DISTRIBUTED</majorModelMode>
   <documentation>%aditoprj%/entity/DSGVOConfigurationAttribute_entity/documentation.adoc</documentation>
+  <icon>VAADIN:LOCK</icon>
   <recordContainer>jdito</recordContainer>
   <entityFields>
     <entityProvider>
diff --git a/entity/DSGVOConfiguration_entity/DSGVOConfiguration_entity.aod b/entity/DSGVOConfiguration_entity/DSGVOConfiguration_entity.aod
index 1c47b5724dc..665178f3ad7 100644
--- a/entity/DSGVOConfiguration_entity/DSGVOConfiguration_entity.aod
+++ b/entity/DSGVOConfiguration_entity/DSGVOConfiguration_entity.aod
@@ -4,6 +4,7 @@
   <title>DSGVO Configuration</title>
   <majorModelMode>DISTRIBUTED</majorModelMode>
   <documentation>%aditoprj%/entity/DSGVOConfiguration_entity/documentation.adoc</documentation>
+  <icon>VAADIN:LOCK</icon>
   <recordContainer>db</recordContainer>
   <entityFields>
     <entityProvider>
@@ -130,6 +131,13 @@
     <entityField>
       <name>REASONID</name>
     </entityField>
+    <entityField>
+      <name>deleteDelay</name>
+      <title>Delete Delay in Days</title>
+      <contentType>NUMBER</contentType>
+      <outputFormat>#</outputFormat>
+      <valueProcess>%aditoprj%/entity/DSGVOConfiguration_entity/entityfields/deletedelay/valueProcess.js</valueProcess>
+    </entityField>
   </entityFields>
   <recordContainers>
     <dbRecordContainer>
diff --git a/entity/DSGVOConfiguration_entity/entityfields/alreadymarked/valueProcess.js b/entity/DSGVOConfiguration_entity/entityfields/alreadymarked/valueProcess.js
index 2689a33903e..67e184ddb24 100644
--- a/entity/DSGVOConfiguration_entity/entityfields/alreadymarked/valueProcess.js
+++ b/entity/DSGVOConfiguration_entity/entityfields/alreadymarked/valueProcess.js
@@ -1,5 +1,9 @@
+import("system.vars");
 import("KeywordRegistry_basic");
 import("system.result");
 import("Sql_lib");
 
-result.string(parseInt(newSelect("COUNT(*)").from("CONTACT").where("CONTACT.STATUS", $KeywordRegistry.contactStatus$markToDelete()).cell()));
\ No newline at end of file
+if (!vars.get("$this.value"))
+{
+    result.string(parseInt(newSelect("COUNT(*)").from("CONTACT").where("CONTACT.STATUS", $KeywordRegistry.contactStatus$markToDelete()).cell()));
+}
diff --git a/entity/DSGVOConfiguration_entity/entityfields/deletedelay/valueProcess.js b/entity/DSGVOConfiguration_entity/entityfields/deletedelay/valueProcess.js
new file mode 100644
index 00000000000..55735ce96cf
--- /dev/null
+++ b/entity/DSGVOConfiguration_entity/entityfields/deletedelay/valueProcess.js
@@ -0,0 +1,12 @@
+import("Keyword_lib");
+import("system.logging");
+import("KeywordRegistry_basic");
+import("KeywordData_lib");
+import("system.result");
+import("system.vars");
+
+if (!vars.get("$this.value"))
+{  
+    result.string(new KeywordAttribute($KeywordRegistry.dsgvoConfiguration(), "Delete Delay in Days", "7")
+    .getValue($KeywordRegistry.dsgvoConfiguration$config()));
+}
\ No newline at end of file
diff --git a/entity/DSGVODeleteFlag_entity/DSGVODeleteFlag_entity.aod b/entity/DSGVODeleteFlag_entity/DSGVODeleteFlag_entity.aod
index e34d12654bb..b21a1ea1b1d 100644
--- a/entity/DSGVODeleteFlag_entity/DSGVODeleteFlag_entity.aod
+++ b/entity/DSGVODeleteFlag_entity/DSGVODeleteFlag_entity.aod
@@ -3,6 +3,7 @@
   <name>DSGVODeleteFlag_entity</name>
   <majorModelMode>DISTRIBUTED</majorModelMode>
   <documentation>%aditoprj%/entity/DSGVODeleteFlag_entity/documentation.adoc</documentation>
+  <icon>VAADIN:LOCK</icon>
   <siblings>
     <element>Person_entity</element>
     <element>LogHistory_entity</element>
diff --git a/entity/Organisation_entity/recordcontainers/db/conditionProcess.js b/entity/Organisation_entity/recordcontainers/db/conditionProcess.js
index c2a18dbbe57..28b3b918e84 100644
--- a/entity/Organisation_entity/recordcontainers/db/conditionProcess.js
+++ b/entity/Organisation_entity/recordcontainers/db/conditionProcess.js
@@ -1,3 +1,4 @@
+import("Organisation_lib");
 import("KeywordRegistry_basic");
 import("Employee_lib");
 import("AttributeRegistry_basic");
@@ -12,9 +13,11 @@ import("Context_lib");
 var cond = newWhere();
 var onlyShowContactIds = JSON.parse(vars.get("$param.OnlyShowContactIds_param"));
 
+cond.and("ORGANISATION.ORGANISATIONID", OrgUtils.getDSGVOAnonymisierungsOrganisationId(), SqlBuilder.NOT_EQUAL())
+
 // filter privat company if it is not needed
 if (vars.getString("$param.WithPrivate_param") != "true")
-    cond.and("ORGANISATION.ORGANISATIONID", "0", SqlBuilder.NOT_EQUAL());
+    cond.and("ORGANISATION.ORGANISATIONID", OrgUtils.getPrivateOrganisationId(), SqlBuilder.NOT_EQUAL());
 
 var excludeOrgsWithPersonId = vars.get("$param.ExcludeOrganisationsByPersonId")
 if (excludeOrgsWithPersonId)
diff --git a/entity/Organisation_entity/recordcontainers/index/query.js b/entity/Organisation_entity/recordcontainers/index/query.js
index c2b15cd1890..7719191536b 100644
--- a/entity/Organisation_entity/recordcontainers/index/query.js
+++ b/entity/Organisation_entity/recordcontainers/index/query.js
@@ -59,7 +59,8 @@ var querySelect = newSelect([
             .and(["COMMUNICATION", "ISSTANDARD", "standardPhone"], "1")
         , "standardPhone")
     .where("CONTACT.STATUS", $KeywordRegistry.contactStatus$inactive(), SqlBuilder.NOT_EQUAL())
-    .and("ORGANISATION.ORGANISATIONID", OrgUtils.getPrivateOrganisationId(), SqlBuilder.NOT_EQUAL());
+    .and("ORGANISATION.ORGANISATIONID", OrgUtils.getPrivateOrganisationId(), SqlBuilder.NOT_EQUAL())
+    .and("ORGANISATION.ORGANISATIONID", OrgUtils.getDSGVOAnonymisierungsOrganisationId(), SqlBuilder.NOT_EQUAL());
 
 if (vars.exists("$local.idvalue") && vars.get("$local.idvalue") && vars.get("$local.idvalue").length > 0) 
     querySelect.and("CONTACT.CONTACTID", "$local.idvalue");
diff --git a/entity/Person_entity/Person_entity.aod b/entity/Person_entity/Person_entity.aod
index d4b5f5d1b7c..47454480a31 100644
--- a/entity/Person_entity/Person_entity.aod
+++ b/entity/Person_entity/Person_entity.aod
@@ -1763,6 +1763,14 @@
           <documentation>%aditoprj%/entity/Person_entity/recordcontainers/db/filterextensions/noactivity_filter/documentation.adoc</documentation>
           <filtertype>EXTENDED</filtertype>
         </filterExtension>
+        <filterExtension>
+          <name>IsContactWithoutContracts_filter</name>
+          <title>Is contact without a contract</title>
+          <contentType>BOOLEAN</contentType>
+          <filterValuesProcess>%aditoprj%/entity/Person_entity/recordcontainers/db/filterextensions/iscontactwithoutcontracts_filter/filterValuesProcess.js</filterValuesProcess>
+          <filterConditionProcess>%aditoprj%/entity/Person_entity/recordcontainers/db/filterextensions/iscontactwithoutcontracts_filter/filterConditionProcess.js</filterConditionProcess>
+          <documentation>%aditoprj%/entity/Person_entity/recordcontainers/db/filterextensions/iscontactwithoutcontracts_filter/documentation.adoc</documentation>
+        </filterExtension>
       </filterExtensions>
     </dbRecordContainer>
     <indexRecordContainer>
diff --git a/entity/Person_entity/entityfields/additionalactivitytasklinks_param/valueProcess.js b/entity/Person_entity/entityfields/additionalactivitytasklinks_param/valueProcess.js
index b8df733c9a7..154b618162e 100644
--- a/entity/Person_entity/entityfields/additionalactivitytasklinks_param/valueProcess.js
+++ b/entity/Person_entity/entityfields/additionalactivitytasklinks_param/valueProcess.js
@@ -1,3 +1,4 @@
+import("Organisation_lib");
 import("system.result");
 import("system.vars");
 import("system.vars");
@@ -5,8 +6,10 @@ import("system.vars");
 var links = [];
 
 var orgId = vars.get("$field.ORGANISATION_ID")
-if (orgId && orgId.trim() != "0")
+if (orgId && !OrgUtils.isPrivateOrganisationId(orgId))
+{
     links.push(["Organisation", vars.get("$field.ORGANISATION_CONTACTID")]);
+}  
 
 links = JSON.stringify(links);
 result.string(links);
\ No newline at end of file
diff --git a/entity/Person_entity/entityfields/orgaddresses/stateProcess.js b/entity/Person_entity/entityfields/orgaddresses/stateProcess.js
index de120baf57e..b35279690e9 100644
--- a/entity/Person_entity/entityfields/orgaddresses/stateProcess.js
+++ b/entity/Person_entity/entityfields/orgaddresses/stateProcess.js
@@ -1,8 +1,9 @@
+import("Organisation_lib");
 import("system.vars");
 import("system.result");
 import("system.neon");
 
-if (vars.getString("$field.ORGANISATION_ID").trim() == "0")
+if (OrgUtils.isPrivateOrganisationId(vars.get("$field.ORGANISATION_ID")))
 {
     result.string(neon.COMPONENTSTATE_INVISIBLE);
 }
diff --git a/entity/Person_entity/entityfields/organisation_contactid/linkedContextProcess.js b/entity/Person_entity/entityfields/organisation_contactid/linkedContextProcess.js
index 8109a73904f..23e84a4ab96 100644
--- a/entity/Person_entity/entityfields/organisation_contactid/linkedContextProcess.js
+++ b/entity/Person_entity/entityfields/organisation_contactid/linkedContextProcess.js
@@ -1,7 +1,11 @@
+import("Organisation_lib");
 import("system.result");
 import("system.vars");
 
-if(vars.get("$field.ORGANISATION_ID").trim() != "0")
+if(!OrgUtils.isPrivateOrganisationId(vars.get("$field.ORGANISATION_ID")))
+{
     result.string("Organisation");
+}
+    
 
 
diff --git a/entity/Person_entity/entityfields/pricelists/stateProcess.js b/entity/Person_entity/entityfields/pricelists/stateProcess.js
index a0643fb14da..25f82fcd6dd 100644
--- a/entity/Person_entity/entityfields/pricelists/stateProcess.js
+++ b/entity/Person_entity/entityfields/pricelists/stateProcess.js
@@ -1,9 +1,8 @@
+import("Organisation_lib");
 import("system.vars");
 import("system.result");
 
-var org_id = vars.get("$field.ORGANISATION_ID").trim();
-
-if(org_id == "0")
+if(OrgUtils.isPrivateOrganisationId(vars.get("$field.ORGANISATION_ID")))
 {
     result.string("EDITABLE");
 }
diff --git a/entity/Person_entity/recordcontainers/db/filterextensions/iscontactwithoutcontracts_filter/documentation.adoc b/entity/Person_entity/recordcontainers/db/filterextensions/iscontactwithoutcontracts_filter/documentation.adoc
new file mode 100644
index 00000000000..a0a5f51d869
--- /dev/null
+++ b/entity/Person_entity/recordcontainers/db/filterextensions/iscontactwithoutcontracts_filter/documentation.adoc
@@ -0,0 +1 @@
+This filter extension filters all persons which have no contracts.
\ No newline at end of file
diff --git a/entity/Person_entity/recordcontainers/db/filterextensions/iscontactwithoutcontracts_filter/filterConditionProcess.js b/entity/Person_entity/recordcontainers/db/filterextensions/iscontactwithoutcontracts_filter/filterConditionProcess.js
new file mode 100644
index 00000000000..a9d0a80f0aa
--- /dev/null
+++ b/entity/Person_entity/recordcontainers/db/filterextensions/iscontactwithoutcontracts_filter/filterConditionProcess.js
@@ -0,0 +1,4 @@
+import("system.result");
+import("Contract_lib");
+
+result.string(ContractUtils.makeIsContactWithoutContractsFilterConditionSql());
diff --git a/entity/Person_entity/recordcontainers/db/filterextensions/iscontactwithoutcontracts_filter/filterValuesProcess.js b/entity/Person_entity/recordcontainers/db/filterextensions/iscontactwithoutcontracts_filter/filterValuesProcess.js
new file mode 100644
index 00000000000..4462144da56
--- /dev/null
+++ b/entity/Person_entity/recordcontainers/db/filterextensions/iscontactwithoutcontracts_filter/filterValuesProcess.js
@@ -0,0 +1,4 @@
+import("system.translate");
+import("system.result");
+
+result.object([["true", translate.text("Yes")], ["false", translate.text("No")]]);
\ No newline at end of file
diff --git a/entity/Person_entity/recordcontainers/db/recordfieldmappings/contracts/filterConditionProcess.js b/entity/Person_entity/recordcontainers/db/recordfieldmappings/contracts/filterConditionProcess.js
index 03e121a6f56..d0d8f353ea9 100644
--- a/entity/Person_entity/recordcontainers/db/recordfieldmappings/contracts/filterConditionProcess.js
+++ b/entity/Person_entity/recordcontainers/db/recordfieldmappings/contracts/filterConditionProcess.js
@@ -2,7 +2,7 @@ import("system.vars");
 import("Sql_lib");
 import("system.result");
 
-result.string(newWhere("CONTACT.CONTACT_ID",
+result.string(newWhere("CONTACT.CONTACTID",
     newSelect("CONTRACT.CONTACT_ID")
     .from("CONTRACT")
     .whereIfSet(vars.get("$local.condition")),
diff --git a/entity/QuickEntry_entity/recordcontainers/jdito/onInsert.js b/entity/QuickEntry_entity/recordcontainers/jdito/onInsert.js
index d356c25a42a..2d6cc1010d4 100644
--- a/entity/QuickEntry_entity/recordcontainers/jdito/onInsert.js
+++ b/entity/QuickEntry_entity/recordcontainers/jdito/onInsert.js
@@ -1,3 +1,4 @@
+import("Organisation_lib");
 import("Sql_lib");
 import("KeywordRegistry_basic");
 import("system.entities");
@@ -6,7 +7,7 @@ import("system.vars");
 //TODO: duplicate check
 
 var rowdata = vars.get("$local.rowdata");
-var organisationId = "0";
+var organisationId = OrgUtils.getPrivateOrganisationId();
 var userNew = rowdata["USER_NEW.value"];
 var dateNew = rowdata["DATE_NEW.value"];
 
diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
index 767f6addc3b..8678431e07a 100644
--- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
+++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
@@ -9037,6 +9037,15 @@
     <entry>
       <key>Turnover and Forecast</key>
     </entry>
+    <entry>
+      <key>DSGVO - relevant attributes</key>
+    </entry>
+    <entry>
+      <key>DSGVO - mark + delete prozess</key>
+    </entry>
+    <entry>
+      <key>Is contact without a contract</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 33eb0f9dde7..ce38a46d86d 100644
--- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
+++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
@@ -11889,6 +11889,18 @@ Bitte Datumseingabe prüfen</value>
     <entry>
       <key>Shows the organisations turnover and forecast</key>
     </entry>
+    <entry>
+      <key>DSGVO - relevant attributes</key>
+      <value>DSGVO - Relevante Eigenschaften</value>
+    </entry>
+    <entry>
+      <key>DSGVO - mark + delete prozess</key>
+      <value>DSGVO - Markierung + Löschprozess</value>
+    </entry>
+    <entry>
+      <key>Is contact without a contract</key>
+      <value>Ist ein Kontakt ohne Vertrag</value>
+    </entry>
   </keyValueMap>
   <font name="Dialog" style="0" size="11" />
 </language>
diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
index 743dd7e941a..56c629be8af 100644
--- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
+++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
@@ -9149,6 +9149,15 @@
     <entry>
       <key>Turnover and Forecast</key>
     </entry>
+    <entry>
+      <key>DSGVO - relevant attributes</key>
+    </entry>
+    <entry>
+      <key>DSGVO - mark + delete prozess</key>
+    </entry>
+    <entry>
+      <key>Is contact without a contract</key>
+    </entry>
   </keyValueMap>
   <font name="Dialog" style="0" size="11" />
 </language>
diff --git a/neonContext/DSGVOConfiguration/DSGVOConfiguration.aod b/neonContext/DSGVOConfiguration/DSGVOConfiguration.aod
index d91e9c10ee7..0eb50d66807 100644
--- a/neonContext/DSGVOConfiguration/DSGVOConfiguration.aod
+++ b/neonContext/DSGVOConfiguration/DSGVOConfiguration.aod
@@ -22,15 +22,11 @@
     </neonViewReference>
     <neonViewReference>
       <name>09c76322-225f-46cd-a3eb-48b56d6c661c</name>
-      <view>DSGVOConfigurationFilterFooter_view</view>
+      <view>DSGVOConfigurationFilterAttribute_view</view>
     </neonViewReference>
     <neonViewReference>
       <name>ea7e56f5-e6f4-4c7c-872c-3ed6f0e5bf24</name>
-      <view>DSGVOConfigurationFilterHeader_view</view>
-    </neonViewReference>
-    <neonViewReference>
-      <name>ed051f3e-c8b3-4561-940f-cd54eeb91dd3</name>
-      <view>DSGVOConfigurationFilterFooter_view</view>
+      <view>DSGVOConfigurationFilterDeleteFlag_view</view>
     </neonViewReference>
   </references>
 </neonContext>
diff --git a/neonView/DSGVOConfigurationFilterAttribute_view/DSGVOConfigurationFilterAttribute_view.aod b/neonView/DSGVOConfigurationFilterAttribute_view/DSGVOConfigurationFilterAttribute_view.aod
new file mode 100644
index 00000000000..673d4669ecb
--- /dev/null
+++ b/neonView/DSGVOConfigurationFilterAttribute_view/DSGVOConfigurationFilterAttribute_view.aod
@@ -0,0 +1,20 @@
+<?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.8" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.8">
+  <name>DSGVOConfigurationFilterAttribute_view</name>
+  <majorModelMode>DISTRIBUTED</majorModelMode>
+  <filterable v="false" />
+  <layout>
+    <drawerLayout>
+      <name>layout</name>
+      <layoutCaption>DSGVO - relevant attributes</layoutCaption>
+      <fixedDrawer v="false" />
+    </drawerLayout>
+  </layout>
+  <children>
+    <neonViewReference>
+      <name>f77ed99c-f893-4cd6-8879-545ff353b77f</name>
+      <entityField>DSGVOConfigurationAttributes</entityField>
+      <view>DSGVOConfigurationAttributeFilter_view</view>
+    </neonViewReference>
+  </children>
+</neonView>
diff --git a/neonView/DSGVOConfigurationFilterFooter_view/DSGVOConfigurationFilterFooter_view.aod b/neonView/DSGVOConfigurationFilterDeleteFlag_view/DSGVOConfigurationFilterDeleteFlag_view.aod
similarity index 58%
rename from neonView/DSGVOConfigurationFilterFooter_view/DSGVOConfigurationFilterFooter_view.aod
rename to neonView/DSGVOConfigurationFilterDeleteFlag_view/DSGVOConfigurationFilterDeleteFlag_view.aod
index a9b323bda18..b132c53249c 100644
--- a/neonView/DSGVOConfigurationFilterFooter_view/DSGVOConfigurationFilterFooter_view.aod
+++ b/neonView/DSGVOConfigurationFilterDeleteFlag_view/DSGVOConfigurationFilterDeleteFlag_view.aod
@@ -1,14 +1,28 @@
 <?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.8" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.8">
-  <name>DSGVOConfigurationFilterFooter_view</name>
+  <name>DSGVOConfigurationFilterDeleteFlag_view</name>
   <majorModelMode>DISTRIBUTED</majorModelMode>
   <layout>
-    <boxLayout>
+    <drawerLayout>
       <name>layout</name>
-      <direction>HORIZONTAL</direction>
-    </boxLayout>
+      <layoutCaption>DSGVO - mark + delete prozess</layoutCaption>
+    </drawerLayout>
   </layout>
   <children>
+    <genericViewTemplate>
+      <name>Generic</name>
+      <isEditable v="true" />
+      <fields>
+        <entityFieldLink>
+          <name>1eb5807a-f82a-419b-bd7b-a020b7a6e778</name>
+          <entityField>alreadyMarked</entityField>
+        </entityFieldLink>
+        <entityFieldLink>
+          <name>8f696499-ef54-4302-9be7-c21262032f21</name>
+          <entityField>deleteDelay</entityField>
+        </entityFieldLink>
+      </fields>
+    </genericViewTemplate>
     <tableViewTemplate>
       <name>Table</name>
       <favoriteActionGroup1>FilterConfigActions</favoriteActionGroup1>
@@ -23,10 +37,5 @@
         </neonTableColumn>
       </columns>
     </tableViewTemplate>
-    <neonViewReference>
-      <name>f77ed99c-f893-4cd6-8879-545ff353b77f</name>
-      <entityField>DSGVOConfigurationAttributes</entityField>
-      <view>DSGVOConfigurationAttributeFilter_view</view>
-    </neonViewReference>
   </children>
 </neonView>
diff --git a/neonView/DSGVOConfigurationFilterHeader_view/DSGVOConfigurationFilterHeader_view.aod b/neonView/DSGVOConfigurationFilterHeader_view/DSGVOConfigurationFilterHeader_view.aod
deleted file mode 100644
index 9d164a33b5a..00000000000
--- a/neonView/DSGVOConfigurationFilterHeader_view/DSGVOConfigurationFilterHeader_view.aod
+++ /dev/null
@@ -1,23 +0,0 @@
-<?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.8" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.8">
-  <name>DSGVOConfigurationFilterHeader_view</name>
-  <majorModelMode>DISTRIBUTED</majorModelMode>
-  <layout>
-    <boxLayout>
-      <name>layout</name>
-      <autoHeight v="true" />
-    </boxLayout>
-  </layout>
-  <children>
-    <genericViewTemplate>
-      <name>Generic</name>
-      <isEditable v="false" />
-      <fields>
-        <entityFieldLink>
-          <name>1eb5807a-f82a-419b-bd7b-a020b7a6e778</name>
-          <entityField>alreadyMarked</entityField>
-        </entityFieldLink>
-      </fields>
-    </genericViewTemplate>
-  </children>
-</neonView>
diff --git a/neonView/DSGVOConfigurationFilter_view/DSGVOConfigurationFilter_view.aod b/neonView/DSGVOConfigurationFilter_view/DSGVOConfigurationFilter_view.aod
index fbc0eaaec35..15549fcdce6 100644
--- a/neonView/DSGVOConfigurationFilter_view/DSGVOConfigurationFilter_view.aod
+++ b/neonView/DSGVOConfigurationFilter_view/DSGVOConfigurationFilter_view.aod
@@ -4,21 +4,21 @@
   <majorModelMode>DISTRIBUTED</majorModelMode>
   <filterable v="true" />
   <layout>
-    <headerFooterLayout>
+    <boxLayout>
       <name>layout</name>
-      <header>2706fe93-0710-4d75-8cbb-c128676e66c5</header>
-    </headerFooterLayout>
+      <direction>HORIZONTAL</direction>
+    </boxLayout>
   </layout>
   <children>
     <neonViewReference>
       <name>2706fe93-0710-4d75-8cbb-c128676e66c5</name>
       <entityField>#ENTITY</entityField>
-      <view>DSGVOConfigurationFilterHeader_view</view>
+      <view>DSGVOConfigurationFilterDeleteFlag_view</view>
     </neonViewReference>
     <neonViewReference>
       <name>1fff34b8-e5d3-4829-be06-dd87f1177408</name>
       <entityField>#ENTITY</entityField>
-      <view>DSGVOConfigurationFilterFooter_view</view>
+      <view>DSGVOConfigurationFilterAttribute_view</view>
     </neonViewReference>
   </children>
 </neonView>
diff --git a/neonView/DSGVODeleteFlagFilter_view/DSGVODeleteFlagFilter_view.aod b/neonView/DSGVODeleteFlagFilter_view/DSGVODeleteFlagFilter_view.aod
index a15dc8d1a8c..a4e8b85f903 100644
--- a/neonView/DSGVODeleteFlagFilter_view/DSGVODeleteFlagFilter_view.aod
+++ b/neonView/DSGVODeleteFlagFilter_view/DSGVODeleteFlagFilter_view.aod
@@ -23,6 +23,10 @@
           <name>68b05f9f-d50f-4fe8-89ec-fe1347008417</name>
           <entityField>DATE_NEW</entityField>
         </neonTableColumn>
+        <neonTableColumn>
+          <name>0958a3b3-4008-4252-a501-0f8a2b943b27</name>
+          <entityField>USER_NEW</entityField>
+        </neonTableColumn>
       </columns>
     </tableViewTemplate>
   </children>
diff --git a/process/ClassificationUpdate_lib/process.js b/process/ClassificationUpdate_lib/process.js
index e7b85ee4058..53e964a2aee 100644
--- a/process/ClassificationUpdate_lib/process.js
+++ b/process/ClassificationUpdate_lib/process.js
@@ -1043,6 +1043,7 @@ ClassificationUpdateHelper._buildFilteredRecsObject = function(pClassificationTy
                                             .leftJoin("CLASSIFICATIONSTORAGE", "CLASSIFICATIONSTORAGE.OBJECT_ROWID = CONTACT.CONTACTID")
                                             .where(db.toFilterCondition(JSON.stringify(filter), "Organisation_entity"))
                                             .and("ORGANISATION.ORGANISATIONID", OrgUtils.getPrivateOrganisationId(), SqlBuilder.NOT_EQUAL())
+                                            .and("ORGANISATION.ORGANISATIONID", OrgUtils.getDSGVOAnonymisierungsOrganisationId(), SqlBuilder.NOT_EQUAL())
                                             .table();
                         }
                         else if (currentObjectType == "Salesproject")
diff --git a/process/Contact_lib/process.js b/process/Contact_lib/process.js
index 4d6ad17a8db..359de1018a3 100644
--- a/process/Contact_lib/process.js
+++ b/process/Contact_lib/process.js
@@ -1,3 +1,4 @@
+import("Organisation_lib");
 import("KeywordRegistry_basic");
 import("MarketingCondition_lib");
 import("Keyword_lib");
@@ -107,9 +108,14 @@ ContactUtils.getResolvingDisplaySubSql = function(pContactIdField, pIncludeOrgan
 ContactUtils.validateIfAlreadyExists = function(pPersonId, pOrganisationId, pOwnContactId)
 {
     if (!pPersonId)
-        return null;
+    {
+        return null;  
+    }
+        
     if (pOrganisationId == "")
-        pOrganisationId = "0";
+    {
+        pOrganisationId = OrgUtils.getPrivateOrganisationId();
+    }
 
     var alreadyExistantContactId = newSelect("CONTACT.CONTACTID")
         .from("CONTACT")
@@ -120,10 +126,16 @@ ContactUtils.validateIfAlreadyExists = function(pPersonId, pOrganisationId, pOwn
         .cell();
         
     if (alreadyExistantContactId)
-        if (pOrganisationId.trim() == "0")
+    {
+        if (OrgUtils.isPrivateOrganisationId(pOrganisationId))
+        {
             return translate.text("This private person doeas already exist and can not be created once more.");
+        }
         else
+        {
             return translate.text("This combination of person and organisation does already exist and can not be created once more.");
+        } 
+    }
     
     return null;
 };
@@ -302,13 +314,13 @@ ContactUtils.getContactTypeByPersOrg = function(pPersonId, pOrganisationId)
     }
     else
     {
-        if (pOrganisationId.replace(/\s/g,"") == "0" )
+        if (OrgUtils.isPrivateOrganisationId(pOrganisationId))
         {
-            return 2; // Privatperson da PERSON_ID nicht leer und ORGANISATION_ID.trim() = '0'
+            return 2; // Privatperson da PERSON_ID nicht leer und ORGANISATION_ID.trim() = ('0' || '1')
         }
         else
         {
-            return 3; // Person einer Organisation da PERSON_ID nicht leer und ORGANISATION_ID nicht '0'
+            return 3; // Person einer Organisation da PERSON_ID nicht leer und ORGANISATION_ID nicht ('0' || '1')
         }
     }
 }
diff --git a/process/Contract_lib/process.js b/process/Contract_lib/process.js
index ad766aa91e6..ad38e53c467 100644
--- a/process/Contract_lib/process.js
+++ b/process/Contract_lib/process.js
@@ -1,3 +1,5 @@
+import("system.result");
+import("system.tools");
 import("system.vars");
 import("system.util");
 import("system.datetime");
@@ -26,7 +28,8 @@ function ContractUtils() {}
  * 
  * @return {String} next valid contract number
  */
-ContractUtils.getNextContractNumber = function() {
+ContractUtils.getNextContractNumber = function() 
+{
     return NumberSequencingUtils.getNextUniqueNumber("CONTRACTCODE", "CONTRACT");
 }
     
@@ -37,11 +40,13 @@ ContractUtils.getNextContractNumber = function() {
  * 
  * @return {Boolean} passed number is valid
  */
-ContractUtils.validateContractNumber = function(pContractNumber) {
+ContractUtils.validateContractNumber = function(pContractNumber) 
+{
     return NumberSequencingUtils.validateUniqueNumber(pContractNumber, "CONTRACTCODE", "CONTRACT");
 }
     
-ContractUtils.getContractNumberValidationFailString = function() {
+ContractUtils.getContractNumberValidationFailString = function() 
+{
     return translate.text("The contract number already exists!");
 }
 
@@ -57,4 +62,32 @@ ContractUtils.createNewContract = function(pRelationId)
     
  
     neon.openContext("Contract", null, null, neon.OPERATINGSTATE_NEW, params);
-}
\ No newline at end of file
+}
+
+/**
+ * Create a new contract and open the contract context in NEW-mode
+ */
+ContractUtils.makeIsContactWithoutContractsFilterConditionSql = function()
+{
+    var operator = vars.get("$local.operator");
+    var rawvalue = vars.get("$local.rawvalue");
+    var operator2 = null;
+
+    rawvalue = (Utils.toBoolean(rawvalue));
+
+    if(operator == "1" && !rawvalue ||  operator == "2" && rawvalue )
+    {
+        operator2 = SqlBuilder.IN();
+    }
+    else if(operator == "1" && rawvalue ||  operator == "2" && !rawvalue)
+    {
+        operator2 = SqlBuilder.NOT_IN();
+    }
+
+    if (operator2) 
+    {
+        return newWhere("CONTACT.CONTACTID", newSelect("CONTRACT.CONTACT_ID").from("CONTRACT"), operator2).toString();
+    }
+    
+    return newWhere().noResult().toString();
+}
diff --git a/process/DSGVOAnonymize_serverProcess/process.js b/process/DSGVOAnonymize_serverProcess/process.js
index 221517b85f5..f91bf9bd2de 100644
--- a/process/DSGVOAnonymize_serverProcess/process.js
+++ b/process/DSGVOAnonymize_serverProcess/process.js
@@ -1,3 +1,4 @@
+import("Organisation_lib");
 import("system.SQLTYPES");
 import("system.logging");
 import("Sql_lib");
@@ -12,6 +13,7 @@ Notice: The commented Code can be used for some Customers who don't want to dele
 
 var contactIds = [[]];
 var personIds = [[]];
+var binaryIDs = [];
 var loghistoryTabelsContact = ["CONTACT", "COMMUNICATION", "ADDRESS", "AB_ATTRIBUTERELATION"];
 var loghistoryTabelsPerson = ["PERSON"];
 var loghistoryTabelsActivity = ["ACTIVITY", "AB_ATTRIBUTERELATION"];
@@ -83,9 +85,11 @@ if (contacts.length > 0)
                 statements.push(newWhere("ACTIVITY.ACTIVITYID", pActivityIds, SqlBuilder.IN())
                     .buildDeleteStatement(true, "ACTIVITY"));
         
-                statementsSys.push(new SqlBuilder(SqlUtils.getBinariesAlias())
-                    .where("ASYS_BINARIES.ROW_ID", pActivityIds, SqlBuilder.IN(), null)
-                    .buildDeleteStatement(true, "ASYS_BINARIES"));
+                binaryIDs = newSelect(["ASYS_BINARIES.ID"], SqlUtils.getBinariesAlias())
+                .from("ASYS_BINARIES")
+                .where("ASYS_BINARIES.ROW_ID", pActivityIds, SqlBuilder.IN())
+                .and("ASYS_BINARIES.TABLENAME", "ACTIVITY")
+                .arrayColumn().concat(binaryIDs);
         
                 statements.push(newWhere("AB_ATTRIBUTERELATION.OBJECT_ROWID", pActivityIds, SqlBuilder.IN())
                     .buildDeleteStatement(true, "AB_ATTRIBUTERELATION"));
@@ -126,9 +130,11 @@ if (contacts.length > 0)
                 statements.push(newWhere("TASK.TASKID", pTaskIds, SqlBuilder.IN())
                     .buildDeleteStatement(true, "TASK"));
        
-                statementsSys.push(new SqlBuilder(SqlUtils.getBinariesAlias())
-                    .where("ASYS_BINARIES.ROW_ID", pTaskIds, SqlBuilder.IN(), null)
-                    .buildDeleteStatement(true, "ASYS_BINARIES"));
+                binaryIDs = newSelect(["ASYS_BINARIES.ID"], SqlUtils.getBinariesAlias())
+                .from("ASYS_BINARIES")
+                .where("ASYS_BINARIES.ROW_ID", pTaskIds, SqlBuilder.IN())
+                .and("ASYS_BINARIES.TABLENAME", "TASK")
+                .arrayColumn().concat(binaryIDs);
                
                 statements.push(newWhere("AB_LOGHISTORY.TABLENAMEID", pTaskIds, SqlBuilder.IN())
                     .and("AB_LOGHISTORY.TABLENAME", "TASK", SqlBuilder.EQUAL())
@@ -164,6 +170,7 @@ if (contacts.length > 0)
                 "USER_EDIT" : user, 
                 "DATE_EDIT" : today, 
                 "ADDRESS_ID" : null, 
+                "ORGANISATION_ID": OrgUtils.getDSGVOAnonymisierungsOrganisationId(),
                 "STATUS" : $KeywordRegistry.contactStatus$inactive()
             }, "CONTACT"));
         
@@ -187,9 +194,11 @@ if (contacts.length > 0)
         statements.push(newWhere("AB_ATTRIBUTERELATION.OBJECT_ROWID", tempContactIds, SqlBuilder.IN())
             .buildDeleteStatement(true, "AB_ATTRIBUTERELATION"));
             
-        statementsSys.push(new SqlBuilder(SqlUtils.getBinariesAlias())
-            .where("ASYS_BINARIES.ROW_ID", tempContactIds, SqlBuilder.IN(), null)
-            .buildDeleteStatement(true, "ASYS_BINARIES"));
+        binaryIDs = newSelect(["ASYS_BINARIES.ID"], SqlUtils.getBinariesAlias())
+                .from("ASYS_BINARIES")
+                .where("ASYS_BINARIES.ROW_ID", tempContactIds, SqlBuilder.IN())
+                .and("ASYS_BINARIES.TABLENAME", "CONTACT")
+                .arrayColumn().concat(binaryIDs);
         
         statements.push(newWhere("AB_OBJECTRELATION.OBJECT1_ROWID", tempContactIds, SqlBuilder.IN())
             .or("AB_OBJECTRELATION.OBJECT2_ROWID", tempContactIds, SqlBuilder.IN())
@@ -213,7 +222,11 @@ if (contacts.length > 0)
     
     db.execute(statements, "Data_alias_noAudit", 10000000);
     db.execute(statementsAudit, "Data_alias", 10000000);
-    db.execute(statementsSys, SqlUtils.getBinariesAlias(), 10000000);
+    
+    binaryIDs.forEach(function (pId) 
+    {
+        db.deleteBinary(pId, SqlUtils.getBinariesAlias())
+    }); 
 }
 
 logging.log("end anonymization");
\ No newline at end of file
diff --git a/process/DSGVOSetDeleteFlags_serverProcess/process.js b/process/DSGVOSetDeleteFlags_serverProcess/process.js
index 5f21ca346a9..5550e007ff2 100644
--- a/process/DSGVOSetDeleteFlags_serverProcess/process.js
+++ b/process/DSGVOSetDeleteFlags_serverProcess/process.js
@@ -9,10 +9,16 @@ import("system.tools");
 import("system.SQLTYPES");
 import("Util_lib");
 
-let selection = JSON.parse(vars.get("$local.tableSelection"));
 var statements = [];
+let selection;
+let systemUser = "System";
 
-if (vars.get("$local.deleteFlags") == "true")
+if (vars.exists("$local.tableSelection") && vars.get("$local.tableSelection"))
+{
+    selection = JSON.parse(vars.get("$local.tableSelection"));
+}
+
+if (!vars.exists("$local.deleteFlags") || vars.get("$local.deleteFlags") == "true")
 {
     let reasons = newSelect(["DSGVOCONFIGURATION.REASON"])
     .from("DSGVOCONFIGURATION")
@@ -125,7 +131,7 @@ function _insertDeleteFlags (pContactId)
             "DSGVODELETEFLAGID": util.getNewUUID(),
             "REASON": this.reason, 
             "CONTACT_ID" : pContactId, 
-            "USER_NEW": vars.get("$sys.user"), 
+            "USER_NEW": systemUser, 
             "DATE_NEW": vars.get("$sys.date")
         }, "DSGVODELETEFLAG"));
         
diff --git a/process/DataPrivacy_lib/process.js b/process/DataPrivacy_lib/process.js
index dcfac3298e2..10c8ba8c478 100644
--- a/process/DataPrivacy_lib/process.js
+++ b/process/DataPrivacy_lib/process.js
@@ -517,6 +517,7 @@ DataPrivacyUtils.checkAllFilled = function(pContactId)
     var countNotFilled = newSelect("count(*)")
     .from("DSGVO")
     .where("DSGVO.CONTACT_ID", pContactId)
+    .and("DSGVO.DSGVOTYPE", "TYPE_PRIVACY_NOTICE" , SqlBuilder.NOT_EQUAL())
     .and(newWhere()
         .or("STATUORITYSOURCE is null")
         .or("PURPOSE is null")
diff --git a/process/Leadimport_lib/process.js b/process/Leadimport_lib/process.js
index 9d57e38ddd2..afc80c5d4f9 100644
--- a/process/Leadimport_lib/process.js
+++ b/process/Leadimport_lib/process.js
@@ -1,3 +1,4 @@
+import("Organisation_lib");
 import("Attribute_lib");
 import("ExportTemplate_lib");
 import("system.workflow");
@@ -737,7 +738,10 @@ LeadImportUtils.insertLeadAttr  = function(pAttrObject, orgid, persid, pUser, pD
         if (persid != "")
         {
             attrValues[0] = "Person";
-            if (orgid == "")	orgid = "0";  // Private
+            if (orgid == "") 
+            {
+                orgid = OrgUtils.getPrivateOrganisationId();  // Private
+            }	
             attrValues[7] = newSelect("CONTACT.CONTACTID")
                                 .from("CONTACT")
                                 .where("CONTACT.ORGANISATION_ID", orgid)
diff --git a/process/Organisation_lib/process.js b/process/Organisation_lib/process.js
index 8542b8c970b..e0f30964498 100644
--- a/process/Organisation_lib/process.js
+++ b/process/Organisation_lib/process.js
@@ -32,7 +32,7 @@ function OrgUtils() {}//TODO: there exsits a OrgUtils and OrganisationUtils, thi
 OrgUtils.isPrivateOrganisationId = function(pOrganisationId)
 {
     //TODO: use this function everywhere instead of manual checks
-    return pOrganisationId.trim() == OrgUtils.getPrivateOrganisationId();
+    return pOrganisationId.trim() == OrgUtils.getPrivateOrganisationId() || pOrganisationId.trim() == OrgUtils.getDSGVOAnonymisierungsOrganisationId();
 }
 
 /**
@@ -45,7 +45,7 @@ OrgUtils.isPrivateOrganisationId = function(pOrganisationId)
 OrgUtils.isPrivateOrganisationContactId = function(pOrganisationContactId)
 {
     //contactid and organisationid in private dummy are equal, so it's okay to check the orgnisation-contactid against the orgnisationid
-    return pOrganisationContactId.trim() == OrgUtils.getPrivateOrganisationId();
+    return pOrganisationContactId.trim() == OrgUtils.getPrivateOrganisationId()|| pOrganisationContactId.trim() == OrgUtils.getDSGVOAnonymisierungsOrganisationId();
 }
 
 /**
@@ -59,6 +59,16 @@ OrgUtils.getPrivateOrganisationId = function()
     return "0";
 }
 
+/**
+ * returns the image for a organisation
+ *
+ * @return {String} hard coded organisationid of the dummy organisation "DSGVO-Anonymisierung"
+ */
+OrgUtils.getDSGVOAnonymisierungsOrganisationId = function()
+{
+    return "1";
+}
+
 /**
  * returns the image for a organisation
  *
-- 
GitLab