Code

Fixed save_object
[gosa.git] / plugins / admin / systems / class_printGeneric.inc
index cca13971748924c67cea1ece5cf1515d1b2505b2..7c51299fe51f3e6c49e77dbf020cce1e3f62d089 100644 (file)
@@ -77,7 +77,7 @@ class printgeneric extends plugin
 
     /* set orig dn to new if object is new */
     $ldap= $this->config->get_ldap_link();
-    $ldap->cat($this->dn);
+    $ldap->cat($this->dn, array('dn'));
     if(!$ldap->count()){
       $this->orig_dn = "new";
     }
@@ -206,9 +206,9 @@ class printgeneric extends plugin
 
       /* Detect if this is a valid printer account;
        */
+      //FIXME: do we need to do this? we've already everything we need in $this->attrs...
       $ldap = $this->config->get_ldap_link();
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->cat($this->dn);
+      $ldap->cat($this->dn, array('objectClass'));
 
       if($ldap->count()){
         $attrs = $ldap->fetch();
@@ -349,6 +349,8 @@ class printgeneric extends plugin
       $smarty->assign("$attr", $this->$attr);
     }
 
+    $smarty->assign("baseACL", chkacl($this->acl,"base"));
+
     if(isset($_POST['AddUser'])){
       $this->dialog = new selectUserToPrinterDialog($this->config, get_userinfo(),"AddUser");
     }
@@ -533,23 +535,23 @@ class printgeneric extends plugin
 
       /* Check if this dn points to a printer, to avoid deleting something else */
       $ldap= $this->config->get_ldap_link();
-      $ldap->cat($this->dn);
+      $ldap->cat($this->dn, array('dn',"objectClass"));
       if(!$ldap->count()){
-        print_red("Trying to remove printer obejct which isn't a printer. Aborted to avoid data loss.");
+        print_red("Trying to remove printer object which isn't a printer. Aborted to avoid data loss.");
         return;
       }
 
       /* Check if obejct is a printer */
       $CheckPrinter = $ldap->fetch();
       if(!in_array("gotoPrinter",$CheckPrinter['objectClass'])){
-        print_red("Trying to remove printer obejct which isn't a printer. Aborted to avoid data loss.");
+        print_red("Trying to remove printer object which isn't a printer. Aborted to avoid data loss.");
         return;
       }
 
       /* Remove account & dns extension */ 
       $this->netConfigDNS->remove_from_parent();
       $ldap->rmdir($this->dn);
-      show_ldap_error($ldap->get_error());
+      show_ldap_error($ldap->get_error(), _("Removing printer failed"));
       $this->handle_post_events("remove");
 
       /* Delete references to object groups */
@@ -600,6 +602,11 @@ class printgeneric extends plugin
       $message[]= "The required field 'Printer name' is not set.";
     }
     
+    /* must: labeledURI */
+    if(empty($this->labeledURI)){
+      $message[]= "The required field 'Printer URL' 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();
@@ -726,7 +733,7 @@ class printgeneric extends plugin
 
       $this->handle_post_events("modify");
     }
-    show_ldap_error($ldap->get_error());
+    show_ldap_error($ldap->get_error(), _("Saving printer failed"));
 
     $this->netConfigDNS->cn = $this->cn;
     $this->netConfigDNS->dn = $this->dn;