function delete() { // load in tickets to do $ticketid = FSS_Input::getInt('ticketid'); $tickets = FSS_Input::getCmd('tickets'); $def_archive = FSS_Ticket_Helper::GetStatusID('def_archive'); if ($ticketid > 0) { $ticket = new SupportTicket(); if ($ticket->load($ticketid)) { $ticket->delete(); } } else { if ($tickets != '') { $tickets = new SupportTickets(); $tickets->limitstart = 0; $tickets->limit = 100; $tickets->loadTicketsByStatus($tickets); foreach ($tickets->tickets as $ticket) { $ticket->delete(); } } } JFactory::getApplication()->redirect($_SERVER['HTTP_REFERER']); }