Code

Updated remove_from_parent for devices.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 10 Oct 2007 06:07:09 +0000 (06:07 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 10 Oct 2007 06:07:09 +0000 (06:07 +0000)
Do not remove a used device

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

plugins/admin/devices/class_deviceGeneric.inc

index 9581068608b488c30b3256c0c00cb028ca8d41c6..70029985af018e2bfee174e317dcbd4203478065 100644 (file)
@@ -125,20 +125,18 @@ class deviceGeneric extends plugin
     plugin::remove_from_parent();
     $ldap = $this->config->get_ldap_link();
     $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=gotoEnvironment)(gotoHotplugDeviceDN=*))",array("cn","gotoHotplugDeviceDN"));
+
+    $ldap->search("(&(objectClass=gotoEnvironment)(gotoHotplugDeviceDN=".$this->dn."))",array("cn","gotoHotplugDeviceDN"));
     $skip = FALSE;
     $str ="";
     $cnt = 3;
     while($cnt && $attrs = $ldap->fetch()){
-      if(in_array($this->dn,$attrs['gotoHotplugDeviceDN'])){
-        $skip =TRUE;
-        $str .= $attrs['cn'][0].", ";
-        $cnt --;
-      }
+      $skip =TRUE;
+      $str .= $attrs['cn'][0].", ";
+      $cnt --;
     }
     if($skip){
       $str  = preg_replace("/, $/","",$str);
-
       if($cnt == 0){
         $str .= "...";
       }