From e16f3b85cbcc66e9c19501bec5d4d054d59f0b4c Mon Sep 17 00:00:00 2001 From: fermin831 Date: Thu, 11 Feb 2016 15:20:02 +0100 Subject: [PATCH] Fixed Custom Graphs deletion TICKETS #3356 --- pandora_console/godmode/reporting/graphs.php | 80 ++++++++++---------- 1 file changed, 42 insertions(+), 38 deletions(-) diff --git a/pandora_console/godmode/reporting/graphs.php b/pandora_console/godmode/reporting/graphs.php index 8c32318bb5..001c6b2827 100644 --- a/pandora_console/godmode/reporting/graphs.php +++ b/pandora_console/godmode/reporting/graphs.php @@ -73,13 +73,16 @@ ui_print_page_header (__('Reporting')." » ".__('Custom graphs'), "images/c // Delete module SQL code if ($delete_graph) { if (check_acl ($config['id_user'], 0, "RW")) { - $result = db_process_sql_delete("tgraph_source", array('id_graph' =>$id)); - - if ($result) - $result = ui_print_success_message(__('Successfully deleted')); - else - $result = ui_print_error_message(__('Not deleted. Error deleting data')); + $exist = db_get_value("id_graph", "tgraph_source", "id_graph", $id); + if ($exist) { + $result = db_process_sql_delete("tgraph_source", array('id_graph' =>$id)); + + if ($result) + $result = ui_print_success_message(__('Successfully deleted')); + else + $result = ui_print_error_message(__('Not deleted. Error deleting data')); + } $result = db_process_sql_delete("tgraph", array('id_graph' =>$id)); if ($result) { @@ -150,7 +153,9 @@ if (!empty ($graphs)) { $table->align[3] = 'left'; if (check_acl ($config['id_user'], 0, "RW")) { $table->align[4] = 'left'; - $table->head[4] = __('Op.'); + $table->head[4] = __('Op.') . + html_print_checkbox('all_delete', 0, false, true, false, + 'check_all_checkboxes();'); $table->size[4] = '90px'; } $table->data = array (); @@ -174,36 +179,33 @@ if (!empty ($graphs)) { $data[4] .= '' . html_print_image("images/cross.png", true) . '' . - html_print_checkbox_extended ('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete"', true); + return false;">' . html_print_image("images/cross.png", true, array('alt' => __('Delete'), 'title' => __('Delete'))) . '' . + html_print_checkbox_extended ('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true); } array_push ($table->data, $data); } - html_print_table ($table); - echo ""; - echo ""; - echo ""; - echo ""; - echo "
"; - echo "
"; - if (!empty($graphs)){ - if (check_acl ($config['id_user'], 0, "RW") && users_can_manage_group_all($graph['id_group'])) { - echo "
"; - html_print_input_hidden('multiple_delete', 1); - html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); - echo "
"; - } - } - if (check_acl ($config['id_user'], 0, "RW")) { - echo '
'; - html_print_submit_button (__('Create graph'), 'create', false, 'class="sub next" style="margin-right:5px;"'); - echo "
"; - } - echo "
"; - echo "
"; + if (!empty($graphs)){ + echo "
"; + html_print_input_hidden('multiple_delete', 1); + html_print_table ($table); + echo "
"; + html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); + echo "
"; + echo "
"; + } + + + echo "
"; + if (check_acl ($config['id_user'], 0, "RW")) { + echo '
'; + html_print_submit_button (__('Create graph'), 'create', false, 'class="sub next" style="margin-right:5px;"'); + echo "
"; + } + echo "
"; + } else { require_once ($config['homedir'] . "/general/firts_task/custom_graphs.php"); @@ -213,13 +215,15 @@ else {