From 4e3daca07c90e78553d35d3dfd296beeb523ca61 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 30 May 2013 13:41:32 +0000 Subject: [PATCH] 2013-05-30 Miguel de Dios * godmode/groups/group_list.php, include/functions_groups.php: fixed the link of to delete the group, now it have the correctly id_group. Fixes: #2253 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8234 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 7 ++++++ pandora_console/godmode/groups/group_list.php | 23 ++++++++++++------- pandora_console/include/functions_groups.php | 12 ++++++---- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 118834835b..247272a2e8 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2013-05-30 Miguel de Dios + + * godmode/groups/group_list.php, include/functions_groups.php: fixed + the link of to delete the group, now it have the correctly id_group. + + Fixes: #2253 + 2013-05-29 Miguel de Dios * operation/events/events.build_table.php, diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index d7538792db..62ec7d5d20 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -225,17 +225,21 @@ if ($delete_group) { $usedGroup = groups_check_used($id_group); if (!$usedGroup['return']) { + $group = db_get_row_filter('tgrupo', + array('id_grupo' => $id_group)); - $group = db_get_row_filter('tgrupo', array('id_grupo' => $id_group)); + db_process_sql_update('tgrupo', + array('parent' => $group['parent']), array('parent' => $id_group)); - db_process_sql_update('tgrupo', array('parent' => $group['parent']), array('parent' => $id_group)); + $result = db_process_sql_delete('tgroup_stat', + array('id_group' => $id_group)); - $result = db_process_sql_delete('tgroup_stat', array('id_group' => $id_group)); - - $result = db_process_sql_delete('tgrupo', array('id_grupo' => $id_group)); + $result = db_process_sql_delete('tgrupo', + array('id_grupo' => $id_group)); } else { - ui_print_error_message(sprintf(__('The group is not empty. It is use in %s.'), implode(', ', $usedGroup['tables']))); + ui_print_error_message( + sprintf(__('The group is not empty. It is use in %s.'), implode(', ', $usedGroup['tables']))); } if ($result && (!$usedGroup['return'])) { @@ -403,10 +407,13 @@ if (!empty($groups)) { $data[5] = ''; } else { - $data[5] = '' . html_print_image("images/config.png", true, array("alt" => __('Edit'), "title" => __('Edit'), "border" => '0')); + $data[5] = '' . html_print_image("images/config.png", true, array("alt" => __('Edit'), "title" => __('Edit'), "border" => '0')); //Check if there is only a group to unable delete it if ((count($groups) > 3) || (count($groups) <= 3 && $group['parent'] != 0)) { - $data[5] .= '  ' . html_print_image("images/cross.png", true, array("alt" => __('Delete'), "border" => '0')); + $data[5] .= '  ' . + '' . html_print_image("images/cross.png", true, array("alt" => __('Delete'), "border" => '0')); } } diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index 2562a2a422..1bbc75dd61 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -33,10 +33,12 @@ function groups_check_used($idGroup) { switch ($config["dbtype"]) { case "mysql": case "postgresql": - $numRows = db_get_num_rows('SELECT * FROM tagente WHERE id_grupo = ' . $idGroup . ';'); + $numRows = db_get_num_rows('SELECT * + FROM tagente WHERE id_grupo = ' . $idGroup . ';'); break; case "oracle": - $numRows = db_get_num_rows('SELECT * FROM tagente WHERE id_grupo = ' . $idGroup); + $numRows = db_get_num_rows('SELECT * + FROM tagente WHERE id_grupo = ' . $idGroup); break; } if ($numRows > 0) { @@ -47,10 +49,12 @@ function groups_check_used($idGroup) { switch ($config["dbtype"]) { case "mysql": case "postgresql": - $numRows = db_get_num_rows('SELECT * FROM talert_actions WHERE id_group = ' . $idGroup . ';'); + $numRows = db_get_num_rows('SELECT * + FROM talert_actions WHERE id_group = ' . $idGroup . ';'); break; case "oracle": - $numRows = db_get_num_rows('SELECT * FROM talert_actions WHERE id_group = ' . $idGroup); + $numRows = db_get_num_rows('SELECT * + FROM talert_actions WHERE id_group = ' . $idGroup); break; }