Skip to content
Snippets Groups Projects
Commit 03e1f324 authored by Peter Rotich's avatar Peter Rotich
Browse files

On ownership change remove the user as a collaborator

A ticket owner can't be a collaborator.
parent 122294af
No related branches found
No related tags found
No related merge requests found
......@@ -1479,11 +1479,20 @@ class Ticket {
$this->ht['user_id'] = $user->getId();
$this->user = null;
$this->collaborators = null;
$this->recipients = null;
$this->logNote('Ticket ownership changed',
Format::htmlchars( sprintf('%s changed ticket ownership to %s',
$thisstaff->getName(), $user->getName()))
);
//Log an internal note
$note = sprintf('%s changed ticket ownership to %s',
$thisstaff->getName(), $user->getName());
//Remove the new owner from list of collaborators
$c = Collaborator::lookup(array('userId' => $user->getId(),
'ticketId' => $this->getId()));
if ($c && $c->remove())
$note.= ' (removed as collaborator)';
$this->logNote('Ticket ownership changed', $note);
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment