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

Save department on create

parent efdbdb39
Branches
Tags
No related merge requests found
...@@ -469,7 +469,7 @@ implements TemplateVariable { ...@@ -469,7 +469,7 @@ implements TemplateVariable {
} }
/*----Static functions-------*/ /*----Static functions-------*/
static function getIdByName($name, $pid=null) { static function getIdByName($name, $pid=null) {
$row = static::objects() $row = static::objects()
->filter(array( ->filter(array(
'name' => $name, 'name' => $name,
...@@ -579,9 +579,12 @@ implements TemplateVariable { ...@@ -579,9 +579,12 @@ implements TemplateVariable {
static function __create($vars, &$errors) { static function __create($vars, &$errors) {
$dept = self::create($vars); $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) { function save($refetch=false) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment