Skip to content

Commit 4f5a628

Browse files
Merge pull request civicrm#7 from Kajakaran/dedupe-fixes
General search fix and if conflict is present in url then show 'conflict' column in search results
2 parents 43532d3 + 1595de3 commit 4f5a628

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

CRM/Contact/Page/AJAX.php

+15
Original file line numberDiff line numberDiff line change
@@ -781,8 +781,10 @@ static function getDedupes() {
781781

782782
$select = array(
783783
'cc1.contact_type' => 'src_contact_type',
784+
'cc1.display_name' => 'src_display_name',
784785
'cc1.contact_sub_type'=> 'src_contact_sub_type',
785786
'cc2.contact_type' => 'dst_contact_type',
787+
'cc2.display_name' => 'dst_display_name',
786788
'cc2.contact_sub_type'=> 'dst_contact_sub_type',
787789
'ce1.email' => 'src_email',
788790
'ce2.email' => 'dst_email',
@@ -840,6 +842,19 @@ static function getDedupes() {
840842
}
841843
}
842844

845+
$searchData = CRM_Utils_Array::value('search', $_REQUEST);
846+
847+
if (!empty($searchData['value'])) {
848+
$where .= " AND
849+
((cc1.display_name LIKE '%{$searchData['value']}%') OR
850+
(ce1.email LIKE '%{$searchData['value']}%') OR
851+
(ca1.street_address LIKE '%{$searchData['value']}%') OR
852+
(ca1.postal_code LIKE '%{$searchData['value']}%') OR
853+
(cc2.display_name LIKE '%{$searchData['value']}%') OR
854+
(ce2.email LIKE '%{$searchData['value']}%') OR
855+
(ca2.street_address LIKE '%{$searchData['value']}%') OR
856+
(ca2.postal_code LIKE '%{$searchData['value']}%')) ";
857+
}
843858
$dupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $where, $offset, $rowCount, $select);
844859
$iFilteredTotal = CRM_Core_DAO::singleValueQuery("SELECT FOUND_ROWS()");
845860

templates/CRM/Contact/Page/DedupeFind.tpl

+7
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@
180180
<script type="text/javascript">
181181
CRM.$(function($) {
182182
var sourceUrl = {/literal}'{$sourceUrl}'{literal};
183+
var context = {/literal}'{$context}'{literal};
183184
$('#dupePairs').dataTable({
184185
//"scrollX": true, // doesn't work with hover popup for for icons
185186
"lengthMenu": [[10, 25, 50, 100, 1000, 2000, -1], [10, 25, 50, 100, 1000, 2000, "All"]],
@@ -262,6 +263,12 @@ CRM.$(function($) {
262263
column.visible( ! column.visible() );
263264
}
264265
});
266+
267+
if(context == 'conflicts') {
268+
$('#conflicts').attr('checked', true);
269+
var column = table.column( $('#conflicts').attr('data-column-main') );
270+
column.visible( ! column.visible() );
271+
}
265272
});
266273

267274
function toggleDedupeSelect(element) {

0 commit comments

Comments
 (0)