Code

Column name changed.
[gosa.git] / gosa-plugins / goto / admin / systems / goto / class_terminalGeneric.inc
index a830400668f5d4ddd0116d33a84fd54631b87ada..9fdf6fabeae2b5438450bfa54308c02c450c7ccb 100644 (file)
@@ -125,7 +125,7 @@ class termgeneric extends plugin
       $ui= get_userinfo();
       $this->base= dn2base($ui->dn);
     } else {
-      $this->base= preg_replace ("/^[^,]+,".normalizePreg(get_ou("terminalou"))."/", "", $this->dn);
+      $this->base= preg_replace ("/^[^,]+,".normalizePreg(get_ou("terminalRDN"))."/", "", $this->dn);
     }
 
     /* Create an array of all Syslog servers */
@@ -426,7 +426,7 @@ class termgeneric extends plugin
     }
 
     /* Permissions for that base? */
-    $this->dn= "cn=".$this->cn.",".get_ou('terminalou').$this->base;
+    $this->dn= "cn=".$this->cn.",".get_ou('terminalRDN').$this->base;
 
     if ($this->cn == ""){
       $message[]= msgPool::required(_("Name"));
@@ -449,7 +449,7 @@ class termgeneric extends plugin
       }
       if ($ldap->count() != 0){
         while ($attrs= $ldap->fetch()){
-          if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".normalizePreg(get_ou('incomingou'))."/", $ldap->getDN())){
+          if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".normalizePreg(get_ou('systemIncomingRDN'))."/", $ldap->getDN())){
             continue;
           } else {
             if ($attrs['dn'] != $this->orig_dn){
@@ -525,6 +525,11 @@ class termgeneric extends plugin
       }
     }
 
+    /* cn=default and macAddress=- indicates that this is a template */
+    if($this->cn == "default"){
+      $this->netConfigDNS->macAddress = "-";
+    }
+
     /* Write back to ldap */
     $ldap= $this->config->get_ldap_link();
     if ($this->orig_dn == 'new'){
@@ -536,12 +541,20 @@ class termgeneric extends plugin
       }
       $ldap->add($this->attrs);
       new log("create","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+      $this->netConfigDNS->cn = $this->cn;
+      $this->netConfigDNS->save();
+
       $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
     } else {
       $ldap->cd($this->dn);
       $this->cleanup();
       $ldap->modify ($this->attrs); 
       new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+      $this->netConfigDNS->cn = $this->cn;
+      $this->netConfigDNS->save();
+
       $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
 
       /* Update all accessTo/trust dependencies */
@@ -550,13 +563,6 @@ class termgeneric extends plugin
       }
     }
     
-    /* cn=default and macAddress=- indicates that this is a template */
-    if($this->cn == "default"){
-      $this->netConfigDNS->macAddress = "-";
-    }
-
-    $this->netConfigDNS->cn = $this->cn;
-    $this->netConfigDNS->save();
     if (!$ldap->success()){
       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
     }
@@ -676,6 +682,9 @@ class termgeneric extends plugin
     if($this->member_of_ogroup && isset($this->parent->by_object['termstartup'])){
       $this->parent->by_object['termstartup']->gotoBootKernel = "default-inherited";
       $this->parent->by_object['termstartup']->gotoLdapServer = "default-inherited";
+
+      $this->parent->by_object['workstartup']->gotoLdap_inherit = TRUE;
+      $this->parent->by_object['workstartup']->gotoLdapServers = array();
     }
   }
 }