From c3087e93b4c083e1e66df84f21c1f29e837208a7 Mon Sep 17 00:00:00 2001
From: "h.boesl" <h.boesl@adito.de>
Date: Tue, 3 Dec 2019 15:56:41 +0100
Subject: [PATCH] Integration - ZIP, CITY and ADDRESS

---
 entity/Organisation_entity/Organisation_entity.aod |  2 --
 .../onlyshowcontactids_param/valueProcess.js       | 10 +++++-----
 .../onlyshowcontactids_param/valueProcess.js       | 14 ++++++++------
 process/DuplicateScanner_lib/process.js            | 10 +++++++---
 4 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod
index 81a15ddda3..a903792d97 100644
--- a/entity/Organisation_entity/Organisation_entity.aod
+++ b/entity/Organisation_entity/Organisation_entity.aod
@@ -1139,13 +1139,11 @@
         </dbRecordFieldMapping>
         <dbRecordFieldMapping>
           <name>STANDARD_EMAIL_COMMUNICATION.displayValue</name>
-          <recordfield></recordfield>
           <expression>%aditoprj%/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/standard_email_communication.displayvalue/expression.js</expression>
           <isFilterable v="true" />
         </dbRecordFieldMapping>
         <dbRecordFieldMapping>
           <name>STANDARD_PHONE_COMMUNICATION.displayValue</name>
-          <recordfield></recordfield>
           <expression>%aditoprj%/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/standard_phone_communication.displayvalue/expression.js</expression>
           <isFilterable v="true" />
         </dbRecordFieldMapping>
diff --git a/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js b/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js
index aaaeaa3d0f..73bdcd3951 100644
--- a/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js
+++ b/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js
@@ -12,15 +12,15 @@ var entityFieldsToLoad = DuplicateScannerUtils.GetEntityFieldsFromConfig(scanner
 
  //Read the values of all available entity fields and write the fieldname7value combination
  //as key/value pairs into an object. This is used to trigger the scan for duplicates
-let fieldValue = "";
-let entityFields = [];
 
-vars.get("$field.STANDARD_CITY")
+vars.get("$field.STANDARD_CITY");
+vars.get("$field.STANDARD_ZIP");
+vars.get("$field.STANDARD_ADDRESS");
 
 for (fieldname in entityFieldsToLoad) 
 { 
-    field = entityFieldsToLoad[fieldname]; 
-    fieldValue = vars.get("$field." + field);
+    let field = entityFieldsToLoad[fieldname]; 
+    let fieldValue = vars.get("$field." + field);
 
     if(fieldValue != null && fieldValue != "")
     {
diff --git a/entity/Person_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js b/entity/Person_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js
index eaa45a32c9..3a0df6ca06 100644
--- a/entity/Person_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js
+++ b/entity/Person_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js
@@ -9,16 +9,18 @@ let scannerName = "PersonDuplicates";
 let targetEntity = "Person_entity";
 let valuesToCheck = {};
 var entityFieldsToLoad = DuplicateScannerUtils.GetEntityFieldsFromConfig(scannerName, targetEntity);
-//project.getEntityStructure(targetEntity);
 
  //Read the values of all available entity fields and write the fieldname7value combination
  //as key/value pairs into an object. This is used to trigger the scan for duplicates
-let fieldValue = "";
-let entityFields = [];
+
+vars.get("$field.STANDARD_CITY");
+vars.get("$field.STANDARD_ZIP");
+vars.get("$field.STANDARD_ADDRESS");
+
 for (fieldname in entityFieldsToLoad) 
 { 
-    field = entityFieldsToLoad[fieldname]; 
-    fieldValue = vars.get("$field." + field);
+    let field = entityFieldsToLoad[fieldname]; 
+    let fieldValue = vars.get("$field." + field);
 
     if(fieldValue != null && fieldValue != "")
     {
@@ -31,7 +33,7 @@ valuesToCheck, null);
 
 let duplicateIds = [];
 
-if(scanResults != null)
+if(scanResults != undefined && scanResults != null)
 {
     //Run thru every duplicate result and read out the id. 
     //Do it now to have a simple array on all usages lateron.
diff --git a/process/DuplicateScanner_lib/process.js b/process/DuplicateScanner_lib/process.js
index 4e06686112..7a07f21ef8 100644
--- a/process/DuplicateScanner_lib/process.js
+++ b/process/DuplicateScanner_lib/process.js
@@ -731,23 +731,27 @@ DuplicateScannerUtils.BuildEntityFieldConfigValueRays = function(pDuplicateField
         let entityFieldValue = pTargetRecordData[entityField];
         if(entityFieldValue == null)
             entityFieldValue = "";
+        else
+            entityFieldValue = entityFieldValue.toLowerCase().replace(/[():\.\/!]/gi, "");
         
         let exclude = fieldConfig.exclude;
         if ( exclude )
         {   
             for(let i = 0; i < exclude.length; i++)
-                entityFieldValue = entityFieldValue.replace(new RegExp(exclude[i], "gi"), "");     
+            {    
+                entityFieldValue = " " + entityFieldValue + " ";
+                entityFieldValue = entityFieldValue.replace(new RegExp( " " + exclude[i] + " ", "gi"), "");
+            }    
         }
         
         let valuelength = fieldConfig.length; 
-
         if ( valuelength )
             entityFieldValue = entityFieldValue.substr(0, parseInt(valuelength)) + "*";
         
         let emptyall = fieldConfig.emptyall; 
         if ( fieldConfig.emptyall && entityFieldValue == "")
             entityFieldValue = "*";
-        
+       
         entityFieldValue = entityFieldValue.trim();
         entityFieldConfigValuesRay.push([pDuplicateFieldsConfig[a], entityFieldValue]);
     }
-- 
GitLab