From 18e4cba3fd1fff60f31856ef119a5e7b9768ccf5 Mon Sep 17 00:00:00 2001 From: Brian Shaughnessy Date: Mon, 20 Apr 2020 15:29:12 -0400 Subject: [PATCH] dev/core#1721 send email to case follow-up activity assignees --- CRM/Case/Form/Activity.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CRM/Case/Form/Activity.php b/CRM/Case/Form/Activity.php index d84717985ca2..01714e436b05 100644 --- a/CRM/Case/Form/Activity.php +++ b/CRM/Case/Form/Activity.php @@ -639,6 +639,28 @@ public function postProcess($params = NULL) { ]; CRM_Case_BAO_Case::processCaseActivity($caseParams); $followupStatus = ts("A followup activity has been scheduled.") . '

'; + + //dev/core#1721 + if (Civi::settings()->get('activity_assignee_notification') && + !in_array($followupActivity->activity_type_id, + Civi::settings()->get('do_not_notify_assignees_for')) + ) { + $followupActivityIDs = [$followupActivity->id]; + $followupAssigneeContacts = CRM_Activity_BAO_ActivityAssignment::getAssigneeNames($followupActivityIDs, TRUE, FALSE); + + if (!empty($followupAssigneeContacts)) { + $mailToFollowupContacts = []; + foreach ($followupAssigneeContacts as $facValues) { + $mailToFollowupContacts[$facValues['email']] = $facValues; + } + + $facParams['case_id'] = $vval['case_id']; + $sentFollowup = CRM_Activity_BAO_Activity::sendToAssignee($followupActivity, $mailToFollowupContacts, $facParams); + if ($sentFollowup) { + $mailStatus .= '
' . ts("A copy of the follow-up activity has also been sent to follow-up assignee contacts(s)."); + } + } + } } } $title = ts("%1 Saved", [1 => $this->_activityTypeName]);