Skip to content
Snippets Groups Projects
Commit 37283c79 authored by Jared Hancock's avatar Jared Hancock
Browse files

Delete and cleanup in proper order

parent fd8cc869
No related branches found
No related tags found
No related merge requests found
...@@ -142,15 +142,22 @@ class Team { ...@@ -142,15 +142,22 @@ class Team {
if(!$thisstaff || !($id=$this->getId())) if(!$thisstaff || !($id=$this->getId()))
return false; return false;
# Remove members of this team
db_query('DELETE FROM '.TEAM_MEMBER_TABLE
.' WHERE team_id='.db_input($id));
# Remove the team # Remove the team
$res = db_query( $res = db_query(
'DELETE FROM '.TEAM_TABLE.' WHERE team_id='.db_input($id) 'DELETE FROM '.TEAM_TABLE.' WHERE team_id='.db_input($id)
.' LIMIT 1'); .' LIMIT 1');
return (db_affected_rows($res) == 1); if (db_affected_rows($res) != 1)
return false;
# Remove members of this team
db_query('DELETE FROM '.TEAM_MEMBER_TABLE
.' WHERE team_id='.db_input($id));
# Reset ticket ownership for tickets owned by this team
db_query('UPDATE '.TICKET_TABLE.' SET team_id=0 WHERE team_id='
.db_input($id));
return true;
} }
/* ----------- Static function ------------------*/ /* ----------- Static function ------------------*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment