From a2a3e67d498f77629a8772fbe4f17569a8bfe33c Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 22 Apr 2021 07:07:22 +0000 Subject: [PATCH] Ent 7363 bug al copiar consola visual --- .../godmode/reporting/map_builder.php | 21 +++++++++++-------- pandora_console/include/functions_menu.php | 1 - .../models/VisualConsole/Items/BarsGraph.php | 20 +++++++++++++++++- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index 3e0ee1abc8..1dd607c57c 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -194,22 +194,22 @@ if ($delete_layout || $copy_layout) { } if ($copy_layout) { - // Number of inserts + // Number of inserts. $ninsert = (int) 0; - // Return from DB the source layout + // Return from DB the source layout. $layout_src = db_get_all_rows_filter( 'tlayout', ['id' => $id_layout] ); - // Name of dst + // Name of dst. $name_dst = get_parameter( 'name_dst', $layout_src[0]['name'].' copy' ); - // Create the new Console + // Create the new Console. $idGroup = $layout_src[0]['id_group']; $background = $layout_src[0]['background']; $height = $layout_src[0]['height']; @@ -217,12 +217,15 @@ if ($delete_layout || $copy_layout) { $visualConsoleName = $name_dst; $values = [ - 'name' => $visualConsoleName, - 'id_group' => $idGroup, - 'background' => $background, - 'height' => $height, - 'width' => $width, + 'name' => $visualConsoleName, + 'id_group' => $idGroup, + 'background' => $background, + 'height' => $height, + 'width' => $width, + 'background_color' => $layout_src[0]['background_color'], + 'is_favourite' => $layout_src[0]['is_favourite'], ]; + $result = db_process_sql_insert('tlayout', $values); $idNewVisualConsole = $result; diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php index 3337cb80de..442a18f61f 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -152,7 +152,6 @@ function menu_print_menu(&$menu) $first_sub_sec2 = ''; foreach ($main['sub'] as $subsec2 => $sub) { - // hd($sub, true); $count_sub++; // Init some variables. diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/BarsGraph.php b/pandora_console/include/rest-api/models/VisualConsole/Items/BarsGraph.php index 62a39dd71a..a56acc94e8 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Items/BarsGraph.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Items/BarsGraph.php @@ -352,7 +352,25 @@ final class BarsGraph extends Item false, false ); - $graph = base64_encode(file_get_contents($image)); + $rc = file_get_contents($image); + if ($rc !== false) { + $graph = base64_encode($rc); + } else { + $graph = graph_nodata_image( + // Width. + $width, + // Height. + $height, + // Type. + 'hbar', + // Text. + '', + // Percent. + false, + // Base64. + true + ); + } } else { if ($typeGraph === 'horizontal') { $graph = \hbar_graph(