Skip to content

Commit 79c08d1

Browse files
committed
Fixed: FS#1221 - Remote : update user 'username unique' error.
1 parent 1f1072f commit 79c08d1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

interface/lib/classes/validate_client.inc.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ class validate_client {
3636
function username_unique($field_name, $field_value, $validator) {
3737
global $app;
3838

39-
if($app->tform->primary_id == 0) {
39+
if(isset($app->remoting_lib->primary_id)) {
40+
$client_id = $app->remoting_lib->primary_id;
41+
} else {
42+
$client_id = $app->tform->primary_id;
43+
}
44+
45+
if($client_id == 0) {
4046
$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM sys_user WHERE username = '".$app->db->quote($field_value)."'");
4147
if($num_rec["number"] > 0) {
4248
$errmsg = $validator['errmsg'];
@@ -47,7 +53,7 @@ function username_unique($field_name, $field_value, $validator) {
4753
}
4854
}
4955
} else {
50-
$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM sys_user WHERE username = '".$app->db->quote($field_value)."' AND client_id != ".$app->tform->primary_id);
56+
$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM sys_user WHERE username = '".$app->db->quote($field_value)."' AND client_id != ".$client_id);
5157
if($num_rec["number"] > 0) {
5258
$errmsg = $validator['errmsg'];
5359
if(isset($app->tform->wordbook[$errmsg])) {

0 commit comments

Comments
 (0)