if (!$bugList) { $bugList = array(); } $response["data"] = $bugList; $response["error"] = "OK"; $response["message"] = "Bugs list retreived."; } /** * ACTION GET SPECIFIC BUG */ if ($action === "get_bug") { if (!isset($id_bug)) { throw new Exception("API::get_bug : missing id_bug!"); } $b = new Bug((int) $id_bug); $response["data"] = $b->getBugData(); $response["error"] = "OK"; $response["message"] = "Bug retreived."; } /** * ACTION COUNT BUGS */ if ($action === "count_bugs") { if (!isset($closed)) { $closed = false; } $lB = new Liste(); $bugList = $lB->getListe('t_bugs', '*', 'date', 'DESC', 'closed', '=', (int) $closed); if (!$bugList) { $bugList = array(); }
extract($post); if ($action === 'addBug') { $b = new Bug(); $b->setBugData($bugInfos); $b->save(); $b->notify('new'); $data['bug'] = $b->getBugData(); $data['error'] = "OK"; $data['message'] = $LANG['New_bug_OK']; } if ($action === 'modBug') { if (!isset($bugID)) { throw new Exception("modBug: bug's ID is missing!"); } $b = new Bug((int) $bugID); $bData = $b->getBugData(false); $oldAssignee = $bData['FK_dev_ID']; $b->setBugData($bugInfos); $b->save(); $newAssignee = $bugInfos['FK_dev_ID']; if ($oldAssignee != $newAssignee) { $b->notify('assign'); } $data['bug'] = $b->getBugData(); $data['error'] = "OK"; $data['message'] = $LANG['Update_bug_OK']; } if ($action === 'killBug') { if (!isset($bugID)) { throw new Exception("killBug: bug's ID is missing!"); }