From 8ab3cdc09cfbac3157e996664616c229214f6c8d Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Fri, 21 Oct 2011 06:03:56 -0400
Subject: [PATCH] Merged revisions 2681-2739 from 3.0.4 stable branch.

---
 interface/web/sites/web_domain_edit.php |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php
index dff5148..34a61a0 100644
--- a/interface/web/sites/web_domain_edit.php
+++ b/interface/web/sites/web_domain_edit.php
@@ -50,7 +50,7 @@
 
 class page_action extends tform_actions {
 
-	// Returna a "3/2/1" path hash from a numeric id '123'
+	//* Returna a "3/2/1" path hash from a numeric id '123'
 	function id_hash($id,$levels) {
 		$hash = "" . $id % 10 ;
 		$id /= 10 ;
@@ -141,10 +141,11 @@
 			$records = $app->db->queryAllRecords($sql);
 			$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
 			$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contact_name'].'</option>';
-			$tmp_data_record = $app->tform->getDataRecord($this->id);
+			//$tmp_data_record = $app->tform->getDataRecord($this->id);
+			print_r($this->dataRecord);
 			if(is_array($records)) {
 				foreach( $records as $rec) {
-					$selected = @($rec["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':'';
+					$selected = @(is_array($this->dataRecord) && ($rec["groupid"] == $this->dataRecord['client_group_id'] || $rec["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
 					$client_select .= "<option value='$rec[groupid]' $selected>$rec[name]</option>\r\n";
 				}
 			}
@@ -226,10 +227,11 @@
 			$sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0 ORDER BY name";
 			$clients = $app->db->queryAllRecords($sql);
 			$client_select = "<option value='0'></option>";
-			$tmp_data_record = $app->tform->getDataRecord($this->id);
+			//$tmp_data_record = $app->tform->getDataRecord($this->id);
 			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"])?'SELECTED':'';
+					$selected = @(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
 					$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
 				}
 			}

--
Gitblit v1.9.1