Fix CDR paging and minor code changes

This commit is contained in:
markjcrane 2023-05-16 10:07:32 -06:00
parent 7aac235f14
commit 155f15a407
1 changed files with 7 additions and 7 deletions

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2021 Portions created by the Initial Developer are Copyright (C) 2008-2023
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -46,12 +46,12 @@
define('TIME_24HR', 1); define('TIME_24HR', 1);
//set defaults //set defaults
if(!isset($_GET['show'])) { if(empty($_GET['show'])) {
$_GET['show'] = 'false'; $_GET['show'] = 'false';
} }
//get post or get variables from http //get post or get variables from http
if (count($_REQUEST) > 0) { if (!empty($_REQUEST)) {
$cdr_id = $_REQUEST["cdr_id"] ?? ''; $cdr_id = $_REQUEST["cdr_id"] ?? '';
$direction = $_REQUEST["direction"] ?? ''; $direction = $_REQUEST["direction"] ?? '';
$caller_id_name = $_REQUEST["caller_id_name"] ?? ''; $caller_id_name = $_REQUEST["caller_id_name"] ?? '';
@ -193,7 +193,7 @@
if ($_GET['show'] == 'all' && permission_exists('xml_cdr_all')) { if ($_GET['show'] == 'all' && permission_exists('xml_cdr_all')) {
$param .= "&show=all"; $param .= "&show=all";
} }
if (isset($order_by)) { if (!empty($order_by)) {
$param .= "&order_by=".urlencode($order_by)."&order=".urlencode($order); $param .= "&order_by=".urlencode($order_by)."&order=".urlencode($order);
} }
@ -223,11 +223,11 @@
} }
//set the default paging //set the default paging
$rows_per_page = $_SESSION['domain']['paging']['numeric']; //$rows_per_page = $_SESSION['domain']['paging']['numeric'];
//prepare to page the results //prepare to page the results
//$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; //set on the page that includes this page //$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; //set on the page that includes this page
if (!isset($_GET['page']) || !is_numeric($_GET['page'])) { if (empty($_GET['page']) || (!empty($_GET['page']) && !is_numeric($_GET['page']))) {
$_GET['page'] = 0; $_GET['page'] = 0;
} }
//ensure page is within bounds of integer //ensure page is within bounds of integer
@ -611,7 +611,7 @@
unset($database, $sql, $parameters); unset($database, $sql, $parameters);
//return the paging //return the paging
if (isset($_REQUEST['export_format']) && $_REQUEST['export_format'] !== "csv" && $_REQUEST['export_format'] !== "pdf") { if (empty($_REQUEST['export_format'])) {
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true, $result_count); //top list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true, $result_count); //top
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page, false, $result_count); //bottom list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page, false, $result_count); //bottom
} }