diff --git a/include/class_config.inc b/include/class_config.inc index ff25f9c41092bf804ad6528bdfee47aee27c9a04..08d5f24960961d556a902b166817faff053d2bb8 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -608,13 +608,10 @@ class config { } } - /*! * \brief Store the departments from ldap in $this->departments - * - * \param string $ignore_dn dn of the department */ - function get_departments($ignore_dn = "") + function get_departments() { /* Initialize result hash */ $result = array(); @@ -629,14 +626,14 @@ class config { $types = departmentManagement::getDepartmentTypes(); /* Create a list of attributes to fetch */ - $filter = ""; - $ldap_values = array("objectClass", "description"); + $filter = ''; + $ldap_values = array('objectClass', 'description'); foreach ($types as $type) { $i = objects::infos($type); $filter .= $i['filter']; $ldap_values[] = $i['mainAttr']; // Specific key for departement objectTypes } - $filter = "(|".$filter.")"; + $filter = '(|'.$filter.')'; /* Get list of department objects */ $ldap = $this->get_ldap_link(); @@ -660,17 +657,15 @@ class config { $dn = $ldap->getDN(); $data = objects::infos($oc); - $this->department_info[$dn] = array("img" => $data['icon'], - "description" => isset($attrs['description'][0])?$attrs['description'][0]:"", - "name" => $attrs[$data['mainAttr']][0]); - - if ($dn == $ignore_dn) { - continue; - } - $c_dn = convert_department_dn($dn)." (".$data['mainAttr'].")"; + $this->department_info[$dn] = array( + 'img' => $data['icon'], + 'description' => (isset($attrs['description'][0]) ? $attrs['description'][0] : ''), + 'name' => $attrs[$data['mainAttr']][0] + ); /* Only assign non-root departments */ if ($dn != $result['/']) { + $c_dn = convert_department_dn($dn).' ('.$data['mainAttr'].')'; $result[$c_dn] = $dn; } } diff --git a/plugins/admin/departments/class_department.inc b/plugins/admin/departments/class_department.inc index 4467fcaaa6250bdb0d111a23a4ae5e2b07d12f09..5eb0aa8fe9e6622e3f9ecdfe904b7f57cc1e1528 100644 --- a/plugins/admin/departments/class_department.inc +++ b/plugins/admin/departments/class_department.inc @@ -179,16 +179,6 @@ class department extends simplePlugin return $message; } - function execute() - { - /* Reload departments */ - $this->config->get_departments($this->dn); - $this->config->make_idepartments(); - - /* Call parent execute */ - return parent::execute(); - } - function get_allowed_bases() { /* Hide all departments, that are subtrees of this department */ diff --git a/plugins/admin/departments/tabs_department.inc b/plugins/admin/departments/tabs_department.inc index 21f76fa7fb223182f8b9577d9219fed1cab78b95..b6328521190eae66a7397d6600ffa6902dc1f39e 100644 --- a/plugins/admin/departments/tabs_department.inc +++ b/plugins/admin/departments/tabs_department.inc @@ -28,6 +28,7 @@ class deptabs extends simpleTabs /* Update department cache */ global $config; $config->get_departments(); + $config->make_idepartments(); } } ?>