ticketsearch.php
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:44k
- <?php
- // +-------------------------------------------------------------+
- // | DeskPRO v [2.0.1 Production]
- // | Copyright (C) 2001 - 2004 Headstart Solutions Limited
- // | Supplied by WTN-WDYL
- // | Nullified by WTN-WDYL
- // | Distribution via WebForum, ForumRU and associated file dumps
- // +-------------------------------------------------------------+
- // | DESKPRO IS NOT FREE SOFTWARE
- // +-------------------------------------------------------------+
- // | License ID : Full Enterprise License =) ...
- // | License Owner : WTN-WDYL Team
- // +-------------------------------------------------------------+
- // | $RCSfile: ticketsearch.php,v $
- // | $Date: 2004/02/13 01:58:34 $
- // | $Revision: 1.112 $
- // +-------------------------------------------------------------+
- // | File Details:
- // | - Ticket search forms and engine.
- // +-------------------------------------------------------------+
- error_reporting(E_ALL ^ E_NOTICE);
- /*
- nodisplay field:
- 1 : Spam
- 2 : User must validate themselves
- 3 : Tech must validate users
- */
- include "./../global.php";
- if (!$_REQUEST['Jump']) {
- tech_nav('Tickets', 'Ticket Search');
- }
- ################################# GLOBAL SECTIONS #####################################
- ////////////////////////// SORT OUT INFORMATION //////////////////////////
- if ($_REQUEST[variables]) {
- $_REQUEST = array_merge(unserialize($_REQUEST[variables]), $_REQUEST);
- }
- // searchtype
- if (!$_REQUEST['searchtype']) {
- $_REQUEST['searchtype'] = "simple";
- }
- ################################# SORT OUT FOOTER_SEARCH #####################################
- if ($user['cats_user']) {
- if (@in_array(-3, $_REQUEST['category'])) {
- $_REQUEST['category'] = split(',', $user['cats_user']);
- }
- }
- ################################# SORT OUT FOOTER_SELECT #####################################
- if (is_array($_REQUEST['unassigned_category'])) {
- $_REQUEST['category'] = $_REQUEST['unassigned_category'];
- $_REQUEST['tech'] = -1;
- $footer_select = true;
- }
- if (is_array($_REQUEST['other_category'])) {
- $_REQUEST['category'] = $_REQUEST['other_category'];
- $_REQUEST['tech'] = 'assigned';
- $footer_select = true;
- }
- if (is_array($_REQUEST['your_category'])) {
- $_REQUEST['category'] = $_REQUEST['your_category'];
- $_REQUEST['tech'] = $user[id];
- $footer_select = true;
- }
- if (is_array($_REQUEST['unassigned_priority'])) {
- $_REQUEST['priority'] = $_REQUEST['unassigned_priority'];
- $_REQUEST['tech'] = -1;
- $footer_select = true;
- }
- if (is_array($_REQUEST['other_priority'])) {
- $_REQUEST['priority'] = $_REQUEST['other_priority'];
- $footer_select = true;
- $_REQUEST['tech'] = 'assigned';
- }
- if (is_array($_REQUEST['your_priority'])) {
- $_REQUEST['priority'] = $_REQUEST['your_priority'];
- $footer_select = true;
- $_REQUEST['tech'] = $user[id];
- }
- if (is_array($_REQUEST['other_tech'])) {
- $_REQUEST['tech'] = $_REQUEST['other_tech'];
- $footer_select = true;
- $_REQUEST['tech'] = 'assigned';
- }
- if ($footer_select) {
- $_REQUEST['do'] = 'search';
- $_REQUEST['awaiting_tech'] = 1;
- $_REQUEST['unresolved'] = 1;
- }
- ////////////////////////// SAVED SEARCH/RESULT ///////////////////////////
- if ($_REQUEST['save_search_op']) {
- $save_items = array('greater', 'lessthan', 'user_owner', 'subject', 'subjectoption',
- 'message', 'messageoption', 'messageowner', 'tech',
- 'ddate_started_start', 'mdate_started_start', 'ydate_started_start',
- 'ddate_started_end', 'mdate_started_end', 'ydate_started_end',
- 'ddate_resolved_start', 'mdate_resolved_start', 'ydate_resolved_start',
- 'ddate_resolved_end', 'mdate_resolved_end', 'ydate_resolved_end',
- 'ddate_activity_start', 'mdate_activity_start', 'ydate_activity_start',
- 'ddate_activity_end', 'mdate_activity_end', 'ydate_activity_end',
- 'resolved', 'unresolved', 'awaiting_tech', 'awaiting_user', 'category', 'priority',
- 'nodisplay');
- foreach ($save_items AS $key => $val) {
- $data[$val] = $_REQUEST[$val];
- }
- }
- if ($_REQUEST['save_search_op'] == 'Save') {
- if ($_REQUEST['saved_search']) {
- $data['custom_fields'] = serialize($_REQUEST['custom_fields']);
- $data = mysql_escape_string(serialize($data));
- $db->query("UPDATE tech_ticket_search
- set data = '$data' WHERE id = '$_REQUEST[saved_search]'
- AND techid = '$user[id]'");
- $message = "Search criteria updated.";
- } else {
- $message = "You must select a valid search to update. [Changes not saved]";
- $_REQUEST['do'] = '';
- $_REQUEST['searchtype'] = 'advanced';
- }
- }
- if ($_REQUEST['save_search_op'] == 'Save As') {
- if ($_REQUEST['save_search_name']) {
- $data['custom_fields'] = serialize($_REQUEST['custom_fields']);
- $data = mysql_escape_string(serialize($data));
- $db->query("INSERT INTO tech_ticket_search (techid, save_name, save_type, data)
- VALUES ('$user[id]', '$_REQUEST[save_search_name]', 'search', '$data')");
- $message = "Search criteria saved as $_REQUEST[save_search_name].";
- } else {
- $message = "You must enter a name to assign to this search. [Search not saved]";
- $_REQUEST['do'] = '';
- $_REQUEST['searchtype'] = 'advanced';
- }
- }
- if ($_REQUEST['save_search_op'] == 'Edit') {
- if ($_REQUEST['saved_search']) {
- $db->query("SELECT data FROM tech_ticket_search WHERE id = '$_REQUEST[saved_search]' AND techid = '$user[id]'");
- $data = $db->row_array();
- $data = unserialize($data[data]);
- $_REQUEST['custom_fields'] = unserialize($data['custom_fields']);
- $_REQUEST['do'] = '';
- $_REQUEST['searchtype'] = 'advanced';
- foreach ($save_items AS $key => $val) {
- $_REQUEST[$val] = $data[$val];
- }
- } else {
- $message = "You must specify a valid search to edit.";
- $_REQUEST['do'] = '';
- $_REQUEST['searchtype'] = 'advanced';
- }
- }
- if ($_REQUEST['save_search_op'] == 'Delete') {
- if ($_REQUEST[saved_search]) {
- $db->query("DELETE FROM tech_ticket_search WHERE id = '$_REQUEST[saved_search]' AND techid = '$user[id]'");
- $_REQUEST['do'] = '';
- $_REQUEST['searchtype'] = 'advanced';
- $message = "Search deleted.";
- } else {
- $message = "You must specify a valid search to delete.";
- $_REQUEST['do'] = '';
- $_REQUEST['searchtype'] = 'advanced';
- }
- }
- if ($_REQUEST['save_search_op'] == 'Run') {
- if ($_REQUEST['saved_search']) {
- $db->query("SELECT data FROM tech_ticket_search WHERE id = '$_REQUEST[saved_search]' AND techid = '$user[id]'");
- $data = $db->row_array();
- $data = unserialize($data[data]);
- foreach ($save_items AS $key => $val) {
- $_REQUEST[$val] = $data[$val];
- }
- $_REQUEST['custom_fields'] = unserialize($data['custom_fields']);
- $_REQUEST['do'] = 'search';
- $_REQUEST['searchtype'] = 'advanced';
- } else {
- $_REQUEST['do'] = '';
- $_REQUEST['searchtype'] = 'advanced';
- $message = "You must specify a valid search to run.";
- }
- }
- // Handle requests from tech/home/ticket_select.php
- if ($_REQUEST['do'] == 'listown') {
- $_REQUEST['tech'] = $user['id'];
- $_REQUEST['do'] = 'search';
- $_REQUEST['unresolved'] = 1;
- $_REQUEST['resolved'] = 0;
- $_REQUEST['awaiting_tech'] = 1;
- $_REQUEST['awaiting_user'] = 0;
- } elseif ($_REQUEST['do'] == 'listnew') {
- $_REQUEST['tech'] = '-1';
- $_REQUEST['do'] = 'search';
- $_REQUEST['unresolved'] = 1;
- $_REQUEST['resolved'] = 0;
- $_REQUEST['awaiting_tech'] = 1;
- $_REQUEST['awaiting_user'] = 0;
- } elseif ($_REQUEST['do'] == 'listothers') {
- $_REQUEST['tech'] = 'assigned';
- $_REQUEST['do'] = 'search';
- $_REQUEST['unresolved'] = 1;
- $_REQUEST['resolved'] = 0;
- $_REQUEST['awaiting_tech'] = 1;
- $_REQUEST['awaiting_user'] = 0;
- }
- ////////////////////////// GET TECH/CATEGORY/PRIORITY INFORMATION //////////////////////////
- // if edit ticket
- $cat_array[-2] = 'Any';
- $cat_array[-1] = 'None';
- $db->query("SELECT * FROM ticket_cat ORDER BY cat_order");
- while ($cat = $db->row_array()) {
- $cat_array[$cat[id]] = $cat[name];
- // for select menus
- $html .= "new Array(true,"category|Change Category","$cat[id]|$cat[name]"),n";
- }
- // if edit + assign to tech
- $tech_array[-2] = 'Any';
- $tech_array[-1] = 'Unassigned';
- $db->query("SELECT * FROM tech ORDER BY username");
- while ($tech = $db->row_array()) {
- $tech_array[$tech[id]] = $tech[username];
- $html .= "new Array(true,"tech|Assign to tech","$tech[id]|$tech[username]"),";
- }
- // if edit ticket
- $pri_array[-2] = 'Any';
- $pri_array[-1] = 'None';
- $db->query("SELECT * FROM ticket_pri ORDER BY pri_order");
- while ($pri = $db->row_array()) {
- $pri_array[$pri[id]] = $pri[name];
- $html .= "new Array(true,"priority|Change Priority","$pri[id]|$pri[name]"),n";
- }
- ###################################### BASIC TICKET SEARCH FORM #################################
- if ($message) {
- alert($message);
- }
- if ($_REQUEST['searchtype'] == "simple" AND !$_REQUEST['Jump']) {
- $help1 = table_thelp('<B>Is Resolved</B>', 'Tickets - Searching', 'Is Resolved');
- $help2 = table_thelp('<B>Awaiting Tech</B>', 'Tickets - Searching', 'Awaiting Tech');
- $help3 = table_thelp('<B>Categories</B>', 'Tickets - Searching', 'Categories');
- $help4 = table_thelp('<B>Priorities</B>', 'Tickets - Searching', 'Priorities');
- $help5 = table_thelp('<B>Tech Owner</B>', 'Tickets - Searching', 'Tech Owner Resolved');
- $help6 = table_thelp('<B>User Owner</B>', 'Tickets - Searching', 'User Owner');
- $help7 = table_thelp('<B>Match Subject</B>', 'Tickets - Searching', 'Match Subject');
- $help8 = table_thelp('<B>Match Message</B>', 'Tickets - Searching', 'Match Message');
- $table[] = array($help1, $help2, $help3, $help4, $help5, $help6);
- $table[] = array(
- '<table border="0"><tr><td>Resolved</td><td>' . form_checkbox_single('resolved', 1, $_REQUEST['resolved']) . '</td></tr><tr><td>Unresolved</td><td>' . form_checkbox_single('unresolved', 1, $_REQUEST['unresolved']) . "</td></tr></table>",
- '<table border="0"><tr><td>Awaiting Tech</td><td>' . form_checkbox_single('awaiting_tech', 1, $_REQUEST['awaiting_tech']) . '</td></tr><tr><td>Awaiting User</td><td>' . form_checkbox_single('awaiting_user', 1, $_REQUEST['awaiting_user']) . "</td></tr></table>",
- form_select('category', $cat_array, '', $_REQUEST['category'], '', '', 5),
- form_select('priority', $pri_array, '', $_REQUEST['priority'], '', '', 5),
- form_select('tech', $tech_array, '', $_REQUEST['tech'], '', '', 5),
- ' username or email<br />' . form_input('user_owner', $_REQUEST['user_owner'], 15) . " <a onClick="openWindow('./../users/quickfind.php?name=searchform.user_owner', 450, 600, 'userfind')">".html_image('tech/pribut040.gif')."</a>"
- );
- $table[] = array(
- "<table border="0"><tr><td>$help7</td><td>" .
- form_input('subject', $_REQUEST['subject'], 30) .
- ' ' .
- form_select('subjectoption', array('OR', 'AND', 'PHRASE'), NULL, $_REQUEST['subjectoption'], 1) .
- " (use % for wildcard)</td></tr><tr><td>$help8</td><td>" .
- form_input('message', $_REQUEST['message'], 30) .
- ' ' .
- form_select('messageoption', array('OR', 'AND', 'PHRASE'), NULL, $_REQUEST['messageoption'], 1) .
- ' ' .
- form_select('messageowner', array('EITHER', 'TECH', 'USER'), NULL, $_REQUEST['messageowner'], 1) .
- ' (use % for wildcard)</td></tr></table>'
- );
- table_header('Search for Tickets', 'ticketsearch.php', array('do' => 'search'), '', 'searchform');
- table_content('', $table);
- table_footer('Search');
- unset($columns, $table);
- }
- ####################################### ADVANCED TICKET SEARCH FORM ####################################
- if ($_REQUEST['searchtype'] == "advanced" AND !$_REQUEST['Jump']) {
- $table[] = table_midheader('Ticket Properties');
- // resolved
- $bit = 'Resolved ' . form_checkbox_single('resolved', 1, $_REQUEST['resolved']) . ' Unresolved ' . form_checkbox_single('unresolved', 1, $_REQUEST['unresolved']);
- $table[] = array(table_thelp('<B>Is Resolved</B>', 'Tickets - Searching', 'Is Resolved'), $bit);
- // awaiting whom
- $bit = 'Awaiting Tech ' . form_checkbox_single('awaiting_tech', 1, $_REQUEST['awaiting_tech']) . ' Awaiting User ' . form_checkbox_single('awaiting_user', 1, $_REQUEST['awaiting_user']);
- $table[] = array(table_thelp('<b>Awaiting Tech Response<b>', 'Tickets - Searching', 'Awaiting Tech'), $bit);
- // Spam or not?
- $bit = 'Spam' . form_checkbox_single('nodisplay', 1, $_REQUEST['nodisplay']);
- $table[] = array(table_thelp('<b>Hidden Tickets<b>', 'Tickets - Searches', 'Hidden Tickets'), $bit);
- // id range
- $bit = form_input('greater', $_REQUEST['greater'], 3) . " < <b>ID</b> > " . form_input('lessthan', $_REQUEST['lessthan'], 3);
- $table[] = array(table_thelp('<b>Ticket ID Range</b>', 'Tickets - Searches', 'Ticket ID Range'), $bit);
- // cats/pri/techowner
- $table[] = array(table_thelp('<b>Categories</b>', 'Tickets - Searches', 'Categories'), form_select('category', $cat_array, '', $_REQUEST['category'], '', '', 3));
- $table[] = array(table_thelp('<b>Priorities</b>', 'Tickets - Searches', 'Priorities'), form_select('priority', $pri_array, '', $_REQUEST['priority'], '', '', 3));
- $table[] = array(table_thelp('<b>Tech Owner</b>', 'Tickets - Searches', 'Tech Owner'), form_select('tech', $tech_array, '', $_REQUEST['tech'], '', '', 3));
- // user owner
- $bit = form_input('user_owner', $_REQUEST['user_owner'], 30) . " <a onClick="openWindow('./../users/quickfind.php?name=searchform.user_owner', 450, 600, 'userfind')">".html_image('tech/bul084.gif')."</a>";
- $table[] = array(table_thelp('<b>Username or E-mail</b>', 'Tickets - Searches', 'User Owner'), $bit);
- $table[] = table_midheader('Search Words');
- // subject
- $bit = form_input('subject', $_REQUEST['subject'], 30) . ' ' . form_select('subjectoption', array('AND', 'OR', 'PHRASE'), '', $_REQUEST['subjectoption'], 1);
- $table[] = array(table_thelp('<b>Match Subject</b>', 'Tickets - Searches', 'Match Subject'), $bit);
- // message
- $bit = form_input('message', $_REQUEST['message'], 30) . ' ' . form_select('messageoption', array('AND', 'OR', 'PHRASE'), '', $_REQUEST['messageoption'], 1) . ' ' . form_select('messageowner', array('EITHER', 'TECH', 'USER'), '', $_REQUEST['messageowner'], 1);
- $table[] = array(table_thelp('<b>Match Message</b>', 'Tickets - Searches', 'Match Message'), $bit);
- $table[] = table_midheader('Dates');
- // started
- if ($_REQUEST['ydate_started_start']) {
- $date = @strtotime("$_REQUEST[ydate_started_start]-$_REQUEST[mdate_started_start]-$_REQUEST[ddate_started_start]");
- } else {
- $date = NULL;
- }
- if ($_REQUEST['ydate_started_end']) {
- $date2 = @strtotime("$_REQUEST[ydate_started_end]-$_REQUEST[mdate_started_end]-$_REQUEST[ddate_started_end]");
- } else {
- $date2 = NULL;
- }
- $bit = 'From ' . form_date('date_started_start', '', $date, '', 1) .
- "<a onClick="datePop('searchform','date_started_start')">".html_image('tech/bul102.gif')."</a> To " . form_date('date_started_end', '', $date2, '', 1) .
- "<a onClick="datePop('searchform', 'date_started_end')">".html_image('tech/bul102.gif')."</a>";
- $table[] = array(table_thelp('<b>Date Started</b>', 'Tickets - Searches', 'Date Started'), $bit);
- unset($date, $date2);
- // resolved
- if ($_REQUEST['ydate_resolved_start']) {
- $date = @strtotime("$_REQUEST[ydate_resolved_start]-$_REQUEST[mdate_resolved_start]-$_REQUEST[ddate_resolved_start]");
- } else {
- $date = NULL;
- }
- if ($_REQUEST['ydate_resolved_end']) {
- $date2 = @strtotime("$_REQUEST[ydate_resolved_end]-$_REQUEST[mdate_resolved_end]-$_REQUEST[ddate_resolved_end]");
- } else {
- $date2 = NULL;
- }
- $bit = 'From ' . form_date('date_resolved_start', '', $date, '', 1) .
- "<a onClick="datePop('searchform', 'date_resolved_start')">".html_image('tech/bul102.gif')."</a> To " . form_date('date_resolved_end', '', $date2, '', 1) .
- "<a onClick="datePop('searchform', 'date_resolved_end')">".html_image('tech/bul102.gif')."</a>";
- $table[] = array(table_thelp('<b>Date Resolved</b>', 'Tickets - Searches', 'Date Resolved'), $bit);
- unset($date, $date2);
- // last activity
- $date = @strtotime("$_REQUEST[ydate_activity_start]-$_REQUEST[mdate_activity_start]-$_REQUEST[ddate_activity_start]");
- $date2 = @strtotime("$_REQUEST[ydate_activity_end]-$_REQUEST[mdate_activity_end]-$_REQUEST[ddate_activity_end]");
- if ($_REQUEST['ydate_resolved_start']) {
- $date = @strtotime("$_REQUEST[ydate_resolved_start]-$_REQUEST[mdate_resolved_start]-$_REQUEST[ddate_resolved_start]");
- } else {
- $date = NULL;
- }
- if ($_REQUEST['ydate_resolved_end']) {
- $date2 = @strtotime("$_REQUEST[ydate_resolved_end]-$_REQUEST[mdate_resolved_end]-$_REQUEST[ddate_resolved_end]");
- } else {
- $date2 = NULL;
- }
- $bit = 'From ' . form_date('date_activity_start', '', $date, '', 1) .
- "<a onClick="datePop('searchform', 'date_activity_start')">".html_image('tech/bul102.gif')."</a> To " . form_date('date_activity_end', '', $date2, '', 1) .
- "<a onClick="datePop('searchform', 'date_activity_end')">".html_image('tech/bul102.gif')."</a>";
- $table[] = array(table_thelp('<b>Date of Last Activity</b>', 'Tickets - Searches', 'Date of Last Activity'), $bit);
- unset($date, $date2);
- $db->query("SELECT * FROM ticket_def WHERE tech_viewable");
- if ($db->num_rows()) {
- $table[] = table_midheader('Custom Ticket Fields');
- }
- while ($ticket_data = $db->row_array()) {
- $bit = field_def($ticket_data, 'redo', $_REQUEST['custom_fields'][$ticket_data['name']], $_REQUEST['custom_fields']["extra" . $ticket_data['name']], '', 'custom_fields', 1, $_REQUEST['custom_fields'][$ticket_data['name'].'_match'], $_REQUEST['custom_fields'][$ticket_data['name'].'_not']);
- $name = unserialize($ticket_data[display_name]);
- $name = $name[$settings[default_language]];
- $ticket_fields_array[$ticket_data[id]] = array(
- 'display_name' => $name,
- 'name' => $ticket_data[name]
- );
- $table[] = array("<b>$name</b>", $bit);
- }
- $table[] = table_midheader('Named Searches and Results');
- $db->query("SELECT id, save_name, save_type FROM tech_ticket_search WHERE techid = '$user[id]' ORDER BY save_type, save_name");
- $saved_searches = array();
- $saved_results = array();
- while ($saves = $db->row_array()) {
- if ($saves[save_type] == 'search') {
- $saved_searches[$saves[id]] = $saves[save_name];
- }
- }
- if ($_REQUEST['saved_search']) {
- $saved_selected = $_REQUEST['saved_search'];
- } else {
- $saved_selected = NULL;
- }
- $saved_searches = iff(count($saved_searches) > 0, form_select('saved_search', $saved_searches, '', $saved_selected), '(None saved) ') .
- form_radio_single('save_search_op', 'No Action', 1) . "No Action " .
- form_radio_single('save_search_op', 'Run') . "Run " .
- form_radio_single('save_search_op', 'Edit') . "Edit " .
- form_radio_single('save_search_op', 'Delete') . "Delete " .
- form_radio_single('save_search_op', 'Save') . "Update " .
- form_radio_single('save_search_op', 'Save As') . "Save as New: " .
- form_input('save_search_name');
- $table[] = array(table_thelp('<B>Saved Searches</B>', 'Tickets - Searches', 'Saved Searches'), $saved_searches);
- table_header('Search for Tickets', 'ticketsearch.php', array('do' => 'search', 'searchtype' => 'advanced'), '', 'searchform');
- table_content($columns, $table);
- table_footer('Search');
- unset($columns, $table);
- // hide search form if searching
- if ($_REQUEST['do'] == "search") {
- echo "<SCRIPT>oc('Search for Tickets');oc('Search for Tickets2');</SCRIPT>";
- }
- }
- echo "</form></form>";
- ############################################# RESULTS #############################################
- if ($_REQUEST['do'] == "search") {
- /*******************************************************
- PART 1: BUILDING WHERE PART OF QUERY
- *******************************************************/
- ////////////////////////// LIMIT BASED ON REPLIES //////////////////////////
- if ($_REQUEST['message']) {
- // message is a phrase
- if ($_REQUEST['messageoption'] == 'PHRASE') {
- $where .= " message LIKE '%" . addslashes($_REQUEST['message']) . "%'";
-
- // message is AND or OR
- } else {
-
- give_default($_REQUEST['messageoption'], 'OR');
- $words = explode(" ", $_REQUEST['message']);
- for ($i=0; $i < count($words); $i++) {
- if ($i == "0") {
- $where .= " message LIKE '%" . addslashes($words[$i]) . "%' ";
- } else {
- $where .= " $_REQUEST[messageoption] message LIKE '%" . addslashes($words[$i]) . "%' ";
- }
- }
- }
-
- if ($_REQUEST['messageowner'] == "TECH") {
- $where .= " AND techid";
- } elseif ($_REQUEST['messageowner'] == "USER") {
- $where .= " AND userid";
- }
-
- $db->query("SELECT ticketid FROM ticket_message WHERE $where");
- if ($db->num_rows() < 1) {
- // make query fail
- $reply_search = " AND 0 ";
- } else {
-
- while ($reply = $db->row_array()) {
- $reply_search[] = $reply['ticketid'];
- }
-
- $reply_search = ' AND ticket.id IN ' . array2sql($reply_search);
- }
- }
- unset($where);
- ////////////////////////// START QUERY //////////////////////////
- $select = "
- SELECT ticket.*,
- ticket_cat.name AS catname,
- ticket_pri.name AS priname,
- user.id AS usrid, user.username AS username,
- tech.username AS techname,tech.id AS tech,
- COUNT(ticket_attachments.id) AS attachments
- FROM ticket
- LEFT JOIN ticket_cat ON (ticket_cat.id = ticket.category)
- LEFT JOIN ticket_pri ON (ticket_pri.id = ticket.priority)
- LEFT JOIN user ON (user.id = ticket.userid)
- LEFT JOIN tech ON (tech.id = ticket.tech)
- LEFT JOIN ticket_attachments ON (ticket_attachments.ticketid = ticket.id)
- WHERE
- ";
- if ($_REQUEST['nodisplay']) {
- $select .= " nodisplay";
- $disp = " AND nodisplay = 1";
- } else {
- $select .= " !nodisplay";
- $disp = " AND !nodisplay";
- }
- ////////////////////////// RESTRICTED CATEGORIES //////////////////////////
- $select .= iff($user[cats_admin], " AND category NOT IN ($user[cats_admin]) ");
- ////////////////////////// CATEGORY / PRIORITY / TECH OWNER //////////////////////////
- // category
- if (is_array($_REQUEST['category'])) {
- // need to remove -1, array search unreliable
- foreach($_REQUEST['category'] AS $key => $var) {
- if ($var == '-1') {
- unset($_REQUEST['category'][$key]);
- $_REQUEST['category'][] = '0';
- }
- if ($var == '-2') {
- $_REQUEST['category'] = array();
- }
-
- }
-
- if (count($_REQUEST['category'])) {
- $dosql = array2sql($_REQUEST['category']);
- $where .= " AND category IN $dosql";
- }
- } elseif ($_REQUEST['category']) {
- $where .= " AND category = $_REQUEST[category]";
- }
- // priority
- if (is_array($_REQUEST['priority'])) {
- // need to remove -1, array search unreliable
- foreach($_REQUEST['priority'] AS $key => $var) {
- if ($var == '-1') {
- unset($_REQUEST['priority'][$key]);
- $_REQUEST['priority'][] = '0';
- }
- if ($var == '-2') {
- $_REQUEST['priority'] = array();
- }
- }
-
- if (count($_REQUEST['priority'])) {
- $dosql = array2sql($_REQUEST['priority']);
- $where .= " AND priority IN $dosql";
- }
- } elseif ($_REQUEST['priority']) {
- $where .= " AND priority = '" . mysql_escape_string($_REQUEST[priority]) . "'";
- }
- // tech owner (array)
- if (is_array($_REQUEST['tech'])) {
- // need to remove -1, array search unreliable
- foreach($_REQUEST['tech'] AS $key => $var) {
- if ($var == '-1') {
- $where .= " AND !tech";
- $breaking++;
- break;
- }
- if ($var == '-2') {
- $breaking++;
- break;
- }
- }
-
- if (!$breaking) {
- if ($user['p_tech_view']) {
- $dosql = array2sql($_REQUEST['tech']);
- $where .= " AND tech IN $dosql";
- } else {
- $where .= " AND tech = '$user[id]'";
- }
- }
- } elseif ($_REQUEST['tech'] == 'assigned' AND $user['p_tech_view']) { // List *others'* tickets
- $where .= " AND tech != $user[id] AND tech";
- } elseif ($_REQUEST['tech']) {
- if ($_REQUEST['tech'] == '-1') {
- $where .= " AND !tech";
- $_REQUEST['tech'] = '0';
- } else {
- $where .= " AND tech = '" . mysql_escape_string($_REQUEST[tech]) . "'";
- }
- }
- ////////////////////////// SPECIFY CERTAIN TICKET FIELDS //////////////////////////
-
- // on these we don't want anything if both match
- // open / closed status
- if ($_REQUEST['unresolved'] == "1" AND !$_REQUEST['resolved']) {
- $where .= " AND is_open = 1";
- $form .= form_hidden('unresolved', 1);
- } elseif ($_REQUEST['resolved'] == "1" AND !$_REQUEST['unresolved']) {
- $where .= " AND is_open = 0";
- $form .= form_hidden('resolved', 1);
- }
- // ticket locked
- if ($_REQUEST['is_locked']) {
- $where .= " AND is_locked = '1'";
- }
- // awaiting tech/user
- if ($_REQUEST['awaiting_tech'] == "1" AND !$_REQUEST['awaiting_user']) {
- $where .= " AND awaiting_tech = 1";
- } elseif ($_REQUEST['awaiting_user'] == "1" AND !$_REQUEST['awaiting_tech']) {
- $where .= " AND awaiting_tech = 0";
- }
- // ticketid range
- if (isset($_REQUEST['lowid'])) {
- $where .= " AND id >= $_REQUEST[lowid]";
- }
- if (isset($_REQUEST['highid'])) {
- $where .= " AND id <= $_REQUEST[highid]";
- }
- // user id
- if ($_REQUEST['user_owner']) {
- $userdata = $db->query_return("SELECT id FROM user WHERE username = '" . mysql_escape_string($_REQUEST['user_owner']) . "'");
- if (!$db->num_rows()) {
- $userdata = $db->query_return("SELECT id FROM user WHERE email = '" . mysql_escape_string($_REQUEST['user_owner']) . "'");
- }
- if (is_array($userdata)) {
- $where .= " AND ticket.userid = $userdata[id]";
- }
- }
- // subject
- if ($_REQUEST['subject']) {
- if ($_REQUEST['subjectoption'] == 'PHRASE') {
- $where .= " AND subject LIKE '%" . mysql_escape_string($_REQUEST['subject']) . "%'";
- } else {
- if (!($_REQUEST['subjectoption'] == 'AND' OR $_REQUEST['subjectoption'] == 'OR')) {
- $_REQUEST['subjectoption'] = 'OR';
- }
- $words = explode(" ", $_REQUEST['subject']);
- $where .= ' AND (';
- for ($i=0; $i < count($words); $i++) {
- if ($i == "0") {
- $where .= " subject LIKE '%$words[$i]%' ";
- } else {
- $where .= " $_REQUEST[subjectoption] subject LIKE '%$words[$i]%' ";
- }
- }
- $where .= ') ';
- }
- }
- ////////////////////////// TIME CALCULATIONS //////////////////////////
- if ($_REQUEST['ydate_started_start']) {
- $date1 = mktime (0, 0, 0, $_REQUEST['mdate_started_start'], $_REQUEST['ddate_started_start'], $_REQUEST['ydate_started_start']);
- $where .= " AND date_opened >= '$date1'";
- }
- if ($_REQUEST['ydate_started_end']) {
- $date2 = strtotime("$_REQUEST[ydate_started_end]-$_REQUEST[mdate_started_end]-$_REQUEST[ddate_started_end] +23 hours 59 minutes 59 seconds");
- $where .= " AND date_opened < '$date2'";
- }
- if ($_REQUEST['ydate_resolved_start']) {
- $date3 = mktime (0, 0, 0, $_REQUEST['mdate_resolved_start'], $_REQUEST['ddate_resolved_start'], $_REQUEST['ydate_resolved_start']);
- $where .= " AND ((date_closed >= '$date1') OR !date_closed)";
- }
- if ($_REQUEST['ydate_resolved_end']) {
- $date4 = strtotime("$_REQUEST[ydate_resolved_end]-$_REQUEST[mdate_resolved_end]-$_REQUEST[ddate_resolved_end] +23 hours 59 minutes 59 seconds");
- $where .= " AND ((date_closed < '$date2') OR !date_closed)";
- }
- if ($_REQUEST['ydate_activity_start']) {
- $date5 = strtotime("$_REQUEST[ydate_activity_start]-$_REQUEST[mdate_activity_start]-$_REQUEST[ddate_activity_start]");
- $where .= " AND ((date_lastreply_tech >= '$date1' OR date_lastreply >= '$date1') OR !date_lastreply)";
- }
- if ($_REQUEST['ydate_activity_end']) {
- $date6 = mktime (0, 0, 0, $_REQUEST['mdate_activity_end'], $_REQUEST['ddate_activity_end'], $_REQUEST['ydate_activity_end']);
- $where .= " AND ((date_lastreply_tech < '$date2' OR date_lastreply < '$date1') OR !date_lastreply)";
- }
- ////////////////////////// CUSTOM TICKET FIELDS //////////////////////////
- $db->query('SELECT * FROM ticket_def WHERE tech_viewable ORDER BY displayorder');
- while ($result = $db->row_array()) {
- $tfields[$result['name']] = $result;
- $tname = unserialize($result[display_name]);
- $tname = $tname[$settings[default_language]];
- $ticket_fields[$result['name']] = array('display_name' => $tname, 'name' => $result['name']);
- }
- if (is_array($_REQUEST[custom_fields])) {
- foreach ($_REQUEST[custom_fields] AS $tkey => $tvar) {
- if (in_array($tkey, array_keys($ticket_fields))) {
- $tmp = field_search($tfields[$tkey],
- $_REQUEST[custom_fields][$tkey],
- $_REQUEST[custom_fields]["extra$tkey"],
- 'ticket',
- $_REQUEST[custom_fields][$tkey."_match"],
- $_REQUEST[custom_fields][$tkey."_not"]
- );
- if (trim($tmp)) {
- $where .= " AND $tmp";
- }
- }
- }
- }
- /*******************************************************
- PART 2: LIMIT BY TICKETS
- *******************************************************/
- if ($settings[ticket_number]) {
- $perpage = $settings[ticket_number];
- } else {
- $perpage = 20;
- }
- if ($_REQUEST['page']) {
- $page = $_REQUEST['page'];
- } else {
- $page = 1;
- }
- $start = $perpage * $page;
- $start = $start - $perpage;
- $limit = " LIMIT $start, $perpage";
- /*******************************************************
- PART 3: ORDERING
- *******************************************************/
- $where .= $disp;
- $where .= " GROUP by ticket.id";
- $where .= " ORDER by id ASC";
- /*******************************************************
- PART 4: COLUMN DISPLAY
- *******************************************************/
- $fields = unserialize($user[fielddisplay]);
- // need to display to tech who has not configured
- if (!is_array($fields)) {
- $fields = array(
- 'default' => array('category', 'priority', 'email', 'techowner', 'timetech', 'timestart'),
- 'admin' => array(),
- 'custom' => array(),
- 'other' => array('actions')
- );
- }
- ////////////////////////// DISPLAY HEADERS //////////////////////////
- if (in_array('awaitingtu', $fields['default'])) {
- $columns[] = 'Awaiting';
- }
- if (in_array('openclosed', $fields['default'])) {
- $columns[] = 'Open/Closed';
- }
- if (in_array('priority', $fields['default'])) {
- $columns[] = 'Priority';
- }
- if (in_array('category', $fields['default'])) {
- $columns[] = 'Category';
- }
- if (in_array('email', $fields['default'])) {
- $columns[] = 'User';
- }
- if (in_array('techowner', $fields['default'])) {
- $columns[] = 'Tech';
- }
- if (in_array('timestart', $fields['default'])) {
- $columns[] = 'Since Opening';
- }
- if (in_array('timetech', $fields['default'])) {
- $columns[] = 'Since Reply';
- }
- if (is_array($fields['other'])) {
- if (!in_array('actions', $fields['other'])) {
- $noact = 1;
- }
- }
- foreach ($fields['custom'] AS $key => $var) {
- if (is_array($ticket_fields['custom'.$var])) {
- $columns[] = $ticket_fields['custom'.$var]['display_name'];
- $showfield[] = $ticket_fields['custom'.$var]['name'];
- $ticket_custom[$ticket_data[name]] = field_display($ticket_fields['custom'.$var], $ticket[$ticket_data[name]]);
- }
- }
- // display headers for admin custom fields
- $sql = array2sql($fields['admin']);
- if ($sql) {
- $db->query("SELECT * FROM ticket_fielddisplay WHERE id IN $sql");
- while ($fielddisplay = $db->row_array()) {
- $columns[] = $fielddisplay[name];
- $admincols[] = $fielddisplay[code];
- }
- }
- /*******************************************************
- PART 5: RUN QUERYS
- *******************************************************/
- // results search
- $query = "
- SELECT id
- FROM ticket
- WHERE id = id
- $reply_search
- $where
- ";
- $db->query($query);
- $total = $db->num_rows();
- while ($result = $db->row_array()) {
- if (!$first) {
- $first = $result['id'];
- }
- // we only want to save 500 tickets here
- if ($y < 500) {
- $linkcode .= $result[id] . ",";
- $y++;
- }
- }
- if ($y) {
- $db->query("INSERT INTO search SET
- query = '" . mysql_escape_string($query) . "',
- results = '".mysql_escape_string($linkcode)."',
- time = '".mktime()."',
- techid = '$user[id]',
- total = '$total'
- ");
- $searchid = $db->last_id();
- }
- if ($_REQUEST['Jump'] AND $y) {
- if ($_REQUEST['ticketid']) {
- $first = $_REQUEST['ticketid'];
- }
- echo "<SCRIPT LANGUAGE="JavaScript">top.center.location.href="load_results.php?id=$first&searchid=$searchid&num=0";</SCRIPT>n";
- echo "<a href="load_results.php?id=$first&searchid=$searchid&num=0">Click here to proceed to the ticket list if you aren't automatically directed.</a>";
- exit;
- }
- /*******************************************************
- PART 5.5: SOME PROCESSING IF THERE IS A RESULT
- *******************************************************/
-
- if ($y) { // we have results
- if (!$_REQUEST['sortby']) {
- $_REQUEST['sortby'] = 'category';
- }
-
- // build quick reply
- $db->query("SELECT quickreply.id, quickreply.name, quickreply_cat.name AS catname FROM quickreply
- LEFT JOIN quickreply_cat ON (quickreply_cat.id = quickreply.category)
- WHERE quickreply.techid = '$user[id]' OR quickreply_cat.global
- ORDER BY $_REQUEST[sortby]
- ");
-
- while ($result = $db->row_array()) {
- if (!$result[catname]) {
- $result[catname] = addslashes_js($result[catname]);
- $html .= "new Array(true,'quickreply|Pick Message','0|UNCATEGORIZED'),n";
- }
- if ($result[catname] != $lastcatname) {
- $result[catname] = addslashes_js($result[catname]);
- $html .= "new Array(true,'quickreply|Pick Message','0|CATEGORY: $result[catname]'),n";
- }
- $result[name] = addslashes_js($result[name]);
- $html .= "new Array(true,'quickreply|Pick Message','$result[id]|- $result[name]'),n";
- $lastcatname = $result[catname];
- }
- // build javascript for drop down menus
- echo get_javascript('dropdown.js');
- ?>
- <SCRIPT language=JavaScript type=text/javascript>
- var Arr = new Array(
- new Array("form","OPT","SO"),
- <?php echo $html; ?>
- new Array(true,"close|Close Ticket","1|Email User"),
- new Array(true,"close|Close Ticket","2|Do not email user"),
- new Array(true,"awaiting_tech|Set as awaiting a tech response",""),
- new Array(true,"awaiting_user|Set as awaiting a user response",""),
- new Array(true,"open|Open Ticket",""),
- new Array(true,"selectone|Select One",""),
- new Array(false,"delete|Delete",""),
- new Array(false,"nuke|Nuke",""),
- new Array(false,"spam|Spam",""),
- new Array(false,"nospam|Not Spam","")
- );
-
- </SCRIPT>
- <?
- }
- /*******************************************************
- PART 6: LOOP THROUGH TICKETS (1. COLUMNS)
- *******************************************************/
- $user_fields = $db->query_return("
- SELECT * FROM user_def WHERE tech_viewable ORDER by displayorder DESC
- ");
- if (is_array($user_fields)) {
- foreach ($user_fields AS $val) {
- $val['disp_name'] = unserialize($val[display_name]);
- }
- }
- $db->query($select . $reply_search . $where . $limit);
- $this_total = $db->num_rows();
- $i=0;
- while ($ticket = $db->row_array()) {
- $ticket_array[$i] = $ticket[id];
-
- // awaiting tech / user
- if (in_array('awaitingtu', $fields['default'])) {
- if ($ticket[awaiting_tech] == 1) {
- $table[$i][] = "<b>Tech</b>";
- } else {
- $table[$i][] = "User</b>";
- }
- }
- // open / closed
- if (in_array('openclosed', $fields['default'])) {
- if ($ticket[is_open] == 1) {
- $table[$i][] = "<b>Open</b>";
- } else {
- $table[$i][] = "Closed";
- }
- }
-
- // priority
- if (in_array('priority', $fields['default'])) {
- if ($ticket[priname] == "") {
- $table[$i][] = "<i>none</i>";
- } else {
- $table[$i][] = $ticket[priname];
- }
- }
-
- // category
- if (in_array('category', $fields['default'])) {
- if ($ticket[catname] == "") {
- $table[$i][] = "<i>none</i>";
- } else {
- $table[$i][] = $ticket[catname];
- }
- }
-
- if (in_array('email', $fields['default'])) {
- $table[$i][] = "<a href="../users/view.php?id=$ticket[userid]&do=view">$ticket[username]</a>";
- }
-
- if (in_array('techowner', $fields['default'])) {
- if ($ticket[techname] != "") {
- $table[$i][] = $ticket[techname];
- } else {
- $table[$i][] = "<i>Unassigned</i>";
- }
- }
-
- $ticket[since_started] = mktime() - $ticket[date_opened];
- $ticket[date_opened] = our_date($ticket[date_opened]);
- if (in_array('timestart', $fields['default'])) {
- $table[$i][] = display_time($ticket[since_started]) . ' ' . html_image('bul042.gif', "Opened: $ticket[date_opened]");
- }
- if (in_array('timetech', $fields['default'])) {
- if ($ticket[date_lastreply] != "0") {
- if (!$ticket[date_awaiting_toggled]) {
- $ticket[date_awaiting_toggled] = $ticket[date_lastreply];
- }
- $ticket[since_reply] = mktime() - $ticket[date_awaiting_toggled];
- $ticket[date_lastreply] = "Last replied: " . our_date($ticket[date_lastreply], 'Full');
- $table[$i][] = display_time($ticket[since_reply]) . html_image('bul042.gif', $ticket['date_lastreply']);
- } else {
- $table[$i][] = "No replies";
- }
- }
-
- $num = $start + $i;
- // show custom fields selected to view
- if (is_array($showfield)) {
- foreach ($showfield AS $key => $var) {
- $table[$i][] = field_display($tfields[$var], $ticket[$var], 1);
- }
- }
- // parse admin options
- if (is_array($admincols)) {
- foreach ($admincols AS $key => $var) {
- eval("$table[$i][] = "" . addslashes($var) . "";");
- }
- }
- /*******************************************************
- PART 7: LOOP THROUGH TICKETS (2.ICONS, SUBJECT AND ACTIONS)
- *******************************************************/
- /******
- * ICONS
- ******/
- // awaiting reply
- if ($ticket['awaiting_tech'] == "1") {
- $icons = html_image('tech/bul095.gif', 'Awaiting tech reply');
- } else {
- $icons = html_image('tech/bul096.gif', 'Awaiting user reply');
- }
-
- $icons .= ' ';
- // locked
- if ($ticket[is_open] == "0") {
- $icons .= html_image('tech/bul097.gif', 'Closed');
- }
- // attachments
- if ($ticket[attachments] > "0") {
- $icons .= ' ';
- if ($ticket[attachments] == "1") {
- $icons .= html_image('tech/bul099.gif', "$ticket[attachments] attachment");
- } else {
- $icons .= html_image('tech/bul099.gif', "$ticket[attachments] attachments");
- }
- }
- if ($ticket['nodisplay'] == 1) {
- $icons .= '[spam]';
- }
-
- if (!$ticket['subject']) {
- $ticket['subject'] = 'No subject';
- }
- /******
- * SUBJECT
- ******/
- $subject_icons = "<table width="100%"><tr valign="top"><td width="45">$icons</td><td valign="top"><b>ID:</b> <a href="load_results.php?id=$ticket[id]&searchid=$searchid&num=$num">$ticket[id]</a> <b>REF:</b> <a href="load_results.php?id=$ticket[id]&searchid=$searchid&num=$num">$ticket[ref]</a> <b>Subject:</b> <a href="load_results.php?id=$ticket[id]&searchid=$searchid&num=$num">$ticket[subject]</a></td><td align="right">";
- unset($icons);
- /******
- * TICKET OPTIONS
- ******/
- // create ticket dos
- $extra[$i] .= "<table><tr valign="top"><td>
- <select onchange="update(this,Arr,$ticket[id])" size="1" name="OPT$ticket[id]">n
- <option value="selectone" selected>===== Select one =====</option>n";
- // delete ticket
- if (p_ticket('delete')) {
- $extra[$i] .= "<option value="delete">Delete ticket</option>n";
- }
- if (p_ticket('delete') AND ($user['p_delete_users'] OR $user['admin'])) {
- $extra[$i] .= "<option value="nuke">Delete Ticket, Delete User, and Ban E-mail</option>n";
- }
- // assign ticket to another tech
- if (p_ticket('edit')) {
- $extra[$i] .= "<option value="tech">Assign to tech</option>n";
- $has_option = 1;
- }
- // mark ticket completed
- if (p_ticket('close') AND $ticket[is_open] == '1') {
- $extra[$i] .= "<option value="close">Close Ticket</option>n";
- $has_option = 1;
- }
- // mark ticket as in progress
- if (p_ticket('close') AND $ticket[is_open] == '0') {
- $extra[$i] .= "<option value="open">Open Ticket</option>n";
- $has_option = 1;
- }
- // mark ticket awaiting a user response
- if (p_ticket('edit') AND $ticket['awaiting_tech'] == '1') {
- $extra[$i] .= "<option value="awaiting_user">Set as awaiting a user response</option>n";
- $has_option = 1;
- }
- // mark ticket awaiting a tech response
- if (p_ticket('edit') AND $ticket['awaiting_tech'] == '0') {
- $extra[$i] .= "<option value="awaiting_tech">Set as awaiting a tech response</option>n";
- $has_option = 1;
- }
- // quick replies
- if (p_ticket('edit')) {
- $extra[$i] .= "<option value="quickreply">Reply with quick reply</option>n";
- $has_option = 1;
- }
- // edit priority / category
- if (p_ticket('edit')) {
- $extra[$i] .= "<option value="priority">Change priority</option><option value="category">Change category</option>n";
- $has_option = 1;
- }
- if (p_ticket('edit') AND $ticket['nodisplay']) {
- $extra[$i] .= "<option value="nospam">Remove "Spam" flag from this ticket</option>n";
- $has_option = 1;
- }
- if (p_ticket('edit') AND !$ticket['nodisplay']) {
- $extra[$i] .= "<option value="spam">Set "Spam" flag for this ticket</option>n";
- $has_option = 1;
- }
- if ($has_option) {
- $extra[$i] .= "</select></td><td>
- <div id="Layer$ticket[id]" style="visibility: hidden">
- <select onchange="update(this,Arr,$ticket[id]);" size="1" name="SO$ticket[id]">
- <option selected>Sub OPT</option>
- </select>
- </div></td><td>" . thelp('Tickets - Searching', 'Search Results') . "</td>
- </tr></table></td></tr></table>";
- unset($has_option);
- } else {
- $extra[$i] = '</td></tr></table>';
- }
- if ($noact) {
- $extra[$i] = $subject_icons . '</td></tr></table>';
- } else {
- $extra[$i] = $subject_icons . $extra[$i];
- }
- $i++;
- }
- /*******************************************************
- PART 8: LOOP THROUGH TICKETS (3. 1st MESSAGE)
- *******************************************************/
- $i = 0;
- $db->query("SELECT id, message, ticketid
- FROM ticket_message
- WHERE ticketid IN " . array2sql($ticket_array, '0') . "
- GROUP BY ticketid
- ORDER BY date DESC
- ");
- while ($result = $db->row_array()) {
- $message_log[$result[ticketid]] = "
- <table width="100%" class="table_midheader"><tr><td><b>Last Message:</b> " . trimstring(htmlspecialchars_uni($result[message]), 400, 1) . "</td></tr></table>";
-
- }
- if (is_array($ticket_array)) {
- foreach ($ticket_array AS $key => $var) {
- $extra2[$i] = iff($message_log[$var], $message_log[$var], ' ');
- $i++;
- }
- }
- /*******************************************************
- PART 9: DISPLAY PAGE
- *******************************************************/
- if (is_array($table)) {
- if ($total < $perpage) {
- if ($total == 1) {
- $message = "The following ticket matched your search criteria";
- } else {
- $message = "The following $total tickets matched your search criteria";
- }
- } else {
-
- $pages = ceil($total / $perpage);
- if ($page == 1) {
- $t_start = 1;
- } else {
- $t_start = $perpage * ($page - 1) + 1;
- }
- $t_end = ($perpage * ($page -1)) + $this_total;
- $message = "$total tickets matched your search criteria. Showing page $page of $pages / Showing tickets $t_start to $t_end";
- }
- table_header("$message [ <a href=./../settings/ticketdisplay.php?saved_search=$searchid>edit column display</a> ]", 'ticketactions.php', array('searchtype' => iff($_REQUEST['searchtype'], $_REQUEST['searchtype'], 'simple'), 'do' => 'process', 'variables' => serialize($_REQUEST)), '', 'form', '', 'onsubmit="return ValidateSelection()"');
- table_content($columns, $table, $extra, '', '', $extra2);
- table_footer('Process Tickets');
- ////////////////////////// BUILD NEXT AND PREV LINKS //////////////////////////
- $variables = serialize($_REQUEST);
- echo "<form action="ticketsearch.php" method="post" name="frm">";
- echo form_hidden('variables', $variables) . form_hidden('do', 'search');
- echo pagenav($total, $perpage, $page, '', 'frm', 'select', 'page');
- echo "<span id="hiddenbit"></span></form>";
- ////////////////////////// BUILD KEY //////////////////////////
- } else {
- echo "<b><center>No tickets matched the specified criteria</center></b>";
- }
- }
- tech_footer();
- ?>