From 5492fd23dec25d7aeb6e45eca00c17ab3afa9e94 Mon Sep 17 00:00:00 2001 From: "d.buechler" <d.buechler@adito.de> Date: Tue, 13 Aug 2019 10:32:19 +0200 Subject: [PATCH] Es werden keine Kontakte mehr im Dublettenreiter angezeigt, wenn es keine Dubletten gibt. --- .../onlyshowcontactids_param/valueProcess.js | 20 ++++++++++++++----- .../recordcontainers/db/conditionProcess.js | 8 +++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/entity/Person_entity/entityfields/selfduplicates/children/onlyshowcontactids_param/valueProcess.js b/entity/Person_entity/entityfields/selfduplicates/children/onlyshowcontactids_param/valueProcess.js index 9bacd4c3ef..0d12ba7897 100644 --- a/entity/Person_entity/entityfields/selfduplicates/children/onlyshowcontactids_param/valueProcess.js +++ b/entity/Person_entity/entityfields/selfduplicates/children/onlyshowcontactids_param/valueProcess.js @@ -3,9 +3,19 @@ import("system.vars"); import("DuplicateScanner_lib"); import("system.result"); - let contactIdToCheck = vars.get("$field.CONTACTID"); -logging.log("im person consumer -> " + contactIdToCheck ); -let test = JSON.stringify(DuplicateScannerUtils.GetCachedDuplicatesForContactId(contactIdToCheck)) -logging.log("test -> " + test); - result.string(test); \ No newline at end of file + +let duplicateIds = DuplicateScannerUtils.GetCachedDuplicatesForContactId(contactIdToCheck); + +/* + * To achieve that if there are no duplicates, no contacts should be shown and therefore returned by the + * recordcontainer, a "nonsense" id gets returned. It then is used in the conditionProcess. + * Because of its invalidity, no records are shown. +*/ +logging.log("duplicateIds -> " + duplicateIds); +logging.log("duplicateIds -> " + duplicateIds.length); + +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/recordcontainers/db/conditionProcess.js b/entity/Person_entity/recordcontainers/db/conditionProcess.js index dc8501cfa3..d2f23d6e22 100644 --- a/entity/Person_entity/recordcontainers/db/conditionProcess.js +++ b/entity/Person_entity/recordcontainers/db/conditionProcess.js @@ -12,9 +12,6 @@ var onlyShowContactIds = JSON.parse(vars.get("$param.OnlyShowContactIds_param")) var additionalCondition = SqlCondition.begin(); let alternativeCondition = "1 = 1"; -logging.log(" onlyShowContactIds-> " + onlyShowContactIds); - - if (vars.exists("$param.ExcludedContactIds_param") && vars.get("$param.ExcludedContactIds_param")) { var excludedContacts = JSON.parse(vars.getString("$param.ExcludedContactIds_param")); @@ -27,11 +24,12 @@ if (vars.exists("$param.ExcludedContactIds_param") && vars.get("$param.ExcludedC cond.andSqlCondition(additionalCondition, "1=1"); } - -if(onlyShowContactIds != null || onlyShowContactIds.length != 0) +if(onlyShowContactIds != null && onlyShowContactIds.length > 0) { + logging.log("hallo -> "); onlyShowContactIds.forEach(function(pContactId) { + logging.log("pContactId -> " + pContactId); additionalCondition.orPrepare("CONTACT.CONTACTID", pContactId); }); -- GitLab