Skip to content

Commit

Permalink
Add help topics to advanced search and csv export
Browse files Browse the repository at this point in the history
  • Loading branch information
protich committed Feb 22, 2013
1 parent 1f1dd03 commit 1fe92c2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
4 changes: 4 additions & 0 deletions include/ajax.tickets.php
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
1 change: 1 addition & 0 deletions include/class.export.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class Export {
'name' => 'From',
'priority_desc' => 'Priority',
'dept_name' => 'Department',
'helptopic' => 'Help Topic',
'source' => 'Source',
'status' => 'Current Status'
),
Expand Down
26 changes: 24 additions & 2 deletions include/staff/tickets.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand Down Expand Up @@ -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()
Expand All @@ -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;
Expand Down Expand Up @@ -616,6 +626,18 @@
?>
</select>
</fieldset>
<fieldset>
<label for="topicId">Help Topic:</label>
<select id="topicId" name="topicId">
<option value="" selected >&mdash; All Help Topics &mdash;</option>
<?php
if($topics=Topic::getHelpTopics()) {
foreach($topics as $id =>$name)
echo sprintf('<option value="%d" >%s</option>', $id, $name);
}
?>
</select>
</fieldset>
<fieldset class="date_range">
<label>Date Range:</label>
<input class="dp" type="input" size="20" name="startDate">
Expand Down

0 comments on commit 1fe92c2

Please sign in to comment.