From 71f5f22387848bad7508516392d309c17c9fcfe7 Mon Sep 17 00:00:00 2001 From: laf Date: Sun, 12 Apr 2015 11:47:21 +0100 Subject: [PATCH] Fixed loading.... issue when no data returned --- html/ajax_table.php | 1 + html/includes/table/address-search.inc.php | 3 +++ html/includes/table/alertlog.inc.php | 3 +++ html/includes/table/alerts.inc.php | 3 +++ html/includes/table/arp-search.inc.php | 3 +++ html/includes/table/devices.inc.php | 3 +++ html/includes/table/eventlog.inc.php | 3 +++ html/includes/table/inventory.inc.php | 3 +++ html/includes/table/poll-log.inc.php | 3 +++ 9 files changed, 25 insertions(+) diff --git a/html/ajax_table.php b/html/ajax_table.php index 7f906e64a..dc5af2c6e 100644 --- a/html/ajax_table.php +++ b/html/ajax_table.php @@ -39,6 +39,7 @@ if (isset($_POST['sort']) && is_array($_POST['sort'])) { } $searchPhrase = mres($_POST['searchPhrase']); $id = mres($_POST['id']); +$response = array(); if (isset($id)) { if (file_exists("includes/table/$id.inc.php")) { diff --git a/html/includes/table/address-search.inc.php b/html/includes/table/address-search.inc.php index 9171c398a..97033ab19 100644 --- a/html/includes/table/address-search.inc.php +++ b/html/includes/table/address-search.inc.php @@ -28,6 +28,9 @@ if ($_POST['search_type'] == 'ipv4') { $count_sql = "SELECT COUNT(`port_id`) $sql"; } $total = dbFetchCell($count_sql,$param); +if (empty($total)) { + $total = 0; +} if (!isset($sort) || empty($sort)) { $sort = '`hostname` ASC'; diff --git a/html/includes/table/alertlog.inc.php b/html/includes/table/alertlog.inc.php index d707d9fd1..0dd0a4d60 100644 --- a/html/includes/table/alertlog.inc.php +++ b/html/includes/table/alertlog.inc.php @@ -20,6 +20,9 @@ if (isset($searchPhrase) && !empty($searchPhrase)) { $count_sql = "SELECT COUNT(`E`.`id`) $sql"; $total = dbFetchCell($count_sql,$param); +if (empty($total)) { + $total = 0; +} if (!isset($sort) || empty($sort)) { $sort = 'time_logged DESC'; diff --git a/html/includes/table/alerts.inc.php b/html/includes/table/alerts.inc.php index 17d83ed64..406563b9b 100644 --- a/html/includes/table/alerts.inc.php +++ b/html/includes/table/alerts.inc.php @@ -15,6 +15,9 @@ $sql = " FROM `alerts` LEFT JOIN `devices` ON `alerts`.`device_id`=`devices`.`de $count_sql = "SELECT COUNT(`alerts`.`id`) $sql"; $total = dbFetchCell($count_sql,$param); +if (empty($total)) { + $total = 0; +} if (!isset($sort) || empty($sort)) { $sort = 'timestamp DESC'; diff --git a/html/includes/table/arp-search.inc.php b/html/includes/table/arp-search.inc.php index 36ab2e19b..f2d29ed9e 100644 --- a/html/includes/table/arp-search.inc.php +++ b/html/includes/table/arp-search.inc.php @@ -20,6 +20,9 @@ if (is_numeric($_POST['device_id'])) { $count_sql = "SELECT COUNT(`M`.`port_id`) $sql"; $total = dbFetchCell($count_sql,$param); +if (empty($total)) { + $total = 0; +} if (!isset($sort) || empty($sort)) { $sort = '`hostname` ASC'; diff --git a/html/includes/table/devices.inc.php b/html/includes/table/devices.inc.php index 7d45e3708..81784f590 100644 --- a/html/includes/table/devices.inc.php +++ b/html/includes/table/devices.inc.php @@ -39,6 +39,9 @@ if( !empty($_POST['group']) ) { $count_sql = "SELECT COUNT(`device_id`) $sql"; $total = dbFetchCell($count_sql,$param); +if (empty($total)) { + $total = 0; +} if (!isset($sort) || empty($sort)) { $sort = '`hostname` DESC'; diff --git a/html/includes/table/eventlog.inc.php b/html/includes/table/eventlog.inc.php index 571173803..c2bd64e4f 100644 --- a/html/includes/table/eventlog.inc.php +++ b/html/includes/table/eventlog.inc.php @@ -27,6 +27,9 @@ if (isset($searchPhrase) && !empty($searchPhrase)) { $count_sql = "SELECT COUNT(datetime) $sql"; $total = dbFetchCell($count_sql,$param); +if (empty($total)) { + $total = 0; +} if (!isset($sort) || empty($sort)) { $sort = 'datetime DESC'; diff --git a/html/includes/table/inventory.inc.php b/html/includes/table/inventory.inc.php index 26e50fbe6..6c5b92823 100644 --- a/html/includes/table/inventory.inc.php +++ b/html/includes/table/inventory.inc.php @@ -43,6 +43,9 @@ if (isset($_POST['device']) && is_numeric($_POST['device'])) { $count_sql = "SELECT COUNT(`entPhysical_id`) $sql"; $total = dbFetchCell($count_sql,$param); +if (empty($total)) { + $total = 0; +} if (!isset($sort) || empty($sort)) { $sort = '`hostname` DESC'; diff --git a/html/includes/table/poll-log.inc.php b/html/includes/table/poll-log.inc.php index edf7d6ed2..93d9259f6 100644 --- a/html/includes/table/poll-log.inc.php +++ b/html/includes/table/poll-log.inc.php @@ -18,6 +18,9 @@ if (!isset($sort) || empty($sort)) { $count_sql = "SELECT COUNT(`D`.`device_id`) $sql"; $total = dbFetchCell($count_sql); +if (empty($total)) { + $total = 0; +} $sql .= " AND D.status ='1' AND D.ignore='0' AND D.disabled='0' ORDER BY $sort";