X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/7797eda9fb04c217a813db88e00bb9ee541eabbb..01654e65fdac375c1db8317a956b727987c98c04:/WEB-INF/lib/ttProjectHelper.class.php?ds=sidebyside diff --git a/WEB-INF/lib/ttProjectHelper.class.php b/WEB-INF/lib/ttProjectHelper.class.php index 2a439dd9..87d75c62 100644 --- a/WEB-INF/lib/ttProjectHelper.class.php +++ b/WEB-INF/lib/ttProjectHelper.class.php @@ -28,6 +28,7 @@ import('ttTeamHelper'); import('ttUserHelper'); +import('ttGroupHelper'); // Class ttProjectHelper is used to help with project related tasks. class ttProjectHelper { @@ -183,6 +184,12 @@ class ttProjectHelper { if (is_a($affected, 'PEAR_Error')) return false; + // Delete client binds to this project. + $sql = "delete from tt_client_project_binds where project_id = $id and group_id = $group_id and org_id = $org_id"; + $affected = $mdb2->exec($sql); + if (is_a($affected, 'PEAR_Error')) + return false; + return true; } @@ -206,15 +213,11 @@ class ttProjectHelper { $affected = $mdb2->exec($sql); if (is_a($affected, 'PEAR_Error')) return false; - - $last_id = 0; - $sql = "select last_insert_id() as last_insert_id"; - $res = $mdb2->query($sql); - $val = $res->fetchRow(); - $last_id = $val['last_insert_id']; + + $last_id = $mdb2->lastInsertID('tt_projects', 'id'); // Bind the project to users. - $active_users = ttTeamHelper::getActiveUsers(array('getAllFields'=>true)); + $active_users = ttGroupHelper::getActiveUsers(array('getAllFields'=>true)); foreach ($active_users as $u) { if(in_array($u['id'], $users)) { $sql = "insert into tt_user_project_binds (project_id, user_id, group_id, org_id, status, rate) values(