From a83d52eba6969475a9d59ddd6967db574f29e9ac Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 8 Jun 2017 18:45:27 +0300 Subject: [PATCH] Add. Statistics takes account to leg. (#2653) Add. Leg field to advanced search form. --- app/xml_cdr/xml_cdr_search.php | 12 ++++++++++++ app/xml_cdr/xml_cdr_statistics_inc.php | 15 +++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/app/xml_cdr/xml_cdr_search.php b/app/xml_cdr/xml_cdr_search.php index d331da8c40..c9ee8f263f 100644 --- a/app/xml_cdr/xml_cdr_search.php +++ b/app/xml_cdr/xml_cdr_search.php @@ -107,8 +107,20 @@ echo " \n"; } echo " \n"; + + if(permission_exists('xml_cdr_b_leg')){ + echo " \n"; + } + echo " \n"; echo " \n"; + + + echo " "; echo " ".$text['label-caller_id_name'].""; //source name echo " "; diff --git a/app/xml_cdr/xml_cdr_statistics_inc.php b/app/xml_cdr/xml_cdr_statistics_inc.php index bfb5596a64..1ada9e04cc 100644 --- a/app/xml_cdr/xml_cdr_statistics_inc.php +++ b/app/xml_cdr/xml_cdr_statistics_inc.php @@ -122,14 +122,20 @@ else { $mos_comparison = "<>"; break; } - } else { - $mos_comparison = ''; - } + } else { + $mos_comparison = ''; + } //$mos_comparison = check_str($_REQUEST["mos_comparison"]); $mos_score = check_str($_REQUEST["mos_score"]); + if(permission_exists('xml_cdr_b_leg')){ + $leg = check_str($_REQUEST["leg"]); + } } - +//if we do not see b-leg then use only a-leg to generate statistics + if(!permission_exists('xml_cdr_b_leg')){ + $leg = 'a'; + } //build the sql where string if ($missed == true) { @@ -182,6 +188,7 @@ else { if (strlen($remote_media_ip) > 0) { $sql_where_ands[] = "remote_media_ip like '%".$remote_media_ip."%'"; } if (strlen($network_addr) > 0) { $sql_where_ands[] = "network_addr like '%".$network_addr."%'"; } if (strlen($mos_comparison) > 0 && strlen($mos_score) > 0 ) { $sql_where_ands[] = "rtp_audio_in_mos " . $mos_comparison . " ".$mos_score.""; } + if (strlen($leg) > 0) { $sql_where_ands[] = "leg='$leg'"; } //if not admin or superadmin, only show own calls if (!permission_exists('xml_cdr_domain')) {