X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2FttGroupHelper.class.php;h=39cdb780094ccb720f80481ed411c8ce76c064c8;hb=bde9999ab047052540e9b57ce39d7932bcb00f9d;hp=01429aa67f963ac6efea95d17b7b0ae9b16505f2;hpb=fec6ce6d32cc779e350a65c641f1b1eafa096ea8;p=timetracker.git diff --git a/WEB-INF/lib/ttGroupHelper.class.php b/WEB-INF/lib/ttGroupHelper.class.php index 01429aa6..39cdb780 100644 --- a/WEB-INF/lib/ttGroupHelper.class.php +++ b/WEB-INF/lib/ttGroupHelper.class.php @@ -67,7 +67,7 @@ class ttGroupHelper { global $user; $mdb2 = getConnection(); - $parent_id = $user->getActiveGroup(); + $parent_id = $user->getGroup(); $org_id = $user->org_id; $sql = "select id from tt_groups where parent_id = $parent_id and org_id = $org_id". @@ -86,7 +86,7 @@ class ttGroupHelper { global $user; $mdb2 = getConnection(); - $parent_id = $user->getActiveGroup(); + $parent_id = $user->getGroup(); $org_id = $user->org_id; $name = $fields['name']; $description = $fields['description']; @@ -156,7 +156,7 @@ class ttGroupHelper { // Obtain subgroups and call self recursively on them. $subgroups = $user->getSubgroups($group_id); foreach($subgroups as $subgroup) { - if (!$this->markGroupDeleted($subgroup['id'])) + if (!ttGroupHelper::markGroupDeleted($subgroup['id'])) return false; } @@ -207,7 +207,8 @@ class ttGroupHelper { } // Mark group deleted. - $sql = "update tt_groups set status = null where id = $group_id and org_id = $org_id"; + $modified_part = ', modified = now(), modified_ip = '.$mdb2->quote($_SERVER['REMOTE_ADDR']).', modified_by = '.$mdb2->quote($user->id); + $sql = "update tt_groups set status = null $modified_part where id = $group_id and org_id = $org_id"; $affected = $mdb2->exec($sql); if (is_a($affected, 'PEAR_Error')) return false; @@ -220,10 +221,13 @@ class ttGroupHelper { global $user; $mdb2 = getConnection(); - // TODO: add modified info to sql for some tables, depending on table name. + // Add modified info to sql for some tables, depending on table name. + if ($table_name == 'tt_users') { + $modified_part = ', modified = now(), modified_ip = '.$mdb2->quote($_SERVER['REMOTE_ADDR']).', modified_by = '.$mdb2->quote($user->id); + } $org_id = $user->org_id; // The only security measure we use here for match. - $sql = "update $table_name set status = null where group_id = $group_id and org_id = $org_id"; + $sql = "update $table_name set status = null $modified_part where group_id = $group_id and org_id = $org_id"; $affected = $mdb2->exec($sql); return (!is_a($affected, 'PEAR_Error')); } @@ -259,7 +263,7 @@ class ttGroupHelper { global $user; $mdb2 = getConnection(); - $group_id = $user->getActiveGroup(); + $group_id = $user->getGroup(); $org_id = $user->org_id; $sql = "select * from tt_roles". " where group_id = $group_id and org_id = $org_id and status is not null";