From 124e7c2da8cf9d80a54496b9b17abd1b59329b33 Mon Sep 17 00:00:00 2001 From: Alex <40072887+alexdcrane@users.noreply.github.com> Date: Tue, 25 Nov 2025 11:53:23 -0700 Subject: [PATCH] Extension Summary: Fix include internal search filter (#7644) * Extension Summary: Fix include internal search filter * Update xml_cdr_extension_summary.php --- app/xml_cdr/resources/classes/xml_cdr.php | 36 +++++++++++------------ app/xml_cdr/xml_cdr_extension_summary.php | 8 ++--- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/app/xml_cdr/resources/classes/xml_cdr.php b/app/xml_cdr/resources/classes/xml_cdr.php index fd1264eecb..34dc1a549f 100644 --- a/app/xml_cdr/resources/classes/xml_cdr.php +++ b/app/xml_cdr/resources/classes/xml_cdr.php @@ -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"; diff --git a/app/xml_cdr/xml_cdr_extension_summary.php b/app/xml_cdr/xml_cdr_extension_summary.php index 0ef0895642..27478b407a 100644 --- a/app/xml_cdr/xml_cdr_extension_summary.php +++ b/app/xml_cdr/xml_cdr_extension_summary.php @@ -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