Merge pull request #4724 from atif-shaikh/CRM-15598
[civicrm-core.git] / CRM / Contact / BAO / ProximityQuery.php
index 6b58e8fc9fb0c57ef9d0665eaae381510d8f2ace..b5e065df0fa7459126cae5589dd0a9f00ab8562f 100644 (file)
@@ -185,6 +185,14 @@ class CRM_Contact_BAO_ProximityQuery {
     );
   }
 
+  /**
+   * @param $latitude
+   * @param $longitude
+   * @param $distance
+   * @param string $tablePrefix
+   *
+   * @return string
+   */
   static function where($latitude, $longitude, $distance, $tablePrefix = 'civicrm_address') {
     self::initialize();
 
@@ -233,6 +241,12 @@ ACOS(
     return $where;
   }
 
+  /**
+   * @param $query
+   * @param $values
+   *
+   * @throws Exception
+   */
   static function process(&$query, &$values) {
     list($name, $op, $distance, $grouping, $wildcard) = $values;
 
@@ -275,7 +289,7 @@ ACOS(
     if (!isset($proximityAddress['country_id'])) {
       // get it from state if state is present
       if (isset($proximityAddress['state_province_id'])) {
-        $proximityAddress['country_id'] = CRM_Core_PseudoConstant::countryForState($proximityAddress['state_province_id']);
+        $proximityAddress['country_id'] = CRM_Core_PseudoConstant::countryIDForStateID($proximityAddress['state_province_id']);
       }
       elseif (isset($config->defaultContactCountry)) {
         $proximityAddress['country_id'] = $config->defaultContactCountry;
@@ -337,6 +351,9 @@ ACOS(
     return;
   }
 
+  /**
+   * @param $input
+   */
   static function fixInputParams(&$input) {
     foreach ($input as $param) {
       if (CRM_Utils_Array::value('0', $param) == 'prox_distance') {