From 611f7076b047efebdc566265d641691dd45eabf1 Mon Sep 17 00:00:00 2001 From: aydreeihn <adriane@enhancesoft.com> Date: Tue, 7 Aug 2018 11:15:51 -0500 Subject: [PATCH] Implement 'Select Active Collaborators': - Enable/Disable Collaborators based on which Collaborators are in the 'Select Active Collaborators' box --- include/class.ticket.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/class.ticket.php b/include/class.ticket.php index c6b2124b4..409804f86 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) -- GitLab