Skip to content
Snippets Groups Projects
Commit cac01cdc authored by Kurund Jalmi's avatar Kurund Jalmi
Browse files

worked on CRM-12285, udpate CMS email if primary email of contact is updated.

----------------------------------------
* CRM-12285: Editing an email using the 'inscreen' edit option does not update the drupal user email, where the email is used for the uf_match
  http://issues.civicrm.org/jira/browse/CRM-12285
parent 185b4e21
Branches
Tags
No related merge requests found
......@@ -38,7 +38,7 @@
*/
class CRM_Core_BAO_Email extends CRM_Core_DAO_Email {
/*
/**
* Create email address - note that the create function calls 'add' but
* has more business logic
*
......@@ -46,19 +46,12 @@ class CRM_Core_BAO_Email extends CRM_Core_DAO_Email {
*/
static function create($params) {
// if id is set & is_primary isn't we can assume no change
$alterPrimary = is_numeric(CRM_Utils_Array::value('is_primary', $params)) || empty($params['id']);
if ($alterPrimary) {
if (is_numeric(CRM_Utils_Array::value('is_primary', $params)) || empty($params['id'])) {
CRM_Core_BAO_Block::handlePrimary($params, get_class());
}
$email = CRM_Core_BAO_Email::add($params);
if ($alterPrimary) {
// update the UF user email if that has changed
CRM_Core_BAO_UFMatch::updateUFName($email->contact_id);
}
return $email;
}
......@@ -98,6 +91,11 @@ WHERE contact_id = {$params['contact_id']}
$email->save();
if ($email->is_primary) {
// update the UF user email if that has changed
CRM_Core_BAO_UFMatch::updateUFName($email->contact_id);
}
CRM_Utils_Hook::post($hook, 'Email', $email->id, $email);
return $email;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment