-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: master
Are you sure you want to change the base?
Conversation
CRM/Utils/Address/BatchUpdate.php
Outdated
@@ -234,6 +239,15 @@ public function processContacts($processGeocode, $parseStreetAddress) { | |||
$unparseableContactAddress[] = " Contact ID: " . $dao->id . " <a href =\"$url\"> " . $dao->street_address . " </a> "; | |||
// reset element values. | |||
$parsedFields = array_fill_keys(array_keys($parsedFields), ''); | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines should be moved to L219 in an else code block. This is because this part of the code is about street addressing parsing not geocoding
CRM/Utils/Address/BatchUpdate.php
Outdated
* 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. | ||
*/ | ||
$results = \Civi\Api4\Address::update() | ||
->addValue('manual_geo_code', true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also this should be changed I think to be like
$addressParams = [
'manual_geo_code' => 1,
'geo_code_1' => 0,
'geo_code_2' => 1,
];
CRM/Utils/Address/BatchUpdate.php
Outdated
@@ -221,6 +226,10 @@ public function processContacts($processGeocode, $parseStreetAddress) { | |||
// when we should found street_number and street_name | |||
if (empty($parsedFields['street_name']) || empty($parsedFields['street_number'])) { | |||
$success = FALSE; | |||
// 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maryguo2023 these 4 lines need to be moved in Old line 214
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the code there should be like the following as this section is about address parsing not geocoding of addresses
if (isset($params['geo_code_1']) && $params['geo_code_1'] != 'null') {
$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'] = 0;
$addressParams['geo_code_2'] = 0;
}
f19459f
to
bb6526c
Compare
60ca79c
to
8ea205e
Compare
8ea205e
to
30027f9
Compare
Overview
A brief description of the pull request. Keep technical jargon to a minimum. Hyperlink relevant discussions.
Before
What is the old user-interface or technical-contract (as appropriate)?
For optimal clarity, include a concrete example such as a screenshot, GIF (LICEcap, SilentCast), or code-snippet.
After
What changed? What is new old user-interface or technical-contract?
For optimal clarity, include a concrete example such as a screenshot, GIF (LICEcap, SilentCast), or code-snippet.
Technical Details
If the PR involves technical details/changes/considerations which would not be manifest to a casual developer skimming the above sections, please describe the details here.
Comments
Anything else you would like the reviewer to note