diff --git a/include/class.ticket.php b/include/class.ticket.php index 816881b93dd8aafb99a1d1ee4632dba08d82f91f..2565984c8de48839ed60f6230390ad2cf4c19a8e 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -1099,7 +1099,11 @@ implements RestrictedAccess, Threadable { if ($slaId == $this->getSLAId()) return true; - $this->sla = Sla::lookup($slaId); + $sla = null; + if ($slaId && !($sla = Sla::lookup($slaId))) + return false; + + $this->sla = $sla; return $this->save(); } /** @@ -2012,7 +2016,8 @@ implements RestrictedAccess, Threadable { // Set SLA of the new department if (!$this->getSLAId() || $this->getSLA()->isTransient()) - $this->selectSLAId(); + if (($slaId=$this->getDept()->getSLAId())) + $this->selectSLAId($slaId); // Log transfer event $this->logEvent('transferred');