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 9bacd4c3ef26280afb97133b752f99ad33c01c46..0d12ba78972752c64fb3be7f6a02e448b38fcf65 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 dc8501cfa30968dc34190525d0341e6fcd44f021..d2f23d6e2221d533d7ec90f23241ba5a667cac52 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); });