Commit 327f28a3 authored by tbrehm's avatar tbrehm

Fixed: FS#1045 - Error when a reseller edit site

parent 7bc0f15d
......@@ -76,9 +76,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(is_array($clients)) {
foreach( $clients as $client) {
$selected = ($client["groupid"] == @$this->dataRecord["sys_groupid"])?'SELECTED':'';
$selected = ($client["groupid"] == @$tmp_data_record["sys_groupid"])?'SELECTED':'';
$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
}
}
......@@ -93,9 +94,10 @@ class page_action extends tform_actions {
$sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY name";
$clients = $app->db->queryAllRecords($sql);
$client_select = '<option value="'.$client['client_id'].'">'.$client['contact_name'].'</option>';
$tmp_data_record = $app->tform->getDataRecord($this->id);
if(is_array($clients)) {
foreach( $clients as $client) {
$selected = @($client["groupid"] == $this->dataRecord["sys_groupid"])?'SELECTED':'';
$selected = @($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':'';
$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
}
}
......
......@@ -80,9 +80,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(is_array($clients)) {
foreach( $clients as $client) {
$selected = ($client["groupid"] == $this->dataRecord["sys_groupid"])?'SELECTED':'';
$selected = ($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':'';
$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
}
}
......@@ -103,9 +104,10 @@ class page_action extends tform_actions {
$sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id'];
$clients = $app->db->queryAllRecords($sql);
$client_select = '<option value="'.$client['client_id'].'">'.$client['contact_name'].'</option>';
$tmp_data_record = $app->tform->getDataRecord($this->id);
if(is_array($clients)) {
foreach( $clients as $client) {
$selected = @($client["groupid"] == $this->dataRecord["sys_groupid"])?'SELECTED':'';
$selected = @($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':'';
$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
}
}
......
......@@ -96,9 +96,10 @@ class page_action extends tform_actions {
$sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY name";
$clients = $app->db->queryAllRecords($sql);
$client_select = '<option value="'.$client['client_id'].'">'.$client['contact_name'].'</option>';
$tmp_data_record = $app->tform->getDataRecord($this->id);
if(is_array($clients)) {
foreach( $clients as $client) {
$selected = @($client["groupid"] == $this->dataRecord["sys_groupid"])?'SELECTED':'';
$selected = @($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':'';
$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
}
}
......@@ -133,9 +134,10 @@ class page_action extends tform_actions {
$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);
if(is_array($clients)) {
foreach( $clients as $client) {
$selected = @($client["groupid"] == $this->dataRecord["sys_groupid"])?'SELECTED':'';
$selected = @($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':'';
$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
}
}
......
......@@ -114,9 +114,10 @@ class page_action extends tform_actions {
$sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY name";
$records = $app->db->queryAllRecords($sql);
$client_select = '<option value="'.$client['client_id'].'">'.$client['contact_name'].'</option>';
$tmp_data_record = $app->tform->getDataRecord($this->id);
if(is_array($records)) {
foreach( $records as $rec) {
$selected = @($rec["groupid"] == $this->dataRecord["sys_groupid"])?'SELECTED':'';
$selected = @($rec["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':'';
$client_select .= "<option value='$rec[groupid]' $selected>$rec[name]</option>\r\n";
}
}
......@@ -169,9 +170,10 @@ class page_action extends tform_actions {
$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);
if(is_array($clients)) {
foreach( $clients as $client) {
$selected = @($client["groupid"] == $this->dataRecord["sys_groupid"])?'SELECTED':'';
$selected = @($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':'';
$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment