Code

Updated devices
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 13 Aug 2008 09:36:02 +0000 (09:36 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 13 Aug 2008 09:36:02 +0000 (09:36 +0000)
-Fixed empty checks.
-Fixed object creation, it wasn't possible to create new devices - no objectClasses were set.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12206 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/devices/class_deviceGeneric.inc

index e87182120b62c388b433a014680e80a5d75165de..59295598ae3bc429f7b5e9f0017d82ab9b59851a 100644 (file)
@@ -86,7 +86,7 @@ class deviceGeneric extends plugin
   {
     $message = plugin::check();
 
-    if(empty($this->cn)||(preg_match("/[^a-z0-9]/i",$this->cn))){
+    if($this->cn == "" ||(preg_match("/[^a-z0-9]/i",$this->cn))){
       $message[]= msgPool::invalid(_("Name"),$this->cn,"/^[a-z0-9]*$/i");
     }
     if(preg_match("/[^a-z0-9!\"?.,;:-_\(\) ]/i",$this->description)){
@@ -165,8 +165,14 @@ class deviceGeneric extends plugin
   {
     plugin::save();
 
-    $this->attrs = array();
-    $this->attrs['cn'] = $this->cn;
+    /* Unset non ldap attributes 
+     */
+    foreach(array("devID","serial","vendor", "type", "description") as $name){
+      if(isset($this->attrs[$name])){
+        unset($this->attrs[$name]);
+      }
+    }
+
     $this->attrs['gotoHotplugDevice'] = "";
     foreach(array("description","devID","serial","vendor", "type") as $post){
       $this->attrs['gotoHotplugDevice'] .= $this->$post."|";