Merge branch 'resolve-conflict-events-reports' into 'develop'

fixed errors in reports evnts

See merge request !106
This commit is contained in:
daniel 2017-02-02 10:14:52 +01:00
commit ffb5df9f23
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_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;
if ($label != '')
$style['label'] = $label;
else
$style['label'] = '';
break;
}
break;
case 'simple_graph':
// Warning. We are using this column to hold this value to avoid
// 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:
$status_all = 1;
break;
case 3:
$filter_event_status[$key] = ('0, 2');
default:
break;
}
@ -2647,6 +2649,8 @@ function events_get_count_events_by_agent ($id_group, $period, $date,
case -1:
$status_all = 1;
break;
case 3:
$filter_event_status[$key] = ('0, 2');
default:
break;
}
@ -2792,6 +2796,8 @@ function events_get_count_events_validated_by_user ($filter, $period, $date,
case -1:
$status_all = 1;
break;
case 3:
$filter_event_status[$key] = ('0, 2');
default:
break;
}
@ -2935,6 +2941,8 @@ function events_get_count_events_by_criticity ($filter, $period, $date,
case -1:
$status_all = 1;
break;
case 3:
$filter_event_status[$key] = ('0, 2');
default:
break;
}
@ -3091,6 +3099,8 @@ function events_get_count_events_validated ($filter, $period = null, $date = nul
case -1:
$status_all = 1;
break;
case 3:
$filter_event_status[$key] = ('0, 2');
default:
break;
}

View File

@ -1418,7 +1418,7 @@ function reporting_event_report_group($report, $content,
}
//total_events
if(isset($return['data'])){
if($return['data'] != ''){
$return['total_events'] = count($return['data']);
}
else{
@ -1497,6 +1497,14 @@ function reporting_event_report_module($report, $content,
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);
}
@ -2306,7 +2314,7 @@ function reporting_event_report_agent($report, $content,
}
//total_events
if(isset($return['data'])){
if($return['data'] != ''){
$return['total_events'] = count($return['data']);
}
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'];
if($item['type']=='event_report_agent' || $item['type']=='event_report_group'){
if($item['description'] != '' && $item['description'] != null){
if($item['type']=='event_report_agent' || $item['type']=='event_report_group' || $item['type']=='event_report_module'){
$table->data['description_row']['description'] .= " - ";
}
$table->data['description_row']['description'] .= "Total events: ".$item["total_events"];
$table->data['count_row']['count'] = "Total events: ".$item["total_events"];
}
$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) {
global $config;
if (!empty($item['failed'])) {
$table->colspan['events']['cell'] = 3;
$table->data['events']['cell'] = $item['failed'];
}
else {
if($item['total_events']){
$table1 = new stdClass();
$table1->width = '99%';
@ -865,7 +857,6 @@ function reporting_html_event_report_group($table, $item, $pdf = 0) {
io_safe_output($event['evento']),
140, false, true);
//$data[1] = $event['event_type'];
$data[] = events_print_type_img ($event["event_type"], true);
if (!empty($event['id_agente']))
@ -892,8 +883,14 @@ function reporting_html_event_report_group($table, $item, $pdf = 0) {
}
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';
$pdf_export = html_print_table($table1, true);
$pdf_export .= html_print_table($table1, true);
$pdf_export .= '<br>';
}
else{
@ -981,11 +978,23 @@ function reporting_html_event_report_group($table, $item, $pdf = 0) {
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) {
global $config;
$show_summary_group = $item['show_summary_group'];
if($item['total_events']){
if (!empty($item['failed'])) {
$table->colspan['events']['cell'] = 3;
$table->data['events']['cell'] = $item['failed'];
@ -996,24 +1005,28 @@ function reporting_html_event_report_module($table, $item, $pdf = 0) {
$table1->width = '99%';
$table1->data = array ();
$table1->head = array ();
$table1->align = array();
$table1->align[2] = 'center';
if($show_summary_group){
$table1->head[0] = __('Status');
$table1->head[1] = __('Event name');
$table1->head[2] = __('Event type');
$table1->head[2] = __('Type');
$table1->head[3] = __('Severity');
$table1->head[4] = __('Count');
$table1->head[5] = __('Timestamp');
$table1->style[0] = 'text-align: center;';
}
else{
$table1->head[0] = __('Status');
$table1->head[1] = __('Event name');
$table1->head[2] = __('Event type');
$table1->head[2] = __('Type');
$table1->head[3] = __('Severity');
$table1->head[4] = __('Timestamp');
$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'])){
$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"]);
}
else{
$table1->cellclass[$i][1] = $table1->cellclass[$i][2] =
$table1->cellclass[$i][1] =
$table1->cellclass[$i][3] =
$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,
"id" => 'status_img_' . $event["id_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']);
if($show_summary_group){
$data[4] = $event['event_rep'];
@ -1066,8 +1079,14 @@ function reporting_html_event_report_module($table, $item, $pdf = 0) {
}
}
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';
$pdf_export = html_print_table($table1, true);
$pdf_export .= html_print_table($table1, true);
$pdf_export .= '<br>';
}
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) {
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) {
global $config;
if($item['total_events'] != 0){
$table1 = new stdClass();
$table1->width = '99%';
$table1->align = array();
@ -1658,8 +1691,14 @@ function reporting_html_event_report_agent($table, $item, $pdf = 0) {
}
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';
$pdf_export = html_print_table($table1, true);
$pdf_export .= html_print_table($table1, true);
$pdf_export .= '<br>';
}
else{
@ -1729,6 +1768,18 @@ function reporting_html_event_report_agent($table, $item, $pdf = 0) {
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) {
global $config;