diff --git a/include/ajax.tickets.php b/include/ajax.tickets.php index d45c32e845d3cd7c9efc40fe4a57d2e8e8d4c553..9c9a8b7d4ddde99fe406f3dcdb6d874d4f17f89c 100644 --- a/include/ajax.tickets.php +++ b/include/ajax.tickets.php @@ -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']); diff --git a/include/class.ticket.php b/include/class.ticket.php index cbc319c6799a35e85f71d70b6f0d5b30fdf74a73..bb07895ae17cb779e64ccad3a0c71aa8452350ca 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -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; diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index dc0f71ce1128eb441c8c076ca25e59fb734a67f0..b255b225dc2aa43fc2c0aa4973513680218ab5c5 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -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>',