in the show queue, it also shows the assigned users name :)

This commit is contained in:
Quitta 2013-07-20 14:45:05 +02:00
parent d1fe49fc7b
commit ff7db2a28c
6 changed files with 25 additions and 1 deletions

View file

@ -20,6 +20,17 @@ class Assigned{
return "ALREADY_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 ) { public static function isAssigned( $ticket_id ) {

View file

@ -234,6 +234,14 @@ class Ticket{
return $priorityArray[$this->getPriority()]; return $priorityArray[$this->getPriority()];
} }
public function getAssigned(){
$user_id = Assigned::getUserAssignedToTicket($this->getTId());
if ($user_id == ""){
return 0;
}else{
return $user_id;
}
}
////////////////////////////////////////////Setters//////////////////////////////////////////////////// ////////////////////////////////////////////Setters////////////////////////////////////////////////////
public function setTId($id){ public function setTId($id){

View file

@ -30,6 +30,7 @@ t_send = "Send reply"
[show_user] [show_user]
[show_queue] [show_queue]
not_assigned = "None"
[show_sgroup] [show_sgroup]
add_to_group_success = "The user has been added to the group!" add_to_group_success = "The user has been added to the group!"

View file

@ -30,6 +30,7 @@ t_send = "Envoyer la reponse"
[show_user] [show_user]
[show_queue] [show_queue]
not_assigned = "Ne pas"
[show_sgroup] [show_sgroup]
add_to_group_success = "ce user est ajoute sur la groupe!" add_to_group_success = "ce user est ajoute sur la groupe!"

View file

@ -9,11 +9,12 @@ function show_queue(){
$queueArray = Ticket_Queue_Handler::getTickets($result['queue_action']); $queueArray = Ticket_Queue_Handler::getTickets($result['queue_action']);
if ($queueArray != "ERROR"){ 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; $i = 0;
foreach( $result['tickets'] as $ticket){ foreach( $result['tickets'] as $ticket){
$result['tickets'][$i]['author'] = WebUsers::getUsername($ticket['authorExtern']); $result['tickets'][$i]['author'] = WebUsers::getUsername($ticket['authorExtern']);
$result['tickets'][$i]['assignedText'] = WebUsers::getUsername($ticket['assigned']);
$i++; $i++;
} }
if(Ticket_User::isMod($_SESSION['ticket_user'])){ if(Ticket_User::isMod($_SESSION['ticket_user'])){

View file

@ -16,6 +16,7 @@
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Title</th> <th>Title</th>
<th>Assigned</th>
<th>Timestamp</th> <th>Timestamp</th>
<th>Category</th> <th>Category</th>
<th>Status</th> <th>Status</th>
@ -26,6 +27,7 @@
<tr> <tr>
<td>{$ticket.tId}</td> <td>{$ticket.tId}</td>
<td><a href ="index.php?page=show_ticket&id={$ticket.tId}">{$ticket.title}</a></td> <td><a href ="index.php?page=show_ticket&id={$ticket.tId}">{$ticket.title}</a></td>
<td>{if $ticket.assignedText neq ""} <a href="index.php?page=show_user&id={$ticket.assigned}">{$ticket.assignedText}</a> {else}<i> {$not_assigned}</i> {/if}</td>
<td class="center"><i>{$ticket.timestamp}</i></td> <td class="center"><i>{$ticket.timestamp}</i></td>
<td class="center">{$ticket.category}</td> <td class="center">{$ticket.category}</td>