dev/core#3439 change batch geocode query to include events
authorBrian Shaughnessy <brian@lcdservices.biz>
Tue, 3 May 2022 18:59:56 +0000 (14:59 -0400)
committerBrian Shaughnessy <brian@lcdservices.biz>
Tue, 3 May 2022 18:59:56 +0000 (14:59 -0400)
CRM/Utils/Address/BatchUpdate.php

index 22177485f34d3d33457574225bdc5f73eb3c961f..d26d35941b12f972650377710d741e727c862780 100644 (file)
@@ -116,7 +116,7 @@ class CRM_Utils_Address_BatchUpdate {
    */
   public function processContacts($processGeocode, $parseStreetAddress) {
     // build where clause.
-    $clause = ['( c.id = a.contact_id )'];
+    $clause = [];
     $params = [];
     if ($this->start) {
       $clause[] = "( c.id >= %1 )";
@@ -137,19 +137,22 @@ class CRM_Utils_Address_BatchUpdate {
     $whereClause = implode(' AND ', $clause);
 
     $query = "
-    SELECT     c.id,
-               a.id as address_id,
-               a.street_address,
-               a.city,
-               a.postal_code,
-               a.country_id,
-               s.name as state,
-               o.name as country
-    FROM       civicrm_contact  c
-    INNER JOIN civicrm_address        a ON a.contact_id = c.id
-    LEFT  JOIN civicrm_country        o ON a.country_id = o.id
-    LEFT  JOIN civicrm_state_province s ON a.state_province_id = s.id
-    WHERE      {$whereClause}
+      SELECT c.id,
+        a.id as address_id,
+        a.street_address,
+        a.city,
+        a.postal_code,
+        a.country_id,
+        s.name as state,
+        o.name as country
+      FROM civicrm_address a
+      LEFT JOIN civicrm_contact c
+        ON a.contact_id = c.id
+      LEFT JOIN civicrm_country o
+        ON a.country_id = o.id
+      LEFT JOIN civicrm_state_province s
+        ON a.state_province_id = s.id
+      WHERE {$whereClause}
       ORDER BY a.id
     ";