From 38199894744f8d05e199e744379c7fb36b480339 Mon Sep 17 00:00:00 2001 From: vgilc Date: Tue, 9 Aug 2011 13:57:14 +0000 Subject: [PATCH] 2011-08-09 Vanessa Gil * godmode/groups/group_list.php: Added groups must have a name and be unique. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4690 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 4 ++ pandora_console/godmode/groups/group_list.php | 41 +++++++++++-------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 95bc625ddb..5aded80216 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,7 @@ +2011-08-09 Vanessa Gil + + * godmode/groups/group_list.php: Added groups must have a name and be unique. + 2011-08-09 Juan Manuel Ramon * godmode/groups/group_list.php: Added db_clean_cache() in order diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index 40b46adb27..705ff7f223 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -111,28 +111,35 @@ if ($create_group) { $alerts_disabled = (bool) get_parameter ('alerts_disabled'); $custom_id = (string) get_parameter ('custom_id'); $skin = (string) get_parameter ('skin'); +$check = db_get_value('nombre', 'tgrupo', 'nombre', $name); + /*Check if name field is empty*/ if ($name != "") { - $values = array( - 'nombre' => $name, - 'icon' => substr ($icon, 0, -4), - 'parent' => $id_parent, - 'disabled' => $alerts_disabled, - 'custom_id' => $custom_id, - 'id_skin' => $skin - ); + if (!$check){ + $values = array( + 'nombre' => $name, + 'icon' => substr ($icon, 0, -4), + 'parent' => $id_parent, + 'disabled' => $alerts_disabled, + 'custom_id' => $custom_id, + 'id_skin' => $skin + ); - $result = db_process_sql_insert('tgrupo', $values); - } - else { - $result = false; - } - - if ($result) { - echo "

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

"; + $result = db_process_sql_insert('tgrupo', $values); + if ($result) { + echo "

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

"; + } else { + echo "

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

"; + } + } else { + echo "

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

"; + } } else { - echo "

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

"; } + //$result = false; + echo "

".__('Group must have a name')."

"; + } + } /* Update group */