Extension Summary: Fix include internal search filter (#7644)

* Extension Summary: Fix include internal search filter

* Update xml_cdr_extension_summary.php
This commit is contained in:
Alex
2025-11-25 11:53:23 -07:00
committed by GitHub
parent e75732c7ab
commit 124e7c2da8
2 changed files with 22 additions and 22 deletions

View File

@@ -1871,7 +1871,7 @@ class xml_cdr {
$sql .= "filter ( \n";
$sql .= " where c.extension_uuid = e.extension_uuid \n";
$sql .= " and status = 'answered' \n";
if (!$this->include_internal) {
if (empty($this->include_internal) || $this->include_internal == 'false') {
$sql .= "and (direction = 'inbound' or direction = 'outbound') \n";
}
$sql .= ") \n";
@@ -1883,7 +1883,7 @@ class xml_cdr {
$sql .= " where c.extension_uuid = e.extension_uuid \n";
$sql .= " and status = 'missed' \n";
$sql .= " and (cc_side is null or cc_side != 'agent') \n";
if (!$this->include_internal) {
if (empty($this->include_internal) || $this->include_internal == 'false') {
$sql .= "and (direction = 'inbound' or direction = 'outbound') \n";
}
$sql .= ") \n";
@@ -1894,7 +1894,7 @@ class xml_cdr {
$sql .= "filter ( \n";
$sql .= " where c.extension_uuid = e.extension_uuid \n";
$sql .= " and status = 'voicemail' \n";
if (!$this->include_internal) {
if (empty($this->include_internal) || $this->include_internal == 'false') {
$sql .= "and (direction = 'inbound' or direction = 'outbound') \n";
}
$sql .= ") \n";
@@ -1906,10 +1906,10 @@ class xml_cdr {
$sql .= " where c.extension_uuid = e.extension_uuid \n";
$sql .= " and status = 'no_answer'\n";
$sql .= " and (cc_side IS NOT NULL or cc_side ='agent')";
if ($this->include_internal) {
$sql .= " and (direction = 'inbound' or direction = 'local') \n";
} else {
if (empty($this->include_internal) || $this->include_internal == 'false') {
$sql .= "and direction = 'inbound' \n";
} else {
$sql .= " and (direction = 'inbound' or direction = 'local') \n";
}
$sql .= ") \n";
$sql .= "as no_answer, \n";
@@ -1919,10 +1919,10 @@ class xml_cdr {
$sql .= "filter ( \n";
$sql .= " where c.extension_uuid = e.extension_uuid \n";
$sql .= " and status = 'busy'\n";
if ($this->include_internal) {
$sql .= " and (direction = 'inbound' or direction = 'local') \n";
} else {
if (empty($this->include_internal) || $this->include_internal == 'false') {
$sql .= " and direction = 'inbound' \n";
} else {
$sql .= " and (direction = 'inbound' or direction = 'local') \n";
}
$sql .= ") \n";
$sql .= "as busy, \n";
@@ -1931,14 +1931,14 @@ class xml_cdr {
$sql .= "sum(c.billsec) \n";
$sql .= "filter ( \n";
$sql .= " where c.extension_uuid = e.extension_uuid \n";
if (!$this->include_internal) {
if (empty($this->include_internal) || $this->include_internal == 'false') {
$sql .= " and (direction = 'inbound' or direction = 'outbound') \n";
}
$sql .= " ) / \n";
$sql .= "count(*) \n";
$sql .= "filter ( \n";
$sql .= " where c.extension_uuid = e.extension_uuid \n";
if (!$this->include_internal) {
if (empty($this->include_internal) || $this->include_internal == 'false') {
$sql .= " and (direction = 'inbound' or direction = 'outbound') \n";
}
$sql .= ") \n";
@@ -1954,10 +1954,10 @@ class xml_cdr {
$sql .= " and hangup_cause <> 'LOSE_RACE' \n";
}
$sql .= " and (cc_side is null or cc_side != 'agent') \n";
if ($this->include_internal) {
$sql .= " and (direction = 'inbound' or direction = 'local') \n";
} else {
if (empty($this->include_internal) || $this->include_internal == 'false') {
$sql .= " and direction = 'inbound' \n";
} else {
$sql .= " and (direction = 'inbound' or direction = 'local') \n";
}
$sql .= ") \n";
$sql .= "as inbound_calls, \n";
@@ -1966,10 +1966,10 @@ class xml_cdr {
$sql .= "sum(c.billsec) \n";
$sql .= "filter ( \n";
$sql .= " where c.extension_uuid = e.extension_uuid \n";
if ($this->include_internal) {
$sql .= " and (direction = 'inbound' or direction = 'local')) \n";
} else {
if (empty($this->include_internal) || $this->include_internal == 'false') {
$sql .= " and direction = 'inbound') \n";
} else {
$sql .= " and (direction = 'inbound' or direction = 'local')) \n";
}
$sql .= "as inbound_duration, \n";
@@ -2016,7 +2016,7 @@ class xml_cdr {
}
$sql .= "and leg = 'a' ";
$sql .= "and extension_uuid is not null ";
$sql .= $sql_date_range;
$sql .= $sql_date_range ?? '';
$sql .= ") as c \n";
$sql .= "where \n";

View File

@@ -44,10 +44,10 @@
//retrieve submitted data
if (!empty($_REQUEST)) {
$quick_select = $_REQUEST['quick_select'];
$start_stamp_begin = $_REQUEST['start_stamp_begin'];
$start_stamp_end = $_REQUEST['start_stamp_end'];
$include_internal = $_REQUEST['include_internal'];
$quick_select = $_REQUEST['quick_select'] ?? null;
$start_stamp_begin = $_REQUEST['start_stamp_begin'] ?? null;
$start_stamp_end = $_REQUEST['start_stamp_end'] ?? null;
$include_internal = $_REQUEST['include_internal'] ?? null;
}
else {
$quick_select = 3; //set default