From 7bce72dd8ffc5a1e072d9d51cd4e40ede7258d3d Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Thu, 07 Apr 2016 12:26:40 -0400
Subject: [PATCH] Fixed: Issue #3693 Choose better default customer numbers for clients of resellers.

---
 interface/web/sites/webdav_user_edit.php |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/interface/web/sites/webdav_user_edit.php b/interface/web/sites/webdav_user_edit.php
index 42c75ca..73e47eb 100644
--- a/interface/web/sites/webdav_user_edit.php
+++ b/interface/web/sites/webdav_user_edit.php
@@ -137,6 +137,15 @@
 
 			/* restrict the names */
 			$this->dataRecord['username'] = $webdavuser_prefix . $this->dataRecord['username'];
+
+			/*
+			*  Get the data of the domain, owning the webdav user
+			*/
+			$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
+			/* The server is the server of the domain */
+			$this->dataRecord["server_id"] = $web["server_id"];
+			/* The Webdav user shall be owned by the same group then the website */
+			$this->dataRecord["sys_groupid"] = $web['sys_groupid'];
 		}
 
 		parent::onBeforeInsert();
@@ -159,7 +168,6 @@
 		
 		$sql = "UPDATE webdav_user SET server_id = ?, sys_groupid = ?, password = ? WHERE webdav_user_id = ?";
 		$app->db->query($sql, $server_id, $sys_groupid, $this->dataRecord["password"], $this->id);
-		
 	}
 
 	function onBeforeUpdate() {

--
Gitblit v1.9.1