2010-04-22 Sergio Martin <sergio.martin@artica.es>

* godmode/groups/group_list.php: Added validation
        when remove a group. Now, if the group is not empty
        shows a message and dont allow to remove it



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2587 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2010-04-22 16:18:32 +00:00
parent 06ba6946f8
commit 43926fd022
2 changed files with 22 additions and 12 deletions

View File

@ -1,3 +1,9 @@
2010-04-22 Sergio Martin <sergio.martin@artica.es>
* godmode/groups/group_list.php: Added validation
when remove a group. Now, if the group is not empty
shows a message and dont allow to remove it
2010-04-22 Miguel de Dios <miguel.dedios@artica.es>
* include/javascript/pandora.js: erased trace line in the source of function

View File

@ -113,22 +113,26 @@ if ($update_group) {
if ($delete_group) {
$id_group = (int) get_parameter ('id_group');
// First valid group for destination group in agents affected by this group delete
$valid_group = process_sql ("SELECT id_group FROM tgrupo WHERE id_grupo != $id_group AND id_grupo > 0 LIMIT 1");
$sql = sprintf ('SELECT * FROM tagente WHERE id_grupo = %d', $id_group);
$agent = process_sql ($sql);
if(!$agent){
$sql = sprintf ('UPDATE tagente set id_grupo = 1 WHERE id_grupo = %d', $valid_group);
$result = process_sql ($sql);
$sql = sprintf ('DELETE FROM tgroup_stat WHERE id_group = %d', $id_group);
$result = process_sql ($sql);
$sql = sprintf ('DELETE FROM tgrupo WHERE id_grupo = %d', $id_group);
$result = process_sql ($sql);
}
else
echo "<h3 class='error'>".__('The group is not empty.')."</h3>";
$sql = sprintf ('DELETE FROM tgrupo WHERE id_grupo = %d', $id_group);
$result = process_sql ($sql);
$sql = sprintf ('DELETE FROM tgroup_stat WHERE id_group = %d', $id_group);
$result = process_sql ($sql);
if (! $result)
if (!$result || $agent )
echo "<h3 class='error'>".__('There was a problem deleting group')."</h3>";
else
echo "<h3 class='suc'>".__('Group successfully deleted')."</h3>";
}
@ -143,7 +147,7 @@ $table->align = array ();
$table->align[4] = 'center';
$table->data = array ();
$groups = get_user_groups ($config['id_user']);
$groups = get_user_groups ($config['id_user'], "AR");
foreach ($groups as $id_group => $group_name) {
$data = array ();