From c9231c9181803a3f693a4564d768f28c408dcae3 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Tue, 17 Nov 2009 17:34:09 +0100 Subject: [PATCH] Added error codes for report --- .../reports/report.eventlog.monilog.class.php | 14 ++++++++++---- src/include/constants_errors.php | 1 + src/include/functions_common.php | 3 +++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/classes/reports/report.eventlog.monilog.class.php b/src/classes/reports/report.eventlog.monilog.class.php index fd69c52..83c3742 100644 --- a/src/classes/reports/report.eventlog.monilog.class.php +++ b/src/classes/reports/report.eventlog.monilog.class.php @@ -151,6 +151,8 @@ class Report_monilog extends Report { // Prepent to array array_unshift( $content["report_summary"], $totalItem ); } + else + return ERROR_REPORT_NODATA; // Get List of hosts $content["report_computers"] = $this->_streamObj->ConsolidateItemListByField( SYSLOG_HOST, $this->_maxHosts, SYSLOG_HOST, SORTING_ORDER_DESC ); @@ -159,9 +161,14 @@ class Report_monilog extends Report { $nowtime = microtime_float(); $content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s, "; - // Create plain hosts list for Consolidate function - foreach ( $content["report_computers"] as $tmpComputer ) - $arrHosts[] = $tmpComputer[SYSLOG_HOST]; + if ( is_array($content["report_summary"]) && count($content["report_summary"]) > 0 ) + { + // Create plain hosts list for Consolidate function + foreach ( $content["report_computers"] as $tmpComputer ) + $arrHosts[] = $tmpComputer[SYSLOG_HOST]; + } + else + return ERROR_REPORT_NODATA; // This function will consolidate the Events based per Host! $this->ConsolidateEventsPerHost($arrHosts); @@ -169,7 +176,6 @@ class Report_monilog extends Report { // TimeStats $nowtime = microtime_float(); $content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s "; - // --- } else diff --git a/src/include/constants_errors.php b/src/include/constants_errors.php index 246008c..5238cfd 100644 --- a/src/include/constants_errors.php +++ b/src/include/constants_errors.php @@ -66,5 +66,6 @@ define('ERROR_MSG_NOMATCH', 18); define('ERROR_CHARTS_NOTCONFIGURED', 20); define('ERROR_MSG_SKIPMESSAGE', 21); define('ERROR_MSG_SCANABORTED', 23); +define('ERROR_REPORT_NODATA', 24); ?> \ No newline at end of file diff --git a/src/include/functions_common.php b/src/include/functions_common.php index c9d7f10..bea7511 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -1763,6 +1763,9 @@ function GetErrorMessage($errorCode) case ERROR_SOURCENOTFOUND: return $content['LN_GEN_ERROR_SOURCENOTFOUND']; + case ERROR_REPORT_NODATA: + return $content['LN_GEN_ERROR_REPORT_NODATA']; + default: return GetAndReplaceLangStr( $content['LN_ERROR_UNKNOWN'], $errorCode ); }