Merge pull request #4724 from atif-shaikh/CRM-15598
[civicrm-core.git] / CRM / Contact / BAO / ProximityQuery.php
index 66df70b4721a70309817428e33166fa57c649f3f..b5e065df0fa7459126cae5589dd0a9f00ab8562f 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -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') {