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 bdf772b6d..5ac6499e5 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 @@ -11,6 +11,14 @@ class Ticket{ ////////////////////////////////////////////Functions//////////////////////////////////////////////////// + /*FUNCTION: getStatusArray + * returns all possible statusses + * + */ + public static function getStatusArray() { + return Array("Waiting on user reply","Waiting on support","Waiting on Dev reply","Closed"); + } + /*FUNCTION: getEntireTicket * return all ticket of the given author's id. * @@ -54,7 +62,7 @@ class Ticket{ public static function create_Ticket( $title, $content, $category, $author) { $ticket = new Ticket(); - $ticket->set($title,0,0,$category,$author); + $ticket->set($title,1,0,$category,$author); $ticket->create(); $ticket_id = $ticket->getTId(); Ticket_Reply::createReply($content, $author, $ticket_id); @@ -128,15 +136,8 @@ class Ticket{ } public function getStatusText(){ - $statusId = $this->getStatus(); - if ($statusId == 0){ - return "Waiting on support.."; - }else if($statusId == 1){ - return "Being handled.."; - }else if($statusId == 2){ - return "Closed"; - } - return "Error"; + $statusArray = Ticket::getStatusArray(); + return $statusArray[$this->getStatus()]; } public function getCategoryName(){ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/func/reply_on_ticket.php b/code/ryzom/tools/server/ryzom_ams/www/html/func/reply_on_ticket.php index e7eebb375..b6017670a 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/func/reply_on_ticket.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/func/reply_on_ticket.php @@ -16,6 +16,14 @@ function reply_on_ticket(){ $content = filter_var($_POST['Content'], FILTER_SANITIZE_STRING); $author = $_SESSION['ticket_user']->getTUserId(); Ticket_Reply::createReply($content, $author, $ticket_id); + + if(isset($_POST['ChangeStatus']) && WebUsers::isAdmin()){ + $newStatus = filter_var($_POST['ChangeStatus'], FILTER_SANITIZE_NUMBER_INT); + $ticket = new Ticket(); + $ticket->load_With_TId($ticket_id); + $ticket->setStatus($newStatus); + $ticket->update(); + } header("Location: index.php?page=show_ticket&id=".$ticket_id); exit; diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket.php index 93654d126..f409e2cb0 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket.php @@ -19,6 +19,10 @@ function show_ticket(){ $result['ticket_replies'][$i]['author'] = WebUsers::getUsername($reply['authorExtern']); $i++; } + if(WebUsers::isAdmin()){ + $result['isAdmin'] = "TRUE"; + $result['statusList'] = Ticket::getStatusArray(); + } return $result; }else{ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_user.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_user.php index 6c13271bc..fee3085c9 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_user.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_user.php @@ -22,7 +22,7 @@ function show_user(){ $ticket_user = Ticket_User::constr_ExternId($result['target_id']); $ticketlist = Ticket::getTicketsOf($ticket_user->getTUserId()); - $result['ticketlist'] = Gui_Elements::make_table($ticketlist, Array("getTId","getTimestamp","getTitle","getStatus","getStatusText","getCategoryName"), Array("tId","timestamp","title","status","statusText","category")); + $result['ticketlist'] = Gui_Elements::make_table($ticketlist, Array("getTId","getTimestamp","getTitle","getStatus","getStatusText","getStatusText","getCategoryName"), Array("tId","timestamp","title","status","statustext","statusText","category")); return $result; }else{ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket.tpl index 22d8f8c46..37444058e 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket.tpl @@ -1,6 +1,6 @@ {block name=content}