Code

When moving or renaming devices, check whether they are in use by a
[gosa.git] / trunk / gosa-plugins / goto / admin / devices / class_deviceGeneric.inc
index d4d5043cae7c2040b2abd65134ad9782fd7fc7ec..cd83d097eef8294095971a63e1fbc34e89feb6ae 100644 (file)
@@ -126,6 +126,21 @@ class deviceGeneric extends plugin
       $message[] = msgPool::permMove();
     }
 
+    if ($this->cn != $this->orig_cn || $this->base != $this->orig_base) { 
+
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->search("(&(objectClass=gotoEnvironment)(gotoHotplugDeviceDN=".LDAP::prepare4filter($this->orig_dn)."))",
+                    array("cn","uid"));
+      $obj = array();
+      while($attrs = $ldap->fetch()){
+        $obj[$ldap->getDN()]= $attrs['cn'][0];
+      }
+      if ($obj != array()) {
+        $message[] = msgPool::stillInUse(_("Device"), $obj);
+      }
+    }
+     
     return($message);
   }