From f7e9ef7662febc60ed3ff7091439f455a28a8a39 Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Fri, 29 Jul 2016 12:51:51 +0200
Subject: [PATCH] Fix 2: #4059 can't edit existing subdomain

---
 interface/lib/classes/tools_sites.inc.php    | 2 +-
 interface/web/sites/web_childdomain_edit.php | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/interface/lib/classes/tools_sites.inc.php b/interface/lib/classes/tools_sites.inc.php
index 94c6d78787..b2881f57cc 100644
--- a/interface/lib/classes/tools_sites.inc.php
+++ b/interface/lib/classes/tools_sites.inc.php
@@ -157,7 +157,7 @@ class tools_sites {
 				$field = "domain";
 				$select = $field;
 			}
-			$sql .= " domain NOT IN (SELECT $select FROM ?? WHERE $field = ?) AND";
+			$sql .= " domain NOT IN (SELECT $select FROM ?? WHERE $field != ?) AND";
 		}
 		if ($_SESSION["s"]["user"]["typ"] == 'admin') {
 			$sql .= " 1";
diff --git a/interface/web/sites/web_childdomain_edit.php b/interface/web/sites/web_childdomain_edit.php
index 2377ad288a..465356402b 100644
--- a/interface/web/sites/web_childdomain_edit.php
+++ b/interface/web/sites/web_childdomain_edit.php
@@ -105,7 +105,7 @@ class page_action extends tform_actions {
 			/*
 			 * The domain-module is in use.
 			*/
-			$domains = $app->tools_sites->getDomainModuleDomains($this->_vhostdomain_type == 'subdomain' ? null : "web_domain", $this->dataRecord["domain"]);
+			$domains = $app->tools_sites->getDomainModuleDomains($this->_vhostdomain_type == 'subdomain' ? null : "web_domain");
 			$domain_select = '';
 			$selected_domain = '';
 			if(is_array($domains) && sizeof($domains) > 0) {
-- 
GitLab