From c664c936bbad1d85df39bf0bac8aa96871c83a7e Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Mon, 24 Oct 2016 22:15:03 +0000 Subject: [PATCH] Save department on create --- include/class.dept.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/class.dept.php b/include/class.dept.php index 1f14bcb15..36ffd2ffb 100644 --- a/include/class.dept.php +++ b/include/class.dept.php @@ -469,7 +469,7 @@ implements TemplateVariable { } /*----Static functions-------*/ - static function getIdByName($name, $pid=null) { + static function getIdByName($name, $pid=null) { $row = static::objects() ->filter(array( 'name' => $name, @@ -579,9 +579,12 @@ implements TemplateVariable { static function __create($vars, &$errors) { $dept = self::create($vars); - $dept->update($vars, $errors); + if (!$dept->update($vars, $errors)) + return false; + + $dept->save(); - return isset($dept->id) ? $dept : null; + return $dept; } function save($refetch=false) { -- GitLab