diff --git a/app/xml_cdr/app_config.php b/app/xml_cdr/app_config.php index 7fcc01970b..d08e6926a9 100644 --- a/app/xml_cdr/app_config.php +++ b/app/xml_cdr/app_config.php @@ -57,6 +57,9 @@ $apps[$x]['permissions'][$y]['name'] = "xml_cdr_mos"; $apps[$x]['permissions'][$y]['groups'][] = "admin"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $y++; + $apps[$x]['permissions'][$y]['name'] = "xml_cdr_all"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; //schema details $y = 0; //table array index diff --git a/app/xml_cdr/app_languages.php b/app/xml_cdr/app_languages.php index 6f75b0bfdf..c6eda215b0 100644 --- a/app/xml_cdr/app_languages.php +++ b/app/xml_cdr/app_languages.php @@ -185,10 +185,10 @@ $text['label-average']['pt-pt'] = "Média"; $text['label-average']['fr-fr'] = "Moyenne"; - $text['label-preset']['en-us'] = 'Quick Select'; - $text['label-preset']['es-cl'] = 'Quick Select'; - $text['label-preset']['pt-pt'] = 'Quick Select'; - $text['label-preset']['fr-fr'] = 'Quick Select'; + $text['label-preset']['en-us'] = 'Quick Select'; + $text['label-preset']['es-cl'] = 'Quick Select'; + $text['label-preset']['pt-pt'] = 'Quick Select'; + $text['label-preset']['fr-fr'] = 'Quick Select'; $text['button-export']['en-us'] = 'Export'; $text['button-export']['es-cl'] = 'Exportación'; @@ -563,35 +563,35 @@ $text['option-false']['pt-pt'] = "Não"; $text['option-false']['fr-fr'] = "Non"; - $text['option-default']['en-us'] = "Default"; - $text['option-default']['es-cl'] = "Default"; - $text['option-default']['pt-pt'] = "Default"; - $text['option-default']['fr-fr'] = "Default"; + $text['option-default']['en-us'] = "Default"; + $text['option-default']['es-cl'] = "Default"; + $text['option-default']['pt-pt'] = "Default"; + $text['option-default']['fr-fr'] = "Default"; - $text['option-last_hour']['en-us'] = "Last Hour"; - $text['option-last_hour']['es-cl'] = "Last Hour"; - $text['option-last_hour']['pt-pt'] = "Last Hour"; - $text['option-last_hour']['fr-fr'] = "Last Hour"; + $text['option-last_hour']['en-us'] = "Last Hour"; + $text['option-last_hour']['es-cl'] = "Last Hour"; + $text['option-last_hour']['pt-pt'] = "Last Hour"; + $text['option-last_hour']['fr-fr'] = "Last Hour"; - $text['option-today']['en-us'] = "Today"; - $text['option-today']['es-cl'] = "Today"; - $text['option-today']['pt-pt'] = "Today"; - $text['option-today']['fr-fr'] = "Today"; + $text['option-today']['en-us'] = "Today"; + $text['option-today']['es-cl'] = "Today"; + $text['option-today']['pt-pt'] = "Today"; + $text['option-today']['fr-fr'] = "Today"; - $text['option-yesterday']['en-us'] = "Yesterday"; - $text['option-yesterday']['es-cl'] = "Yesterday"; - $text['option-yesterday']['pt-pt'] = "Yesterday"; - $text['option-yesterday']['fr-fr'] = "Yesterday"; + $text['option-yesterday']['en-us'] = "Yesterday"; + $text['option-yesterday']['es-cl'] = "Yesterday"; + $text['option-yesterday']['pt-pt'] = "Yesterday"; + $text['option-yesterday']['fr-fr'] = "Yesterday"; - $text['option-this_month']['en-us'] = "This Month"; - $text['option-this_month']['es-cl'] = "This Month"; - $text['option-this_month']['pt-pt'] = "This Month"; - $text['option-this_month']['fr-fr'] = "This Month"; + $text['option-this_month']['en-us'] = "This Month"; + $text['option-this_month']['es-cl'] = "This Month"; + $text['option-this_month']['pt-pt'] = "This Month"; + $text['option-this_month']['fr-fr'] = "This Month"; - $text['option-this_year']['en-us'] = "This Year"; - $text['option-this_year']['es-cl'] = "This Year"; - $text['option-this_year']['pt-pt'] = "This Year"; - $text['option-this_year']['fr-fr'] = "This Year"; + $text['option-this_year']['en-us'] = "This Year"; + $text['option-this_year']['es-cl'] = "This Year"; + $text['option-this_year']['pt-pt'] = "This Year"; + $text['option-this_year']['fr-fr'] = "This Year"; $text['confirm-delete']['en-us'] = "Do you really want to delete this?"; $text['confirm-delete']['es-cl'] = "¿Realmente desea eliminar el número?"; @@ -608,4 +608,13 @@ $text['message-delete']['pt-pt'] = "Remoção Efectuada"; $text['message-delete']['fr-fr'] = "Supprimé"; + $text['button-show_all']['en-us'] = "Show All"; + $text['button-show_all']['es-cl'] = "Mostrar Todos"; + $text['button-show_all']['pt-pt'] = "Mostrar Todos"; + $text['button-show_all']['fr-fr'] = "Montrer Tout"; + + $text['label-domain-name']['en-us'] = "Domain Name"; + $text['label-domain-name']['es-cl'] = "Nombre de Dominio"; + $text['label-domain-name']['pt-pt'] = "Nome de Domínio"; + $text['label-domain-name']['fr-fr'] = "Nom de Domaine"; ?> \ No newline at end of file diff --git a/app/xml_cdr/v_xml_cdr_import.php b/app/xml_cdr/v_xml_cdr_import.php index f8842859af..29e6f7b12f 100644 --- a/app/xml_cdr/v_xml_cdr_import.php +++ b/app/xml_cdr/v_xml_cdr_import.php @@ -38,6 +38,7 @@ else { include "root.php"; require_once "resources/require.php"; + require_once "resources/pdo.php"; } //set debug diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php index f538be4765..7679c49c9a 100644 --- a/app/xml_cdr/xml_cdr.php +++ b/app/xml_cdr/xml_cdr.php @@ -125,6 +125,9 @@ else { echo " \n"; echo " \n"; echo " "; } echo "\n"; + if ($_GET['showall'] && permission_exists('xml_cdr_all')) { + echo th_order_by('domain_name', $text['label-domain-name'], $order_by, $order, null, null, $param); + //echo " \n"; + } echo th_order_by('caller_id_name', $text['label-cid-name'], $order_by, $order, null, null, $param); echo th_order_by('caller_id_number', $text['label-source'], $order_by, $order, null, null, $param); echo th_order_by('destination_number', $text['label-destination'], $order_by, $order, null, null, $param); @@ -473,7 +482,14 @@ else { unset($recording_file_path); } - $tr_link = (if_group("admin") || if_group("superadmin") || if_group("cdr")) ? "href='xml_cdr_details.php?uuid=".$row['uuid']."'" : null; + //$tr_link = (if_group("admin") || if_group("superadmin") || if_group("cdr")) ? "href='xml_cdr_details.php?uuid=".$row['uuid']."'" : null; + if ((if_group("admin") || if_group("superadmin") || if_group("cdr")) && $_GET['showall']) { + $tr_link .= "href='xml_cdr_details.php?uuid=".$row['uuid']."&showall=true'"; + } elseif (if_group("admin") || if_group("superadmin") || if_group("cdr")) { + $tr_link .= "href='xml_cdr_details.php?uuid=".$row['uuid']."'"; + } else { + $tr_link = null; + } echo "\n"; if (permission_exists('xml_cdr_delete')) { echo " "; } - + if ($_GET['showall'] && permission_exists('xml_cdr_all')) { + echo " \n"; + } echo " \n"; @@ -627,7 +647,7 @@ else { } echo " \n"; if (if_group("admin") || if_group("superadmin") || if_group("cdr")) { echo " "; echo " "; echo " "; diff --git a/app/xml_cdr/xml_cdr_inc.php b/app/xml_cdr/xml_cdr_inc.php index a3e3bff344..580685b14f 100644 --- a/app/xml_cdr/xml_cdr_inc.php +++ b/app/xml_cdr/xml_cdr_inc.php @@ -200,6 +200,9 @@ else { $param .= "&remote_media_ip=".$remote_media_ip; $param .= "&network_addr=".$network_addr; $param .= "&bridge_uuid=".$bridge_uuid; + if ($_GET['showall'] && permission_exists('xml_cdr_all')) { + $param .= "&showall=" . $_GET['showall']; + } if (isset($order_by)) { $param .= "&order_by=".$order_by."&order=".$order; } @@ -277,7 +280,16 @@ else { $sql .= "rtp_audio_in_mos, "; } $sql .= "(answer_epoch - start_epoch) as tta "; - $sql .= "from v_xml_cdr where domain_uuid = '".$domain_uuid."' ".$sql_where; + if ($_GET['showall'] && permission_exists('xml_cdr_all')) { + $sql .= ", domain_name "; + } + $sql .= "from v_xml_cdr "; + if ($_GET['showall'] && permission_exists('xml_cdr_all')) { + if ($sql_where) { $sql .= "where "; } + } else { + $sql .= "where domain_uuid = '".$domain_uuid."' "; + } + $sql .= $sql_where; if (strlen($order_by)> 0) { $sql .= " order by ".$order_by." ".$order." "; } if ($rows_per_page == 0) { $sql .= " limit ".$_SESSION['cdr']['limit']['numeric']." offset 0 "; diff --git a/app/xml_cdr/xml_cdr_statistics.php b/app/xml_cdr/xml_cdr_statistics.php index 2be98869ce..cd2f9ad1e4 100644 --- a/app/xml_cdr/xml_cdr_statistics.php +++ b/app/xml_cdr/xml_cdr_statistics.php @@ -47,6 +47,9 @@ else { echo "\n"; echo " \n"; echo "
\n"; + if (permission_exists('xml_cdr_all')) { + echo " \n"; + } if (permission_exists('xml_cdr_search_advanced')) { echo " \n"; } @@ -371,6 +374,12 @@ else { echo " \n"; + //echo " ".$text['label-domain-name']."\n"; + //echo "
 "; + echo $row['domain_name'].' '; + echo " "; echo $row['caller_id_name'].' '; echo " "; if (if_group("admin") || if_group("superadmin") || if_group("cdr")) { - echo "".$hangup_cause.""; + echo "".$hangup_cause.""; } else { echo $hangup_cause; @@ -635,7 +655,7 @@ else { echo "
"; + if (permission_exists('xml_cdr_all')) { + echo " \n"; + } echo " \n"; echo " \n"; echo "
".$text['label-call-statistics']."\n"; + if (permission_exists('xml_cdr_all')) { + echo " \n"; + } echo " \n"; echo " \n"; echo " \n"; diff --git a/app/xml_cdr/xml_cdr_statistics_inc.php b/app/xml_cdr/xml_cdr_statistics_inc.php index 50b1eef365..e0327e4907 100644 --- a/app/xml_cdr/xml_cdr_statistics_inc.php +++ b/app/xml_cdr/xml_cdr_statistics_inc.php @@ -57,7 +57,11 @@ else { } else { //superadmin or admin - $sql_where = "where domain_uuid = '$domain_uuid' "; + if ($_GET['showall'] && permission_exists('xml_cdr_all')) { + $sql_where = ""; + } else { + $sql_where = "where domain_uuid = '$domain_uuid' "; + } } //create the sql query to get the xml cdr records @@ -74,11 +78,15 @@ else { function get_call_volume_between($start, $end, $where) { global $db; if (strlen($where) == 0) { - $where = "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + if ($_GET['showall'] && permission_exists('xml_cdr_all')) { + $where = "where "; + } else { + $where = "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + } } $sql = " select count(*) as count from v_xml_cdr "; $sql .= $where; - $sql .= "and start_epoch BETWEEN ".$start." AND ".$end." "; + $sql .= " start_epoch BETWEEN ".$start." AND ".$end." "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC); @@ -98,11 +106,15 @@ else { function get_call_seconds_between($start, $end, $where) { global $db; if (strlen($where) == 0) { - $where = "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + if ($_GET['showall'] && permission_exists('xml_cdr_all')) { + $where .= "where "; + } else { + $where = "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + } } $sql = " select sum(billsec) as seconds from v_xml_cdr "; $sql .= $where; - $sql .= "and start_epoch BETWEEN ".$start." AND ".$end." "; + $sql .= "start_epoch BETWEEN ".$start." AND ".$end." "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC); @@ -145,8 +157,12 @@ else { $stats[$i]['avg_min'] = ($stats[$i]['volume'] - $stats[$i]['missed']) / 60; //answer / seizure ratio - $where = "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $where .= "and billsec = '0' "; + if ($_GET['showall'] && permission_exists('xml_cdr_all')) { + $where .= "where "; + } else { + $where = "where domain_uuid = '".$_SESSION['domain_uuid']."' and "; + } + $where .= "billsec = '0' "; $where .= "and direction = 'inbound' "; $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); @@ -169,8 +185,12 @@ else { $stats[$i]['minutes'] = $stats[$i]['seconds'] / 60; $stats[$i]['avg_sec'] = $stats[$i]['seconds'] / $stats[$i]['volume']; $stats[$i]['avg_min'] = ($stats[$i]['volume'] - $stats[$i]['missed']) / (60*24); - $where = "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $where .= "and billsec = '0' "; + if ($_GET['showall'] && permission_exists('xml_cdr_all')) { + $where .= "where "; + } else { + $where = "where domain_uuid = '".$_SESSION['domain_uuid']."' and "; + } + $where .= "billsec = '0' "; $where .= "and direction = 'inbound' "; $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); @@ -190,8 +210,12 @@ else { $stats[$i]['minutes'] = $stats[$i]['seconds'] / 60; $stats[$i]['avg_sec'] = $stats[$i]['seconds'] / $stats[$i]['volume']; $stats[$i]['avg_min'] = ($stats[$i]['volume'] - $stats[$i]['missed']) / (60*24*7); - $where = "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $where .= "and billsec = '0' "; + if ($_GET['showall'] && permission_exists('xml_cdr_all')) { + $where .= "where "; + } else { + $where = "where domain_uuid = '".$_SESSION['domain_uuid']."' and "; + } + $where .= "billsec = '0' "; $where .= "and direction = 'inbound' "; $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); @@ -211,8 +235,12 @@ else { $stats[$i]['minutes'] = $stats[$i]['seconds'] / 60; $stats[$i]['avg_sec'] = $stats[$i]['seconds'] / $stats[$i]['volume']; $stats[$i]['avg_min'] = ($stats[$i]['volume'] - $stats[$i]['missed']) / (60*24*30); - $where = "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $where .= "and billsec = '0' "; + if ($_GET['showall'] && permission_exists('xml_cdr_all')) { + $where .= "where "; + } else { + $where = "where domain_uuid = '".$_SESSION['domain_uuid']."' and"; + } + $where .= " billsec = '0' "; $where .= "and direction = 'inbound' "; $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);