Code

Updated dhcp account
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 28 Mar 2008 14:31:55 +0000 (14:31 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 28 Mar 2008 14:31:55 +0000 (14:31 +0000)
-IP addresses will now be updated

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

gosa-plugins/systems/admin/systems/class_termDNS.inc

index 4c34e9eb41a206b1c37062a0f9445a9dae26d3fb..a0925d884a9d1a0427d530c594d0987ffe30053a 100644 (file)
@@ -645,21 +645,6 @@ class termDNS extends plugin
         }
       }
 
-      if(count($this->dhcpHostEntry) == 0){
-        $this->dialog = new dhcpHost($this->dhcpParentNode,TRUE);
-        $this->dialog->cn = $this->cn;
-        $this->dialog->dhcpHWAddress = "ethernet ".$this->macAddress;
-        if(!empty($this->ipHostNumber)){
-          $this->dialog->statements['fixed-address'] = $this->ipHostNumber;
-        }
-        $this->dialog->execute();
-        $this->dialog->save_object(); 
-        $this->dhcpHostEntry = $this->dialog->save();
-        if(count($this->dhcpHostEntry['dhcpOption']) == 0){
-          $this->dhcpHostEntry['dhcpOption']= array("host-name ".$this->cn);
-        }
-      }
-
       /* Write mac address to dhcp settings */
       if($this->dhcp_is_Account){
         if(!isset($this->dhcpHostEntry['dhcpHWAddress'][0]) || 
@@ -668,7 +653,16 @@ class termDNS extends plugin
           $this->dhcpHostEntry['MODIFIED'] = TRUE;
         }
       }
-  
+
+      /* Updated IP host number */
+      if($this->dhcp_is_Account){
+        foreach($this->dhcpHostEntry['dhcpStatements'] as $id => $value){
+          if(preg_match("/^fixed-address/",$value)){
+            $this->dhcpHostEntry['dhcpStatements'][$id] = "fixed-address ".$this->ipHostNumber; 
+            $this->dhcpHostEntry['MODIFIED'] = TRUE;
+          }
+        }
+      }
 
       /* Unset dhcpStatements if this attribute is empty  */
       if(isset($this->dhcpHostEntry['dhcpStatements']) &&