Code

Reset array of dns to delete, before adding new dns
[gosa.git] / gosa-plugins / goto / admin / devices / class_deviceGeneric.inc
index e929f51552de9c964d870605dfea90d2f883eac2..099788aad5a4abc1fb1cc5e6a981da7e1ad0893d 100644 (file)
@@ -26,9 +26,8 @@ class deviceGeneric extends plugin
     $this->is_account = TRUE;
 
     $this->types= array("camera" => _("Digital camera"),
-                        "harddisk" => _("Harddisk"),
-                        "stick" => _("USB stick"),
-                        "cd" => _("CD/DVD drive"),);
+                        "disc" => _("USB stick"),
+                        "cdrom" => _("CD/DVD drive"),);
     asort($this->types);
 
     /* Set class values */
@@ -98,15 +97,15 @@ class deviceGeneric extends plugin
       $message[]= msgPool::invalid(_("Serial"),"","","0x1234");
     }
     if(empty($this->vendor) || !$this->is_2byteHex($this->vendor)){
-      $message[]= msgPool::invalid(_("Vender ID"),"","","0x1234");
+      $message[]= msgPool::invalid(_("Vendor ID"),"","","0x1234");
     }
-   
+  
     /* Check if entry already exists */ 
-    if($this->cn != $this->orig_cn){
+    if($this->cn != $this->orig_cn || $this->dn == "new"){
       $ldap = $this->config->get_ldap_link();
       $ldap->search("(&(objectClass=gotoDevice)(cn=".$this->cn."*))",array("cn"));
       if($ldap->count()){
-        $message[]= msgPool::duplicate(_("Name"));
+        $message[]= msgPool::duplicated(_("Name"));
       }
     }
 
@@ -144,7 +143,7 @@ class deviceGeneric extends plugin
     $ldap->search("(&(objectClass=gotoEnvironment)(gotoHotplugDeviceDN=".$this->dn."))",array("cn","gotoHotplugDeviceDN"));
     $skip = FALSE;
     $obj = array();
-    while($cnt && $attrs = $ldap->fetch()){
+    while($attrs = $ldap->fetch()){
       $obj[$ldap->getDN()]= $attrs['cn'][0];
       $skip =TRUE;
     }