diff --git a/include/class.ticket.php b/include/class.ticket.php index 17a0ef50b09f4f5a49424bc647f54ae2850c7ffe..578cbeeeb7e064b89bd928748637dc8bc9accd8e 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -1760,13 +1760,19 @@ class Ticket { $vars['note']=sprintf('Ticket Updated by %s', $thisstaff->getName()); $this->logNote('Ticket Updated', $vars['note'], $thisstaff); + + // Decide if we need to keep the just selected SLA + $keepSLA = ($this->getSLAId() != $vars['slaId']); + + // Reload the ticket so we can do further checking $this->reload(); // Reselect SLA if transient - if(!$this->getSLAId() || $this->getSLA()->isTransient()) + if (!$keepSLA + && (!$this->getSLA() || $this->getSLA()->isTransient())) $this->selectSLAId(); - //Clear overdue flag if duedate or SLA changes and the ticket is no longer overdue. + // Clear overdue flag if duedate or SLA changes and the ticket is no longer overdue. if($this->isOverdue() && (!$this->getEstDueDate() //Duedate + SLA cleared || Misc::db2gmtime($this->getEstDueDate()) > Misc::gmtime() //New due date in the future.