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

small adjustments DuplicatsScanner

parent 3bb7ed61
No related branches found
No related tags found
No related merge requests found
...@@ -1388,15 +1388,15 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact ...@@ -1388,15 +1388,15 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
<expression>%aditoprj%/entity/Person_entity/recordcontainers/db/recordfieldmappings/commrestrictions_active.value/expression.js</expression> <expression>%aditoprj%/entity/Person_entity/recordcontainers/db/recordfieldmappings/commrestrictions_active.value/expression.js</expression>
</dbRecordFieldMapping> </dbRecordFieldMapping>
<dbRecordFieldMapping> <dbRecordFieldMapping>
<name>STANDRAD_ADDRESS.value</name> <name>STANDARD_ADDRESS.value</name>
<recordfield>ADDRESS.ADDRESS</recordfield> <recordfield>ADDRESS.ADDRESS</recordfield>
</dbRecordFieldMapping> </dbRecordFieldMapping>
<dbRecordFieldMapping> <dbRecordFieldMapping>
<name>STANDRAD_CITY.value</name> <name>STANDARD_CITY.value</name>
<recordfield>ADDRESS.CITY</recordfield> <recordfield>ADDRESS.CITY</recordfield>
</dbRecordFieldMapping> </dbRecordFieldMapping>
<dbRecordFieldMapping> <dbRecordFieldMapping>
<name>STANDRAD_ZIP.value</name> <name>STANDARD_ZIP.value</name>
<recordfield>ADDRESS.ZIP</recordfield> <recordfield>ADDRESS.ZIP</recordfield>
</dbRecordFieldMapping> </dbRecordFieldMapping>
</recordFieldMappings> </recordFieldMappings>
...@@ -1455,7 +1455,12 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact ...@@ -1455,7 +1455,12 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
<indexFieldType>PROPER_NAME</indexFieldType> <indexFieldType>PROPER_NAME</indexFieldType>
</indexRecordFieldMapping> </indexRecordFieldMapping>
<indexRecordFieldMapping> <indexRecordFieldMapping>
<name>STANDARD_ADDRESS.displayValue</name> <name>STANDARD_ADDRESS.value</name>
<indexFieldType>ADDRESS</indexFieldType>
<additionalFieldNameAliases>
<element>address</element>
</additionalFieldNameAliases>
<isMultiValued v="true" />
</indexRecordFieldMapping> </indexRecordFieldMapping>
<indexRecordFieldMapping> <indexRecordFieldMapping>
<name>STANDARD_COUNTRY.value</name> <name>STANDARD_COUNTRY.value</name>
...@@ -1467,9 +1472,19 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact ...@@ -1467,9 +1472,19 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
</indexRecordFieldMapping> </indexRecordFieldMapping>
<indexRecordFieldMapping> <indexRecordFieldMapping>
<name>STANDARD_ZIP.value</name> <name>STANDARD_ZIP.value</name>
<indexFieldType>ADDRESS</indexFieldType>
<additionalFieldNameAliases>
<element>zip</element>
</additionalFieldNameAliases>
<isMultiValued v="true" />
</indexRecordFieldMapping> </indexRecordFieldMapping>
<indexRecordFieldMapping> <indexRecordFieldMapping>
<name>STANDARD_CITY.value</name> <name>STANDARD_CITY.value</name>
<indexFieldType>ADDRESS</indexFieldType>
<additionalFieldNameAliases>
<element>city</element>
</additionalFieldNameAliases>
<isMultiValued v="true" />
</indexRecordFieldMapping> </indexRecordFieldMapping>
<indexRecordFieldMapping> <indexRecordFieldMapping>
<name>STANDARD_EMAIL_COMMUNICATION.value</name> <name>STANDARD_EMAIL_COMMUNICATION.value</name>
......
...@@ -332,7 +332,7 @@ DuplicateScannerUtils.ScanRecords = function(pTargetEntity, pTargetRecordsData, ...@@ -332,7 +332,7 @@ DuplicateScannerUtils.ScanRecords = function(pTargetEntity, pTargetRecordsData,
//If the contact id loading query has no results, stop. //If the contact id loading query has no results, stop.
//No ids should be deleted if an error has been made in this query. //No ids should be deleted if an error has been made in this query.
if(pTargetRecordsData.length <= 0) if(pTargetRecordsData.length <= 0)
return; return foundDuplicateIds;
//First it gets checked if the current id has already been identified. If that's the case it'll continue with the next. //First it gets checked if the current id has already been identified. If that's the case it'll continue with the next.
//Otherwise an object gets build in the form of ["FilterFieldName" = "FilterFieldValueFromQuery"] with which a scan for possible duplicates get's started //Otherwise an object gets build in the form of ["FilterFieldName" = "FilterFieldValueFromQuery"] with which a scan for possible duplicates get's started
...@@ -351,7 +351,7 @@ DuplicateScannerUtils.ScanRecords = function(pTargetEntity, pTargetRecordsData, ...@@ -351,7 +351,7 @@ DuplicateScannerUtils.ScanRecords = function(pTargetEntity, pTargetRecordsData,
} }
let foundDuplicates = _DuplicateScannerUtils._scanForDuplicates(pTargetEntity, let foundDuplicates = _DuplicateScannerUtils._scanForDuplicates(pTargetEntity,
entityFieldValuesRay, pResultFields, pEntityIdField, idValue, pFormatValuesConsumeWebserviceCallback, pUseExternalWebservice, pIndexPattern) entityFieldValuesRay, pResultFields, idValue, pFormatValuesConsumeWebserviceCallback, pUseExternalWebservice, pIndexPattern)
if(foundDuplicates == null || foundDuplicates.length == 0) if(foundDuplicates == null || foundDuplicates.length == 0)
{ {
...@@ -574,7 +574,7 @@ DuplicateScannerUtils.ScanForDuplicates = function(pFilterName, pTargetEntity, p ...@@ -574,7 +574,7 @@ DuplicateScannerUtils.ScanForDuplicates = function(pFilterName, pTargetEntity, p
let idValue = pValuesToCheck[entityIdField]; let idValue = pValuesToCheck[entityIdField];
return _DuplicateScannerUtils._scanForDuplicates(pTargetEntity, return _DuplicateScannerUtils._scanForDuplicates(pTargetEntity,
entityFieldConfigValuesRay, resultFields, entityIdField, idValue, entityFieldConfigValuesRay, resultFields, idValue,
pFormatValuesConsumeWebserviceCallback, useExternalWebservice, indexPattern) pFormatValuesConsumeWebserviceCallback, useExternalWebservice, indexPattern)
} }
...@@ -732,7 +732,7 @@ DuplicateScannerUtils.BuildEntityFieldConfigValueRays = function(pDuplicateField ...@@ -732,7 +732,7 @@ DuplicateScannerUtils.BuildEntityFieldConfigValueRays = function(pDuplicateField
if(entityFieldValue == null) if(entityFieldValue == null)
entityFieldValue = ""; entityFieldValue = "";
else else
entityFieldValue = entityFieldValue.toLowerCase().replace(/[():\.\/!]/gi, ""); entityFieldValue = entityFieldValue.toLowerCase().replace(/[():\.\/!]/gi, "").trim();
let exclude = fieldConfig.exclude; let exclude = fieldConfig.exclude;
if ( exclude ) if ( exclude )
...@@ -748,8 +748,8 @@ DuplicateScannerUtils.BuildEntityFieldConfigValueRays = function(pDuplicateField ...@@ -748,8 +748,8 @@ DuplicateScannerUtils.BuildEntityFieldConfigValueRays = function(pDuplicateField
if ( valuelength ) if ( valuelength )
entityFieldValue = entityFieldValue.substr(0, parseInt(valuelength)) + "*"; entityFieldValue = entityFieldValue.substr(0, parseInt(valuelength)) + "*";
let emptyall = fieldConfig.emptyall; let empty = fieldConfig.empty;
if ( fieldConfig.emptyall && entityFieldValue == "") if ( !empty && entityFieldValue == "")
entityFieldValue = "*"; entityFieldValue = "*";
entityFieldValue = entityFieldValue.trim(); entityFieldValue = entityFieldValue.trim();
...@@ -884,14 +884,14 @@ _DuplicateScannerUtils._loadEntityIdField = function(pFilterName, pTargetEntity) ...@@ -884,14 +884,14 @@ _DuplicateScannerUtils._loadEntityIdField = function(pFilterName, pTargetEntity)
* @see DuplicateScannerUtils.ScanForDuplicates for the documentation * @see DuplicateScannerUtils.ScanForDuplicates for the documentation
*/ */
_DuplicateScannerUtils._scanForDuplicates = function(pTargetEntity, pEntityFieldConfigValuesRay, _DuplicateScannerUtils._scanForDuplicates = function(pTargetEntity, pEntityFieldConfigValuesRay,
pResultFields, pRecordIdFieldToIgnore, pRecordIdValueToIgnore, pFormatValuesConsumeWebserviceCallback, pUseExternalWebservice, pIndexPattern) pResultFields, pRecordIdValueToIgnore, pFormatValuesConsumeWebserviceCallback, pUseExternalWebservice, pIndexPattern)
{ {
//No filterfields/indexpattern => No indexsearch //No filterfields/indexpattern => No indexsearch
if(pEntityFieldConfigValuesRay.length < 1 || pIndexPattern == null || pIndexPattern == "") if(pEntityFieldConfigValuesRay.length < 1 || pIndexPattern == null || pIndexPattern == "")
return null; return null;
let possibleDuplicates = []; let possibleDuplicates = [];
let ignoreSourceRecordPattern = _DuplicateScannerUtils._getIgnoreSourceRecordPattern(pRecordIdFieldToIgnore, pRecordIdValueToIgnore); let ignoreSourceRecordPattern = _DuplicateScannerUtils._getIgnoreSourceRecordPattern(pRecordIdValueToIgnore);
let indexPatternWithValues = _DuplicateScannerUtils._replacePlaceholderForValuesInPattern(pIndexPattern, pEntityFieldConfigValuesRay); let indexPatternWithValues = _DuplicateScannerUtils._replacePlaceholderForValuesInPattern(pIndexPattern, pEntityFieldConfigValuesRay);
indexPatternWithValues = ignoreSourceRecordPattern + indexPatternWithValues + ")"; indexPatternWithValues = ignoreSourceRecordPattern + indexPatternWithValues + ")";
...@@ -1116,13 +1116,12 @@ _DuplicateScannerUtils._buildDeleteCachedUnrelatedDuplicateQuery = function(pSou ...@@ -1116,13 +1116,12 @@ _DuplicateScannerUtils._buildDeleteCachedUnrelatedDuplicateQuery = function(pSou
/* /*
* Creates a pattern which excludes the field and it's value * Creates a pattern which excludes the field and it's value
* *
* @param {String} pRecordIdFieldToIgnore Field to be ignored
* @param {String} pRecordIdValueToIgnore The fields value * @param {String} pRecordIdValueToIgnore The fields value
* @returns {String} Pattern which excludes the gived field in combination with the 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) _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