summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-11-17 14:46:23 -0800
committerFrederic Guillot <fred@kanboard.net>2017-11-17 14:46:23 -0800
commit2a313eb971ab36e166308f7882897ef204234d0a (patch)
tree6bb7a72ee7bce1c0baef908af49ff1b817c939f2 /app/Controller
parent3b786e05e0e51ca6f85ef9a3ca0d649f3e34c534 (diff)
Add the possibility to send tasks and comments to multiple recipients
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/CommentMailController.php23
-rw-r--r--app/Controller/TaskMailController.php23
2 files changed, 24 insertions, 22 deletions
diff --git a/app/Controller/CommentMailController.php b/app/Controller/CommentMailController.php
index 144c9a13..94947027 100644
--- a/app/Controller/CommentMailController.php
+++ b/app/Controller/CommentMailController.php
@@ -51,24 +51,25 @@ class CommentMailController extends BaseController
protected function sendByEmail(array $values)
{
- $html = $this->template->render('comment_mail/email', array(
- 'email' => $values,
- ));
+ $html = $this->template->render('comment_mail/email', array('email' => $values));
+ $emails = explode_csv_field($values['emails']);
- $this->emailClient->send(
- $values['email'],
- $values['email'],
- $values['subject'],
- $html
- );
+ foreach ($emails as $email) {
+ $this->emailClient->send(
+ $email,
+ $email,
+ $values['subject'],
+ $html
+ );
+ }
}
protected function prepareComment(array $values)
{
- $values['comment'] .= "\n\n_".t('Sent by email to [%s](mailto:%s) (%s)', $values['email'], $values['email'], $values['subject']).'_';
+ $values['comment'] .= "\n\n_".t('Sent by email to "%s" (%s)', $values['emails'], $values['subject']).'_';
unset($values['subject']);
- unset($values['email']);
+ unset($values['emails']);
return $values;
}
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
+ );
+ }
}
}