Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified functions in BatchUpdate.php file #139

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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