From ec848acc18b1518954e4c339674135a3294a67bd Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 1 Dec 2016 15:36:14 +0100 Subject: [PATCH] create new report sla weekly --- .../reporting_builder.item_editor.php | 31 +++++++++++++++++-- .../reporting_builder.list_items.php | 2 +- .../godmode/reporting/reporting_builder.php | 1 + .../include/functions_reporting.php | 16 ++++++---- .../include/functions_reporting_html.php | 3 ++ pandora_console/include/functions_reports.php | 2 ++ 6 files changed, 46 insertions(+), 9 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 74a26124d7..eac587c38e 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -133,6 +133,7 @@ switch ($action) { switch ($type) { case 'SLA_monthly': + case 'SLA_weekly': case 'SLA_services': case 'SLA': case 'top_n': @@ -264,6 +265,24 @@ switch ($action) { // 'top_n' filed will be reused for SLA sort option $sla_sorted_by = $item['top_n']; break; + + case 'SLA_weekly': + $description = $item['description']; + $only_display_wrong = $item['only_display_wrong']; + $monday = $item['monday']; + $tuesday = $item['tuesday']; + $wednesday = $item['wednesday']; + $thursday = $item['thursday']; + $friday = $item['friday']; + $saturday = $item['saturday']; + $sunday = $item['sunday']; + $time_from = $item['time_from']; + $time_to = $item['time_to']; + $show_graph = $item['show_graph']; + // 'top_n' filed will be reused for SLA sort option + $sla_sorted_by = $item['top_n']; + break; + case 'SLA_services': $description = $item['description']; $period = $item['period']; @@ -2528,7 +2547,7 @@ function chooseType() { $("#row_working_time").show(); $("#row_only_display_wrong").show(); $("#row_show_graph").show(); - $("#row_show_in_two_columns").show(); + //$("#row_show_in_two_columns").show(); $("#row_sort").show(); $('#row_hide_notinit_agents').show(); break; @@ -2537,7 +2556,15 @@ function chooseType() { $("#row_description").show(); $("#sla_list").show(); $("#row_working_time").show(); - $("#row_show_in_two_columns").show(); + //$("#row_show_in_two_columns").show(); + $("#row_sort").show(); + break; + + case 'SLA_weekly': + $("#row_description").show(); + $("#sla_list").show(); + $("#row_working_time").show(); + //$("#row_show_in_two_columns").show(); $("#row_sort").show(); break; diff --git a/pandora_console/godmode/reporting/reporting_builder.list_items.php b/pandora_console/godmode/reporting/reporting_builder.list_items.php index 3687bc62c8..197cf7ba2f 100755 --- a/pandora_console/godmode/reporting/reporting_builder.list_items.php +++ b/pandora_console/godmode/reporting/reporting_builder.list_items.php @@ -223,7 +223,7 @@ if ($moduleFilter != 0) { // Filter report items created from metaconsole in normal console list and the opposite if (defined('METACONSOLE') and $config['metaconsole'] == 1) { $where .= ' AND ((server_name IS NOT NULL AND length(server_name) != 0) ' . - 'OR ' . $type_escaped . ' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'top_n\',\'SLA_monthly\'))'; + 'OR ' . $type_escaped . ' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'top_n\',\'SLA_monthly\',\'SLA_weekly\'))'; } else $where .= ' AND ((server_name IS NULL OR length(server_name) = 0) ' . diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index c871309b34..406f14a1cd 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -936,6 +936,7 @@ switch ($action) { $values['text'] = $intervals; break; case 'SLA_monthly': + case 'SLA_weekly': case 'SLA_services': case 'SLA': $values['period'] = get_parameter('period'); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index b378a2ae3b..c0cc603591 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -449,6 +449,11 @@ function reporting_make_reporting_data($report = null, $id_report, $report, $content); break; + case 'SLA_weekly': + $report['contents'][] = reporting_enterprise_sla_weekly( + $report, + $content); + break; case 'SLA_services': $report['contents'][] = reporting_enterprise_sla_services_refactoriced( $report, @@ -4764,12 +4769,11 @@ function reporting_availability($report, $content, $date=false, $time=false) { $text = $row['data']['agent'] . " (" . $text . ")"; - /* - //Restore dbconnection - if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) { - metaconsole_restore_db(); - } - */ + //Restore dbconnection + if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) { + metaconsole_restore_db(); + } + //find order $row['data']['order'] = $row['data']['SLA']; diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 0bbc1d5096..2ce03b6c27 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -275,6 +275,9 @@ function reporting_html_print_report($report, $mini = false) { case 'SLA_monthly': reporting_enterprise_html_SLA_monthly($table, $item, $mini); break; + case 'SLA_weekly': + reporting_enterprise_html_SLA_weekly($table, $item, $mini); + break; case 'SLA_services': reporting_enterprise_html_SLA_services($table, $item, $mini); break; diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php index 698e4fc088..40b1ba6508 100755 --- a/pandora_console/include/functions_reports.php +++ b/pandora_console/include/functions_reports.php @@ -537,6 +537,8 @@ function reports_get_report_types ($template = false, $not_editor = false) { if ($config['enterprise_installed']) { $types['SLA_monthly'] = array('optgroup' => __('SLA'), 'name' => __('Monthly S.L.A.')); + $types['SLA_weekly'] = array('optgroup' => __('SLA'), + 'name' => __('Weekly S.L.A.')); if (!$config['metaconsole'] && !$template) { $types['SLA_services'] = array('optgroup' => __('SLA'),