Skip to content

Commit 492fb7a

Browse files
author
Pascal Dreissen
committed
Server select fixes (only one selectable when more servers where appointed) Fixes #4725
1 parent 6f4ac3d commit 492fb7a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

interface/lib/classes/custom_datasource.inc.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ function dns_servers($field, $record) {
4747
if($_SESSION["s"]["user"]["typ"] == 'user') {
4848
// Get the limits of the client
4949
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
50+
5051
$client = $app->db->queryOneRecord("SELECT default_dnsserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
5152
$sql = "SELECT server_id,server_name FROM server WHERE server_id = ?";
5253
} else {
@@ -167,9 +168,10 @@ function client_servers($field, $record) {
167168
$sql = "SELECT $server_type as server_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?";
168169
$client = $app->db->queryOneRecord($sql, $client_group_id);
169170
if($client['server_id'] > 0) {
170-
//* Select the default server for the client
171-
$sql = "SELECT server_id,server_name FROM server WHERE server_id = ?";
172-
$records = $app->db->queryAllRecords($sql, $client['server_id']);
171+
//* Select the available servers for the client
172+
$clientservers = $client['server_id'];
173+
$sql = "SELECT server_id,server_name FROM server WHERE server_id IN ($clientservers) ORDER BY server_name";
174+
$records = $app->db->queryAllRecords($sql);
173175
} else {
174176
//* Not able to find the clients defaults, use this as fallback and add a warning message to the log
175177
$app->log('Unable to find default server for client in custom_datasource.inc.php', 1);
@@ -182,7 +184,7 @@ function client_servers($field, $record) {
182184
$records = $app->db->queryAllRecords($sql, $field);
183185
}
184186

185-
187+
186188
$records_new = array();
187189
if(is_array($records)) {
188190
foreach($records as $rec) {
@@ -197,4 +199,4 @@ function client_servers($field, $record) {
197199

198200
}
199201

200-
?>
202+
?>

0 commit comments

Comments
 (0)