Exemple #1
0
 /**
  * Removes a ticket and all associated records (tags, comments, etc.)
  *
  * @return	void
  */
 public function removeTask()
 {
     // Check for request forgeries
     Request::checkToken();
     // Incoming
     $ids = Request::getVar('id', array());
     // Check for an ID
     if (count($ids) < 1) {
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_SUPPORT_ERROR_SELECT_TICKET_TO_DELETE'), 'error');
         return;
     }
     foreach ($ids as $id) {
         $id = intval($id);
         // Delete tags
         $tags = new Tags($id);
         $tags->removeAll();
         // Delete comments
         $comment = new Tables\Comment($this->database);
         $comment->deleteComments($id);
         // Delete attachments
         $attach = new Tables\Attachment($this->database);
         $attach->deleteAllForTicket($id);
         // Delete ticket
         $ticket = new Tables\Ticket($this->database);
         $ticket->delete($id);
     }
     // Output messsage and redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_SUPPORT_TICKET_SUCCESSFULLY_DELETED', count($ids)));
 }
Exemple #2
0
 /**
  * Removes a ticket and all associated records (tags, comments, etc.)
  *
  * @return	void
  */
 public function deleteTask()
 {
     // Incoming
     $id = Request::getInt('id', 0);
     // Check for an ID
     if (!$id) {
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=tickets'));
         return;
     }
     // Delete tags
     $tags = new Tags($id);
     $tags->removeAll();
     // Delete comments
     $comment = new Tables\Comment($this->database);
     $comment->deleteComments($id);
     $attach = new Tables\Attachment($this->database);
     if (!$attach->deleteAllForTicket($id)) {
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=tickets'), $attach->getError(), 'error');
         return;
     }
     // Delete ticket
     $ticket = new Tables\Ticket($this->database);
     $ticket->delete($id);
     // Output messsage and redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=tickets'));
 }