$app->db->query("UPDATE client SET parent_client_id = ".$app->functions->intval($_SESSION['s']['user']['client_id'])." WHERE client_id = ".$this->id);
}else{
if($this->dataRecord['parent_client_id']>0){
//* get userid of the reseller and add it to the group of the client
$tmp=$app->db->queryOneRecord("SELECT sys_user.userid FROM sys_user,sys_group WHERE sys_user.default_group = sys_group.groupid AND sys_group.client_id = ".$app->functions->intval($this->dataRecord['parent_client_id']));
$app->db->query("UPDATE client SET parent_client_id = ".$app->functions->intval($this->dataRecord['parent_client_id'])." WHERE client_id = ".$this->id);
unset($tmp);
}
}
//* Set the default servers
...
...
@@ -448,7 +474,7 @@ class page_action extends tform_actions {
$tmp=$app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".intval($this->id));
$groupid=$tmp['groupid'];
unset($tmp);
//* Remove sys_user of old reseller from client group
if($this->oldDataRecord['parent_client_id']>0){
//* get userid of the old reseller remove it from the group of the client
$tmp=$app->db->queryOneRecord("SELECT sys_user.userid FROM sys_user,sys_group WHERE sys_user.default_group = sys_group.groupid AND sys_group.client_id = ".$app->functions->intval($this->oldDataRecord['parent_client_id']));
//* get userid of the reseller and add it to the group of the client
$tmp=$app->db->queryOneRecord("SELECT sys_user.userid, sys_user.default_group FROM sys_user,sys_group WHERE sys_user.default_group = sys_group.groupid AND sys_group.client_id = ".$app->functions->intval($this->dataRecord['parent_client_id']));