Code

Some fixes
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 31 Mar 2006 06:07:30 +0000 (06:07 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 31 Mar 2006 06:07:30 +0000 (06:07 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2937 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_servDNSeditZoneEntries.inc

index fa41684f87f1d392356002951ae6b45224c7cbc5..7a2e57a45d817e6106ec421c3c040efad07d80a3 100644 (file)
@@ -168,8 +168,13 @@ class servDNSeditZoneEntries extends plugin
        */
       if(preg_match("/RenameHost_/",$name)){
         if((isset($this->Devices[$Name])) && ($Name != $value)){
-          $this->Devices[$value] = $this->Devices[$Name];
-          unset($this->Devices[$Name]);
+    
+          if(isset($this->Devices[$value])){
+            print_red(sprintf(_("Can't rename '%s' to '%s' there is already an entry with the same name in our zone editing dialog."),$Name,$value));
+          }else{
+            $this->Devices[$value] = $this->Devices[$Name];
+            unset($this->Devices[$Name]);
+          }
         }
       }
     }
@@ -197,9 +202,16 @@ class servDNSeditZoneEntries extends plugin
       /* Renaming check for existing devices 
        */
       if(isset($device['OrigCn'])  && ($DevName != $device['OrigCn'] )){
-        $ldap->search("(cn=".$DevName.")",array("cn"));
+        $ldap->cd($this->config->current['BASE']);
+        $ldap->search("(relativeDomainName=".$DevName.")",array("relativeDomainName"));
+        if($ldap->count()){
+          $message[] = sprintf(_("Can not rename '%s' to '%s',the destination name already exists."),$device['OrigCn'],$DevName);
+        }
+      }elseif(!isset($device['OrigCn'])){
+        $ldap->cd($this->config->current['BASE']);
+        $ldap->search("(relativeDomainName=".$DevName.")",array("relativeDomainName"));
         if($ldap->count()){
-          $message[] = sprintf(_("Can't rename '%s' to '%s',the destination name already exists."),$device['OrigCn'],$DevName);
+          $message[] = sprintf(_("Can not create '%s',the destination name already exists."),$DevName);
         }
       }