2013-05-30 Miguel de Dios <miguel.dedios@artica.es>

* 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
This commit is contained in:
mdtrooper 2013-05-30 13:41:32 +00:00
parent c4612236f6
commit 17274a32c6
3 changed files with 30 additions and 12 deletions

View File

@ -1,3 +1,10 @@
2013-05-30 Miguel de Dios <miguel.dedios@artica.es>
* 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 <miguel.dedios@artica.es> 2013-05-29 Miguel de Dios <miguel.dedios@artica.es>
* operation/events/events.build_table.php, * operation/events/events.build_table.php,

View File

@ -225,17 +225,21 @@ if ($delete_group) {
$usedGroup = groups_check_used($id_group); $usedGroup = groups_check_used($id_group);
if (!$usedGroup['return']) { 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 { 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'])) { if ($result && (!$usedGroup['return'])) {
@ -403,10 +407,13 @@ if (!empty($groups)) {
$data[5] = ''; $data[5] = '';
} }
else { else {
$data[5] = '<a href="index.php?sec='.$sec.'&sec2=godmode/groups/configure_group&id_group='.$group['id_grupo'].'&pure='.$pure.'">' . html_print_image("images/config.png", true, array("alt" => __('Edit'), "title" => __('Edit'), "border" => '0')); $data[5] = '<a href="index.php?sec='.$sec.'&sec2=godmode/groups/configure_group&id_group=' . $group['id_grupo'] . '&pure='.$pure.'">' . 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 //Check if there is only a group to unable delete it
if ((count($groups) > 3) || (count($groups) <= 3 && $group['parent'] != 0)) { if ((count($groups) > 3) || (count($groups) <= 3 && $group['parent'] != 0)) {
$data[5] .= '&nbsp;&nbsp;<a href="index.php?sec='.$sec.'&sec2=godmode/groups/group_list&id_group='.$id_group.'&delete_group=1&pure='.$pure.'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">' . html_print_image("images/cross.png", true, array("alt" => __('Delete'), "border" => '0')); $data[5] .= '&nbsp;&nbsp;' .
'<a href="index.php?sec=' . $sec . '&' .
'sec2=godmode/groups/group_list&' .
'id_group=' . $group['id_grupo'] . '&delete_group=1&pure=' . $pure . '" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">' . html_print_image("images/cross.png", true, array("alt" => __('Delete'), "border" => '0'));
} }
} }

View File

@ -33,10 +33,12 @@ function groups_check_used($idGroup) {
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
case "postgresql": 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; break;
case "oracle": 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; break;
} }
if ($numRows > 0) { if ($numRows > 0) {
@ -47,10 +49,12 @@ function groups_check_used($idGroup) {
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
case "postgresql": 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; break;
case "oracle": 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; break;
} }