-
-
Notifications
You must be signed in to change notification settings - Fork 817
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
CRM-21041: Respect default 'Communication Style' when creating a … #11269
CRM-21041: Respect default 'Communication Style' when creating a … #11269
Conversation
Can one of the admins verify this patch? |
@civicrm-builder add to whitelist |
CRM/Contact/BAO/Contact.php
Outdated
|
||
// CRM-21041: set default 'Communication Style' if unset when creating a contact. | ||
if (empty($params['communication_style_id'])) { | ||
$params['communication_style_id'] = array_pop(CRM_Core_OptionGroup::values('communication_style', TRUE, NULL, NULL, 'AND is_default = 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.
in some versions of php this won't work because array_pop() can't be called on a function.
@@ -306,6 +306,11 @@ public static function &create(&$params, $fixAddress = TRUE, $invokeHooks = TRUE | |||
} | |||
} | |||
} | |||
|
|||
// CRM-21041: set default 'Communication Style' if unset when creating a contact. | |||
if (empty($params['communication_style_id'])) { |
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.
Should also test for the presence of id in params and skip if updating.
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.
@colemanw
This whole code block lives inside
if (empty($params['contact_id'])) { } check
So this will only be executed when creating a contact and will be skipped when updating one.
Pls let me know if this is not what you were referring to
Thanks
…ult_communication_style_on_api_contact_create CRM-21041: Respect default 'Communication Style' when creating a …
...Contact via API
Overview
Respect default 'Communication Style' when creating a Contact through the API
Before
When creating a contact via the API, the default 'Communication Style' is not used and the contact has no value set for Communication Style.
After
Now when a contact is created via the API, the default 'Communication Style' is set for that contact.