From 52ed732258c260ce45d0621db5e1f42b57b2c624 Mon Sep 17 00:00:00 2001 From: "d.buechler" <d.buechler@adito.de> Date: Fri, 24 Jan 2020 13:08:06 +0100 Subject: [PATCH] =?UTF-8?q?#1048305=20Wenn=20keine=20Konfiguration=20angeg?= =?UTF-8?q?eben=20ist,=20wird=20auch=20nicht=20versucht=20zu=20pr=C3=BCfen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../onlyshowcontactids_param/valueProcess.js | 91 +++++++++--------- .../onlyshowcontactids_param/valueProcess.js | 92 ++++++++++--------- 2 files changed, 97 insertions(+), 86 deletions(-) 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 8c7da5082a..45379fef45 100644 --- a/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js +++ b/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js @@ -10,48 +10,53 @@ let targetEntity = "Organisation_entity"; let valuesToCheck = {}; var entityFieldsToLoad = DuplicateScannerUtils.GetEntityFieldsFromConfig(scannerName, 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 - -vars.get("$field.STANDARD_CITY"); -vars.get("$field.STANDARD_ZIP"); -vars.get("$field.STANDARD_ADDRESS"); - -let field = ''; -let fieldValue = ''; -for (fieldname in entityFieldsToLoad) -{ - field = entityFieldsToLoad[fieldname]; - fieldValue = vars.get("$field." + field); - - if(fieldValue != null && fieldValue != "") - { - valuesToCheck[field] = fieldValue; - } -} - -let scanResults = DuplicateScannerUtils.ScanForDuplicates(scannerName, targetEntity, -valuesToCheck, null); - -let duplicateIds = []; - -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. - for (let i = 0; i < scanResults.length; i++) - { - let duplicateContactId = scanResults[i][indexsearch.FIELD_ID]; - duplicateIds.push(duplicateContactId); - } -} - -/* - * To achieve that if there are no duplicates, no contacts should be shown and therefore returned by the - * recordcontainer, an invalid id gets returned. It then is used in the conditionProcess to load the duplicates. - * Because of its invalidity, no records are shown. -*/ -if(duplicateIds.length == 0) +if(entityFieldsToLoad == null || entityFieldsToLoad.length == 0) result.string(JSON.stringify(["nodata"])); else - result.string(JSON.stringify(duplicateIds)); \ No newline at end of file +{ + //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 + + vars.get("$field.STANDARD_CITY"); + vars.get("$field.STANDARD_ZIP"); + vars.get("$field.STANDARD_ADDRESS"); + + let field = ''; + let fieldValue = ''; + for (fieldname in entityFieldsToLoad) + { + field = entityFieldsToLoad[fieldname]; + fieldValue = vars.get("$field." + field); + + if(fieldValue != null && fieldValue != "") + { + valuesToCheck[field] = fieldValue; + } + } + + let scanResults = DuplicateScannerUtils.ScanForDuplicates(scannerName, targetEntity, + valuesToCheck, null); + + let duplicateIds = []; + + 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. + for (let i = 0; i < scanResults.length; i++) + { + let duplicateContactId = scanResults[i][indexsearch.FIELD_ID]; + duplicateIds.push(duplicateContactId); + } + } + + /* + * To achieve that if there are no duplicates, no contacts should be shown and therefore returned by the + * recordcontainer, an invalid id gets returned. It then is used in the conditionProcess to load the duplicates. + * Because of its invalidity, no records are shown. + */ + if(duplicateIds.length == 0) + result.string(JSON.stringify(["nodata"])); + else + result.string(JSON.stringify(duplicateIds)); +} \ No newline at end of file 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 091706c58d..4d8165c1e4 100644 --- a/entity/Person_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js +++ b/entity/Person_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js @@ -10,51 +10,57 @@ let targetEntity = "Person_entity"; let valuesToCheck = {}; var entityFieldsToLoad = DuplicateScannerUtils.GetEntityFieldsFromConfig(scannerName, 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 - -vars.get("$field.STANDARD_CITY"); -vars.get("$field.STANDARD_ZIP"); -vars.get("$field.STANDARD_ADDRESS"); -vars.get("$field.FIRSTNAME"); -vars.get("$field.LASTNAME"); - - -let field = ''; -let fieldValue = ''; -for (fieldname in entityFieldsToLoad) -{ - field = entityFieldsToLoad[fieldname]; - fieldValue = vars.get("$field." + field); - - if(fieldValue != null && fieldValue != "") - { - valuesToCheck[field] = fieldValue; - } -} +if(entityFieldsToLoad == null || entityFieldsToLoad.length == 0) + result.string(JSON.stringify(["nodata"])); +else +{ + //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 scanResults = DuplicateScannerUtils.ScanForDuplicates(scannerName, targetEntity, -valuesToCheck, null); + vars.get("$field.STANDARD_CITY"); + vars.get("$field.STANDARD_ZIP"); + vars.get("$field.STANDARD_ADDRESS"); + vars.get("$field.FIRSTNAME"); + vars.get("$field.LASTNAME"); -let duplicateIds = []; -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. - for (let i = 0; i < scanResults.length; i++) - { - let duplicateContactId = scanResults[i][indexsearch.FIELD_ID]; - duplicateIds.push(duplicateContactId); - } + let field = ''; + let fieldValue = ''; + for (fieldname in entityFieldsToLoad) + { + field = entityFieldsToLoad[fieldname]; + fieldValue = vars.get("$field." + field); + + if(fieldValue != null && fieldValue != "") + { + valuesToCheck[field] = fieldValue; + } + } + + let scanResults = DuplicateScannerUtils.ScanForDuplicates(scannerName, targetEntity, + valuesToCheck, null); + + let duplicateIds = []; + + 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. + for (let i = 0; i < scanResults.length; i++) + { + let duplicateContactId = scanResults[i][indexsearch.FIELD_ID]; + duplicateIds.push(duplicateContactId); + } + } + + /* + * To achieve that if there are no duplicates, no contacts should be shown and therefore returned by the + * recordcontainer, an invalid id gets returned. It then is used in the conditionProcess to load the duplicates. + * Because of its invalidity, no records are shown. + */ + if(duplicateIds.length == 0) + result.string(JSON.stringify(["nodata"])); + else + result.string(JSON.stringify(duplicateIds)); } -/* - * To achieve that if there are no duplicates, no contacts should be shown and therefore returned by the - * recordcontainer, an invalid id gets returned. It then is used in the conditionProcess to load the duplicates. - * Because of its invalidity, no records are shown. -*/ -if(duplicateIds.length == 0) - result.string(JSON.stringify(["nodata"])); -else - result.string(JSON.stringify(duplicateIds)); \ No newline at end of file -- GitLab