diff --git a/app/call_center/call_center_agent_status.php b/app/call_center/call_center_agent_status.php
index 9ae901739b..7909f86362 100644
--- a/app/call_center/call_center_agent_status.php
+++ b/app/call_center/call_center_agent_status.php
@@ -51,7 +51,7 @@ require_once "resources/paging.php";
//get the http post values and set them as php variables
if (count($_POST)>0) {
//include the dnd php class
- include "resources/classes/do_not_disturb.php";
+ include PROJECT_PATH."/app/calls/resources/classes/do_not_disturb.php";
foreach($_POST['agents'] as $row) {
if (strlen($row['status']) > 0) {
@@ -81,43 +81,17 @@ require_once "resources/paging.php";
//loop through the list of assigned extensions
foreach ($_SESSION['user']['extension'] as &$sub_row) {
- $extension = $sub_row["user"];
- //hunt_group information used to determine if this is an add or an update
- $sql = "select * from v_hunt_groups ";
- $sql .= "where domain_uuid = '$domain_uuid' ";
- $sql .= "and hunt_group_extension = '$extension' ";
- $prep_statement_2 = $db->prepare(check_sql($sql));
- $prep_statement_2->execute();
- $result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
- foreach ($result2 as &$row2) {
- if ($row2["hunt_group_type"] == 'dnd') {
- $dnd_action = "update";
- $dnd_uuid = $row2["hunt_group_uuid"];
- }
- }
- unset ($prep_statement_2, $result2, $row2);
- //add or update dnd
+ //update dnd
$dnd = new do_not_disturb;
//$dnd->debug = false;
$dnd->domain_uuid = $domain_uuid;
- $dnd->dnd_uuid = $dnd_uuid;
$dnd->domain_name = $_SESSION['domain_name'];
- $dnd->extension = $extension;
+ $dnd->extension = $sub_row["user"];
if ($row['status'] == "Do Not Disturb") {
- $dnd->dnd_enabled = "true";
- if ($dnd_action == "add") {
- $dnd->dnd_add();
- }
- if ($dnd_action == "update") {
- $dnd->dnd_update();
- }
+ $dnd->enabled = "true";
}
else {
- //for other status disable dnd
- if ($dnd_action == "update") {
- $dnd->dnd_enabled = "false";
- $dnd->dnd_update();
- }
+ $dnd->enabled = "false";
}
unset($dnd);
}
@@ -193,21 +167,29 @@ require_once "resources/paging.php";
foreach($agent_array as $row) {
$tmp = explode('@',$row["name"]);
$agent_name = $tmp[0];
- if ($tmp[1] == $_SESSION['domain_name']) {
- echo "
\n";
- echo " | ".$row['name']." | \n";
- echo " ".$row['status']." | \n";
- echo " ";
- echo " \n";
- echo " \n";
- echo " \n";
- echo " \n";
- echo " \n";
- echo " \n";
- echo " | \n";
- echo "
\n";
+ $str = '';
+ $str .= "\n";
+ $str .= " | ".$row['name']." | \n";
+ $str .= " ".$row['status']." | \n";
+ $str .= " ";
+ $str .= " \n";
+ $str .= " \n";
+ $str .= " \n";
+ $str .= " \n";
+ $str .= " \n";
+ $str .= " \n";
+ $str .= " | \n";
+ $str .= "
\n";
+ if (count($_SESSION['domains']) > 1) {
+ if ($tmp[1] == $_SESSION['domain_name']) {
+ echo $str;
+ if ($c==0) { $c=1; } else { $c=0; }
+ }
+ }
+ else {
+ echo $str;
+ if ($c==0) { $c=1; } else { $c=0; }
}
- if ($c==0) { $c=1; } else { $c=0; }
$x++;
} //end foreach
unset($sql, $result, $row_count);
diff --git a/app/calls/resources/classes/do_not_disturb.php b/app/calls/resources/classes/do_not_disturb.php
index 53c9db70c3..5792982fd4 100644
--- a/app/calls/resources/classes/do_not_disturb.php
+++ b/app/calls/resources/classes/do_not_disturb.php
@@ -31,7 +31,7 @@ include "root.php";
public $domain_uuid;
public $domain_name;
public $extension_uuid;
- private $extension;
+ public $extension;
public $enabled;
private $dial_string;
@@ -68,13 +68,23 @@ include "root.php";
//determine whether to update the dial string
$sql = "select * from v_extensions ";
$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
- $sql .= "and extension_uuid = '".$this->extension_uuid."' ";
+ if ($this->extension_uuid) > 0) {
+ $sql .= "and extension_uuid = '".$this->extension_uuid."' ";
+ }
+ else {
+ $sql .= "and extension = '".$this->extension."' ";
+ }
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) > 0) {
foreach ($result as &$row) {
- $this->extension = $row["extension"];
+ if ($this->extension_uuid) == 0) {
+ $this->extension_uuid = $row["extension_uuid"];
+ }
+ if ($this->extension) == 0) {
+ $this->extension = $row["extension"];
+ }
}
}
unset ($prep_statement);