Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.7.21
-
Fix Version/s: 4.7.25
-
Component/s: Core CiviCRM, NYSS
-
Labels:
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:None
-
Funding Source:Needs Funding
-
Verified?:No
Description
The "Search Primary Details Only" setting is a very useful setting for administrators: By disabling they can easily search for contacts with multiple email addresses (which in my experience is quite a common need).
Unfortunately it breaks mailing delivery. At https://github.com/civicrm/civicrm-core/blob/master/CRM/Contact/BAO/Query.php#L2637
if (Civi::settings()->get('searchPrimaryDetailsOnly') || $apiEntity) { $searchPrimary = "AND {$name}.is_primary = 1"; }
we need to pass in $apiEntity if we want to search primary emails only. However getTokenDetails() at https://github.com/civicrm/civicrm-core/blob/master/CRM/Utils/Token.php#L1240 leaves $apiEntity argument at its default value NULL. This results in multiple rows being returned for contacts with multiple email addresses, and because of the query limit being set to the number of contacts being looked up, some contacts do not have a row in the results.
Because these contacts are missing their preferred email format (HTML, Text, etc.) an email message cannot be composed for them. Delivery status will be unknown and this error will be logged: "CiviMail will not send an empty mail body, Skipping: "
Attachments
Issue Links
- links to