Though for usual cases like Support / Sales it is not so important, if you map group to operator one to one it makes sense.
Here is the patch. You need to replace two methods:
in libs/chat.php:
function setup_survey($name, $email, $groupid, $info, $referrer) {
global $settings, $page;
$page['formname'] = topage($name);
$page['formemail'] = topage($email);
$page['formgroupid'] = $groupid;
$page['forminfo'] = topage($info);
$page['referrer'] = urlencode(topage($referrer));
if($settings['enablegroups'] == '1' && $settings["surveyaskgroup"] == "1") {
$allgroups = get_groups(false,true);
$val = "";
foreach($allgroups as $k) {
$groupname = $k['vclocalname'];
if($k['ilastseen'] !== NULL && $k['ilastseen'] < $settings['online_timeout']) {
$groupname .= " (online)";
}
$val .= "<option value=\"".$k['groupid']."\"".($k['groupid'] == $groupid ? " selected=\"selected\"" : "").">$groupname</option>";
}
$page['groups'] = $val;
}
$page['showemail'] = $settings["surveyaskmail"] == "1" ? "1" : "";
$page['showmessage'] = $settings["surveyaskmessage"] == "1" ? "1" : "";
$page['showname'] = $settings['usercanchangename'] == "1" ? "1" : "";
}
and in libs/operator.php:
function get_groups($countagents, $checkonline=false) {
$link = connect();
$query = "select chatgroup.groupid as groupid, vclocalname, vclocaldescription".
($countagents
? ", (SELECT count(*) from chatgroupoperator where chatgroup.groupid = chatgroupoperator.groupid) as inumofagents"
: "").
($checkonline
? ", (SELECT min(unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time ".
"from chatgroupoperator, chatoperator where chatgroup.groupid = chatgroupoperator.groupid ".
"and chatgroupoperator.operatorid = chatoperator.operatorid) as ilastseen"
: "").
" from chatgroup order by vclocalname";
$result = select_multi_assoc($query, $link);
mysql_close($link);
return $result;
}
Also, I've attached the file with it.