Admin panel table modification

Has anyone been able to add a field to the Admin panel ticket table. There was a post regarding this issue but there hasn't been any follow up. I have added a new field "Company' when creating a new ticket client and staff side and would like to add this field to the main ticket table. Has anyone managed to do this, any info would be much appreciated.

Finbar

Go through the instructions required to add a new field to the client side. In particular, you MUST add the necessary part to class.ticket.php, and to the database - otherwise it will not work.

When you added code to open.inc.php, it created the field for the client to enter data into. You need to do the same to newticket.inc.php - this displays the field so the staff member can enter data.

Thanks PRedmond your post prompted my revision of previous posts and with the modification for adding fields. As i have mention i had added the Company field on most pages except for the Admin ticket page. I have now managed to add a column with the header 'Company' and populate with company names, the inspiration coming from webpragmatist. See below for the modification steps.

/include/staff/ticket.inc.php

1.On Line 199 is the code:

$qselect = 'SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,ticket.staff_id,subject,name,email,dept_name '.

',ticket.status,ticket.source,isoverdue,isanswered,ticket.created,pri.* ,count(attach.attach_id) as attachments ';

replace with

$qselect = 'SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,ticket.staff_id,subject,name,email,dept_name '.

,ticket.status,ticket.source,isoverdue,isanswered,location,ticket.created,pri.* ,count(attach.attach_id) as attachments ';

nb. In the above code 'location' refers to my osticket table element where my company names reside.

2.After line 383 which is the code:

From

add

Company

nb. this adds the 'Company' column to the admin ticket page.

3. After line 421 which has the code:

<?=Format:($row,22,strpos($row,'@'))?> 

add

<?=$row?>

The next modification i am trying to achieve is to make this Company column sortable.

Finbar.

Please help!!! =(

I followed Frink09's instructions, and I'm having a problem, which I thought might happen. >

I want an area (directly under "Email Address") for Referrals. It's a drop-down list of all my staff members, and a client can choose which one referred them to the site. Listing a referral isn't required, so there's no (*) next to it.

I also want "Due Date" to appear on the tickets, so clients can choose when they need their projects completed. Currently, this only appears when a staff member edits a ticket.

Here's all the files I edited. Please let me know what I did wrong! =(

Thanks in advance!!

[bhoward_files.zip](https://forum.osticket.com/assets/files/migrated/5/d17cd25dfb98661048361d6b5308073.zip)

@[deleted]

The next modification i am trying to achieve is to make this Company column sortable.

Sortable on the admin side, I assume? Find <a href="tickets.php?sort=ID&order=<?=$negorder?><?=$qstr?>" title="Sort By Ticket ID <?=$negorder?>">Ticket</a></th>

in staff/tickets.inc.php

It should give you a starting point!!

7 days later

Hi cyid

I have added a field called company and I have made the following changes which also allows me to edit the field. So have a look and check that you have done the same:

include/staff/editticket.inc.php

at about line 11 add:

at about line 52 add:

include/staff/tickets.inc.php

At around line 199 include company in the $qselect = statement as follows:

At around line 383 add another column for the tickets table as follows:

Also adjust the column widths of all the columns here so your new column fits in niceley, I have done mine like this:

At around line 422 add to the last column (the last td statement):

Again adjust the truncate numbers so that it looks ok on your web page - I set mine at 19.

tickets.php:

At around line 39 add a variable to the existing ones:

At around line 72 add:

At around line 138 add:

Because my field is a Comapany field I try to add it after the name or fullname each time.

At around line 406 add company to the list of $search = array...:

At around line 412 add (after name):

At around line 984 add (after name):

At around line 1022 add (after name):

At around line 1071 add:

At around line 1197 add (after name):

And that seems to be it. Hopefully I have covered some things not already covered in this forum.

Note: I cannot seem to make the field Company a non required field even though I have set the required value to 0. Hence the error response "Use Private if not a Company". This seems to work OK.

Hi@ll, hi martinvines ...

I guess I'm doing something wrong. : When I try to apply your mod I can't edit the tickets.php in the same way you do.

There are two files called tickets.php one in the scp folder and one in root -> but, both do not contain the same content you posted.

Can anyone please tell me what I'm doing wrong?!

Thanks for your efforts,

--

greetings,

Selandar.

13 days later

Sortable Company Field

Thanks PRedmond for your help on the sortable field,

/include/staff/ticket.inc.php

on line 383

Company

i replaced with

<?=$qstr?>" title="Sort By Company <?=$negorder?>">Company

and now the company field is sortable ,which means that each Company is easily grouped together.

Finbar.

8 days later

drop down boxes

hey guys,

loving osticket just got it up yesterday been playing with it all nite..

i would like to a drop down box in the new ticket page. has anyone got the code for this please?

thanks

Update on the mod, so your staff can use the %alias in premade replies

I followed these excellent instructions, and successfully added a field for a a website address, to the ticket form. It was well explained, and easy to implement. I am going to repeat this process for additional fields, and would like to thank the author of this post for his efforts.

However, I wanted be able to include this variable in my pre-made replies listing on the admin page, so a step further was needed.

6.) after you have created your new field, edit /include/staff/templates.inc.php :

On (or around) line 136:

<table width="100%" border="0" cellspacing=1 cellpadding=1>

<tr><td width="100">%id</td><td>Ticket ID (internal ID)</td></tr>

<tr><td>%ticket</td><td>Ticket number (external ID)</td></tr>

<tr><td>%email</td><td>Email address</td></tr>

<tr><td>%website</td><td>Website address (mod added by Scott Fleming)</td></tr>

<tr><td>%name</td><td>Full name</td></tr>

<tr><td>%subject</td><td>Subject</td></tr>

<tr><td>%topic</td><td>Help topic (web only)</td></tr>

<tr><td>%phone</td><td>Phone number | ext</td></tr>

<tr><td>%status</td><td>Status</td></tr>

<tr><td>%priority</td><td>Priority</td></tr>

<tr><td>%dept</td><td>Department</td></tr>

<tr><td>%assigned_staff</td><td>Assigned staff (if any)</td></tr>

<tr><td>%createdate</td><td>Date created</td></tr>

<tr><td>%duedate</td><td>Due date</td></tr>

<tr><td>%closedate</td><td>Date closed</td></tr>

</table>

Add autocomplete with new field

Hi is any one know how to add autocomplete option with newly added field on page newticket.inc.php

i hv done follow steps:

update JS function on newticket.inc.php

callback: function (obj) { document.getElementById('email').value = obj.id; document.getElementById('name').value = obj.info; document.getElementById('client_id').value = obj.client_id; return false;}

client_id is my new field

Step 02

update ajax.ticket.php and modify function searchbyemail($params) {

function searchbyemail($params) {

$input = db_input(strtolower($params),false);

$len = strlen($input);

$limit = isset($params) ? (int) $params;

$items=array();

$sql='SELECT DISTINCT email,name,client_id FROM '.TICKET_TABLE.' WHERE email LIKE \''.$input.'%\' ORDER BY created LIMIT '.$limit;

$resp=db_query($sql);

if($resp && db_num_rows($resp)){

while(list($email,$name,$client_id)=db_fetch_row($resp)) {

$name=(strpos($name,'@')===false)?$name:'';

$client_id=(strpos($client_id,'@')===false)?$client_id:'';

$items ='{"id": "'.$email.'", "value": "'.$email.'", "info": "'.$name'", "client": "'.$client_id.'" }';

}

}

$result= '{"results": }';

return $result;

}

But i get Undefined as a result for that particular field...plz help

16 days later

I noticed a major glitch with this code

You can't edit these fields if you click on a ticket (from the control panel) and hit "Edit Ticket". I can't make any changes at all, unless I go directly to the database (in my case, by using myPHPadmin).

Is there a way to fix this? The default fields (such as "Name", "Telephone Number", etc.) can be edited...so what code(s) did the "official/original" programmer use?

9 days later

so iam no complete confused. so many diffrent ideas / post how to add a new field like "company"

whats the simplest way to add this for a noob?

I had this same problem. I had to dig through this whole thread to find the answer and here it is. It was around page 7 or 8.

You should also modify the update() function around line 1064 in your \include\class.ticket.php file. It should be like this (adjust it to your actuall variable/code):

$sql='UPDATE '.TICKET_TABLE.' SET updated=NOW() '.

',email='.db_input($var).

',name='.db_input(Format:($var)).

',subject='.db_input(Format:($var)).

',subs='.db_input($var). // <-- do not forget this!

',phone='.db_input($var).

',phone_ext='.db_input($var?$var).

',priority_id='.db_input($var).

',duedate='.($var?db_input(date('Y-m-d G',Misc:($var.' '.$var))):'NULL');

Sincerely,

Masino Sinaga

Hi sternen

i tried this also, no luck. my problem is to finde all the right "lines" and files to insert this bloody things :-)

after many hours solved

:) :) :) :)

My Problem

Hello,

I've installed the osTicket and it works perfectly. I've decided to try and implement this mod and i run into difficulty. I've edited all the files as per the instructions, uploaded them to my webs-server and then the main index page doesn't load, its just blank. I've replaced the 'edited' files with those of a fresh osTicket install one by one and have narrowed the problem down to the support/include/class.ticket.php file. It seems when i edit this file and upload it to the server the webpage doesn't show, if i replace it with the file that came with the osTicket zip file the page loads again. I've attached a copy of the edited class.ticket.php file. I am trying to insert a new field called 'callsign' for your information.

Thanks in advance

Josh

[class.ticket.php file.zip](https://forum.osticket.com/assets/files/migrated/5/226b046e0051616bb18289a1c2ce7c8.zip)

21 days later

Similar problem here

Hello,

I've installed the osTicket and it works perfectly. I've decided to try and implement this mod and i run into difficulty. I've edited all the files as per the instructions, uploaded them to my webs-server and then the main index page doesn't load, its just blank. I've replaced the 'edited' files with those of a fresh osTicket install one by one and have narrowed the problem down to the support/include/class.ticket.php file. It seems when i edit this file and upload it to the server the webpage doesn't show, if i replace it with the file that came with the osTicket zip file the page loads again. I've attached a copy of the edited class.ticket.php file. I am trying to insert a new field called 'callsign' for your information.

Thanks in advance

Josh

I have a similar problem. I can see the page to create the ticket, but when I submit it, I simply get a blank white page. The ticket is never created. Any suggestions?

a month later

Help

Hi,

I've tried to insert the right code but i'm new to php and mysql.

I edited open.php and the new field shows. I've made a new table in mysql for the field. I've edited the class file but when i make a new ticket it doesn't write the data into the new field in the database. I'm afraid i've made an error changing the class file.

Is there anyone dutch on this forum who can explain to me what to insert and where to insert it ?

Thanks,

Sander