diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod index fa429536f9db0f8b9ba1fab98c64efb56e268dca..c31e2ab18b5d3d7dbafc491a0f2cf2f7765b4c94 100644 --- a/entity/Organisation_entity/Organisation_entity.aod +++ b/entity/Organisation_entity/Organisation_entity.aod @@ -1045,6 +1045,28 @@ <name>OnlyOwnSupervised_param</name> <expose v="true" /> </entityParameter> + <entityConsumer> + <name>SelfDuplicatesUncached</name> + <dependency> + <name>dependency</name> + <entityName>Organisation_entity</entityName> + <fieldName>SelfDuplicatesProvider</fieldName> + </dependency> + <children> + <entityParameter> + <name>DuplicateActionsControl_param</name> + <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/duplicateactionscontrol_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>DuplicateCurrentContactId_param</name> + <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/duplicatecurrentcontactid_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>OnlyShowContactIds_param</name> + <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/duplicateactionscontrol_param/valueProcess.js b/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/duplicateactionscontrol_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..81570217c3ecd3cf76deb5e14d7ac0a6121a59bb --- /dev/null +++ b/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/duplicateactionscontrol_param/valueProcess.js @@ -0,0 +1,2 @@ +import("system.result"); +result.string("1");//todo use keyword \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/duplicatecurrentcontactid_param/valueProcess.js b/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/duplicatecurrentcontactid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..821415ae694dd9c3d98a7703f4c59b81a37f524b --- /dev/null +++ b/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/duplicatecurrentcontactid_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.vars"); +import("system.result"); +result.string(vars.get("$field.CONTACTID")); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js b/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..0578e1b08ae24d8b311e59f95f2a6d575ce47b9e --- /dev/null +++ b/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js @@ -0,0 +1,56 @@ +import("system.project"); +import("system.indexsearch"); +import("system.logging"); +import("system.vars"); +import("DuplicateScanner_lib"); +import("system.result"); + +let targetEntity = "Organisation_entity"; +let valuesToCheck = {}; +var entityModel = 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 = []; +for (fieldname in entityModel.fields) +{ + field = entityModel.fields[fieldname]; + if(field.fieldType == project.ENTITYFIELDTYPE_FIELD) + { + fieldValue = vars.get("$field." + field.name); + + if(fieldValue != null && fieldValue != "") + { +// logging.log("field.name -> " + field.name); + valuesToCheck[field.name] = fieldValue; +// logging.log("field value -> " + fieldValue); + } + } +} + +let scanResults = DuplicateScannerUtils.ScanForDuplicates("OrganisationDuplicates", targetEntity, +valuesToCheck, null); + +let duplicateIds = []; + +if(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 e6e230e4586c88bdb54b48fdd7c795c95fb79047..476e86c009a244b49af87c73fc1caa006972b953 100644 --- a/entity/Person_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js +++ b/entity/Person_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js @@ -33,14 +33,18 @@ let scanResults = DuplicateScannerUtils.ScanForDuplicates("PersonDuplicates", ta valuesToCheck, null); let duplicateIds = []; -//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++) + +if(scanResults != null) { - let duplicateContactId = scanResults[i][indexsearch.FIELD_ID]; - duplicateIds.push(duplicateContactId); + //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); + } } -logging.log("duplicateIds.length -> " + duplicateIds.length); + /* * 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. diff --git a/neonView/OrganisationMain_view/OrganisationMain_view.aod b/neonView/OrganisationMain_view/OrganisationMain_view.aod index b7faebeb1416f5b51f161b590ba7cf6814d84a67..1acc8fcfd3019b3ec8bfcc253e11075492e329af 100644 --- a/neonView/OrganisationMain_view/OrganisationMain_view.aod +++ b/neonView/OrganisationMain_view/OrganisationMain_view.aod @@ -65,5 +65,10 @@ <entityField>SelfDuplicatesConsumer</entityField> <view>OrganisationFilter_view</view> </neonViewReference> + <neonViewReference> + <name>c84abb91-0af3-42d0-825b-78ea4de324ea</name> + <entityField>SelfDuplicatesUncached</entityField> + <view>OrganisationFilter_view</view> + </neonViewReference> </children> </neonView>