Code

Base for printGeneric wasn't set correctly
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 27 Apr 2006 04:29:05 +0000 (04:29 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 27 Apr 2006 04:29:05 +0000 (04:29 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3129 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_printGeneric.inc

index e18bf2409d5411060e8d21610f33d79b226a341f..51b124383034e151f792c4f8f3d8ada7428008b6 100644 (file)
@@ -91,7 +91,13 @@ class printgeneric extends plugin
       $this->base= dn2base($ui->dn);
       $this->cn= "";
     } else {
-      $this->base= dn2base($this->dn);
+    
+      /* Set base and check if the extracted base exists */
+      $this->base= preg_replace("/ou=printers,ou=systems,/","",dn2base($this->dn));
+      if(!isset($this->config->idepartments[$this->base])){
+        print_red(_("Can't extract a valid base out of object dn, setting base to '%s'."),$_SESSION['CurrentMainBase']);
+        $this->base = $_SESSION['CurrentMainBase'];
+      }
     }
 
     /* Extract selected ppd */
@@ -588,7 +594,7 @@ class printgeneric extends plugin
     if(($this->BelongsTo == "Printer") && (empty($this->cn))){
       $message[]= "The required field 'Printer name' is not set.";
     }
-
+    
     /* Check if there is already an entry with this cn*/
     if (($this->orig_dn != $dn)&&($this->BelongsTo == "Printer")){
       $ldap= $this->config->get_ldap_link();