From 4cd1ca38a4f144911c71f485a21aa0270f0c5751 Mon Sep 17 00:00:00 2001
From: Tatiana Llorente <tatiana.llorente@artica.es>
Date: Tue, 7 Jan 2020 09:25:31 +0100
Subject: [PATCH] =?UTF-8?q?Ent=205091=20unificacion=20de=20tama=C3=B1o=20d?=
 =?UTF-8?q?e=20letra=20en=20informes?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../godmode/setup/setup_visuals.php           | 10 ++-
 pandora_console/include/functions_config.php  | 10 ++-
 .../include/functions_reporting_html.php      | 79 +++++++++----------
 3 files changed, 55 insertions(+), 44 deletions(-)

diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php
index 9c3c857b0a..60da29ea46 100755
--- a/pandora_console/godmode/setup/setup_visuals.php
+++ b/pandora_console/godmode/setup/setup_visuals.php
@@ -1038,8 +1038,13 @@ $row++;
 
     $row++;
 
-    $table_report->data[$row][0] = __('PDF font size');
-    $table_report->data[$row][1] = "<input type ='number' value=".$config['font_size_item_report']." size='1' name='font_size_item_report' min='1' max='9' step='0.1'>";
+    $table_report->data[$row][0] = __('PDF font size (px)');
+    $table_report->data[$row][1] = "<input type ='number' value=".$config['global_font_size_report']." name='global_font_size_report' min='1' max='50' step='1'>";
+
+    $row++;
+
+    $table_report->data[$row][0] = __('HTML font size for SLA (em)');
+    $table_report->data[$row][1] = "<input type ='number' value=".$config['font_size_item_report']." name='font_size_item_report' min='1' max='9' step='0.1'>";
 
     $row++;
 
@@ -1049,6 +1054,7 @@ $row++;
         true
     );
     $table_report->data[$row][1] = html_print_input_text('graph_image_height', $config['graph_image_height'], '', 20, 20, true);
+
     $row++;
 
     $interval_description = [
diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php
index 92491fb02b..8f896545cd 100644
--- a/pandora_console/include/functions_config.php
+++ b/pandora_console/include/functions_config.php
@@ -1286,7 +1286,11 @@ function config_update_config()
 
                     // Juanma (06/05/2014) New feature: Custom front page for reports.
                     if (!config_update_value('font_size_item_report', get_parameter('font_size_item_report', 2))) {
-                        $error_update[] = __('Font size for items reports');
+                        $error_update[] = __('HTML font size for SLA (em)');
+                    }
+
+                    if (!config_update_value('global_font_size_report', get_parameter('global_font_size_report', 14))) {
+                        $error_update[] = __('PDF font size (px)');
                     }
 
                     if (!config_update_value('interval_description', (string) get_parameter('interval_description', 'large'))) {
@@ -2817,6 +2821,10 @@ function config_process_config()
         config_update_value('font_size_item_report', 2);
     }
 
+    if (!isset($config['global_font_size_report'])) {
+        config_update_value('global_font_size_report', 14);
+    }
+
     if (!isset($config['interval_description'])) {
         config_update_value('interval_description', 'large');
     }
diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php
index cd93334327..ac7ee7cd21 100644
--- a/pandora_console/include/functions_reporting_html.php
+++ b/pandora_console/include/functions_reporting_html.php
@@ -447,9 +447,9 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
     $interval_description = $config['interval_description'];
 
     if ($mini) {
-        $font_size = '1.5';
+        $font_size = '1.5em';
     } else {
-        $font_size = $config['font_size_item_report'];
+        $font_size = $config['font_size_item_report'].'em';
     }
 
     $metaconsole_on = is_metaconsole();
@@ -588,18 +588,18 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
                     $row[] = round($sla['sla_limit'], 2).'%';
 
                     if (reporting_sla_is_not_init_from_array($sla)) {
-                        $row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NOTINIT.';">'.__('N/A').'</span>';
-                        $row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NOTINIT.';">'.__('Not init').'</span>';
+                        $row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_NOTINIT.';">'.__('N/A').'</span>';
+                        $row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_NOTINIT.';">'.__('Not init').'</span>';
                     } else if (reporting_sla_is_ignored_from_array($sla)) {
-                        $row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_IGNORED.';">'.__('N/A').'</span>';
-                        $row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_IGNORED.';">'.__('No data').'</span>';
+                        $row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_IGNORED.';">'.__('N/A').'</span>';
+                        $row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_IGNORED.';">'.__('No data').'</span>';
                         // Normal calculation.
                     } else if ($sla['sla_status']) {
-                        $row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">'.sla_truncate($sla['sla_value'], $config['graph_precision']).'%</span>';
-                        $row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">'.__('OK').'</span>';
+                        $row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_NORMAL.';">'.sla_truncate($sla['sla_value'], $config['graph_precision']).'%</span>';
+                        $row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_NORMAL.';">'.__('OK').'</span>';
                     } else {
-                        $row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">'.sla_truncate($sla['sla_value'], $config['graph_precision']).'%</span>';
-                        $row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">'.__('Fail').'</span>';
+                        $row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_CRITICAL.';">'.sla_truncate($sla['sla_value'], $config['graph_precision']).'%</span>';
+                        $row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_CRITICAL.';">'.__('Fail').'</span>';
                     }
 
                     // Second table for time globals.
@@ -2310,7 +2310,6 @@ function reporting_html_network_interfaces_report($table, $item, $pdf=0)
             $table_agent->head = [];
             $table_agent->head[0] = __('Agent').' '.$agent['agent'];
             $table_agent->headstyle = [];
-            $table_agent->headstyle[0] = 'font-size: 16px;';
             $table_agent->style[0] = 'text-align: center';
 
             $table_agent->data['interfaces'] = '';
@@ -2399,7 +2398,6 @@ function reporting_html_alert_report($table, $item, $pdf=0)
             '',
             true
         );
-        return true;
     }
 
     $table1->head['agent']    = __('Agent');
@@ -2503,9 +2501,9 @@ function reporting_html_monitor_report($table, $item, $mini, $pdf=0)
     global $config;
 
     if ($mini) {
-        $font_size = '1.5';
+        $font_size = '1.5em';
     } else {
-        $font_size = $config['font_size_item_report'];
+        $font_size = $config['font_size_item_report'].'em';
     }
 
     $table->colspan['module']['cell'] = 3;
@@ -2516,10 +2514,10 @@ function reporting_html_monitor_report($table, $item, $mini, $pdf=0)
     $table1->head = [];
     $table1->data = [];
     if ($item['data']['unknown'] == 1) {
-        $table1->data['data']['unknown'] = '<p style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">';
+        $table1->data['data']['unknown'] = '<p style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_UNKNOWN.';">';
         $table1->data['data']['unknown'] .= __('Unknown').'</p>';
     } else {
-        $table1->data['data']['ok'] = '<p style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">';
+        $table1->data['data']['ok'] = '<p style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_NORMAL.';">';
         $table1->data['data']['ok'] .= html_print_image(
             'images/module_ok.png',
             true
@@ -2530,7 +2528,7 @@ function reporting_html_monitor_report($table, $item, $mini, $pdf=0)
             )
         ).' %</p>';
 
-        $table1->data['data']['fail'] = '<p style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">';
+        $table1->data['data']['fail'] = '<p style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_CRITICAL.';">';
         $table1->data['data']['fail'] .= html_print_image(
             'images/module_critical.png',
             true
@@ -2750,9 +2748,9 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e
     global $config;
 
     if ($mini) {
-        $font_size = '1.5';
+        $font_size = '1.5em';
     } else {
-        $font_size = $config['font_size_item_report'];
+        $font_size = $config['font_size_item_report'].'em';
     }
 
     if (isset($item['visual_format']) && $item['visual_format'] != 0
@@ -2867,7 +2865,7 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e
         $table->colspan['data']['cell'] = 3;
         $table->cellstyle['data']['cell'] = 'text-align: left;';
 
-        $table->data['data']['cell'] = '<p style="font: bold '.$font_size.'em Arial, Sans-serif; color: #000000;">';
+        $table->data['data']['cell'] = '<p style="font-weight: bold; font-size: '.$font_size.'; color: #000000;">';
 
         if ($check_empty && empty($item['data']['value'])) {
             $table->data['data']['cell'] .= __('Unknown');
@@ -3021,6 +3019,7 @@ function reporting_html_availability($table, $item, $pdf=0)
 
     global $config;
 
+    $font_size = $config['font_size_item_report'].'em';
     $interval_description = $config['interval_description'];
 
     if (!empty($item['data'])) {
@@ -3227,7 +3226,7 @@ function reporting_html_availability($table, $item, $pdf=0)
                 $table_row[] = '';
             };
 
-            $table_row[] = '<span style="font-size: 1.2em; font-weight:bold;">'.sla_truncate($row['SLA'], $config['graph_precision']).'%</span>';
+            $table_row[] = '<span style="font-size: '.$font_size.'; font-weight:bold;">'.sla_truncate($row['SLA'], $config['graph_precision']).'%</span>';
 
             $table_row2 = [];
             $table_row2[] = $row['agent'];
@@ -3323,7 +3322,7 @@ function reporting_html_availability($table, $item, $pdf=0)
                     $item['resume']['min'],
                     $config['graph_precision']
                 ).'%',
-                'avg'      => '<span style="font-size: 1.2em; font-weight:bold;">'.sla_truncate($item['resume']['avg'], $config['graph_precision']).'%</span>',
+                'avg'      => '<span style="font-size: '.$font_size.'; font-weight:bold;">'.sla_truncate($item['resume']['avg'], $config['graph_precision']).'%</span>',
             ];
             if ($item['fields']['agent_max_value'] == false) {
                 $table1->head['max_text'] = '';
@@ -3380,6 +3379,14 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
     global $config;
     $metaconsole_on = is_metaconsole();
 
+    $font_size = $config['font_size_item_report'].'em';
+
+    if ($pdf) {
+        $font_mini = '9px';
+    } else {
+        $font_mini = 'inherit';
+    }
+
     if ($metaconsole_on !== false) {
         $hack_metaconsole = '../../';
     } else {
@@ -3443,8 +3450,9 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
 
                 $table1->data[0][0] = $chart['agent'].'<br />'.$chart['module'];
                 $table1->data[0][1] = $chart['chart'];
-                $table1->data[0][2] = "<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>".$sla_value.'</span>';
-                $table1->data[0][3] = $checks_resume;
+                $table1->data[0][2] = "<span style = 'font-weight: bold; font-size: ".$font_size.'; color: '.$color."'>".$sla_value.'</span>';
+                $table1->data[0][3] = "<span style = 'font-size: ".$font_mini.";'>".$checks_resume.'</span>';
+
                 $tables_chart .= html_print_table(
                     $table1,
                     true
@@ -3464,8 +3472,10 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
                 }
 
                 $title = '';
-                $checks_resume_text = $checks_resume;
-                $sla_value_text = "<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>".$sla_value.'</span>';
+                $checks_resume_text = '<span style = "font-size: '.$font_mini.';">';
+                $checks_resume_text .= $checks_resume;
+                $checks_resume_text .= '</span>';
+                $sla_value_text = "<span style = 'font-weight: bold; font-size: ".$font_size.' !important; color: '.$color."'>".$sla_value.'</span>';
                 switch ($item['data'][$k_chart]['failover']) {
                     case 'primary':
                         $title = '<b>'.__('Primary').'</b>';
@@ -3482,8 +3492,8 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
                     case 'result':
                     default:
                         $title = '<b>'.__('Result').'</b>';
-                        $sla_value_text = "<span style = 'font: bold 3em Arial, Sans-serif; color: ".$color."'>".$sla_value.'</span>';
-                        $checks_resume_text = '<span style = "font-size: 12pt;">';
+                        $sla_value_text = "<span style = 'font-weight: bold; font-size: ".$font_size.' !important; color: '.$color."'>".$sla_value.'</span>';
+                        $checks_resume_text = '<span style = "font-size: '.$font_mini.';">';
                         $checks_resume_text .= $checks_resume;
                         $checks_resume_text .= '</span>';
                     break;
@@ -5123,19 +5133,6 @@ function reporting_html_planned_downtimes_table($planned_downtimes)
     $table->style = [];
     $table->data = [];
 
-    if ($for_pdf) {
-        $table->titlestyle = 'background: #373737; color: #FFF; display: table-cell; font-size: 12px; border: 1px solid grey';
-        $table->class = 'table_sla';
-
-        for ($i = 0; $i < count($table->head); $i++) {
-            $table->headstyle[$i] = 'background: #666; color: #FFF; display: table-cell; font-size: 11px; border: 1px solid grey';
-        }
-
-        for ($i = 0; $i < count($table->head); $i++) {
-            $table->style[$i] = 'display: table-cell; font-size: 10px;';
-        }
-    }
-
     foreach ($planned_downtimes as $planned_downtime) {
         $data = [];
         $data[0] = $planned_downtime['name'];