diff --git a/entity/Person_entity/recordcontainers/db/onDBInsert.js b/entity/Person_entity/recordcontainers/db/onDBInsert.js index 24cf1d86f36cadd8dee58580e15c628303b0a7a9..0a1ea849e4507f7e1f552c10898f642d1a7155c4 100644 --- a/entity/Person_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Person_entity/recordcontainers/db/onDBInsert.js @@ -1,3 +1,5 @@ +import("system.translate"); +import("Employee_lib"); import("system.util"); import("system.logging"); import("system.vars"); @@ -45,6 +47,27 @@ if(scanResults.length > 0) let insertCount = DuplicateScannerUtils.CacheNewScanResults(contactId, scanResults, targetEntity); logging.log("insertCount -> " + insertCount); -//todo create notification -//notification.addNotification(util.getNewUUID(), null, null, null, notification., notification.PRIO_NORMAL, 2, notification.STATE_UNSEEN, [user], message, description); + +let userId = EmployeeUtils.getCurrentUserId(); +let caption = translate.text("Duplicates have been found"); +let descriptionText = "%0 duplicates have been identified."; + +if(scanResults.length == 1) + descriptionText = "%0 duplicate has been identified." + +let description = translate.withArguments(descriptionText, [scanResults.length]); + +let notificationConfig = notification.createConfig() + .addUserWithId(userId) + .forcedPriority(notification.PRIO_NORMAL) + .notificationType("_____SYSTEM_NOTIFICATION_MESSAGE") + .initialState(notification.STATE_UNSEEN) + .caption(caption) + .description(description) + .daysToLive(1); + +notification.addNotificationWith(notificationConfig); + +//notification.addNotification(util.getNewUUID(), null, null, null, "_____SYSTEM_NOTIFICATION_MESSAGE", notification.PRIO_NORMAL, 1, notification.STATE_UNSEEN, [EmployeeUtils.getCurrentUserId()], "message", "description"); + } \ No newline at end of file diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index ee0f9cacabdc7d574794f1263ec0782df1899dea..9b604892dac5cb76c222b6b7005a4711bea6b4e9 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -5184,6 +5184,15 @@ <entry> <key>Data block size</key> </entry> + <entry> + <key>%0 duplicate has been identified.</key> + </entry> + <entry> + <key>%0 duplicates have been identified.</key> + </entry> + <entry> + <key>Duplicates have been found</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> <sqlModels> diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index b8fe1b3b4d322f7c24993ffb4ac775d665c9ec85..aacef49ca75874ebe60bc2f267876f3ad87c8dd6 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -6537,6 +6537,18 @@ <key>Data block size</key> <value>Datenblockgröße</value> </entry> + <entry> + <key>%0 duplicate has been identified.</key> + <value>Es wurde %0 Dublette identifiziert.</value> + </entry> + <entry> + <key>%0 duplicates have been identified.</key> + <value>Es wurden %0 Dubletten identifiziert.</value> + </entry> + <entry> + <key>Duplicates have been found</key> + <value>Dubletten gefunden!</value> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index 8c4f9f0883739c2607f97b58fbbb223ffa0df10f..33425616e0556745f8981f90e949323a6b77a6cb 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -5234,6 +5234,15 @@ <entry> <key>Data block size</key> </entry> + <entry> + <key>Duplicates have been found</key> + </entry> + <entry> + <key>%0 duplicates have been identified.</key> + </entry> + <entry> + <key>%0 duplicate has been identified.</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/process/DuplicateScanner_lib/process.js b/process/DuplicateScanner_lib/process.js index c9e8a0da62d501d85e4bf3a04e1908453555f7eb..e574027be229e724618b5c7ebe91190f69d9ee7d 100644 --- a/process/DuplicateScanner_lib/process.js +++ b/process/DuplicateScanner_lib/process.js @@ -432,18 +432,18 @@ pDuplicateFieldsConfig, pResultFields, pUseExternalWebservice, pFormatValuesCons * The contents of the cluster have to be identical, if no fitting cluster could be found an empty string is returned. * * @param {String} pNewRecordId The id of the record which was used to scan for duplicates - * @param {String[]} pDuplicateIds Duplicate ids used to search for a cluster containing them + * @param {String[]} pScanResults The scan results containing the Duplicate ids which are used to search for a cluster containing them * @param {String} pTargetEntity Entity which has been configured * @returns {String} A clusterid if a matching cluster has been found, otherwise "" */ -DuplicateScannerUtils.CacheNewScanResults = function(pNewRecordId, pDuplicateIds, pTargetEntity) +DuplicateScannerUtils.CacheNewScanResults = function(pNewRecordId, pScanResults, pTargetEntity) { 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 < pDuplicateIds.length; i++) + for (let i = 0; i < pScanResults.length; i++) { - let duplicateContactId = pDuplicateIds[i][indexsearch.FIELD_ID]; + let duplicateContactId = pScanResults[i][indexsearch.FIELD_ID]; duplicateIds.push(duplicateContactId); }