/** * creates a new reply on a ticket. * Creates a ticket_content entry and links it with a new created ticket_reply, a log entry will be written about this. * In case the ticket creator replies on a ticket, he will set the status by default to 'waiting on support'. * @param $content the content of the reply * @param $author the id of the reply creator. * @param $ticket_id the id of the ticket of which we want the replies. * @param $hidden should be 0 or 1 * @param $ticket_creator the ticket's starter his id. */ public static function createReply($content, $author, $ticket_id, $hidden, $ticket_creator) { $ticket_content = new Ticket_Content(); $ticket_content->setContent($content); $ticket_content->create(); $content_id = $ticket_content->getTContentId(); $ticket_reply = new Ticket_Reply(); $ticket_reply->set(array('Ticket' => $ticket_id, 'Content' => $content_id, 'Author' => $author, 'Hidden' => $hidden)); $ticket_reply->create(); $reply_id = $ticket_reply->getTReplyId(); if ($ticket_creator == $author) { Ticket::updateTicketStatus($ticket_id, 1, $author); } Ticket_Log::createLogEntry($ticket_id, $author, 4, $reply_id); }