Skip to content

Commit

Permalink
Modified functions in BatchUpdate.php file
Browse files Browse the repository at this point in the history
  • Loading branch information
pipeline authored and monishdeb committed Nov 1, 2023
1 parent 134a8dc commit 30027f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CRM/Core/BAO/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -1297,6 +1297,8 @@ public static function addGeocoderData(&$params) {
// ensure that if the geocoding provider (Google, OSM etc) has returned the string 'null' because they can't geocode, ensure that contacts are not placed on null island 0,0
if ($params[$geocode] !== 'null') {
$params[$geocode] = (float) substr($params[$geocode], 0, 14);
//set manual_geo_code to 0
$params['manual_geo_code'] = FALSE;
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions CRM/Utils/Address/BatchUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ public function processContacts($processGeocode, $parseStreetAddress) {
if ($processGeocode) {
$clause[] = '( a.geo_code_1 is null OR a.geo_code_1 = 0 )';
$clause[] = '( a.geo_code_2 is null OR a.geo_code_2 = 0 )';
// the scheduled job is ignoring trying to geocode addresses where manual_geocode is 1
$clause[] = '( a.manual_geo_code = 0 )';
$clause[] = '( a.country_id is not null )';
}

Expand Down Expand Up @@ -211,6 +213,11 @@ public function processContacts($processGeocode, $parseStreetAddress) {
$totalGeocoded++;
$addressParams = $params;
}
else {
// If an address has failed in the geocoding scheduled job i.e. no lat/long is fetched, we will update the manual_geocode field to 1.
$addressParams['manual_geo_code'] = TRUE;
$addressParams['geo_code_1'] = $addressParams['geo_code_2'] = 0;
}
}

// parse street address
Expand Down

0 comments on commit 30027f9

Please sign in to comment.