Code

Fixed glpi contact/technical person selection
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 29 Nov 2006 07:40:59 +0000 (07:40 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 29 Nov 2006 07:40:59 +0000 (07:40 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5240 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_divListSystem.inc
plugins/admin/systems/class_glpiSelectUser.inc

index 435f8291fda0ba698df4d61f6e656467de5e2fd0..bb233f22652e5668215efdffc4265ee1a0f5eb79 100644 (file)
@@ -159,7 +159,7 @@ class divListSystem extends MultiSelectWindow
         name='newsystem_server' alt='"._("New Server")."' title='"._("New Server")."'>&nbsp;";
     }
 
-    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"printer/printgenric"))){
+    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"printer/printgeneric"))){
       $listhead .= "<input class='center' type='image' align='middle' src='images/select_new_printer.png'    
         name='newsystem_printer'     alt='"._("New Printer")."' title='"._("New Printer")."'>&nbsp;";
     }
index ff7c0a4ac7b7354ebe9f9aa63e6c9362c5bca1e3..208dca5536034c34af86912cf1bdb268c754cae8 100644 (file)
@@ -146,13 +146,27 @@ class glpiSelectUser extends plugin
      /* Prepare departments,
        which are shown in the listbox on top of the listbox
      */
-    $options= "";
+
+    
+    /* Get all departments within this subtree */
     $this->base = $_SESSION['glpi_user_filter']['base'];
-    foreach ($this->get_allowed_bases("users/user") as $key => $value){
-      if ($_SESSION['glpi_user_filter']['base'] == $key){
-        $options.= "<option selected='selected' value='$key'>$value</option>";
-      } else {
-        $options.= "<option value='$key'>$value</option>";
+    $options  ="";
+    $base = $this->config->current['BASE'];
+    $deps= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", "users", $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH);
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments("users");
+    $ids = $this->config->idepartments;
+    foreach($deps as $dep){
+      if(isset($ids[$dep['dn']]) && in_array_ics($dep['dn'], $tdeps)){
+        $value = $ids[$dep['dn']];
+        if ($this->base == $dep['dn']){
+          $options.= "<option selected='selected' value='".$dep['dn']."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep['dn']."'>$value</option>";
+        }
       }
     }
 
@@ -209,7 +223,7 @@ class glpiSelectUser extends plugin
      * So we are able to navigate like in konquerer
      */
 
-    $res3= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))",preg_replace("/\//","",$this->acl_category),
+    $res3= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))","users",
        $base, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT);
 
     $this->departments= array();
@@ -230,7 +244,7 @@ class glpiSelectUser extends plugin
      */
     $ou = get_people_ou();
 
-    $res2= get_list("(&(|(cn=$regex)(sn=$regex))(objectClass=person))", preg_replace("/\//","",$this->acl_category),
+    $res2= get_list("(&(|(cn=$regex)(sn=$regex))(objectClass=person))", "users",
                     $ou.$base, array("cn", "sn", "uid", "givenName", "description"),
                     GL_SUBSEARCH | GL_SIZELIMIT);