Skip to content

Commit d4d7340

Browse files
authored
Fix Search for duplicated customers (#475)
* Fix Search for duplicated customers * Apply php-cs-fixer changes --------- Co-authored-by: aryaantony92 <[email protected]>
1 parent 1cb0ba4 commit d4d7340

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/DuplicatesIndex/DefaultMariaDbDuplicatesIndex.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,25 +239,26 @@ public function getPotentialDuplicates($page, $pageSize = 100, $declined = false
239239
$select
240240
->from(self::POTENTIAL_DUPLICATES_TABLE)
241241
->select(
242-
'id',
243-
'duplicateCustomerIds',
244-
'declined',
245-
'fieldCombinations',
246-
'creationDate',
247-
'modificationDate'
242+
self::POTENTIAL_DUPLICATES_TABLE . '.id',
243+
'duplicateCustomerIds',
244+
'declined',
245+
'fieldCombinations',
246+
self::POTENTIAL_DUPLICATES_TABLE . '.creationDate',
247+
self::POTENTIAL_DUPLICATES_TABLE . '.modificationDate'
248248
)
249249
->addOrderBy('id', 'asc');
250250

251-
$idField = Service::getVersionDependentDatabaseColumnName('id');
252251
if (!is_null($filterCustomerList)) {
253252
$query = $filterCustomerList->getQueryBuilder()
254253
->resetQueryPart('select')
255-
->select($idField);
254+
->select('id');
256255
$joinTable = 'object_' . $filterCustomerList->getClassId();
256+
$joinIdField = $joinTable . '.id';
257+
257258
$select
258259
->distinct()
259-
->innerJoin(self::POTENTIAL_DUPLICATES_TABLE, $joinTable, $joinTable, 'FIND_IN_SET('. $idField .', duplicateCustomerIds)')
260-
->andWhere($idField . ' in (' . $query . ')');
260+
->innerJoin(self::POTENTIAL_DUPLICATES_TABLE, $joinTable, $joinTable, 'FIND_IN_SET(' . $joinIdField . ', duplicateCustomerIds)')
261+
->andWhere($joinIdField . ' in (' . $query . ')');
261262
}
262263

263264
if ($declined) {

0 commit comments

Comments
 (0)