$email = new CRM_Core_DAO_Email();
$email->copyValues($params);
-
- // lower case email field to optimize queries
- $strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
- $email->email = $strtolower($email->email);
+ if (!empty($email->email)) {
+ // lower case email field to optimize queries
+ $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 other emails to is_bulkmail false
* 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()) {
+ if ($email->is_bulkmail != 'null' && !empty($params['contact_id']) && !self::isMultipleBulkMail()) {
$sql = "
UPDATE civicrm_email
SET is_bulkmail = 0
'MailingEventResubscribe',
'UFGroup',
'Activity',
- 'Email',
'Event',
'GroupContact',
'MembershipPayment',
'pcp_id',
),
),
+ 'Email' => array(
+ 'cant_update' => array(
+ // This is being legitimately manipulated to always have a valid primary - skip.
+ 'is_primary',
+ ),
+ ),
'Pledge' => array(
'cant_update' => array(
'pledge_original_installment_amount',
}
else {
$entity[$fieldName] = substr('New String', 0, CRM_Utils_Array::Value('maxlength', $specs, 100));
+ if ($fieldName == 'email') {
+ $entity[$fieldName] = strtolower($entity[$fieldName]);
+ }
// typecast with array to satisfy changes made in CRM-13160
if ($entityName == 'MembershipType' && in_array($fieldName, array(
'relationship_type_id',