From d8458b2ddd0962fe18f2f4a3a1389e964417df54 Mon Sep 17 00:00:00 2001 From: Quitta Date: Mon, 22 Jul 2013 22:58:12 +0200 Subject: [PATCH] when the ticket starter replies on a ticket the ticket status changes to waiting for support automatically! --- .../ryzom_ams/ams_lib/autoload/ticket.php | 23 ++++++++++++++++++- .../ams_lib/autoload/ticket_reply.php | 6 ++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php index 6595f2bc7..0db211738 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php @@ -99,6 +99,23 @@ class Ticket{ return $ticket_id; } + + /*FUNCTION: updateTicketStatus() + * + * + */ + public static function updateTicketStatus( $ticket_id, $newStatus, $author) { + + $ticket = new Ticket(); + $ticket->load_With_TId($ticket_id); + if ($ticket->getStatus() != $newStatus){ + $ticket->setStatus($newStatus); + Ticket_Log::createLogEntry( $ticket_id, $author, 5, $newStatus); + } + $ticket->update(); + + } + /*FUNCTION: updateTicketStatusAndPriority() * creates a ticket + first initial reply and fills in the content of it! @@ -135,7 +152,7 @@ class Ticket{ $ticket->load_With_TId($ticket_id); //if status is not closed if($ticket->getStatus() != 3){ - Ticket_Reply::createReply($content, $author, $ticket_id, $hidden); + Ticket_Reply::createReply($content, $author, $ticket_id, $hidden, $ticket->getAuthor()); }else{ //TODO: Show error message that ticket is closed } @@ -169,7 +186,11 @@ class Ticket{ public static function forwardTicket($user_id, $ticket_id, $group_id){ if(self::ticketExists($ticket_id)){ if(isset($group_id) && $group_id != ""){ + //unassign the ticket incase the ticket is assined to yourself + self::unAssignTicket($user_id, $ticket_id); + //forward the ticket $returnvalue = Forwarded::forwardTicket($group_id, $ticket_id); + //make a log entry of this action Ticket_Log::createLogEntry( $ticket_id, $user_id, 8, $group_id); return $returnvalue; }else{ diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_reply.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_reply.php index e2af13ba4..dafbdf74b 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_reply.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_reply.php @@ -47,7 +47,7 @@ class Ticket_Reply{ return $result; } - public static function createReply($content, $author, $ticket_id , $hidden){ + public static function createReply($content, $author, $ticket_id , $hidden, $ticket_creator){ $ticket_content = new Ticket_Content(); $ticket_content->setContent($content); $ticket_content->create(); @@ -57,6 +57,10 @@ class 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); }