From a4912f64e572bec49ce9312c95a0a31805530534 Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Wed, 20 Jun 2012 17:24:43 +0000 Subject: [PATCH] 2012-06-20 Juan Manuel Ramon * godmode/groups/modu_group_list.php: Fixed module update when a module group is deleted. Merged from branches. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6637 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 7 +++++ .../godmode/groups/modu_group_list.php | 28 ++++++++++++------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 1afe9911c4..11051504a6 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2012-06-20 Juan Manuel Ramon + + * godmode/groups/modu_group_list.php: Fixed module update when a + module group is deleted. + + Merged from branches. + 2012-06-20 Sergio Martin * include/functions_graph.php diff --git a/pandora_console/godmode/groups/modu_group_list.php b/pandora_console/godmode/groups/modu_group_list.php index 29e5fddc62..1ffe018911 100644 --- a/pandora_console/godmode/groups/modu_group_list.php +++ b/pandora_console/godmode/groups/modu_group_list.php @@ -71,18 +71,18 @@ if ($create_group) { $result = db_process_sql_insert('tmodule_group', array('name' => $name)); if ($result) { - echo "

".__('Group successfully created')."

"; + ui_print_success_message(__('Group successfully created')); } else { - echo "

".__('There was a problem creating group')."

"; + ui_print_error_message(__('There was a problem creating group')); } } else { - echo "

".__('Each module group must have a different name')."

"; + ui_print_error_message(__('Each module group must have a different name')); } } else { - echo "

".__('Module group must have a name')."

"; + ui_print_error_message(__('Module group must have a name')); } } @@ -102,18 +102,18 @@ if ($update_group) { $result = db_process_sql_update('tmodule_group', array('name' => $name), array('id_mg' => $id_group)); if ($result !== false) { - echo "

".__('Group successfully updated')."

"; + ui_print_success_message(__('Group successfully updated')); } else { - echo "

".__('There was a problem modifying group')."

"; + ui_print_error_message(__('There was a problem modifying group')); } } else { - echo "

".__('Each module group must have a different name')."

"; + ui_print_error_message(__('Each module group must have a different name')); } } else { - echo "

".__('Module group must have a name')."

"; + ui_print_error_message(__('Module group must have a name')); } } @@ -123,10 +123,18 @@ if ($delete_group) { $result = db_process_sql_delete('tmodule_group', array('id_mg' => $id_group)); + if ($result) { + $result = db_process_sql_update('tagente_modulo', array('id_module_group' => 0), array('id_module_group' => $id_group)); + + // A group with no modules can be deleted, to avoid a message error then do the follwing + if ($result !== false) + $result = true; + } + if (! $result) - echo "

".__('There was a problem deleting group')."

"; + ui_print_error_message(__('There was a problem deleting group')); else - echo "

".__('Group successfully deleted')."

"; + ui_print_success_message(__('Group successfully deleted')); } $total_groups = db_get_num_rows('SELECT * FROM tmodule_group');