Skip to content
Snippets Groups Projects
Commit 51e95378 authored by Heinz Boesl's avatar Heinz Boesl
Browse files

changes DuplicatesScanner

parent eb249907
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,7 @@
<entityField>#ENTITY</entityField>
<isCreatable v="false" />
<isDeletable v="false" />
<isEditable v="false" />
<isEditable v="true" />
<columns>
<neonTableColumn>
<name>7508e984-6a0b-4ec6-ab49-452e2b54f76d</name>
......
......@@ -361,7 +361,7 @@ DuplicateScannerUtils.ScanRecords = function(pTargetEntity, pTargetRecordsData,
}
let foundDuplicates = _DuplicateScannerUtils._scanForDuplicates(pTargetEntity,
entityFieldValuesRay, pResultFields, pEntityIdField, idValue, pFormatValuesConsumeWebserviceCallback, pUseExternalWebservice, pIndexPattern)
entityFieldValuesRay, pResultFields, idValue, pFormatValuesConsumeWebserviceCallback, pUseExternalWebservice, pIndexPattern)
if(foundDuplicates == null || foundDuplicates.length == 0)
{
......@@ -584,7 +584,7 @@ DuplicateScannerUtils.ScanForDuplicates = function(pFilterName, pTargetEntity, p
let idValue = pValuesToCheck[entityIdField];
return _DuplicateScannerUtils._scanForDuplicates(pTargetEntity,
entityFieldConfigValuesRay, resultFields, entityIdField, idValue,
entityFieldConfigValuesRay, resultFields, idValue,
pFormatValuesConsumeWebserviceCallback, useExternalWebservice, indexPattern)
}
......@@ -897,14 +897,14 @@ _DuplicateScannerUtils._loadEntityIdField = function(pFilterName, pTargetEntity)
* @see DuplicateScannerUtils.ScanForDuplicates for the documentation
*/
_DuplicateScannerUtils._scanForDuplicates = function(pTargetEntity, pEntityFieldConfigValuesRay,
pResultFields, pRecordIdFieldToIgnore, pRecordIdValueToIgnore, pFormatValuesConsumeWebserviceCallback, pUseExternalWebservice, pIndexPattern)
pResultFields, pRecordIdValueToIgnore, pFormatValuesConsumeWebserviceCallback, pUseExternalWebservice, pIndexPattern)
{
//No filterfields/indexpattern => No indexsearch
if(pEntityFieldConfigValuesRay.length < 1 || pIndexPattern == null || pIndexPattern == "")
return null;
let possibleDuplicates = [];
let ignoreSourceRecordPattern = _DuplicateScannerUtils._getIgnoreSourceRecordPattern(pRecordIdFieldToIgnore, pRecordIdValueToIgnore);
let ignoreSourceRecordPattern = _DuplicateScannerUtils._getIgnoreSourceRecordPattern(pRecordIdValueToIgnore);
let indexPatternWithValues = _DuplicateScannerUtils._replacePlaceholderForValuesInPattern(pIndexPattern, pEntityFieldConfigValuesRay);
indexPatternWithValues = ignoreSourceRecordPattern + indexPatternWithValues + ")";
......@@ -990,10 +990,6 @@ _DuplicateScannerUtils._setResultFields = function(pIndexQuery, pResultFields)
resultFields.push(pResultFields[i]);
}
// if(resultIndexFields.length == 0 && resultFields.length == 0)
// pIndexQuery = pIndexQuery.addResultIndexFields([indexsearch.FIELD_ID]);
// else
// {
if(resultIndexFields.length > 0)
pIndexQuery = pIndexQuery.addResultIndexFields(resultIndexFields);
......@@ -1001,8 +997,6 @@ _DuplicateScannerUtils._setResultFields = function(pIndexQuery, pResultFields)
{
pIndexQuery = pIndexQuery.addResultFields(resultFields);
}
// }
return pIndexQuery;
}
......@@ -1077,10 +1071,6 @@ _DuplicateScannerUtils._buildUpdateAttachParticipantsToNewContactQuery = functio
_DuplicateScannerUtils._buildDeleteRemoveObsoleteParticipantsRecordsQuery = function (pTableName, pContactIdColumn, pAssignableIdColumn, pSourceContactId, pTargetContactId, updateStatements)
{
//DELETE FROM CAMPAIGNPARTICIPANT
// WHERE ( CAMPAIGN_ID in (select ab.CAMPAIGN_ID from (select CAMPAIGN_ID, CONTACT_ID from CAMPAIGNPARTICIPANT) ab where ab.CONTACT_ID = '64a51ec3-e75d-4415-8aa2-a00a1e9be0b0') and CAMPAIGN_ID = '51960918-3b24-4bac-8f1c-3892bf210f6d')
var selectAssignableIdsOfTargetContactQuery = newSelect(pAssignableIdColumn)
.from(pTableName)
.where([pTableName, pContactIdColumn], pTargetContactId);
......@@ -1103,7 +1093,7 @@ _DuplicateScannerUtils._buildDeletePersonAndContactQuery = function(pSourcePerso
{
let recordsToDelete = []
recordsToDelete.push(["PERSON", newWhere("PERSON.PERSONID", pSourcePersonId).build()]);
recordsToDelete.push(["CONTACT", newWhere("CONTACT.CONTACTID", pSourcePersonId).build()]);
recordsToDelete.push(["CONTACT", newWhere("CONTACT.CONTACTID", pSourceContactId).build()]);
return recordsToDelete;
}
......@@ -1126,13 +1116,12 @@ _DuplicateScannerUtils._buildDeleteCachedUnrelatedDuplicateQuery = function(pSou
/*
* Creates a pattern which excludes the field and it's value
*
* @param {String} pRecordIdFieldToIgnore Field to be ignored
* @param {String} pRecordIdValueToIgnore The fields value
* @returns {String} Pattern which excludes the gived field in combination with the value
*/
_DuplicateScannerUtils._getIgnoreSourceRecordPattern = function(pRecordIdFieldToIgnore, pRecordIdValueToIgnore)
_DuplicateScannerUtils._getIgnoreSourceRecordPattern = function(pRecordIdValueToIgnore)
{
return "( +( -" + pRecordIdFieldToIgnore.toLowerCase() + "_value:(" + pRecordIdValueToIgnore + ") ) ";
return "( +( -" + indexsearch.FIELD_ID + ":(" + pRecordIdValueToIgnore + ") ) ";
}
_DuplicateScannerUtils._buildUpdateContactIdStatements = function(pTableInfos, pSourceContactId, pTargetContactId)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment