From cf3d3207f9079a0508f03935faa8724c5a0115fe Mon Sep 17 00:00:00 2001 From: Alok Patel Date: Thu, 20 Dec 2018 14:58:22 +0530 Subject: [PATCH] GREENS-201: Added Find contacts button. GREENS-202: Removed second contact filter field. --- CRM/Contact/Page/DedupeException.php | 16 ++------ .../CRM/Contact/Page/DedupeException.tpl | 37 ++++++++----------- 2 files changed, 20 insertions(+), 33 deletions(-) diff --git a/CRM/Contact/Page/DedupeException.php b/CRM/Contact/Page/DedupeException.php index ec8b4f60bd..8b47b516e4 100644 --- a/CRM/Contact/Page/DedupeException.php +++ b/CRM/Contact/Page/DedupeException.php @@ -56,14 +56,12 @@ class CRM_Contact_Page_DedupeException extends CRM_Core_Page { $params = array(); $contactOneQ = CRM_Utils_Request::retrieve('crmContact1Q', 'String'); - $contactTwoQ = CRM_Utils_Request::retrieve('crmContact2Q', 'String'); if ($contactOneQ) { $params['contact_id1.display_name'] = array('LIKE' => '%' . $contactOneQ . '%'); - } + $params['contact_id2.display_name'] = array('LIKE' => '%' . $contactOneQ . '%'); - if ($contactTwoQ) { - $params['contact_id2.display_name'] = array('LIKE' => '%' . $contactTwoQ . '%'); + $params['options']['or'] = [["contact_id1.display_name", "contact_id2.display_name"]]; } $totalitems = civicrm_api3('Exception', "getcount", $params); @@ -88,17 +86,12 @@ class CRM_Contact_Page_DedupeException extends CRM_Core_Page { protected function getExceptions() { list($offset, $limit) = $this->_pager->getOffsetAndRowCount(); $contactOneQ = CRM_Utils_Request::retrieve('crmContact1Q', 'String'); - $contactTwoQ = CRM_Utils_Request::retrieve('crmContact2Q', 'String'); if (!$contactOneQ) { $contactOneQ = ''; } - if (!$contactTwoQ) { - $contactTwoQ = ''; - } $this->assign('searchcontact1', $contactOneQ); - $this->assign('searchcontact2', $contactTwoQ); $params = array( "options" => array('limit' => $limit, 'offset' => $offset), @@ -107,10 +100,9 @@ class CRM_Contact_Page_DedupeException extends CRM_Core_Page { if ($contactOneQ != '') { $params['contact_id1.display_name'] = array('LIKE' => '%' . $contactOneQ . '%'); - } + $params['contact_id2.display_name'] = array('LIKE' => '%' . $contactOneQ . '%'); - if ($contactTwoQ != '') { - $params['contact_id2.display_name'] = array('LIKE' => '%' . $contactTwoQ . '%'); + $params['options']['or'] = [["contact_id1.display_name", "contact_id2.display_name"]]; } $exceptions = civicrm_api3("Exception", "get", $params); diff --git a/templates/CRM/Contact/Page/DedupeException.tpl b/templates/CRM/Contact/Page/DedupeException.tpl index ec358547ad..2b4c346276 100644 --- a/templates/CRM/Contact/Page/DedupeException.tpl +++ b/templates/CRM/Contact/Page/DedupeException.tpl @@ -27,18 +27,20 @@ {ts}Filter Contacts{/ts}
- - - - - -
-
- -
-
- -
+
+ + + + + +
+
+ +
+
@@ -108,7 +110,8 @@ var timer = null; // apply the search - $('#searchOptions input').on( 'keydown', function () { + $('.filtercontacts').on( 'click', function (e) { + e.preventDefault(); clearTimeout(timer); timer = setTimeout(updateTable, 500) }); @@ -116,7 +119,6 @@ function updateTable() { var contact1term = $('#search-contact1').val(); - var contact2term = $('#search-contact2').val(); currentLocation = currentLocation.replace(/crmPID=\d+/, 'crmPID=' + 0); @@ -127,13 +129,6 @@ currentLocation += '&crmContact1Q='+contact1term; } - if (currentLocation.indexOf('crmContact2Q') !== -1) { - currentLocation = currentLocation.replace(/crmContact2Q=\w*/, 'crmContact2Q=' + contact2term); - } - else { - currentLocation += '&crmContact2Q='+contact2term; - } - refresh(currentLocation); } -- 2.25.1