From aaa95afe261fab94d5968e4ef8bc0d1a74b03656 Mon Sep 17 00:00:00 2001 From: Brian Shaughnessy Date: Tue, 3 May 2022 14:59:56 -0400 Subject: [PATCH] dev/core#3439 change batch geocode query to include events --- CRM/Utils/Address/BatchUpdate.php | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/CRM/Utils/Address/BatchUpdate.php b/CRM/Utils/Address/BatchUpdate.php index 22177485f3..d26d35941b 100644 --- a/CRM/Utils/Address/BatchUpdate.php +++ b/CRM/Utils/Address/BatchUpdate.php @@ -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 "; -- 2.25.1