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

Add API parameter for fix_address #11372

Merged
merged 1 commit into from
Jan 19, 2018
Merged

Conversation

ejegg
Copy link
Contributor

@ejegg ejegg commented Dec 5, 2017

Overview

Expose fix_address parameter in mailing address creation API call

Before

Every address created via API has fixes applied to it, adding potentially unnecessary database overhead.

After

Address creation API calls can include 'fix_address' => FALSE to skip fixes.

Technical Details

Simply exposes the existing second parameter to CRM_Core_BAO_Address::add.

Comments

Already in use at the Wikimedia Foundation, seems to be working fine.

Copy link
Member

@colemanw colemanw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing! Can you please fill out the rest of the description for this PR and check the code comments I've made?

@@ -110,6 +114,11 @@ function _civicrm_api3_address_create_spec(&$params) {
at once, the job \'Geocode and Parse Addresses\' can execute this task after the import)',
'type' => CRM_Utils_Type::T_BOOLEAN,
);
$params['fix_address'] = array(
'title' => 'Fix address',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add ts() around the name.

$params['fix_address'] = array(
'title' => 'Fix address',
'description' => 'When true, apply various fixes to the address before insert. Default true.',
'type' => CRM_Utils_Type::T_BOOLEAN,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add 'api_default' => TRUE and then you won't need the additions on L79.

@ejegg
Copy link
Contributor Author

ejegg commented Dec 18, 2017

Thanks for the review @colemanw ! I've added the ts() calls and finished the PR description.

@ejegg
Copy link
Contributor Author

ejegg commented Dec 18, 2017

oops, seems like the api_default didn't actually guarantee it being set.

@colemanw
Copy link
Member

@ejegg my mistake it should have been api.default

Defaults to true, but lets you skip address fixes if desired.
@ejegg
Copy link
Contributor Author

ejegg commented Jan 10, 2018

Note: I had to add the explicit default setting back in because api.default is not consulted when an API call is made with the 'id' parameter set.

@ejegg
Copy link
Contributor Author

ejegg commented Jan 19, 2018

Hi @colemanw , I think I've made all the changes you requested. Is there something I should do here in github to formally indicate that and get rid of the 'Changes requested' status with the red 'X' mark?

@colemanw colemanw merged commit 625c375 into civicrm:master Jan 19, 2018
@colemanw
Copy link
Member

This looks great. Thanks @ejegg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants