From 578851f22a8f819aa215a75c5f1bfde15957884f Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Tue, 1 Mar 2016 07:14:30 +0000 Subject: [PATCH] SLA on transfer Only change SLA if target department has an SLA. --- include/class.ticket.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/class.ticket.php b/include/class.ticket.php index 816881b93..2565984c8 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'); -- GitLab