From ff7db2a28cb03b1804ddbc00cf801bf7281b21c9 Mon Sep 17 00:00:00 2001 From: Quitta Date: Sat, 20 Jul 2013 14:45:05 +0200 Subject: [PATCH] in the show queue, it also shows the assigned users name :) --- .../server/ryzom_ams/ams_lib/autoload/assigned.php | 11 +++++++++++ .../server/ryzom_ams/ams_lib/autoload/ticket.php | 8 ++++++++ .../server/ryzom_ams/ams_lib/translations/en.ini | 1 + .../server/ryzom_ams/ams_lib/translations/fr.ini | 1 + .../server/ryzom_ams/www/html/inc/show_queue.php | 3 ++- .../ryzom_ams/www/html/templates/show_queue.tpl | 2 ++ 6 files changed, 25 insertions(+), 1 deletion(-) diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/assigned.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/assigned.php index a810b068c..32b7ef734 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/assigned.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/assigned.php @@ -20,6 +20,17 @@ class Assigned{ return "ALREADY_ASSIGNED"; } + } + + // Get the id of the user assigned to a ticket + public static function getUserAssignedToTicket($ticket_id) { + $dbl = new DBLayer("lib"); + $statement = $dbl->execute("SELECT ticket_user.ExternId FROM `assigned` JOIN `ticket_user` ON assigned.User = ticket_user.TUserId WHERE `Ticket` = :ticket_id", Array('ticket_id' => $ticket_id)); + $user_id = $statement->fetch(); + return $user_id['ExternId']; + + + } public static function isAssigned( $ticket_id ) { 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 6e97d93d8..cfcd6f3df 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 @@ -234,6 +234,14 @@ class Ticket{ return $priorityArray[$this->getPriority()]; } + public function getAssigned(){ + $user_id = Assigned::getUserAssignedToTicket($this->getTId()); + if ($user_id == ""){ + return 0; + }else{ + return $user_id; + } + } ////////////////////////////////////////////Setters//////////////////////////////////////////////////// public function setTId($id){ diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini index 073e274cc..930ab69f1 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini @@ -30,6 +30,7 @@ t_send = "Send reply" [show_user] [show_queue] +not_assigned = "None" [show_sgroup] add_to_group_success = "The user has been added to the group!" diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini index 81d234233..8a9257305 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini @@ -30,6 +30,7 @@ t_send = "Envoyer la reponse" [show_user] [show_queue] +not_assigned = "Ne pas" [show_sgroup] add_to_group_success = "ce user est ajoute sur la groupe!" diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_queue.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_queue.php index 4ab1ca878..ff8818e4f 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_queue.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_queue.php @@ -9,11 +9,12 @@ function show_queue(){ $queueArray = Ticket_Queue_Handler::getTickets($result['queue_action']); if ($queueArray != "ERROR"){ - $result['tickets'] = Gui_Elements::make_table($queueArray, Array("getTId","getTitle","getTimestamp","getAuthor()->getExternId","getTicket_Category()->getName","getStatus","getStatusText"), Array("tId","title","timestamp","authorExtern","category","status","statusText")); + $result['tickets'] = Gui_Elements::make_table($queueArray, Array("getTId","getTitle","getTimestamp","getAuthor()->getExternId","getTicket_Category()->getName","getStatus","getStatusText","getAssigned"), Array("tId","title","timestamp","authorExtern","category","status","statusText","assigned")); $i = 0; foreach( $result['tickets'] as $ticket){ $result['tickets'][$i]['author'] = WebUsers::getUsername($ticket['authorExtern']); + $result['tickets'][$i]['assignedText'] = WebUsers::getUsername($ticket['assigned']); $i++; } if(Ticket_User::isMod($_SESSION['ticket_user'])){ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_queue.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_queue.tpl index c47d113db..f5f5a2120 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_queue.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_queue.tpl @@ -16,6 +16,7 @@ ID Title + Assigned Timestamp Category Status @@ -26,6 +27,7 @@ {$ticket.tId} {$ticket.title} + {if $ticket.assignedText neq ""} {$ticket.assignedText} {else} {$not_assigned} {/if} {$ticket.timestamp} {$ticket.category}