Skip to content

Commit

Permalink
Merge pull request civicrm#7 from Kajakaran/dedupe-fixes
Browse files Browse the repository at this point in the history
General search fix and if conflict is present in url then show 'conflict' column in search results
  • Loading branch information
deepak-srivastava committed Apr 20, 2015
2 parents 43532d3 + 1595de3 commit 4f5a628
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
15 changes: 15 additions & 0 deletions CRM/Contact/Page/AJAX.php
Original file line number Diff line number Diff line change
Expand Up @@ -781,8 +781,10 @@ static function getDedupes() {

$select = array(
'cc1.contact_type' => 'src_contact_type',
'cc1.display_name' => 'src_display_name',
'cc1.contact_sub_type'=> 'src_contact_sub_type',
'cc2.contact_type' => 'dst_contact_type',
'cc2.display_name' => 'dst_display_name',
'cc2.contact_sub_type'=> 'dst_contact_sub_type',
'ce1.email' => 'src_email',
'ce2.email' => 'dst_email',
Expand Down Expand Up @@ -840,6 +842,19 @@ static function getDedupes() {
}
}

$searchData = CRM_Utils_Array::value('search', $_REQUEST);

if (!empty($searchData['value'])) {
$where .= " AND
((cc1.display_name LIKE '%{$searchData['value']}%') OR
(ce1.email LIKE '%{$searchData['value']}%') OR
(ca1.street_address LIKE '%{$searchData['value']}%') OR
(ca1.postal_code LIKE '%{$searchData['value']}%') OR
(cc2.display_name LIKE '%{$searchData['value']}%') OR
(ce2.email LIKE '%{$searchData['value']}%') OR
(ca2.street_address LIKE '%{$searchData['value']}%') OR
(ca2.postal_code LIKE '%{$searchData['value']}%')) ";
}
$dupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $where, $offset, $rowCount, $select);
$iFilteredTotal = CRM_Core_DAO::singleValueQuery("SELECT FOUND_ROWS()");

Expand Down
7 changes: 7 additions & 0 deletions templates/CRM/Contact/Page/DedupeFind.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@
<script type="text/javascript">
CRM.$(function($) {
var sourceUrl = {/literal}'{$sourceUrl}'{literal};
var context = {/literal}'{$context}'{literal};
$('#dupePairs').dataTable({
//"scrollX": true, // doesn't work with hover popup for for icons
"lengthMenu": [[10, 25, 50, 100, 1000, 2000, -1], [10, 25, 50, 100, 1000, 2000, "All"]],
Expand Down Expand Up @@ -262,6 +263,12 @@ CRM.$(function($) {
column.visible( ! column.visible() );
}
});

if(context == 'conflicts') {
$('#conflicts').attr('checked', true);
var column = table.column( $('#conflicts').attr('data-column-main') );
column.visible( ! column.visible() );
}
});

function toggleDedupeSelect(element) {
Expand Down

0 comments on commit 4f5a628

Please sign in to comment.