diff --git a/modules/Vtiger/models/FindDuplicate.php b/modules/Vtiger/models/FindDuplicate.php index 2537065378096e339b009c29976c8b26c26ee62f..a916c72db6cb14bf899edb42e43735cc35d60bb6 100644 --- a/modules/Vtiger/models/FindDuplicate.php +++ b/modules/Vtiger/models/FindDuplicate.php @@ -68,7 +68,10 @@ class Vtiger_FindDuplicate_Model extends Vtiger_Base_Model { $groupRecordCount = 0; $entries = array(); for($i=0; $i<$rows; $i++) { - $entries[] = $db->query_result_rowdata($result, $i); + // row will have value with (index and column names) + $row = $db->query_result_rowdata($result, $i); + // we should discard values with index for comparisions + $entries[] = array_filter($row, function($k) { return !is_numeric($k); }, ARRAY_FILTER_USE_KEY); } $paging->calculatePageRange($entries); @@ -85,9 +88,17 @@ class Vtiger_FindDuplicate_Model extends Vtiger_Base_Model { for ($i=0; $i<$rows; $i++) { $row = $entries[$i]; if($i != 0) { - $slicedArray = array_slice($row, 2); + // make copy of current row + $slicedArray = array_slice($row, 0); + + // prepare for map comparisions array_walk($temp, 'lower_array'); array_walk($slicedArray, 'lower_array'); + unset($temp["recordid"]); // remove id which will obviously vary. + unset($slicedArray["recordid"]); + + // if there is any value difference between (temp = prev) and (slicedArray = current) + // group them separately. $arrDiff = array_diff($temp, $slicedArray); if(php7_count($arrDiff) > 0) { $groupCount++; @@ -186,4 +197,4 @@ class Vtiger_FindDuplicate_Model extends Vtiger_Base_Model { return $recordIds; } -} \ No newline at end of file +}