Don't filter LOSE_RACE of already filtering originating_leg_uuid

It is redundant to filter out LOSE_RACE when originating_leg_uuid is also filtered, there is an overlap where every call with LOSE_RACE also has an originating_leg.
This commit is contained in:
demonspork
2021-02-20 11:14:47 -06:00
parent 77974b71dc
commit b5272984d1
3 changed files with 17 additions and 11 deletions

View File

@@ -973,7 +973,10 @@ if (!class_exists('xml_cdr')) {
$sql .= "filter ( \n";
$sql .= " where c.extension_uuid = e.extension_uuid \n";
$sql .= " and missed_call = true \n";
if (!permission_exists('xml_cdr_lose_race')) {
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";
}
if ($this->include_internal) {
@@ -1029,7 +1032,10 @@ if (!class_exists('xml_cdr')) {
$sql .= "count(*) \n";
$sql .= "filter ( \n";
$sql .= " where c.extension_uuid = e.extension_uuid \n";
if (!permission_exists('xml_cdr_lose_race')) {
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";
}
if ($this->include_internal) {