*/
class CRM_Contact_Form_Search_Custom_Proximity extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
- protected $_latitude = NULL;
- protected $_longitude = NULL;
- protected $_distance = NULL;
protected $_aclFrom = NULL;
protected $_aclWhere = NULL;
unset($this->_formValues['uf_group_id']);
unset($this->_formValues['component_mode']);
unset($this->_formValues['operator']);
-
- if (!empty($this->_formValues)) {
- // add the country and state
- self::addGeocodingData($this->_formValues);
- $this->_latitude = $this->_formValues['geo_code_1'];
- $this->_longitude = $this->_formValues['geo_code_2'];
-
- if ($this->_formValues['prox_distance_unit'] == "miles") {
- $conversionFactor = 1609.344;
- }
- else {
- $conversionFactor = 1000;
- }
- $this->_distance = $this->_formValues['distance'] * $conversionFactor;
- }
$this->_group = $this->_formValues['group'] ?? NULL;
$this->_tag = $this->_formValues['tag'] ?? NULL;
$isCountOnly = TRUE;
}
+ if (empty($this->_formValues['geo_code_1']) || empty($this->_formValues['geo_code_2'])) {
+ self::addGeocodingData($this->_formValues);
+ }
+
$searchParams = [
['prox_distance_unit', '=', $this->_formValues['prox_distance_unit'], 0, 0],
['prox_distance', '=', $this->_formValues['distance'], 0, 0],