There have been a lot of questions about how to add a new field to the ticket and rightly so, the more info a user can provide the better. For our purposes we wanted to add a Company field so we knew exactly who we were dealing with.
We added the field successfully and this thread explains the process. As a favor, can someone help us with adding that new field to the "tickets.inc.php" page?!?! It would be greatly appreciated. We'd like to be able to see Company in that table as a column where you see the ticket id, date, department, priority etc.
To add a new field there are 6 places you have to go to accomplish your goal.
MySQL Database: manually add a field to ost_Ticket
support/include/class.ticket.php
support/include/client/open.inc.php
support/include/client/viewticket.inc.php
include/staff/viewticket.inc.php
include/staff/newticket.inc.php
2.) class.ticket.php
Add your variable here:
class Ticket{
var $id;
var $extid;
var $email;
var $status;
var $created;
var $updated;
var $priority;
and here: like so ($this->newvar=$row;)
if(($res=db_query($sql)) && db_num_rows($res)):
$row=db_fetch_array($res);
$this->id =$row;
$this->extid =$row;
$this->email =$row;
$this->fullname =$row;
and here:
//GET
function getId(){
return $this->id;
}
function getExtId(){
return $this->extid;
}
function getEmail(){
return $this->email;
}
function getNewvar(){
return $this->newvar;
}
and here:
function create($var,&$errors,$origin,$autorespond=true,$alertstaff=true) {
global $cfg,$thisclient,$_FILES;
$id=0;
$fields=array();
$fields = array('type'=>'string', 'required'=>1, 'error'=>'newvar required');
and finally:
$extId=Ticket:();
$sql= 'INSERT INTO '.TICKET_TABLE.' SET created=NOW() '.
',ticketID='.db_input($extId).
',dept_id='.db_input($deptId).
',priority_id='.db_input($priorityId).
',email='.db_input($var).
',name='.db_input(Format:($var)).
',newvar='.db_input(Format:($var)).
3.) open.inc.php Copy info from other the other fields, just make sure the new field php scripts are different.
4.) viewticket.inc.php Repeat Step 3
5.) staff/viewticket.inc.php Repeat Step 4
4.) staff/newticket.inc.php Repeat Step 5