Skip to content

Commit 55485d1

Browse files
committed
Fix client selection
1 parent f8ad820 commit 55485d1

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

interface/web/client/client_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function onShowEdit() {
9494

9595
chdir('../client');
9696

97-
$tmp = $app->db->queryOneRecord("SELECT company_name, contact_firstname, contact_name, email FROM client WHERE sys_groupid = ?", $current_client_id);
97+
$tmp = $app->db->queryOneRecord("SELECT company_name, contact_firstname, contact_name, email FROM client WHERE client_id = ?", $current_client_id);
9898
$app->tpl->setVar('company_name', $tmp['company_name']);
9999
$app->tpl->setVar('contact_name', $tmp['contact_name']);
100100
$app->tpl->setVar('email', $tmp['email']);

interface/web/dashboard/dashlets/limits.php

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -147,32 +147,20 @@ public function show($limit_to_client_id = 0)
147147
}
148148
$tpl->setVar($wb);
149149

150-
if ($app->auth->is_admin()) {
151-
$user_is_admin = true;
152-
} else {
153-
$user_is_admin = false;
154-
}
155-
$tpl->setVar('is_admin', $user_is_admin);
156-
157-
if ($user_is_admin == false) {
158-
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
159-
$client = $app->db->queryOneRecord("SELECT * FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
160-
}
161-
162-
if ($limit_to_client_id == 0 || !$app->auth->is_admin()) {
150+
if ($limit_to_client_id == 0) {
163151
$client_id = $_SESSION['s']['user']['client_id'];
164152
} else {
165153
$client_id = $limit_to_client_id;
166154
}
167155

156+
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
157+
$client = $app->db->queryOneRecord("SELECT * FROM client WHERE client_id = ?", $client_id);
158+
159+
168160
$rows = array();
169161
foreach ($limits as $limit) {
170162
$field = $limit['field'];
171-
if ($user_is_admin) {
172-
$value = $wb['unlimited_txt'];
173-
} else {
174-
$value = $client[$field];
175-
}
163+
$value = $client[$field];
176164
if ($value != 0 || $value == $wb['unlimited_txt']) {
177165
$value_formatted = ($value == '-1')?$wb['unlimited_txt']:$value;
178166
if (isset($limit['q_type']) && $limit['q_type'] != '') {

0 commit comments

Comments
 (0)