Update call_center_agent_edit.php

This commit is contained in:
FusionPBX
2017-05-16 10:28:53 -06:00
committed by GitHub
parent d1305fda8d
commit 7b4cdda010

View File

@@ -83,6 +83,7 @@
//get http post variables and set them to php variables
if (is_array($_POST)) {
$call_center_agent_uuid = check_str($_POST["call_center_agent_uuid"]);
$user_uuid = check_str($_POST["user_uuid"]);
$agent_name = check_str($_POST["agent_name"]);
$agent_type = check_str($_POST["agent_type"]);
$agent_call_timeout = check_str($_POST["agent_call_timeout"]);
@@ -110,6 +111,7 @@
$msg = '';
//if (strlen($call_center_agent_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-call_center_agent_uuid']."<br>\n"; }
//if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
if (strlen($user_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-user_uuid']."<br>\n"; }
if (strlen($agent_name) == 0) { $msg .= $text['message-required']." ".$text['label-agent_name']."<br>\n"; }
if (strlen($agent_type) == 0) { $msg .= $text['message-required']." ".$text['label-agent_type']."<br>\n"; }
if (strlen($agent_call_timeout) == 0) { $msg .= $text['message-required']." ".$text['label-agent_call_timeout']."<br>\n"; }
@@ -211,22 +213,20 @@
$_POST["call_center_agent_uuid"] = $call_center_agent_uuid;
}
//get the user_uuid
$sql = "select user_uuid from v_users ";
//get the users array
$sql = "SELECT * FROM v_users ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and username = '".$agent_name."' ";
$sql .= "order by username asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$user_uuid = $row["user_uuid"];
}
$users = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset($prep_statement, $sql);
//prepare the array
$array['call_center_agents'][] = $_POST;
//$array['users'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
//$array['users'][0]['user_uuid'] = $user_uuid;
//$array['users'][0]['user_status'] = $agent_status;
$array['users'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['users'][0]['user_uuid'] = $user_uuid;
$array['users'][0]['user_status'] = $agent_status;
//save to the data
$database = new database;
@@ -271,6 +271,7 @@
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$call_center_agent_uuid = $row["call_center_agent_uuid"];
$user_uuid = $row["user_uuid"];
$agent_name = $row["agent_name"];
$agent_type = $row["agent_type"];
$agent_call_timeout = $row["agent_call_timeout"];
@@ -410,6 +411,26 @@
echo "</td>\n";
echo "</tr>\n";
echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-username']."</td>";
echo " <td class='vtable' align='left'>";
echo " <select name=\"user_uuid\" class='formfld' style='width: auto;'>\n";
echo " <option value=\"\"></option>\n";
foreach($users as $field) {
if ($user_uuid == $field['user_uuid']) {
echo " <option value='".$field['user_uuid']."' selected='selected'>".$field['username']."</option>\n";
}
else {
echo " <option value='".$field['user_uuid']."' $selected>".$field['username']."</option>\n";
}
}
echo " </select>";
unset($users);
echo " <br>\n";
echo " ".$text['description-users']."\n";
echo " </td>";
echo " </tr>";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-agent_id']."\n";