/** * @deprecated */ static function getContactList() { // if context is 'customfield' if (CRM_Utils_Array::value('context', $_GET) == 'customfield') { return self::contactReference(); } $params = array('version' => 3, 'check_permissions' => TRUE); // String params // FIXME: param keys don't match input keys, using this array to translate $whitelist = array('s' => 'name', 'fieldName' => 'field_name', 'tableName' => 'table_name', 'context' => 'context', 'rel' => 'rel', 'contact_sub_type' => 'contact_sub_type', 'contact_type' => 'contact_type'); foreach ($whitelist as $key => $param) { if (!empty($_GET[$key])) { $params[$param] = $_GET[$key]; } } //CRM-10687: Allow quicksearch by multiple fields if (!empty($params['field_name'])) { if ($params['field_name'] == 'phone_numeric') { $params['name'] = preg_replace('/[^\\d]/', '', $params['name']); } if (!$params['name']) { CRM_Utils_System::civiExit(); } } // Numeric params $whitelist = array('limit', 'org', 'employee_id', 'cid', 'id', 'cmsuser'); foreach ($whitelist as $key) { if (!empty($_GET[$key]) && is_numeric($_GET[$key])) { $params[$key] = $_GET[$key]; } } $result = civicrm_api('Contact', 'getquick', $params); CRM_Core_Page_AJAX::autocompleteResults(CRM_Utils_Array::value('values', $result), 'data'); }
/** * Function for building EventFee combo box */ function eventFee() { $name = trim(CRM_Utils_Type::escape($_GET['s'], 'String')); if (!$name) { $name = '%'; } $whereClause = "cv.label LIKE '{$name}%' "; $query = "SELECT DISTINCT (\ncv.label\n), cv.id\nFROM civicrm_price_field_value cv\nLEFT JOIN civicrm_price_field cf ON cv.price_field_id = cf.id\nLEFT JOIN civicrm_price_set_entity ce ON ce.price_set_id = cf.price_set_id\nWHERE ce.entity_table = 'civicrm_event' AND {$whereClause}\nGROUP BY cv.label"; $dao = CRM_Core_DAO::executeQuery($query); $results = array(); while ($dao->fetch()) { $results[$dao->id] = $dao->label; } CRM_Core_Page_AJAX::autocompleteResults($results); }
/** * Function to obtain list of permissioned employer for the given contact-id. */ static function getPermissionedEmployer() { $cid = CRM_Utils_Type::escape($_GET['cid'], 'Integer'); $name = trim(CRM_Utils_Type::escape($_GET['s'], 'String')); $name = str_replace('*', '%', $name); $elements = CRM_Contact_BAO_Relationship::getPermissionedEmployer($cid, $name); $results = array(); if (!empty($elements)) { foreach ($elements as $cid => $name) { $results[$cid] = $name['name']; } } CRM_Core_Page_AJAX::autocompleteResults($results); }