diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod index 96b76098fde1ff72a627226316fcbca2d88d72cc..5d0a9854f2e80cc4c90d4ed86f57033deba52692 100644 --- a/entity/Organisation_entity/Organisation_entity.aod +++ b/entity/Organisation_entity/Organisation_entity.aod @@ -948,7 +948,6 @@ <entityProvider> <name>SelfDuplicatesProvider</name> <titlePlural>Duplicates</titlePlural> - <recordContainer>index</recordContainer> </entityProvider> <entityParameter> <name>OnlyShowContactIds_param</name> @@ -1022,6 +1021,7 @@ </entityParameter> <entityParameter> <name>DuplicateCurrentContactId_param</name> + <title></title> <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/duplicatecurrentcontactid_param/valueProcess.js</valueProcess> </entityParameter> <entityParameter> 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 fdbb29bfe3953fb655929382d1c4f393330c2d0a..dc76aa3c55e06cac19bd958cb8ddadc9bf8cb66f 100644 --- a/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js +++ b/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js @@ -1,6 +1,5 @@ import("system.project"); import("system.indexsearch"); -import("system.logging"); import("system.vars"); import("DuplicateScanner_lib"); import("system.result"); 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 495e2c4503d7e5d36426e013ac66bf55a049a2d4..298a31152459215443150f749876368fb83b2d09 100644 --- a/entity/Person_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js +++ b/entity/Person_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js @@ -5,65 +5,50 @@ import("system.vars"); import("DuplicateScanner_lib"); import("system.result"); -let scannerName = "PersonDuplicates"; -let targetEntity = "Person_entity"; -let valuesToCheck = {}; +var scannerName = "PersonDuplicates"; +var targetEntity = "Person_entity"; +var valuesToCheck = {}; var entityFieldsToLoad = DuplicateScannerUtils.GetEntityFieldsFromConfig(scannerName, targetEntity); -if(entityFieldsToLoad == null || entityFieldsToLoad.length == 0) - result.string(JSON.stringify(["nodata"])); +var idsForEmptyResult = JSON.stringify(["nodata"]); + +if (entityFieldsToLoad == null || entityFieldsToLoad.length == 0) + result.string(idsForEmptyResult); 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 - vars.get("$field.STANDARD_CITY"); - vars.get("$field.STANDARD_ZIP"); - vars.get("$field.STANDARD_ADDRESS"); - vars.get("$field.FIRSTNAME"); - vars.get("$field.LASTNAME"); - vars.get("$field.PersAddresses.insertedRows") - vars.get("$field.PersAddresses.changedRows") - vars.get("$field.PersAddresses.deletedRows") - - - 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)); -} - + vars.get("$field.STANDARD_CITY"); + vars.get("$field.STANDARD_ZIP"); + vars.get("$field.STANDARD_ADDRESS"); + vars.get("$field.FIRSTNAME"); + vars.get("$field.LASTNAME"); + vars.get("$field.PersAddresses.insertedRows") + vars.get("$field.PersAddresses.changedRows") + vars.get("$field.PersAddresses.deletedRows") + + for (let fieldname in entityFieldsToLoad) + { + var field = entityFieldsToLoad[fieldname]; + var fieldValue = vars.get("$field." + field); + if (fieldValue) + valuesToCheck[field] = fieldValue; + } + + var scanResults = DuplicateScannerUtils.ScanForDuplicates(scannerName, targetEntity, valuesToCheck, null) || []; + var duplicateIds = scanResults.map(function (duplicate) + { + return duplicate[indexsearch.FIELD_ID]; + }); + + /* + * 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(idsForEmptyResult); + else + result.string(JSON.stringify(duplicateIds)); +} \ No newline at end of file diff --git a/neonView/OrganisationEdit_view/OrganisationEdit_view.aod b/neonView/OrganisationEdit_view/OrganisationEdit_view.aod index bf0627608ee7b8dc96295b24265ec8512dd3ca1c..81ab662529757a2607ec8dc7421c97a730400b11 100644 --- a/neonView/OrganisationEdit_view/OrganisationEdit_view.aod +++ b/neonView/OrganisationEdit_view/OrganisationEdit_view.aod @@ -11,6 +11,11 @@ </boxLayout> </layout> <children> + <neonViewReference> + <name>f2fa0351-15af-4d1c-b7dd-0e42d9c7889f</name> + <entityField>SelfDuplicatesUncached</entityField> + <view>OrganisationDuplicateEditview_view</view> + </neonViewReference> <genericViewTemplate> <name>Edit</name> <editMode v="true" />