diff --git a/admin/extensionstatus.php b/admin/extensionstatus.php index d0c7a297..ba2800ea 100644 --- a/admin/extensionstatus.php +++ b/admin/extensionstatus.php @@ -45,24 +45,24 @@ include ("../functions/functions.xhtml.php"); xhtml_head(T_("Display extension status"),true,array("../css/table.css")); -$sql= "SELECT o.firstName, o.extension, CASE o.voip_status WHEN 0 THEN '" . T_("VoIP Offline") . "' ELSE '" . T_("VoIP Online") . "' END as voip_status, CASE ca.state WHEN 0 THEN '" . T_("Not called") . "' WHEN 1 THEN '" . T_("Requesting call") . "' WHEN 2 THEN '" . T_("Ringing") . "' WHEN 3 THEN '" . T_("Answered") . "' WHEN 4 THEN '" . T_("Requires coding") . "' ELSE '" . T_("Done") . "' END as state, CONCAT('' , c.case_id, '') as case_id, SEC_TO_TIME(TIMESTAMPDIFF(SECOND,cal.start,CONVERT_TZ(NOW(),'SYSTEM','UTC'))) as calltime, voip_status as vs - FROM operator as o +$sql= "SELECT CONCAT('',o.firstName,'') as firstName, e.extension, CASE e.status WHEN 0 THEN '" . T_("VoIP Offline") . "' ELSE '" . T_("VoIP Online") . "' END as status, CASE ca.state WHEN 0 THEN '" . T_("Not called") . "' WHEN 1 THEN '" . T_("Requesting call") . "' WHEN 2 THEN '" . T_("Ringing") . "' WHEN 3 THEN '" . T_("Answered") . "' WHEN 4 THEN '" . T_("Requires coding") . "' ELSE '" . T_("Done") . "' END as state, CONCAT('' , c.case_id, '') as case_id, SEC_TO_TIME(TIMESTAMPDIFF(SECOND,cal.start,CONVERT_TZ(NOW(),'SYSTEM','UTC'))) as calltime, e.status as vs + FROM extension as e + LEFT JOIN `operator` as o ON (o.operator_id = e.current_operator_id) LEFT JOIN `case` as c ON (c.current_operator_id = o.operator_id) LEFT JOIN `call_attempt` as cal ON (cal.operator_id = o.operator_id AND cal.end IS NULL and cal.case_id = c.case_id) LEFT JOIN `call` as ca ON (ca.case_id = c.case_id AND ca.operator_id = o.operator_id AND ca.outcome_id= 0 AND ca.call_attempt_id = cal.call_attempt_id) - WHERE o.voip = 1 - ORDER BY o.operator_id ASC"; + ORDER BY e.extension_id ASC"; $rs = $db->GetAll($sql); if (!empty($rs)) { - xhtml_table($rs,array("extension","firstName","voip_status","case_id","state","calltime"),array(T_("Extension"),T_("Operator"),T_("VoIP Status"),T_("Case ID"),T_("Call state"),T_("Time on call")),"tclass",array("vs" => "1")); + xhtml_table($rs,array("extension","firstName","firstName","status","case_id","state","calltime"),array(T_("Extension"),T_("Operator"),T_("Assignment"),T_("VoIP Status"),T_("Case ID"),T_("Call state"),T_("Time on call")),"tclass",array("vs" => "1")); } else - print "
" . T_("No operators") . "
"; - + print "" . T_("No extensions") . "
"; + xhtml_foot(); ?> diff --git a/admin/operatorlist.php b/admin/operatorlist.php index 8b3c195d..7468b311 100644 --- a/admin/operatorlist.php +++ b/admin/operatorlist.php @@ -67,8 +67,6 @@ if (isset($_POST['submit'])) firstName = " . $db->qstr($_POST['firstName']) . ", chat_user = " . $db->qstr($_POST['chat_user']) . ", chat_password = " . $db->qstr($_POST['chat_password']) . ", - extension = " . $db->qstr($_POST['extension']) . ", - extension_password = " . $db->qstr($_POST['extension_password']) . ", Time_zone_name = " . $db->qstr($_POST['timezone']) . ", voip = $voip, enabled = $enabled, chat_enable = $chat_enable WHERE operator_id = $operator_id"; @@ -76,7 +74,21 @@ if (isset($_POST['submit'])) $rs = $db->Execute($sql); if (!empty($rs)) - { + { + $sql = "UPDATE extension + SET current_operator_id = NULL + WHERE current_operator_id= $operator_id"; + $db->Execute($sql); + + if (!empty($_POST['extension_id'])) + { + $sql = "UPDATE extension + SET current_operator_id = $operator_id + WHERE extension_id = " . intval($_POST['extension_id']); + + $db->Execute($sql); + } + if (HTPASSWD_PATH !== false && !empty($_POST['password'])) { //update password in htaccess @@ -91,7 +103,7 @@ if (isset($_POST['submit'])) } else { - $msg = T_("Failed to update user. Please make sure the username and extension are unique"); + $msg = T_("Failed to update user. Please make sure the username is unique"); } } $_GET['edit'] = $operator_id; @@ -119,6 +131,14 @@ if (isset($_GET['edit'])) echo ""; if (!empty($msg)) print "