projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #3112 from freeform/CRM-14568
[civicrm-core.git]
/
CRM
/
Utils
/
Address
/
BatchUpdate.php
diff --git
a/CRM/Utils/Address/BatchUpdate.php
b/CRM/Utils/Address/BatchUpdate.php
index dcc483d19ea0ba95dcb4379ce9eb2b0312c56ff7..49a8903c18ea1f452ef0c27982f3a8fb47a0600b 100644
(file)
--- a/
CRM/Utils/Address/BatchUpdate.php
+++ b/
CRM/Utils/Address/BatchUpdate.php
@@
-1,9
+1,9
@@
<?php
/*
+--------------------------------------------------------------------+
<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.
4
|
+ | CiviCRM version 4.
5
|
+--------------------------------------------------------------------+
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-201
3
|
+ | Copyright CiviCRM LLC (c) 2004-201
4
|
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
@@
-59,7
+59,7
@@
class CRM_Utils_Address_BatchUpdate {
// do check for geocoding.
$processGeocode = FALSE;
if (empty($config->geocodeMethod)) {
// do check for geocoding.
$processGeocode = FALSE;
if (empty($config->geocodeMethod)) {
- if (
$this->geocoding == 'true'
) {
+ if (
CRM_Utils_String::strtobool($this->geocoding) === TRUE
) {
$this->returnMessages[] = ts('Error: You need to set a mapping provider under Administer > System Settings > Mapping and Geocoding');
$this->returnError = 1;
$this->returnResult();
$this->returnMessages[] = ts('Error: You need to set a mapping provider under Administer > System Settings > Mapping and Geocoding');
$this->returnError = 1;
$this->returnResult();
@@
-68,7
+68,7
@@
class CRM_Utils_Address_BatchUpdate {
else {
$processGeocode = TRUE;
// user might want to over-ride.
else {
$processGeocode = TRUE;
// user might want to over-ride.
- if (
$this->geocoding == 'false'
) {
+ if (
CRM_Utils_String::strtobool($this->geocoding) === FALSE
) {
$processGeocode = FALSE;
}
}
$processGeocode = FALSE;
}
}
@@
-83,7
+83,7
@@
class CRM_Utils_Address_BatchUpdate {
);
$parseStreetAddress = FALSE;
if (!$parseAddress) {
);
$parseStreetAddress = FALSE;
if (!$parseAddress) {
- if (
$this->parse == 'true'
) {
+ if (
CRM_Utils_String::strtobool($this->parse) === TRUE
) {
$this->returnMessages[] = ts('Error: You need to enable Street Address Parsing under Administer > Localization > Address Settings.');
$this->returnError = 1;
return $this->returnResult();
$this->returnMessages[] = ts('Error: You need to enable Street Address Parsing under Administer > Localization > Address Settings.');
$this->returnError = 1;
return $this->returnResult();
@@
-92,7
+92,7
@@
class CRM_Utils_Address_BatchUpdate {
else {
$parseStreetAddress = TRUE;
// user might want to over-ride.
else {
$parseStreetAddress = TRUE;
// user might want to over-ride.
- if (
$this->parse == 'false'
) {
+ if (
CRM_Utils_String::strtobool($this->parse) === FALSE
) {
$parseStreetAddress = FALSE;
}
}
$parseStreetAddress = FALSE;
}
}
@@
-111,12
+111,15
@@
class CRM_Utils_Address_BatchUpdate {
function processContacts(&$config, $processGeocode, $parseStreetAddress) {
// build where clause.
$clause = array('( c.id = a.contact_id )');
function processContacts(&$config, $processGeocode, $parseStreetAddress) {
// build where clause.
$clause = array('( c.id = a.contact_id )');
+ $params = array();
if ($this->start) {
if ($this->start) {
- $clause[] = "( c.id >= $this->start )";
+ $clause[] = "( c.id >= %1 )";
+ $params[1] = array($this->start, 'Integer');
}
if ($this->end) {
}
if ($this->end) {
- $clause[] = "( c.id <= $this->end )";
+ $clause[] = "( c.id <= %2 )";
+ $params[2] = array($this->end, 'Integer');
}
if ($processGeocode) {
}
if ($processGeocode) {
@@
-145,8
+148,7
@@
class CRM_Utils_Address_BatchUpdate {
$totalGeocoded = $totalAddresses = $totalAddressParsed = 0;
$totalGeocoded = $totalAddresses = $totalAddressParsed = 0;
- $dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
-
+ $dao = CRM_Core_DAO::executeQuery($query, $params);
if ($processGeocode) {
require_once (str_replace('_', DIRECTORY_SEPARATOR, $config->geocodeMethod) . '.php');
}
if ($processGeocode) {
require_once (str_replace('_', DIRECTORY_SEPARATOR, $config->geocodeMethod) . '.php');
}
@@
-211,9
+213,7
@@
class CRM_Utils_Address_BatchUpdate {
$success = TRUE;
// consider address is automatically parseable,
// when we should found street_number and street_name
$success = TRUE;
// consider address is automatically parseable,
// when we should found street_number and street_name
- if (!CRM_Utils_Array::value('street_name', $parsedFields) ||
- !CRM_Utils_Array::value('street_number', $parsedFields)
- ) {
+ if (empty($parsedFields['street_name']) || empty($parsedFields['street_number'])) {
$success = FALSE;
}
$success = FALSE;
}