Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#2554 Remove code to assign contact to the template in sendEmail #21490

Merged
merged 1 commit into from
Sep 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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