From efd65edefa2ec9623e9b4b5a28af99c931fba839 Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 18 Feb 2019 13:13:17 +0100 Subject: [PATCH] fixed errors Former-commit-id: dc70e23da17691f3af6602cd85e2f01b27d27d58 --- .../reporting_builder.item_editor.php | 1 + .../godmode/reporting/reporting_builder.php | 14 ++- .../include/functions_reporting.php | 2 - .../include/functions_reporting_html.php | 109 ++++++++++++++---- 4 files changed, 100 insertions(+), 26 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 38584d6b6a..c274ce7b30 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -202,6 +202,7 @@ switch ($action) { switch ($type) { case 'event_report_log': + hd('entra', true); $period = $item['period']; $description = $item['description']; diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index abab21b8fe..fa3e720a00 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1116,8 +1116,13 @@ switch ($action) { $name_it = (string) get_parameter('name'); $values['name'] = reporting_label_macro($items_label, $name_it); - // Added support for projection graphs, prediction date and SLA reports - // 'top_n_value','top_n' and 'text' fields will be reused for these types of report + /* + Added support for projection graphs, + prediction date and SLA reports + 'top_n_value','top_n' and 'text' + fields will be reused for these types of report + */ + switch ($values['type']) { case 'projection_graph': $values['period'] = get_parameter('period1'); @@ -1127,7 +1132,8 @@ switch ($action) { break; case 'event_report_log': - $agents_to_report = get_parameter('id_agents2'); + + $agents_to_report = get_parameter('id_agents3'); $source = get_parameter('source', ''); $search = get_parameter('search', ''); $log_number = get_parameter('log_number', ''); @@ -1525,7 +1531,7 @@ switch ($action) { break; case 'event_report_log': - $agents_to_report = get_parameter('id_agents2'); + $agents_to_report = get_parameter('id_agents3'); $source = get_parameter('source', ''); $search = get_parameter('search', ''); $log_number = get_parameter('log_number', ''); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 1aa9ecf618..1581119772 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -142,7 +142,6 @@ function reporting_make_reporting_data( enterprise_include_once('include/functions_metaconsole.php'); $return = []; - if (!empty($report)) { $contents = $report['contents']; } else { @@ -6792,7 +6791,6 @@ function reporting_general($report, $content) if (!is_numeric($data_res[$index])) { $return['data'][$ag_name][$mod_name] = $data_res[$index]; } else { - hd($data_res[$index], true); $return['data'][$ag_name][$mod_name] = format_for_graph($data_res[$index], 2).' '.$unit; } } diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index b882cc0ae0..362120e0a1 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -1322,15 +1322,29 @@ function reporting_html_event_report_module($table, $item, $pdf=0) } -function reporting_html_inventory_changes($table, $item) +/** + * Print in html inventory changes reports + * + * @param object $table Head table or false if it comes from pdf. + * @param array $item Items data. + * @param boolean $pdf Print pdf true or false. + * + * @return html + */ +function reporting_html_inventory_changes($table, $item, $pdf=0) { + $return_pdf = ''; if (!empty($item['failed'])) { - $table->colspan['failed']['cell'] = 3; - $table->cellstyle['failed']['cell'] = 'text-align: center;'; - $table->data['failed']['cell'] = $item['failed']; + if ($pdf === 0) { + $table->colspan['failed']['cell'] = 3; + $table->cellstyle['failed']['cell'] = 'text-align: center;'; + $table->data['failed']['cell'] = $item['failed']; + } else { + $return_pdf .= $item['failed']; + } } else { foreach ($item['data'] as $module_item) { - $table1 = null; + $table1 = new stdClass(); $table1->width = '99%'; $table1->cellstyle = []; @@ -1348,7 +1362,10 @@ function reporting_html_inventory_changes($table, $item) $table1->colspan[2][0] = 2; if (count($module_item['added'])) { - $table1->data = array_merge($table1->data, $module_item['added']); + $table1->data = array_merge( + $table1->data, + $module_item['added'] + ); } $table1->cellstyle[(3 + count($module_item['added']))][0] = 'background: #373737; color: #FFF; text-align: center;'; @@ -1356,25 +1373,59 @@ function reporting_html_inventory_changes($table, $item) $table1->colspan[(3 + count($module_item['added']))][0] = 2; if (count($module_item['deleted'])) { - $table1->data = array_merge($table1->data, $module_item['deleted']); + $table1->data = array_merge( + $table1->data, + $module_item['deleted'] + ); } - $table->colspan[$module_item['agent'].'_'.$module_item['module']]['cell'] = 3; - $table->data[$module_item['agent'].'_'.$module_item['module']]['cell'] = html_print_table($table1, true); + if ($pdf === 0) { + $table->colspan[$module_item['agent'].'_'.$module_item['module']]['cell'] = 3; + $table->data[$module_item['agent'].'_'.$module_item['module']]['cell'] = html_print_table( + $table1, + true + ); + } else { + $table1->title = $item['title']; + $table1->titleclass = 'title_table_pdf'; + $table1->titlestyle = 'text-align:left;'; + $return_pdf .= html_print_table( + $table1, + true + ); + } } } + + if ($pdf !== 0) { + return $return_pdf; + } } -function reporting_html_inventory($table, $item) +/** + * Print in html inventory reportd + * + * @param object $table Head table or false if it comes from pdf. + * @param array $item Items data. + * @param boolean $pdf Print pdf true or false. + * + * @return html + */ +function reporting_html_inventory($table, $item, $pdf=0) { + $return_pdf = ''; if (!empty($item['failed'])) { - $table->colspan['failed']['cell'] = 3; - $table->cellstyle['failed']['cell'] = 'text-align: center;'; - $table->data['failed']['cell'] = $item['failed']; + if ($pdf === 0) { + $table->colspan['failed']['cell'] = 3; + $table->cellstyle['failed']['cell'] = 'text-align: center;'; + $table->data['failed']['cell'] = $item['failed']; + } else { + $return_pdf .= $item['failed']; + } } else { foreach ($item['data'] as $module_item) { - $table1 = null; + $table1 = new stdClass(); $table1->width = '99%'; $first = reset($module_item['data']); @@ -1384,12 +1435,12 @@ function reporting_html_inventory($table, $item) $table1->data[0][0] = $module_item['agent_name']; if ($count_columns == 1) { $table1->colspan[0][0] = ($count_columns + 1); - // + columm date } else { $table1->colspan[0][0] = $count_columns; } - $table1->cellstyle[1][0] = $table1->cellstyle[1][1] = 'background: #373737; color: #FFF;'; + $table1->cellstyle[1][0] = 'background: #373737; color: #FFF;'; + $table1->cellstyle[1][1] = 'background: #373737; color: #FFF;'; $table1->data[1][0] = $module_item['name']; if (($count_columns - 1) > 0) { $table1->colspan[1][0] = ($count_columns - 1); @@ -1405,16 +1456,34 @@ function reporting_html_inventory($table, $item) $table1->data[2] = array_keys($first); if (($count_columns - 1) == 0) { $table1->colspan[2][0] = ($count_columns + 1); - // + columm date; } - $table1->data = array_merge($table1->data, $module_item['data']); + $table1->data = array_merge( + $table1->data, + $module_item['data'] + ); - $table->colspan[$module_item['name'].'_'.$module_item['id_agente']]['cell'] = 3; - $table->data[$module_item['name'].'_'.$module_item['id_agente']]['cell'] = html_print_table($table1, true); + if ($pdf === 0) { + $table->colspan[$module_item['name'].'_'.$module_item['id_agente']]['cell'] = 3; + $table->data[$module_item['name'].'_'.$module_item['id_agente']]['cell'] = html_print_table( + $table1, + true + ); + } else { + $table1->title = $item['title']; + $table1->titleclass = 'title_table_pdf'; + $table1->titlestyle = 'text-align:left;'; + $return_pdf .= html_print_table( + $table1, + true + ); + } } } + if ($pdf !== 0) { + return $return_pdf; + } }