From 8de24d4a4c4dd9b0e87c524b8021b06f5055394f Mon Sep 17 00:00:00 2001
From: Florian Schaal <info@schaal-24.de>
Date: Wed, 14 Sep 2016 12:49:30 +0200
Subject: [PATCH] Fixes #4146

---
 interface/web/client/domain_edit.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/interface/web/client/domain_edit.php b/interface/web/client/domain_edit.php
index 9064581c17..67be43e04c 100644
--- a/interface/web/client/domain_edit.php
+++ b/interface/web/client/domain_edit.php
@@ -85,10 +85,10 @@ class page_action extends tform_actions {
 			$clients = $app->db->queryAllRecords($sql);
 			$client_select = '';
 			if($_SESSION["s"]["user"]["typ"] == 'admin') $client_select .= "<option value='0'></option>";
-			$tmp_data_record = $app->tform->getDataRecord($this->id);
+			if($this->id > 0) $tmp_data_record = $app->tform->getDataRecord($this->id); else $tmp_data_record = $this->dataRecord;
 			if(is_array($clients)) {
 				foreach( $clients as $client) {
-					$selected = ($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':'';
+					$selected = ($client["groupid"] == $tmp_data_record["sys_groupid"] || $client["groupid"] == $tmp_data_record["client_group_id"])?'SELECTED':'';
 					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
-- 
GitLab