Code

Updated printGeneric.
[gosa.git] / plugins / admin / systems / class_printGeneric.inc
index 12b80670eaf80058aeb026814318fb5ff09c6023..a3a3f34a32a3c694878816caa2007b5a0ec7c8fe 100644 (file)
@@ -249,7 +249,7 @@ class printgeneric extends plugin
      */
     if($this->BelongsTo == "unknown"){
       $display= $this->show_header(_("Add printer extension"),
-          _("Could not intialize printer tab, parameter parent was missing while construction."),TRUE,TRUE);
+          _("Could not initialize printer tab, parameter parent was missing while construction."),TRUE,TRUE);
       return($display);
     }
 
@@ -499,10 +499,10 @@ class printgeneric extends plugin
           $smarty->assign("driverInfo", $ppdManager->loadDescription($path.$this->gotoPrinterPPD));
         }
       }else{
-        $smarty->assign("driverInfo", _("not defined"));
+        $smarty->assign("driverInfo", _("Not defined"));
       }
     }else{
-      $smarty->assign("driverInfo",_("can't get ppd informations."));
+      $smarty->assign("driverInfo",_("Can't get ppd informations."));
     }
 
     /* Create user & admin user list */
@@ -589,7 +589,7 @@ class printgeneric extends plugin
 
       /* Delete references to object groups */
       $ldap->cd ($this->config->current['BASE']);
-      $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+      $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
       while ($ldap->fetch()){
         $og= new ogroup($this->config, $ldap->getDN());
         unset($og->member[$this->dn]);
@@ -640,13 +640,18 @@ class printgeneric extends plugin
 
     /* must: cn */
     if(($this->BelongsTo == "Printer") && (empty($this->cn))){
-      $message[]= "The required field 'Printer name' is not set.";
+      $message[]= _("The required field 'Printer name' is not set.");
+    }
+
+    /* must: cn */
+    if(($this->BelongsTo == "Printer") && !is_dns_name($this->cn)){
+      $message[]= _("Invalid character in printer name.");
     }
 
     if($this->BelongsTo == "Printer"){
       $ui= get_userinfo();
       $acl= get_permissions ($dn, $ui->subtreeACL);
-      $acl= get_module_permission($acl, "printgeneric", $this->dn);
+      $acl= get_module_permission($acl, "printgeneric", $dn);
       if (chkacl($acl, "create") != ""){
         $message[]= _("You have no permissions to create a printer on this 'Base'.");
       }
@@ -717,8 +722,17 @@ class printgeneric extends plugin
       $this->PPDdialogToSave->save_ppd();
     }
 
+    if($this->orig_dn != $this->dn && $this->initially_was_account){
+      if(!empty($this->gotoPrinterPPD)) {
+        $this->PPDdialogToSave = new printerPPDDialog($this->config, $this->dn,$this->gotoPrinterPPD);
+        $this->PPDdialogToSave->cn = $this->cn;
+        $this->PPDdialogToSave->generateProperties();
+        $this->gotoPrinterPPD = $this->PPDdialogToSave->update_ppd_url();
+      }
+    }
+
     /* Remove previously selected ppd file.*/
-    if($this->initial_PPD != $this->gotoPrinterPPD){
+    if($this->initial_PPD != $this->gotoPrinterPPD && $this->initially_was_account){
       if(!empty($this->initial_PPD)){
         $tmp = new printerPPDDialog($this->config, $this->dn,$this->initial_PPD);
         $tmp->removeModifiedPPD();
@@ -838,9 +852,6 @@ class printgeneric extends plugin
       $this->netConfigDNS->dn = $this->dn;
       $this->netConfigDNS->save($this->dn);
     }
-
-    /* This is a multi object. Handle tagging here... */
-    $this->handle_object_tagging();
   }
 
   function generateList(){