Update xml_cdr_inc.php

Only check the select count if there is a default setting that instructs it to do so as it is slow on a large number of records.
This commit is contained in:
FusionPBX 2016-06-11 07:15:11 -06:00 committed by GitHub
parent ba042dc8d5
commit cd5baa1df5
1 changed files with 24 additions and 18 deletions

View File

@ -273,6 +273,7 @@ else {
//page results if rows_per_page is greater than zero
if ($rows_per_page > 0) {
if ($_SESSION['cdr']['count']['boolean'] == "true") {
//get the number of rows in the v_xml_cdr
$sql = "select count(*) as num_rows from v_xml_cdr ";
$sql .= "where domain_uuid = '".$domain_uuid."' ".$sql_where;
@ -288,11 +289,16 @@ else {
}
}
unset($prep_statement, $result);
}
else {
//limit the number of results
if ($num_rows > $_SESSION['cdr']['limit']['numeric']) {
$num_rows = $_SESSION['cdr']['limit']['numeric'];
}
else {
$num_rows = '1000';
}
}
if ($_SESSION['domain']['paging']['numeric'] != '' && $rows_per_page > $_SESSION['domain']['paging']['numeric']) {
$rows_per_page = $_SESSION['domain']['paging']['numeric'];
}