CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • 3.0 Stable - Proximity Search Error
Pages: [1]

Author Topic: 3.0 Stable - Proximity Search Error  (Read 3894 times)

honeyl

  • Guest
3.0 Stable - Proximity Search Error
October 02, 2009, 05:18:18 am
Just installed 3.0 Stable release, no problem.

Search -> Custom Searches -> Proximity Search

yields the following error "Sorry. A non-recoverable error has occurred. Could not geocode input. Return to home page."

Google maps works fine within contact dashboard.

-- Lee

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: 3.0 Stable - Proximity Search Error
October 02, 2009, 08:00:03 am

i tried reproducing on demo:

http://drupal.demo.civicrm.org/civicrm/contact/search/custom?csid=6&reset=1

and it seemed to work fine. what steps did u do to get the error?

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

honeyl

  • Guest
Re: 3.0 Stable - Proximity Search Error
October 02, 2009, 08:13:49 am
Lobo,

I just tried it on the demo as well, no problem.

But it continues to do it on my server. I just navigated the path on my earlier post, and got the error right off the bat.

I double checked the Mapping and Geocoding admin page, and it all looks good, plus the mapping works fine within contact dashboard.

-- Lee

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: 3.0 Stable - Proximity Search Error
October 02, 2009, 08:33:03 am

hey lee:

1. can you try to enter a new address and see if it geocodes that? (and hence able to map it)

2. if u know some PHP, can u add some debugging code to:

CRM/Utils/Geocode/Google.php, function format and see if u can track it down

3. can you try a different address to search? maybe the address is causing an issue

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

honeyl

  • Guest
Re: 3.0 Stable - Proximity Search Error
October 02, 2009, 10:17:29 am
Quote from: Donald Lobo on October 02, 2009, 08:33:03 am

1. can you try to enter a new address and see if it geocodes that? (and hence able to map it)


Tried another address in the Contact View, and it mapped just fine. Just to make sure we're on the same page, I never even got to the Proximity Search page because the error message popped up right after I selected it from the drop down menu. I'm able to map only through the Contact View page.

The Proximity Search is something we are very much interested in, as it will allow us to arrange localized meetings of our members throughout the state. So I'm glad to do anything you need to track this down.

Quote

2. if u know some PHP, can u add some debugging code to:

CRM/Utils/Geocode/Google.php, function format and see if u can track it down

I don't know PHP, but if you send me the code to <honeycuttlee@gmail.com>, I'll slip it into the Google.php file and report back results.


-- Lee

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: 3.0 Stable - Proximity Search Error
October 09, 2009, 01:52:39 pm
Lobo,
On this issue --

Simply commenting out the error in CRM/Contacts/Form/Search/Custom/Proximit.php will allow it to run properly. The existence of the error statement doesn't make sense to me. Context is line 85-93:

Code: [Select]
// use the address to get the latitude and longitude
            require_once 'CRM/Utils/Geocode/Google.php';
            CRM_Utils_Geocode_Google::format( $this->_formValues );

            if ( ! isset( $this->_formValues['geo_code_1'] ) ||
                 ! isset( $this->_formValues['geo_code_2'] ) ||
                 ! isset( $this->_formValues['distance'] ) ) {
                CRM_Core_Error::fatal( ts( 'Could not geocode input' ) );
            }

I may be confused by this function, but isn't it supposed to be a postprocess function? And isn't the purpose of the error to crash if the address values passed to the geocode render no result? If so, why is it throwing an error when the search page is first loaded?
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: 3.0 Stable - Proximity Search Error
October 09, 2009, 02:04:22 pm
Ok, so this is a preprocess that gets run twice. And what's happening is that on initial page load there's an initial value within $this->_formValues, which means the section of the script intended for the second run w/ postprocess is getting run on initial load. And that's triggering the validation elements of it (like whether there's a geocode and distance value), thus the error.

The array element that's getting prepopulated is: uf_group_id

And incidentally, I think this is causing the setDefaultValues function to not work (I noticed the default country is not prepopulating, and sticking an exit statement inside that function doesn't end the script).

Is uf_group_id showing up from some other place in the system? What's the best way to clear it out?
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: 3.0 Stable - Proximity Search Error
October 10, 2009, 05:53:30 am
This error was due to having a default search result profile configured in global settings. The id for the default profile is passed to the search script in the formValues array on initial load, which triggers the validation piece and throws the error (validation should only occur after form submit).

An easy fix is to unset that array value around line 75 (before the IF clause):

Code: [Select]
unset( $this->_formValues['uf_group_id'] );
But I suspect this will impact other custom searches, and the array clearing should happen farther up in the code (before the specific custom search is called).
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: 3.0 Stable - Proximity Search Error
October 10, 2009, 10:27:39 am

I think its more an issue of that custom search

It should check if the form has been submitted / has enough info in formValues rather than checking for an empty array

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • 3.0 Stable - Proximity Search Error

This forum was archived on 2017-11-26.