X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FAddress%2FBatchUpdate.php;h=4e3a47331fa810a1b8fbd824002a7ec5e29e2a9e;hb=73e57781380c5e928082d48d3a7e61ed1f339f78;hp=1c421a5e78cd0bae38b88960332ae718222def01;hpb=f6af7e6f06447f2725f5878bb824b8e792d3cc30;p=civicrm-core.git
diff --git a/CRM/Utils/Address/BatchUpdate.php b/CRM/Utils/Address/BatchUpdate.php
index 1c421a5e78..4e3a47331f 100644
--- a/CRM/Utils/Address/BatchUpdate.php
+++ b/CRM/Utils/Address/BatchUpdate.php
@@ -39,14 +39,14 @@
*/
class CRM_Utils_Address_BatchUpdate {
- var $start = NULL;
- var $end = NULL;
- var $geocoding = 1;
- var $parse = 1;
- var $throttle = 0;
+ public $start = NULL;
+ public $end = NULL;
+ public $geocoding = 1;
+ public $parse = 1;
+ public $throttle = 0;
- var $returnMessages = array();
- var $returnError = 0;
+ public $returnMessages = [];
+ public $returnError = 0;
/**
* Class constructor.
@@ -132,16 +132,16 @@ class CRM_Utils_Address_BatchUpdate {
*/
public function processContacts($processGeocode, $parseStreetAddress) {
// build where clause.
- $clause = array('( c.id = a.contact_id )');
- $params = array();
+ $clause = ['( c.id = a.contact_id )'];
+ $params = [];
if ($this->start) {
$clause[] = "( c.id >= %1 )";
- $params[1] = array($this->start, 'Integer');
+ $params[1] = [$this->start, 'Integer'];
}
if ($this->end) {
$clause[] = "( c.id <= %2 )";
- $params[2] = array($this->end, 'Integer');
+ $params[2] = [$this->end, 'Integer'];
}
if ($processGeocode) {
@@ -173,19 +173,19 @@ class CRM_Utils_Address_BatchUpdate {
$dao = CRM_Core_DAO::executeQuery($query, $params);
- $unparseableContactAddress = array();
+ $unparseableContactAddress = [];
while ($dao->fetch()) {
$totalAddresses++;
- $params = array(
+ $params = [
'street_address' => $dao->street_address,
'postal_code' => $dao->postal_code,
'city' => $dao->city,
'state_province' => $dao->state,
'country' => $dao->country,
'country_id' => $dao->country_id,
- );
+ ];
- $addressParams = array();
+ $addressParams = [];
// process geocode.
if ($processGeocode) {
@@ -254,22 +254,21 @@ class CRM_Utils_Address_BatchUpdate {
$address->id = $dao->address_id;
$address->copyValues($addressParams);
$address->save();
- $address->free();
}
}
- $this->returnMessages[] = ts("Addresses Evaluated: %1", array(
+ $this->returnMessages[] = ts("Addresses Evaluated: %1", [
1 => $totalAddresses,
- )) . "\n";
+ ]) . "\n";
if ($processGeocode) {
- $this->returnMessages[] = ts("Addresses Geocoded: %1", array(
- 1 => $totalGeocoded,
- )) . "\n";
+ $this->returnMessages[] = ts("Addresses Geocoded: %1", [
+ 1 => $totalGeocoded,
+ ]) . "\n";
}
if ($parseStreetAddress) {
- $this->returnMessages[] = ts("Street Addresses Parsed: %1", array(
- 1 => $totalAddressParsed,
- )) . "\n";
+ $this->returnMessages[] = ts("Street Addresses Parsed: %1", [
+ 1 => $totalAddressParsed,
+ ]) . "\n";
if ($unparseableContactAddress) {
$this->returnMessages[] = "
\n" . ts("Following is the list of contacts whose address is not parsed:") . "
\n";
foreach ($unparseableContactAddress as $contactLink) {
@@ -287,7 +286,7 @@ class CRM_Utils_Address_BatchUpdate {
* @return array
*/
public function returnResult() {
- $result = array();
+ $result = [];
$result['is_error'] = $this->returnError;
$result['messages'] = '';
// Pad message size to allow for prefix added by CRM_Core_JobManager.