fixed errors in reports evnts

This commit is contained in:
daniel 2017-02-02 10:13:58 +01:00
parent 707381284e
commit 5dad591b02
4 changed files with 395 additions and 331 deletions

View File

@ -1146,17 +1146,12 @@ switch ($action) {
$style['event_graph_by_criticity'] = $event_graph_by_criticity; $style['event_graph_by_criticity'] = $event_graph_by_criticity;
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated; $style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
switch ($values['type']) {
case 'event_report_group':
case 'event_report_agent':
$style['event_filter_search'] = $event_filter_search; $style['event_filter_search'] = $event_filter_search;
if ($label != '') if ($label != '')
$style['label'] = $label; $style['label'] = $label;
else else
$style['label'] = ''; $style['label'] = '';
break; break;
}
break;
case 'simple_graph': case 'simple_graph':
// Warning. We are using this column to hold this value to avoid // Warning. We are using this column to hold this value to avoid
// the modification of the database for compatibility reasons. // the modification of the database for compatibility reasons.

View File

@ -1315,6 +1315,8 @@ function events_get_agent ($id_agent, $period, $date = 0,
case -1: case -1:
$status_all = 1; $status_all = 1;
break; break;
case 3:
$filter_event_status[$key] = ('0, 2');
default: default:
break; break;
} }
@ -2647,6 +2649,8 @@ function events_get_count_events_by_agent ($id_group, $period, $date,
case -1: case -1:
$status_all = 1; $status_all = 1;
break; break;
case 3:
$filter_event_status[$key] = ('0, 2');
default: default:
break; break;
} }
@ -2792,6 +2796,8 @@ function events_get_count_events_validated_by_user ($filter, $period, $date,
case -1: case -1:
$status_all = 1; $status_all = 1;
break; break;
case 3:
$filter_event_status[$key] = ('0, 2');
default: default:
break; break;
} }
@ -2935,6 +2941,8 @@ function events_get_count_events_by_criticity ($filter, $period, $date,
case -1: case -1:
$status_all = 1; $status_all = 1;
break; break;
case 3:
$filter_event_status[$key] = ('0, 2');
default: default:
break; break;
} }
@ -3091,6 +3099,8 @@ function events_get_count_events_validated ($filter, $period = null, $date = nul
case -1: case -1:
$status_all = 1; $status_all = 1;
break; break;
case 3:
$filter_event_status[$key] = ('0, 2');
default: default:
break; break;
} }

View File

@ -1418,7 +1418,7 @@ function reporting_event_report_group($report, $content,
} }
//total_events //total_events
if(isset($return['data'])){ if($return['data'] != ''){
$return['total_events'] = count($return['data']); $return['total_events'] = count($return['data']);
} }
else{ else{
@ -1497,6 +1497,14 @@ function reporting_event_report_module($report, $content,
metaconsole_restore_db(); metaconsole_restore_db();
} }
//total_events
if($return['data'][0]['data'] != ''){
$return['total_events'] = count($return['data'][0]['data']);
}
else{
$return['total_events'] = 0;
}
return reporting_check_structure_content($return); return reporting_check_structure_content($return);
} }
@ -2306,7 +2314,7 @@ function reporting_event_report_agent($report, $content,
} }
//total_events //total_events
if(isset($return['data'])){ if($return['data'] != ''){
$return['total_events'] = count($return['data']); $return['total_events'] = count($return['data']);
} }
else{ else{

View File

@ -163,13 +163,9 @@ function reporting_html_print_report($report, $mini = false, $report_info = 1) {
$table->data['description_row']['description'] = $item['description']; $table->data['description_row']['description'] = $item['description'];
if($item['type']=='event_report_agent' || $item['type']=='event_report_group'){ if($item['type']=='event_report_agent' || $item['type']=='event_report_group' || $item['type']=='event_report_module'){
if($item['description'] != '' && $item['description'] != null){
$table->data['description_row']['description'] .= " - "; $table->data['count_row']['count'] = "Total events: ".$item["total_events"];
}
$table->data['description_row']['description'] .= "Total events: ".$item["total_events"];
} }
$table->colspan['description_row']['description'] = 3; $table->colspan['description_row']['description'] = 3;
@ -781,11 +777,7 @@ function reporting_html_top_n($table, $item) {
function reporting_html_event_report_group($table, $item, $pdf = 0) { function reporting_html_event_report_group($table, $item, $pdf = 0) {
global $config; global $config;
if (!empty($item['failed'])) { if($item['total_events']){
$table->colspan['events']['cell'] = 3;
$table->data['events']['cell'] = $item['failed'];
}
else {
$table1 = new stdClass(); $table1 = new stdClass();
$table1->width = '99%'; $table1->width = '99%';
@ -865,7 +857,6 @@ function reporting_html_event_report_group($table, $item, $pdf = 0) {
io_safe_output($event['evento']), io_safe_output($event['evento']),
140, false, true); 140, false, true);
//$data[1] = $event['event_type'];
$data[] = events_print_type_img ($event["event_type"], true); $data[] = events_print_type_img ($event["event_type"], true);
if (!empty($event['id_agente'])) if (!empty($event['id_agente']))
@ -892,8 +883,14 @@ function reporting_html_event_report_group($table, $item, $pdf = 0) {
} }
if($pdf){ if($pdf){
$table0 = new stdClass();
$table0->width = '99%';
$table0->class = 'table-beauty';
$table0->data['count_row']['count'] = "Total events: ".$item["total_events"];
$pdf_export = html_print_table($table0, true);
$table1->class = 'table-beauty'; $table1->class = 'table-beauty';
$pdf_export = html_print_table($table1, true); $pdf_export .= html_print_table($table1, true);
$pdf_export .= '<br>'; $pdf_export .= '<br>';
} }
else{ else{
@ -981,11 +978,23 @@ function reporting_html_event_report_group($table, $item, $pdf = 0) {
return $pdf_export; return $pdf_export;
} }
} }
else {
if($pdf){
$table0 = new stdClass();
$table0->width = '99%';
$table0->class = 'table-beauty';
$table0->data['count_row']['count'] = "Total events: ".$item["total_events"];
$pdf_export = html_print_table($table0, true);
return $pdf_export;
}
}
} }
function reporting_html_event_report_module($table, $item, $pdf = 0) { function reporting_html_event_report_module($table, $item, $pdf = 0) {
global $config; global $config;
$show_summary_group = $item['show_summary_group']; $show_summary_group = $item['show_summary_group'];
if($item['total_events']){
if (!empty($item['failed'])) { if (!empty($item['failed'])) {
$table->colspan['events']['cell'] = 3; $table->colspan['events']['cell'] = 3;
$table->data['events']['cell'] = $item['failed']; $table->data['events']['cell'] = $item['failed'];
@ -996,24 +1005,28 @@ function reporting_html_event_report_module($table, $item, $pdf = 0) {
$table1->width = '99%'; $table1->width = '99%';
$table1->data = array (); $table1->data = array ();
$table1->head = array (); $table1->head = array ();
$table1->align = array();
$table1->align[2] = 'center';
if($show_summary_group){ if($show_summary_group){
$table1->head[0] = __('Status'); $table1->head[0] = __('Status');
$table1->head[1] = __('Event name'); $table1->head[1] = __('Event name');
$table1->head[2] = __('Event type'); $table1->head[2] = __('Type');
$table1->head[3] = __('Severity'); $table1->head[3] = __('Severity');
$table1->head[4] = __('Count'); $table1->head[4] = __('Count');
$table1->head[5] = __('Timestamp'); $table1->head[5] = __('Timestamp');
$table1->style[0] = 'text-align: center;'; $table1->style[0] = 'text-align: center;';
} }
else{ else{
$table1->head[0] = __('Status'); $table1->head[0] = __('Status');
$table1->head[1] = __('Event name'); $table1->head[1] = __('Event name');
$table1->head[2] = __('Event type'); $table1->head[2] = __('Type');
$table1->head[3] = __('Severity'); $table1->head[3] = __('Severity');
$table1->head[4] = __('Timestamp'); $table1->head[4] = __('Timestamp');
$table1->style[0] = 'text-align: center;'; $table1->style[0] = 'text-align: center;';
} }
$table->data['tatal_events']['cell'] = "Total events: ".$item["total_events"];
if (is_array($item['data']) || is_object($item['data'])){ if (is_array($item['data']) || is_object($item['data'])){
$item_data = array_reverse($item['data']); $item_data = array_reverse($item['data']);
} }
@ -1027,7 +1040,7 @@ function reporting_html_event_report_module($table, $item, $pdf = 0) {
$table1->cellclass[$i][5] = get_priority_class($event["criticity"]); $table1->cellclass[$i][5] = get_priority_class($event["criticity"]);
} }
else{ else{
$table1->cellclass[$i][1] = $table1->cellclass[$i][2] = $table1->cellclass[$i][1] =
$table1->cellclass[$i][3] = $table1->cellclass[$i][3] =
$table1->cellclass[$i][4] = get_priority_class($event["criticity"]); $table1->cellclass[$i][4] = get_priority_class($event["criticity"]);
} }
@ -1053,7 +1066,7 @@ function reporting_html_event_report_module($table, $item, $pdf = 0) {
"title" => $title_st, "title" => $title_st,
"id" => 'status_img_' . $event["id_evento"])); "id" => 'status_img_' . $event["id_evento"]));
$data[1] = io_safe_output($event['evento']); $data[1] = io_safe_output($event['evento']);
$data[2] = $event['event_type']; $data[2] = events_print_type_img ($event["event_type"], true);
$data[3] = get_priority_name ($event['criticity']); $data[3] = get_priority_name ($event['criticity']);
if($show_summary_group){ if($show_summary_group){
$data[4] = $event['event_rep']; $data[4] = $event['event_rep'];
@ -1066,8 +1079,14 @@ function reporting_html_event_report_module($table, $item, $pdf = 0) {
} }
} }
if($pdf){ if($pdf){
$table0 = new stdClass();
$table0->width = '99%';
$table0->class = 'table-beauty';
$table0->data['count_row']['count'] = "Total events: ".$item["total_events"];
$pdf_export = html_print_table($table0, true);
$table1->class = 'table-beauty'; $table1->class = 'table-beauty';
$pdf_export = html_print_table($table1, true); $pdf_export .= html_print_table($table1, true);
$pdf_export .= '<br>'; $pdf_export .= '<br>';
} }
else{ else{
@ -1157,6 +1176,18 @@ function reporting_html_event_report_module($table, $item, $pdf = 0) {
} }
} }
} }
else{
if($pdf){
$table0 = new stdClass();
$table0->width = '99%';
$table0->class = 'table-beauty';
$table0->data['count_row']['count'] = "Total events: ".$item["total_events"];
$pdf_export = html_print_table($table0, true);
return $pdf_export;
}
}
}
function reporting_html_inventory_changes($table, $item) { function reporting_html_inventory_changes($table, $item) {
if (!empty($item['failed'])) { if (!empty($item['failed'])) {
@ -1573,6 +1604,8 @@ function reporting_html_group_report($table, $item) {
function reporting_html_event_report_agent($table, $item, $pdf = 0) { function reporting_html_event_report_agent($table, $item, $pdf = 0) {
global $config; global $config;
if($item['total_events'] != 0){
$table1 = new stdClass(); $table1 = new stdClass();
$table1->width = '99%'; $table1->width = '99%';
$table1->align = array(); $table1->align = array();
@ -1658,8 +1691,14 @@ function reporting_html_event_report_agent($table, $item, $pdf = 0) {
} }
if($pdf){ if($pdf){
$table0 = new stdClass();
$table0->width = '99%';
$table0->class = 'table-beauty';
$table0->data['count_row']['count'] = "Total events: ".$item["total_events"];
$pdf_export = html_print_table($table0, true);
$table1->class = 'table-beauty'; $table1->class = 'table-beauty';
$pdf_export = html_print_table($table1, true); $pdf_export .= html_print_table($table1, true);
$pdf_export .= '<br>'; $pdf_export .= '<br>';
} }
else{ else{
@ -1729,6 +1768,18 @@ function reporting_html_event_report_agent($table, $item, $pdf = 0) {
return $pdf_export; return $pdf_export;
} }
} }
else{
if($pdf){
$table0 = new stdClass();
$table0->width = '99%';
$table0->class = 'table-beauty';
$table0->data['count_row']['count'] = "Total events: ".$item["total_events"];
$pdf_export = html_print_table($table0, true);
return $pdf_export;
}
}
}
function reporting_html_historical_data($table, $item) { function reporting_html_historical_data($table, $item) {
global $config; global $config;