From 53deb0a0eb20d0ad7388641b84fb2e671df4fd12 Mon Sep 17 00:00:00 2001
From: Benjamin Ulrich <b.ulrich@adito.de>
Date: Tue, 18 Feb 2020 10:54:44 +0100
Subject: [PATCH] =?UTF-8?q?[Projekt:=20Entwicklung=20-=20Neon][TicketNr.:?=
 =?UTF-8?q?=201048420][Dublette/=20Kontakt:=20Fehlermeldung=20bei=20Integr?=
 =?UTF-8?q?iere=20ausgew=C3=A4hlten=20in=20aktuellen=20Datensatz]=20[Proje?=
 =?UTF-8?q?kt:=20Entwicklung=20-=20Neon][TicketNr.:=201052262][Firmen=20un?=
 =?UTF-8?q?d=20Personen=20k=C3=B6nnen=20nicht=20gel=C3=B6scht=20werden]=20?=
 =?UTF-8?q?[Projekt:=20Entwicklung=20-=20Neon][TicketNr.:=201048690][Reite?=
 =?UTF-8?q?r=20Beziehungen=20in=20der=20Firma]?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 process/DuplicateScanner_lib/process.js | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/process/DuplicateScanner_lib/process.js b/process/DuplicateScanner_lib/process.js
index f94019bc93..9dd0aa2b77 100644
--- a/process/DuplicateScanner_lib/process.js
+++ b/process/DuplicateScanner_lib/process.js
@@ -59,7 +59,7 @@ DuplicateScannerUtils.DeleteCachedDuplicate = function(pDuplicateId)
                                                         SqlBuilder.IN())
                     .and("DUPLICATECLUSTERS.DUPLICATEID", pDuplicateId, SqlBuilder.NOT_EQUAL());
 
-var test = newSelect("CLUSTERID")
+var clusterIdArray = newSelect("CLUSTERID")
                     .from("DUPLICATECLUSTERS")
                     .where("DUPLICATECLUSTERS.CLUSTERID", newSelect("CLUSTERID")
                                                             .from("DUPLICATECLUSTERS")
@@ -67,20 +67,11 @@ var test = newSelect("CLUSTERID")
                                                         SqlBuilder.IN())
                     .and("DUPLICATECLUSTERS.DUPLICATEID", pDuplicateId, SqlBuilder.NOT_EQUAL())
                     .groupBy("CLUSTERID");
-    
-    var so = "select count(ID),( select CLUSTERID from DUPLICATECLUSTERS)"
-+ " from DUPLICATECLUSTERS where DUPLICATECLUSTERS.CLUSTERID in"
-+ " (select CLUSTERID from DUPLICATECLUSTERS where(DUPLICATECLUSTERS.DUPLICATEID = ('" + pDuplicateId + "')))"
-+ " and("
-+ " DUPLICATECLUSTERS.DUPLICATEID <> ('" + pDuplicateId + "')"
-+ " )"
-+ " group by CLUSTERID"
 
 
     var countAndClusterId = query.arrayRow();
-    var testundso = test.arrayRow()
     let countDuplicatesInClusterWithoutParameterId = countAndClusterId[0];
-    let clusterId = testundso[0];
+    let clusterId = clusterIdArray[0];
 
     //If only one duplicate would be remaining,
     //the whole cluster has to be deleted because there are no more duplicates.
-- 
GitLab