diff --git a/include/class.group.php b/include/class.group.php index 0a9dc94e138004ebfcdd8ef800d9ffebc026a8d8..6352289749de218a7841c40fa1cc4f8daf966d37 100644 --- a/include/class.group.php +++ b/include/class.group.php @@ -97,7 +97,7 @@ class Group extends VerySimpleModel { function updateDeptAccess($dept_ids) { - if ($dept_ids && is_array($dept_ids)) { + if (is_array($dept_ids)) { $groups = GroupDeptAccess::objects() ->filter(array('group_id' => $this->getId())); foreach ($groups as $group) { @@ -111,9 +111,8 @@ class Group extends VerySimpleModel { 'group_id'=>$this->getId(), 'dept_id'=>$id ))->save(); } - return true; } - return false; + return true; } function delete() { @@ -204,7 +203,7 @@ class Group extends VerySimpleModel { $this->notes=Format::sanitize($vars['notes']); if ($this->save()) - return $this->updateDeptAccess($vars['depts']); + return $this->updateDeptAccess($vars['depts'] ?: array()); if (isset($this->group_id)) { $errors['err']=sprintf(__('Unable to update %s.'), __('this group'))