Code

Applied patch Mike Gabriel, to enabled removal of dhcp host entries when host is...
[gosa.git] / gosa-plugins / systems / admin / systems / class_termDNS.inc
index 23bfb40585810f3434b83f5a159e8c4aa0b56f56..5fcdd76e05a563f4344055ae917d5fc037614eb9 100644 (file)
@@ -471,9 +471,15 @@ class termDNS extends plugin
 
   function remove_from_parent()
   {
+
+    $ldap = $this->config->get_ldap_link();
+
+    /************
+     * DNS Handling
+     ************/
+
     if($this->DNS_is_account){
 
-      $ldap = $this->config->get_ldap_link();
 
       $tmp = array();
       $this->dnsEntry['exists'] = false;
@@ -489,6 +495,19 @@ class termDNS extends plugin
         }
       }
     }
+
+
+    /************
+     * DHCP Handling 
+     ************/
+
+    /* DHCP removed */
+    if($this->dhcp_is_Account){
+      $ldap->rmdir_recursive($this->dhcpHostEntry['dn']);
+      if (!$ldap->success()){
+        msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dhcpHostEntry['dn'], LDAP_DEL, get_class()));
+      }
+    }
   }
 
 
@@ -786,7 +805,7 @@ class termDNS extends plugin
           ($this->dhcpHostEntry['dhcpStatements'] == "" || count($this->dhcpHostEntry['dhcpStatements']) == 0) ){
         unset($this->dhcpHostEntry['dhcpStatements']);
       }
-  
+
       /* DHCP removed */
       if($this->initial_dhcp_is_Account && !$this->dhcp_is_Account){
         $ldap->rmdir_recursive($this->dhcpHostEntry['dn']);