Skip to content

Commit

Permalink
Merge pull request #21490 from eileenmcnaughton/case_email
Browse files Browse the repository at this point in the history
dev/core#2554 Remove code to assign contact to the template in sendEmail
  • Loading branch information
demeritcowboy authored Sep 20, 2021
2 parents 91660d4 + 4c2eade commit 0d2b937
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions CRM/Activity/BAO/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -1056,37 +1056,6 @@ public static function sendEmail(
$from = "$fromDisplayName <$fromEmail>";
}

$returnProperties = [];
if (isset($messageToken['contact'])) {
foreach ($messageToken['contact'] as $key => $value) {
$returnProperties[$value] = 1;
}
}

if (isset($subjectToken['contact'])) {
foreach ($subjectToken['contact'] as $key => $value) {
if (!isset($returnProperties[$value])) {
$returnProperties[$value] = 1;
}
}
}

// get token details for contacts, call only if tokens are used
$details = [];
if (!empty($returnProperties) || !empty($tokens) || !empty($allTokens)) {
list($details) = CRM_Utils_Token::getTokenDetails(
$contactIds,
$returnProperties,
NULL, NULL, FALSE,
$allTokens,
'CRM_Activity_BAO_Activity'
);
}

$tokens = [];
CRM_Utils_Hook::tokens($tokens);
$categories = array_keys($tokens);

$escapeSmarty = FALSE;
if (defined('CIVICRM_MAIL_SMARTY') && CIVICRM_MAIL_SMARTY) {
$smarty = CRM_Core_Smarty::singleton();
Expand Down Expand Up @@ -1120,13 +1089,6 @@ public static function sendEmail(
$html = $contributionDetails[$contactId]['html'];
}

if (!empty($details) && is_array($details["{$contactId}"])) {
// unset email from details since it always returns primary email address
unset($details["{$contactId}"]['email']);
unset($details["{$contactId}"]['email_id']);
$values = array_merge($values, $details["{$contactId}"]);
}

$tokenSubject = $subject;
$tokenText = in_array($values['preferred_mail_format'], ['Both', 'Text'], TRUE) ? $text : '';
$tokenHtml = in_array($values['preferred_mail_format'], ['Both', 'HTML'], TRUE) ? $html : '';
Expand All @@ -1140,7 +1102,6 @@ public static function sendEmail(
'tokenContext' => $caseId ? ['caseId' => $caseId] : [],
'contactId' => $contactId,
'disableSmarty' => !CRM_Utils_Constant::value('CIVICRM_MAIL_SMARTY'),
'tplParams' => ['contact' => $values],
]);

$sent = FALSE;
Expand Down

0 comments on commit 0d2b937

Please sign in to comment.