diff --git a/include/class.thread.php b/include/class.thread.php index 8bb321eedea75d38d3a855e0de3d520df471d480..2aa82cd494a89ba6f3a6c8f2adf73b519dea6bf2 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -301,6 +301,11 @@ implements Searchable { return false; break; + case $to instanceof Team: + //Referred to a Team + return ($this->getReferral($to->getId(), + ObjectModel::OBJECT_TYPE_TEAM)); + break; case $to instanceof Dept: // Refered to the dept return ($this->getReferral($to->getId(), @@ -314,7 +319,7 @@ implements Searchable { function refer($to) { if ($this->isReferred($to, true)) - return true; + return false; $vars = array('thread_id' => $this->getId()); switch (true) { diff --git a/include/class.ticket.php b/include/class.ticket.php index c6b2124b45cfea9721aa84ca04a1ec246b2cb14c..409804f865aa6009d67c42a864e748192ea1905e 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -2916,6 +2916,22 @@ implements RestrictedAccess, Threadable, Searchable { if (isset($vars['ccs']) && count($vars['ccs'])) $this->addCollaborators($vars['ccs'], array(), $errors); + if ($collabs = $this->getCollaborators()) { + foreach ($collabs as $collaborator) { + $cid = $collaborator->getUserId(); + // Enable collaborators if they were reselected + if (!$collaborator->isActive() && ($vars['ccs'] && in_array($cid, $vars['ccs']))) + $collaborator->setFlag(Collaborator::FLAG_ACTIVE, true); + // Disable collaborators if they were unchecked + elseif ($collaborator->isActive() && (!$vars['ccs'] || !in_array($cid, $vars['ccs']))) + $collaborator->setFlag(Collaborator::FLAG_ACTIVE, false); + + $collaborator->save(); + } + } + // clear db cache + $this->getThread()->_collaborators = null; + // Get active recipients of the response $recipients = $this->getRecipients($vars['reply-to'], $vars['ccs']); if ($recipients instanceof MailingList)