diff --git a/include/ajax.tickets.php b/include/ajax.tickets.php index 626f51af081721166e0d728e88cd615adc05423c..8e53141a89972ba5be56990a9869287f36ae693c 100644 --- a/include/ajax.tickets.php +++ b/include/ajax.tickets.php @@ -31,11 +31,11 @@ class TicketsAjaxAPI extends AjaxController { $limit = isset($_REQUEST['limit']) ? (int) $_REQUEST['limit']:25; $tickets=array(); - $sql='SELECT DISTINCT ticketID, email.address AS email' + $sql='SELECT DISTINCT `number`, email.address AS email' .' FROM '.TICKET_TABLE.' ticket' .' LEFT JOIN '.USER_TABLE.' user ON user.id = ticket.user_id' .' LEFT JOIN '.USER_EMAIL_TABLE.' email ON user.id = email.user_id' - .' WHERE ticketID LIKE \''.db_input($_REQUEST['q'], false).'%\''; + .' WHERE `number` LIKE \''.db_input($_REQUEST['q'], false).'%\''; $sql.=' AND ( staff_id='.db_input($thisstaff->getId()); diff --git a/include/class.export.php b/include/class.export.php index b5c5a44396eb07aec4c6a20c87d34a0a7c9eeff5..b95a7d16d587541188d40d4cc6f45097b00b757f 100644 --- a/include/class.export.php +++ b/include/class.export.php @@ -57,7 +57,7 @@ class Export { $sql = str_replace(' FROM ', ',' . implode(',', $select) . ' FROM ', $sql); return self::dumpQuery($sql, array( - 'ticketID' => 'Ticket Id', + 'number' => 'Ticket Number', 'created' => 'Date', 'subject' => 'Subject', 'name' => 'From', diff --git a/include/class.ticket.php b/include/class.ticket.php index bde94ec59d595d6be2f765979de60cde3c217797..cd3a649ec71323b2419caa6301d80021a390ca7d 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -85,7 +85,7 @@ class Ticket { $this->ht = db_fetch_array($res); $this->id = $this->ht['ticket_id']; - $this->number = $this->ht['ticketID']; + $this->number = $this->ht['number']; $this->_answers = array(); $this->loadDynamicData(); @@ -1894,7 +1894,7 @@ class Ticket { $sql ='SELECT ticket.ticket_id FROM '.TICKET_TABLE.' ticket ' .' LEFT JOIN '.USER_TABLE.' user ON user.id = ticket.user_id' .' LEFT JOIN '.USER_EMAIL_TABLE.' email ON user.id = email.user_id' - .' WHERE ticket.ticketID='.db_input($extId); + .' WHERE ticket.`number`='.db_input($extId); if($email) $sql .= ' AND email.address = '.db_input($email); @@ -1926,7 +1926,7 @@ class Ticket { //We can allow collissions...extId and email must be unique ...so same id with diff emails is ok.. // But for clarity...we are going to make sure it is unique. $id=Misc::randNumber(EXT_TICKET_ID_LEN); - if(db_num_rows(db_query('SELECT ticket_id FROM '.TICKET_TABLE.' WHERE ticketID='.db_input($id)))) + if(db_num_rows(db_query('SELECT ticket_id FROM '.TICKET_TABLE.' WHERE `number`='.db_input($id)))) return Ticket::genExtRandID(); return $id; @@ -2220,7 +2220,7 @@ class Ticket { $sql='INSERT INTO '.TICKET_TABLE.' SET created=NOW() ' .' ,lastmessage= NOW()' .' ,user_id='.db_input($user->id) - .' ,ticketID='.db_input($extId) + .' ,`number`='.db_input($extId) .' ,dept_id='.db_input($deptId) .' ,topic_id='.db_input($topicId) .' ,ip_address='.db_input($ipaddress) @@ -2237,9 +2237,9 @@ class Ticket { /* -------------------- POST CREATE ------------------------ */ if(!$cfg->useRandomIds()) { - //Sequential ticketIDs support really..really suck arse. + //Sequential ticket number support really..really suck arse. $extId=$id; //To make things really easy we are going to use autoincrement ticket_id. - db_query('UPDATE '.TICKET_TABLE.' SET ticketID='.db_input($extId).' WHERE ticket_id='.$id.' LIMIT 1'); + db_query('UPDATE '.TICKET_TABLE.' SET `number`='.db_input($extId).' WHERE ticket_id='.$id.' LIMIT 1'); //TODO: RETHING what happens if this fails?? [At the moment on failure random ID is used...making stuff usable] } diff --git a/include/client/tickets.inc.php b/include/client/tickets.inc.php index 5d1be85cc00c0e24baf143c7c31c5eb98ed1be29..f9774f54a2a33c2bc5da11589f1846e3edc14005 100644 --- a/include/client/tickets.inc.php +++ b/include/client/tickets.inc.php @@ -18,7 +18,7 @@ if(isset($_REQUEST['status'])) { //Query string status has nothing to do with th $status='open'; //Defaulting to open } -$sortOptions=array('id'=>'ticketID', 'subject'=>'subject.value', +$sortOptions=array('id'=>'`number`', 'subject'=>'subject.value', 'status'=>'ticket.status', 'dept'=>'dept_name','date'=>'ticket.created'); $orderWays=array('DESC'=>'DESC','ASC'=>'ASC'); //Sorting options... @@ -38,7 +38,7 @@ if($order_by && strpos($order_by,',')) $x=$sort.'_sort'; $$x=' class="'.strtolower($order).'" '; -$qselect='SELECT ticket.ticket_id,ticket.ticketID,ticket.dept_id,isanswered, ' +$qselect='SELECT ticket.ticket_id,ticket.`number`,ticket.dept_id,isanswered, ' .'dept.ispublic, subject.value as subject,' .'dept_name,ticket. status, ticket.source, ticket.created '; @@ -66,7 +66,7 @@ $search=($_REQUEST['a']=='search' && $_REQUEST['q']); if($search) { $qstr.='&a='.urlencode($_REQUEST['a']).'&q='.urlencode($_REQUEST['q']); if(is_numeric($_REQUEST['q'])) { - $qwhere.=" AND ticket.ticketID LIKE '$queryterm%'"; + $qwhere.=" AND ticket.`number` LIKE '$queryterm%'"; } else {//Deep search! $queryterm=db_real_escape($_REQUEST['q'],false); //escape the term ONLY...no quotes. $qwhere.=' AND ( ' @@ -153,10 +153,10 @@ $negorder=$order=='DESC'?'ASC':'DESC'; //Negate the sorting if($row['attachments']) $subject.=' <span class="Icon file"></span>'; - $ticketID=$row['ticketID']; + $ticketNumber=$row['number']; if($row['isanswered'] && !strcasecmp($row['status'],'open')) { $subject="<b>$subject</b>"; - $ticketID="<b>$ticketID</b>"; + $ticketNumber="<b>$ticketNumber</b>"; } $phone=Format::phone($row['phone']); if($row['phone_ext']) @@ -165,7 +165,7 @@ $negorder=$order=='DESC'?'ASC':'DESC'; //Negate the sorting <tr id="<?php echo $row['ticket_id']; ?>"> <td class="centered"> <a class="Icon <?php echo strtolower($row['source']); ?>Ticket" title="<?php echo $row['email']; ?>" - href="tickets.php?id=<?php echo $row['ticket_id']; ?>"><?php echo $ticketID; ?></a> + href="tickets.php?id=<?php echo $row['ticket_id']; ?>"><?php echo $ticketNumber; ?></a> </td> <td> <?php echo Format::db_date($row['created']); ?></td> <td> <?php echo ucfirst($row['status']); ?></td> diff --git a/include/staff/tickets.inc.php b/include/staff/tickets.inc.php index bbd837c9ce8b94f5cd292854f13e85950a47be18..530d6b2d93ec7262370d81fed89c0a7bab14bdfa 100644 --- a/include/staff/tickets.inc.php +++ b/include/staff/tickets.inc.php @@ -115,7 +115,7 @@ if($search): $qstr.='&query='.urlencode($searchTerm); $queryterm=db_real_escape($searchTerm,false); //escape the term ONLY...no quotes. if (is_numeric($searchTerm)) { - $qwhere.=" AND ticket.ticketID LIKE '$queryterm%'"; + $qwhere.=" AND ticket.`number` LIKE '$queryterm%'"; } elseif (strpos($searchTerm,'@') && Validator::is_email($searchTerm)) { //pulling all tricks! # XXX: What about searching for email addresses in the body of @@ -143,7 +143,7 @@ if ($_REQUEST['advsid'] && isset($_SESSION['adv_'.$_REQUEST['advsid']])) { db_input($_SESSION['adv_'.$_REQUEST['advsid']])).')'; } -$sortOptions=array('date'=>'effective_date','ID'=>'ticketID', +$sortOptions=array('date'=>'effective_date','ID'=>'`number`', 'pri'=>'priority_id','name'=>'user.name','subj'=>'subject', 'status'=>'ticket.status','assignee'=>'assigned','staff'=>'staff', 'dept'=>'dept_name'); @@ -195,7 +195,7 @@ $$x=' class="'.strtolower($order).'" '; if($_GET['limit']) $qstr.='&limit='.urlencode($_GET['limit']); -$qselect ='SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,ticket.staff_id,ticket.team_id ' +$qselect ='SELECT ticket.ticket_id,lock_id,`number`,ticket.dept_id,ticket.staff_id,ticket.team_id ' .' ,user.name' .' ,email.address as email, dept_name ' .' ,ticket.status,ticket.source,isoverdue,isanswered,ticket.created '; @@ -386,7 +386,7 @@ if ($results) { }else{ $lc=Format::truncate($row['dept_name'],40); } - $tid=$row['ticketID']; + $tid=$row['number']; $subject = Format::htmlchars(Format::truncate($row['subject'],40)); $threadcount=$row['thread_count']; if(!strcasecmp($row['status'],'open') && !$row['isanswered'] && !$row['lock_id']) {