CDR Stats: Added missing 'and' in SQL queries.

This commit is contained in:
Nate Jones
2015-04-05 02:26:31 +00:00
parent 23c27f1347
commit 919a7e2bd2
+12 -10
View File
@@ -81,7 +81,8 @@ else {
if (strlen($where) == 0) { if (strlen($where) == 0) {
if ($_GET['showall'] && permission_exists('xml_cdr_all')) { if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
$where = "where "; $where = "where ";
} else { }
else {
$where = "where domain_uuid = '".$_SESSION['domain_uuid']."' and "; $where = "where domain_uuid = '".$_SESSION['domain_uuid']."' and ";
} }
} }
@@ -109,7 +110,8 @@ else {
if (strlen($where) == 0) { if (strlen($where) == 0) {
if ($_GET['showall'] && permission_exists('xml_cdr_all')) { if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
$where = "where "; $where = "where ";
} else { }
else {
$where = "where domain_uuid = '".$_SESSION['domain_uuid']."' and "; $where = "where domain_uuid = '".$_SESSION['domain_uuid']."' and ";
} }
} }
@@ -163,8 +165,8 @@ else {
} else { } else {
$where = "where domain_uuid = '".$_SESSION['domain_uuid']."' and "; $where = "where domain_uuid = '".$_SESSION['domain_uuid']."' and ";
} }
$where .= "billsec = '0' "; $where .= " billsec = '0' and ";
$where .= "and direction = 'inbound' "; $where .= " direction = 'inbound' and ";
$stats[$i]['missed'] = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $where); $stats[$i]['missed'] = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $where);
$stats[$i]['asr'] = (($stats[$i]['volume'] - $stats[$i]['missed']) / ($stats[$i]['volume']) * 100); $stats[$i]['asr'] = (($stats[$i]['volume'] - $stats[$i]['missed']) / ($stats[$i]['volume']) * 100);
@@ -191,8 +193,8 @@ else {
} else { } else {
$where = "where domain_uuid = '".$_SESSION['domain_uuid']."' and "; $where = "where domain_uuid = '".$_SESSION['domain_uuid']."' and ";
} }
$where .= "billsec = '0' "; $where .= " billsec = '0' and ";
$where .= "and direction = 'inbound' "; $where .= " direction = 'inbound' and ";
$stats[$i]['missed'] = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $where); $stats[$i]['missed'] = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $where);
$stats[$i]['asr'] = (($stats[$i]['volume'] - $stats[$i]['missed']) / ($stats[$i]['volume']) * 100); $stats[$i]['asr'] = (($stats[$i]['volume'] - $stats[$i]['missed']) / ($stats[$i]['volume']) * 100);
$stats[$i]['aloc'] = $stats[$i]['minutes'] / ($stats[$i]['volume'] - $stats[$i]['missed']); $stats[$i]['aloc'] = $stats[$i]['minutes'] / ($stats[$i]['volume'] - $stats[$i]['missed']);
@@ -216,8 +218,8 @@ else {
} else { } else {
$where = "where domain_uuid = '".$_SESSION['domain_uuid']."' and "; $where = "where domain_uuid = '".$_SESSION['domain_uuid']."' and ";
} }
$where .= "billsec = '0' "; $where .= " billsec = '0' and ";
$where .= "and direction = 'inbound' "; $where .= " direction = 'inbound' and ";
$stats[$i]['missed'] = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $where); $stats[$i]['missed'] = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $where);
$stats[$i]['asr'] = (($stats[$i]['volume'] - $stats[$i]['missed']) / ($stats[$i]['volume']) * 100); $stats[$i]['asr'] = (($stats[$i]['volume'] - $stats[$i]['missed']) / ($stats[$i]['volume']) * 100);
$stats[$i]['aloc'] = $stats[$i]['minutes'] / ($stats[$i]['volume'] - $stats[$i]['missed']); $stats[$i]['aloc'] = $stats[$i]['minutes'] / ($stats[$i]['volume'] - $stats[$i]['missed']);
@@ -241,8 +243,8 @@ else {
} else { } else {
$where = "where domain_uuid = '".$_SESSION['domain_uuid']."' and "; $where = "where domain_uuid = '".$_SESSION['domain_uuid']."' and ";
} }
$where .= " billsec = '0' "; $where .= " billsec = '0' and ";
$where .= "and direction = 'inbound' "; $where .= " direction = 'inbound' and ";
$stats[$i]['missed'] = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $where); $stats[$i]['missed'] = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $where);
$stats[$i]['asr'] = (($stats[$i]['volume'] - $stats[$i]['missed']) / ($stats[$i]['volume']) * 100); $stats[$i]['asr'] = (($stats[$i]['volume'] - $stats[$i]['missed']) / ($stats[$i]['volume']) * 100);
$stats[$i]['aloc'] = $stats[$i]['minutes'] / ($stats[$i]['volume'] - $stats[$i]['missed']); $stats[$i]['aloc'] = $stats[$i]['minutes'] / ($stats[$i]['volume'] - $stats[$i]['missed']);