From e1b717cb0c7e0775e343139f9ec800848f3b4fff Mon Sep 17 00:00:00 2001 From: Poonam Date: Thu, 13 Feb 2014 11:30:35 +0530 Subject: [PATCH] --Added contact_type parameter for ajax autocomplete field --- CRM/Contact/Page/AJAX.php | 3 ++- api/v3/Contact.php | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CRM/Contact/Page/AJAX.php b/CRM/Contact/Page/AJAX.php index f41d364174..9795ea531b 100644 --- a/CRM/Contact/Page/AJAX.php +++ b/CRM/Contact/Page/AJAX.php @@ -52,7 +52,8 @@ class CRM_Contact_Page_AJAX { 'tableName' => 'table_name', 'context' => 'context', 'rel' => 'rel', - 'contact_sub_type' => 'contact_sub_type' + 'contact_sub_type' => 'contact_sub_type', + 'contact_type' => 'contact_type' ); foreach ($whitelist as $key => $param) { if (!empty($_GET[$key])) { diff --git a/api/v3/Contact.php b/api/v3/Contact.php index 4053530654..56f49a6bf7 100644 --- a/api/v3/Contact.php +++ b/api/v3/Contact.php @@ -650,6 +650,11 @@ function civicrm_api3_contact_getquick($params) { $where .= " AND cc.contact_sub_type = '{$contactSubType}'"; } + if (!empty($params['contact_type'])) { + $contactType = CRM_Utils_Type::escape($params['contact_type'], 'String'); + $where .= " AND cc.contact_type LIKE '{$contactType}'"; + } + //set default for current_employer or return contact with particular id if (!empty($params['id'])) { $where .= " AND cc.id = " . (int) $params['id']; -- 2.25.1