<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
*/
static function format(&$values, $stateName = FALSE) {
// we need a valid country, else we ignore
- if (!CRM_Utils_Array::value('country', $values)) {
+ if (empty($values['country'])) {
return FALSE;
}
$add = '';
- if (CRM_Utils_Array::value('street_address', $values)) {
+ if (!empty($values['street_address'])) {
$add = urlencode(str_replace('', '+', $values['street_address']));
$add .= ',+';
}
$add .= ',+';
}
- if (CRM_Utils_Array::value('state_province', $values)) {
- if (CRM_Utils_Array::value('state_province_id', $values)) {
+ if (!empty($values['state_province'])) {
+ if (!empty($values['state_province_id'])) {
$stateProvince = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_StateProvince', $values['state_province_id']);
}
else {
}
}
- if (CRM_Utils_Array::value('postal_code', $values)) {
+ if (!empty($values['postal_code'])) {
$add .= '+' . urlencode(str_replace('', '+', $values['postal_code']));
$add .= ',+';
}
- if (CRM_Utils_Array::value('country', $values)) {
+ if (!empty($values['country'])) {
$add .= '+' . urlencode(str_replace('', '+', $values['country']));
}
}
}
elseif ($xml->status == 'OVER_QUERY_LIMIT') {
- CRM_Core_Error::fatal('Geocoding failed. Message from Google: ' . $xml->status);
+ CRM_Core_Error::debug_var('Geocoding failed. Message from Google: ', (string ) $xml->status);
+ $values['geo_code_1'] = $values['geo_code_2'] = 'null';
+ $values['geo_code_error'] = $xml->status;
+ return FALSE;
}
}