From 9e7726629947931ee40f69571226309806c800e5 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Thu, 5 May 2022 10:55:52 -0600 Subject: [PATCH] Re-add permission check for xml_cdr_lose_race and xml_cdr_enterprise_leg. --- app/xml_cdr/resources/classes/xml_cdr.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/app/xml_cdr/resources/classes/xml_cdr.php b/app/xml_cdr/resources/classes/xml_cdr.php index 0b78f690cd..2a4b2a6044 100644 --- a/app/xml_cdr/resources/classes/xml_cdr.php +++ b/app/xml_cdr/resources/classes/xml_cdr.php @@ -1046,7 +1046,12 @@ if (!class_exists('xml_cdr')) { $sql .= "count(*) \n"; $sql .= "filter ( \n"; $sql .= " where c.extension_uuid = e.extension_uuid \n"; - $sql .= " and hangup_cause != 'LOSE_RACE' \n"; + if (!permission_exists('xml_cdr_enterprise_leg')) { + $sql .= " and originating_leg_uuid is null \n"; + } + elseif (!permission_exists('xml_cdr_lose_race')) { + $sql .= " and hangup_cause <> 'LOSE_RACE' \n"; + } $sql .= " and originating_leg_uuid IS NULL \n"; $sql .= " and (answer_stamp IS NOT NULL and bridge_uuid IS NOT NULL) \n"; $sql .= " and (cc_side IS NULL or cc_side !='agent')"; @@ -1063,7 +1068,12 @@ if (!class_exists('xml_cdr')) { $sql .= "count(*) \n"; $sql .= "filter ( \n"; $sql .= " where c.extension_uuid = e.extension_uuid \n"; - $sql .= " and hangup_cause != 'LOSE_RACE' \n"; + if (!permission_exists('xml_cdr_enterprise_leg')) { + $sql .= " and originating_leg_uuid is null \n"; + } + elseif (!permission_exists('xml_cdr_lose_race')) { + $sql .= " and hangup_cause <> 'LOSE_RACE' \n"; + } $sql .= " and originating_leg_uuid IS NULL \n"; $sql .= " and ( \n"; @@ -1141,7 +1151,12 @@ if (!class_exists('xml_cdr')) { $sql .= "count(*) \n"; $sql .= "filter ( \n"; $sql .= " where c.extension_uuid = e.extension_uuid \n"; - $sql .= " and hangup_cause != 'LOSE_RACE' \n"; + if (!permission_exists('xml_cdr_enterprise_leg')) { + $sql .= " and originating_leg_uuid is null \n"; + } + elseif (!permission_exists('xml_cdr_lose_race')) { + $sql .= " and hangup_cause <> 'LOSE_RACE' \n"; + } $sql .= " and originating_leg_uuid IS NULL \n"; $sql .= " and (cc_side is null or cc_side != 'agent') \n"; if ($this->include_internal) {