From 2a313eb971ab36e166308f7882897ef204234d0a Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Fri, 17 Nov 2017 14:46:23 -0800 Subject: Add the possibility to send tasks and comments to multiple recipients --- app/Controller/TaskMailController.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'app/Controller/TaskMailController.php') diff --git a/app/Controller/TaskMailController.php b/app/Controller/TaskMailController.php index feb96a68..9e753af1 100644 --- a/app/Controller/TaskMailController.php +++ b/app/Controller/TaskMailController.php @@ -36,7 +36,7 @@ class TaskMailController extends BaseController $this->flash->success(t('Task sent by email successfully.')); $this->commentModel->create(array( - 'comment' => t('This task was sent by email to "%s" with subject "%s".', $values['email'], $values['subject']), + 'comment' => t('This task was sent by email to "%s" with subject "%s".', $values['emails'], $values['subject']), 'user_id' => $this->userSession->getId(), 'task_id' => $task['id'], )); @@ -49,15 +49,16 @@ class TaskMailController extends BaseController protected function sendByEmail(array $values, array $task) { - $html = $this->template->render('task_mail/email', array( - 'task' => $task, - )); - - $this->emailClient->send( - $values['email'], - $values['email'], - $values['subject'], - $html - ); + $emails = explode_csv_field($values['emails']); + $html = $this->template->render('task_mail/email', array('task' => $task)); + + foreach ($emails as $email) { + $this->emailClient->send( + $email, + $email, + $values['subject'], + $html + ); + } } } -- cgit v1.2.3