-
- // Delete user binds to this project.
- $sql = "delete from tt_user_project_binds where project_id = $id";
+
+ $group_id = $user->getGroup();
+ $org_id = $user->org_id;
+
+ // Start with project itself. Reason: if the passed in project_id is bogus,
+ // we'll fail right here and don't damage any other data.
+
+ // Mark project as deleted and remove associated tasks.
+ $sql = "update tt_projects set status = NULL, tasks = NULL where id = $id and group_id = $group_id and org_id = $org_id";