Skip to content
Snippets Groups Projects
Commit 360f206d authored by Jared Hancock's avatar Jared Hancock
Browse files

Merge pull request #332 from protich/issue/recipients


Limit recipients count to active collaborators

Reviewed-By: default avatarJared Hancock <jared@osticket.com>
parents acbdaa48 c636e0cd
No related branches found
No related tags found
No related merge requests found
......@@ -579,7 +579,7 @@ class TicketsAjaxAPI extends AjaxController {
$errors = $info = array();
if ($ticket->updateCollaborators($_POST, $errors))
Http::response(201, sprintf('Recipients (%d)', $ticket->getNumCollaborators()));
Http::response(201, sprintf('Recipients (%d)', $ticket->getNumActiveCollaborators()));
if($errors && $errors['err'])
$info +=array('error' => $errors['err']);
......
......@@ -565,6 +565,14 @@ class Ticket {
return $this->ht['collaborators'];
}
function getNumActiveCollaborators() {
if (!isset($this->ht['active_collaborators']))
$this->ht['active_collaborators'] = count($this->getActiveCollaborators());
return $this->ht['active_collaborators'];
}
function getActiveCollaborators() {
return $this->getCollaborators(array('isactive'=>1));
}
......@@ -630,6 +638,7 @@ class Ticket {
db_query($sql);
unset($this->ht['active_collaborators']);
$this->collaborators = null;
return true;
......
......@@ -454,7 +454,7 @@ $tcount+= $ticket->getNumNotes();
}
$recipients = 'Add Recipients';
if ($ticket->getNumCollaborators())
$recipients = sprintf('Recipients (%d)', $ticket->getNumCollaborators());
$recipients = sprintf('Recipients (%d)', $ticket->getNumActiveCollaborators());
echo sprintf('<span><a class="collaborators"
href="#tickets/%d/collaborators/manage"><span id="recipients">%s</span></a></span>',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment