From a61fce127de24717212d5fac47475787af2c5dde Mon Sep 17 00:00:00 2001 From: Tobias Lounsbury Date: Tue, 30 Aug 2016 11:57:22 -0700 Subject: [PATCH] CRM-19278: Added logic to support all return status codes for the Google Geocoding API --- CRM/Utils/Geocode/Google.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CRM/Utils/Geocode/Google.php b/CRM/Utils/Geocode/Google.php index 8621e2bd46..4dd734ceed 100644 --- a/CRM/Utils/Geocode/Google.php +++ b/CRM/Utils/Geocode/Google.php @@ -148,17 +148,17 @@ class CRM_Utils_Geocode_Google { return TRUE; } } - elseif ($xml->status == 'OVER_QUERY_LIMIT') { - CRM_Core_Error::debug_var('Geocoding failed. Message from Google: ', (string ) $xml->status); + elseif ($xml->status == 'ZERO_RESULTS') { + // reset the geo code values if we did not get any good values + $values['geo_code_1'] = $values['geo_code_2'] = 'null'; + return FALSE; + } + else { + CRM_Core_Error::debug_var("Geocoding failed. Message from Google: ({$xml->status})", (string ) $xml->error_message); $values['geo_code_1'] = $values['geo_code_2'] = 'null'; $values['geo_code_error'] = $xml->status; return FALSE; } } - - // reset the geo code values if we did not get any good values - $values['geo_code_1'] = $values['geo_code_2'] = 'null'; - return FALSE; } - } -- 2.25.1