From 70f138b91b4e42a028682a88d1199b993a450edb Mon Sep 17 00:00:00 2001 From: JediKev <kevin@enhancesoft.com> Date: Thu, 17 Jan 2019 14:14:53 -0600 Subject: [PATCH] issue: Task Response With Collaborators MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This addresses a fatal error when adding a new response to a Task with Collaborators. When we implemented the MailingList for Users/Collaborators we forgot about the little Task Collaborators (poor little guys). This adds a new function called `getRecipients()` to `class Thread` that utilizes MailingList instead of UserList. This also adds two new functions to `class Util` that retrieves the User’s `user_id`. --- include/class.task.php | 2 +- include/class.thread.php | 11 +++++++++++ include/class.util.php | 5 +++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/class.task.php b/include/class.task.php index 55f015289..fe1e71921 100644 --- a/include/class.task.php +++ b/include/class.task.php @@ -1189,7 +1189,7 @@ class Task extends TaskModel implements RestrictedAccess, Threadable { global $cfg; if (!$entry instanceof ThreadEntry - || !($recipients=$this->getThread()->getParticipants()) + || !($recipients=$this->getThread()->getRecipients()) || !($dept=$this->getDept()) || !($tpl=$dept->getTemplate()) || !($msg=$tpl->getTaskActivityNoticeMsgTemplate()) diff --git a/include/class.thread.php b/include/class.thread.php index 343b3e900..a9485d0b8 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -263,6 +263,17 @@ implements Searchable { return $this->_participants; } + // MailingList of recipients (collaborators) + function getRecipients() { + $list = new MailingList(); + if ($collabs = $this->getActiveCollaborators()) { + foreach ($collabs as $c) + $list->addCc($c); + } + + return $list; + } + function getReferral($id, $type) { return $this->referrals->findFirst(array( diff --git a/include/class.util.php b/include/class.util.php index a3bc2305d..e78c00d1d 100644 --- a/include/class.util.php +++ b/include/class.util.php @@ -5,6 +5,7 @@ require_once INCLUDE_DIR . 'class.variable.php'; // Used by the email system interface EmailContact { function getId(); + function getUserId(); function getName(); function getEmail(); } @@ -28,6 +29,10 @@ implements EmailContact { return $this->contact->getId(); } + function getUserId() { + return $this->contact->getUserId(); + } + function getEmail() { return $this->contact->getEmail(); } -- GitLab