From c2714028dacb42225da1733eaa6896b84e70744f Mon Sep 17 00:00:00 2001 From: eileen Date: Wed, 8 May 2013 09:43:20 +1200 Subject: [PATCH] CRM-12550 avoid extraneous log_civicrm_email entries --- CRM/Core/BAO/Email.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CRM/Core/BAO/Email.php b/CRM/Core/BAO/Email.php index 3643680896..d3cb38f4b7 100644 --- a/CRM/Core/BAO/Email.php +++ b/CRM/Core/BAO/Email.php @@ -75,14 +75,21 @@ class CRM_Core_BAO_Email extends CRM_Core_DAO_Email { $strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower'; $email->email = $strtolower($email->email); - // since we're setting bulkmail for 1 of this contact's emails, first reset all their emails to is_bulkmail false - // (only 1 email address can have is_bulkmail = true) + /* + * since we're setting bulkmail for 1 of this contact's emails, first reset all their other emails to is_bulkmail false + * We shouldn't not set the current email to false even though we + * are about to reset it to avoid contaminating the changelog if logging is enabled + * (only 1 email address can have is_bulkmail = true) + */ if ($email->is_bulkmail != 'null' && $params['contact_id'] && !self::isMultipleBulkMail()) { $sql = " UPDATE civicrm_email SET is_bulkmail = 0 WHERE contact_id = {$params['contact_id']} "; + if($hook == 'edit'){ + $sql .= " AND id <> {$params['id']}"; + } CRM_Core_DAO::executeQuery($sql); } -- 2.25.1