From f6e18b4e27602ae8bff51eb2baf12ab26e42deb8 Mon Sep 17 00:00:00 2001 From: Jared Hancock <gravydish@gmail.com> Date: Mon, 18 Jun 2012 08:47:07 -0500 Subject: [PATCH] Add delete support for Teams --- include/class.team.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/class.team.php b/include/class.team.php index b3f996d28..116fae389 100644 --- a/include/class.team.php +++ b/include/class.team.php @@ -136,6 +136,23 @@ class Team { return true; } + function delete() { + global $thisstaff; + + if(!$thisstaff || !($id=$this->getId())) + return false; + + # Remove members of this team + db_query('DELETE FROM '.TEAM_MEMBER_TABLE + .' WHERE team_id='.db_input($id)); + + # Remove the team + $res = db_query( + 'DELETE FROM '.TEAM_TABLE.' WHERE team_id='.db_input($id) + .' LIMIT 1'); + return (db_affected_rows($res) == 1); + } + /* ----------- Static function ------------------*/ function lookup($id){ return ($id && is_numeric($id) && ($team= new Team($id)) && $team->getId()==$id)?$team:null; -- GitLab