Merge pull request #2033 from JoeMurray/master
[civicrm-core.git] / api / v3 / Contact.php
index 434e11b01b081bc41459fef195a341bf1481e463..423190976a1b184b3d039436e060b4cd232e0840 100644 (file)
@@ -182,7 +182,7 @@ function _civicrm_api3_contact_get_spec(&$params) {
   $params['state_province_id']['title'] = 'Primary Address State Province ID';
   $params['state_province_name']['title'] = 'Primary Address State Province Name';
   $params['state_province']['title'] = 'Primary Address State Province';
-  $params['country_id']['title'] = 'Primary Address State Province ID';
+  $params['country_id']['title'] = 'Primary Address Country ID';
   $params['country']['title'] = 'Primary Address country';
   $params['worldregion_id']['title'] = 'Primary Address World Region ID';
   $params['worldregion']['title'] = 'Primary Address World Region';
@@ -566,6 +566,9 @@ function civicrm_api3_contact_getquick($params) {
       case 'phone':
       case 'email':
         $actualSelectElements[] = $select[] = ($value == 'address') ? $selectText : $value;
+        if ($value == 'phone') {
+          $actualSelectElements[] = $select[] = 'phone_ext';
+        }
         $from[$value] = "LEFT JOIN civicrm_{$value} {$suffix} ON ( cc.id = {$suffix}.contact_id AND {$suffix}.is_primary = 1 ) ";
         break;
 
@@ -646,6 +649,10 @@ function civicrm_api3_contact_getquick($params) {
     }
   }
 
+  if (CRM_Utils_Array::value('contact_sub_type', $params)) {
+    $where .= " AND cc.contact_sub_type = \"{$params['contact_sub_type']}\" ";
+  }
+
   //set default for current_employer or return contact with particular id
   if (CRM_Utils_Array::value('id', $params)) {
     $where .= " AND cc.id = " . (int) $params['id'];