Skip to content

Commit

Permalink
dev/core#2914 Fix for incorrect sent count in message
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Oct 14, 2021
1 parent 2f4fb2e commit 5c38cff
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions CRM/Contact/Form/Task/EmailTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,10 @@ public function submit($formValues): void {
// has no meaning for followup activities, and this doesn't prevent
// creating more manually if desired.
$followupStatus = $this->createFollowUpActivities($formValues, $activityIds[0]);
$count_success = count($this->_toContactDetails);

CRM_Core_Session::setStatus(ts('One message was sent successfully. ', [
'plural' => '%count messages were sent successfully. ',
'count' => $count_success,
'count' => $sent,
]) . $followupStatus, ts('Message Sent', ['plural' => 'Messages Sent', 'count' => $count_success]), 'success');
}

Expand Down Expand Up @@ -737,7 +737,7 @@ protected function sendEmail(

$userID = CRM_Core_Session::getLoggedInContactID();

$sent = $notSent = [];
$sent = 0;
$attachmentFileIds = [];
$activityIds = [];
$firstActivityCreated = FALSE;
Expand All @@ -755,7 +755,6 @@ protected function sendEmail(
'disableSmarty' => !CRM_Utils_Constant::value('CIVICRM_MAIL_SMARTY'),
]);

$sent = FALSE;
// To minimize storage requirements, only one copy of any file attachments uploaded to CiviCRM is kept,
// even when multiple contacts will receive separate emails from CiviCRM.
if (!empty($attachmentFileIds)) {
Expand Down Expand Up @@ -785,7 +784,7 @@ protected function sendEmail(
$bcc
)
) {
$sent = TRUE;
$sent++;
}
}

Expand Down

0 comments on commit 5c38cff

Please sign in to comment.