Beispiel #1
0
 /**
  * Delete a ticket
  *
  * @apiMethod DELETE
  * @apiUri    /support/{ticket}
  * @apiParameter {
  * 		"name":        "ticket",
  * 		"description": "Ticket identifier",
  * 		"type":        "integer",
  * 		"required":    true,
  * 		"default":     0
  * }
  * @return    void
  */
 public function deleteTask()
 {
     $this->requiresAuthentication();
     if (!$this->acl->check('delete', 'tickets')) {
         throw new Exception(Lang::txt('Not authorized'), 403);
     }
     // Initiate class and bind data to database fields
     $ticket_id = Request::getInt('ticket', 0);
     // Initiate class and bind data to database fields
     $row = new \Components\Support\Models\Ticket($ticket_id);
     if (!$row->exists()) {
         throw new Exception(Lang::txt('COM_SUPPORT_ERROR_MISSING_RECORD'), 404);
     }
     if (!$row->delete()) {
         throw new Exception($row->getError(), 500);
     }
     $this->send(null, 204);
 }