From 1fe92c2c6bfc41fe9981d4ab2f85dce7f29e8817 Mon Sep 17 00:00:00 2001 From: Peter Rotich Date: Fri, 22 Feb 2013 15:11:43 -0500 Subject: [PATCH] Add help topics to advanced search and csv export --- include/ajax.tickets.php | 4 ++++ include/class.export.php | 1 + include/staff/tickets.inc.php | 26 ++++++++++++++++++++++++-- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/include/ajax.tickets.php b/include/ajax.tickets.php index 0e010879..1d887f04 100644 --- a/include/ajax.tickets.php +++ b/include/ajax.tickets.php @@ -107,6 +107,10 @@ function search() { if($_REQUEST['deptId']) $where.=' AND ticket.dept_id='.db_input($_REQUEST['deptId']); + //Help topic + if($_REQUEST['topicId']) + $where.=' AND ticket.topic_id='.db_input($_REQUEST['topicId']); + //Status switch(strtolower($_REQUEST['status'])) { case 'open': diff --git a/include/class.export.php b/include/class.export.php index 3c289550..372cf62e 100644 --- a/include/class.export.php +++ b/include/class.export.php @@ -41,6 +41,7 @@ class Export { 'name' => 'From', 'priority_desc' => 'Priority', 'dept_name' => 'Department', + 'helptopic' => 'Help Topic', 'source' => 'Source', 'status' => 'Current Status' ), diff --git a/include/staff/tickets.inc.php b/include/staff/tickets.inc.php index 0d14cf4a..ed591619 100644 --- a/include/staff/tickets.inc.php +++ b/include/staff/tickets.inc.php @@ -142,6 +142,12 @@ $qwhere.=' AND ticket.dept_id='.db_input($_REQUEST['deptId']); $qstr.='&deptId='.urlencode($_REQUEST['deptId']); } + + //Help topic + if($_REQUEST['topicId']) { + $qwhere.=' AND ticket.topic_id='.db_input($_REQUEST['topicId']); + $qstr.='&topicId='.urlencode($_REQUEST['topicId']); + } //Assignee if(isset($_REQUEST['assignee']) && strcasecmp($_REQUEST['status'], 'closed')) { @@ -273,7 +279,8 @@ .' ,IF(ticket.duedate IS NULL,IF(sla.id IS NULL, NULL, DATE_ADD(ticket.created, INTERVAL sla.grace_period HOUR)), ticket.duedate) as duedate ' .' ,IF(ticket.reopened is NULL,IF(ticket.lastmessage is NULL,ticket.created,ticket.lastmessage),ticket.reopened) as effective_date ' .' ,CONCAT_WS(" ", staff.firstname, staff.lastname) as staff, team.name as team ' - .' ,IF(staff.staff_id IS NULL,team.name,CONCAT_WS(" ", staff.lastname, staff.firstname)) as assigned '; + .' ,IF(staff.staff_id IS NULL,team.name,CONCAT_WS(" ", staff.lastname, staff.firstname)) as assigned ' + .' ,IF(ptopic.topic_pid IS NULL, topic.topic, CONCAT_WS(" / ", ptopic.topic, topic.topic)) as helptopic '; $qfrom.=' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON (ticket.priority_id=pri.priority_id) ' .' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON (ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() @@ -282,7 +289,10 @@ .' LEFT JOIN '.TICKET_THREAD_TABLE.' thread ON ( ticket.ticket_id=thread.ticket_id) ' .' LEFT JOIN '.STAFF_TABLE.' staff ON (ticket.staff_id=staff.staff_id) ' .' LEFT JOIN '.TEAM_TABLE.' team ON (ticket.team_id=team.team_id) ' - .' LEFT JOIN '.SLA_TABLE.' sla ON (ticket.sla_id=sla.id AND sla.isactive=1) '; + .' LEFT JOIN '.SLA_TABLE.' sla ON (ticket.sla_id=sla.id AND sla.isactive=1) ' + .' LEFT JOIN '.TOPIC_TABLE.' topic ON (ticket.topic_id=topic.topic_id) ' + .' LEFT JOIN '.TOPIC_TABLE.' ptopic ON (ptopic.topic_id=topic.topic_pid) '; + $query="$qselect $qfrom $qwhere $qgroup ORDER BY $order_by $order LIMIT ".$pageNav->getStart().",".$pageNav->getLimit(); //echo $query; @@ -616,6 +626,18 @@ ?> +
+ + +