$client=$app->db->queryOneRecord("SELECT limit_dns_zone, default_dnsserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
// When the record is updated
if($this->id>0){
// restore the server ID if the user is not admin and record is edited
$tmp=$app->db->queryOneRecord("SELECT server_id FROM dns_soa WHERE id = ".intval($this->id));
$this->dataRecord["server_id"]=$tmp["server_id"];
unset($tmp);
// When the record is inserted
}else{
// set the server ID to the default mailserver of the client
$client=$app->db->queryOneRecord("SELECT limit_dns_zone, default_dnsserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
// When the record is updated
if($this->id>0){
// restore the server ID if the user is not admin and record is edited
$tmp=$app->db->queryOneRecord("SELECT server_id FROM dns_soa WHERE id = ".intval($this->id));
$this->dataRecord["server_id"]=$tmp["server_id"];
unset($tmp);
// When the record is inserted
}else{
// set the server ID to the default mailserver of the client