From 81d1cf93fb7315ce3e2543236b8e456d719fc58c Mon Sep 17 00:00:00 2001 From: Botanic Date: Wed, 23 Oct 2013 23:58:34 -0700 Subject: [PATCH] added option for assigned and unassigned ie "both" --HG-- branch : rc-botanic-webdev --- .../ams_lib/autoload/ticket_queue.php | 27 ++++++++++++++----- .../www/html/templates/show_queue.tpl | 21 ++++++++------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue.php index e72f1024d..03b2d6729 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue.php @@ -84,14 +84,18 @@ class Ticket_Queue{ if($who == "user"){ $selectfrom = "SELECT * FROM `ticket` t LEFT JOIN `assigned` a ON t.TId = a.Ticket LEFT JOIN `ticket_user` tu ON tu.TUserId = a.User"; - if ($how == "assigned"){ + if ($how == "both"){ + $assign = ""; + }else if ($how == "assigned"){ $assign = "tu.TUserId = :id" ; }else if ($how == "not_assigned"){ $assign = "(tu.TUserId != :id OR a.Ticket IS NULL)"; } }else if ($who == "support_group"){ $selectfrom = "SELECT * FROM `ticket` t LEFT JOIN `assigned` a ON t.TId = a.Ticket LEFT JOIN `ticket_user` tu ON tu.TUserId = a.User LEFT JOIN `forwarded` f ON t.TId = f.Ticket"; - if ($how == "assigned"){ + if ($how == "both"){ + $assign = ""; + }else if ($how == "assigned"){ $assign = "f.Group = :id"; }else if ($how == "not_assigned"){ $assign = "(f.Group != :id OR f.Ticket IS NULL)" ; @@ -101,23 +105,34 @@ class Ticket_Queue{ if ($what == "waiting_for_support"){ $status = "t.Status = 1"; - }else if ($what == "waiting_for_user"){ + }else if ($what == "waiting_for_users"){ $status = "t.Status = 0"; }else if ($what == "closed"){ $status = "t.Status = 3"; } - $query = $selectfrom ." WHERE " . $assign; - if(isset($status)){ - $query = $query . " AND " . $status; + if ($assign == "") { + $query = $selectfrom; + if(isset($status)){ + $query = $query . " WHERE " . $status; + } + } else { + $query = $selectfrom ." WHERE " . $assign; + if(isset($status)){ + $query = $query . " AND " . $status; + } } + + if($who == "user"){ $params = array('id' => $userid); }else if ($who == "support_group"){ $params = array('id' => $groupid); } + $this->query = $query; $this->params = $params; + //print_r($this); } 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 5c8c9c31a..c47227719 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,29 +16,30 @@
Show tickets to - + - +