Skip to content
Snippets Groups Projects
Commit 1bc9bebf authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #118 from greezybacon/issue/118

Looks good.

Reviewed By: Peter 06/18/12
parents a99f5662 37283c79
No related branches found
No related tags found
No related merge requests found
......@@ -136,6 +136,30 @@ class Team {
return true;
}
function delete() {
global $thisstaff;
if(!$thisstaff || !($id=$this->getId()))
return false;
# Remove the team
$res = db_query(
'DELETE FROM '.TEAM_TABLE.' WHERE team_id='.db_input($id)
.' LIMIT 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 ------------------*/
function lookup($id){
return ($id && is_numeric($id) && ($team= new Team($id)) && $team->getId()==$id)?$team:null;
......
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