By popular demand, I have update the instructions for the Easy Custom Column for osTicket 1.9.4 for form lists.
What does this allow you to do?
It allows you to show a custom form list in your Agents Ticket Queue. This is rather helpful for when you have a list of items relating to your business and you want to be able to see it.
I have only tested this code with lists.
The full code can be found here:
https://gist.github.com/a-bennett/6febddc9e328151dc99a
For those who are interested in doing it themselves (or maybe have already edited there tickets.inc.php file) you can see the changes between the original file and the updated here:
https://gist.github.com/a-bennett/6febddc9e328151dc99a/revisions
How do I find the form ID?
- By looking at the table _form_field and finding your form object by looking down the list of the labels, then once you have found it taking the ID from that row.
- If you know how to inspect an web element, (using web inspector, firebug, etc) then you can try the following:
In the admin panel go to “Manage” -> “Forms” -> click on your form name.
Inspect the input field of the name of your item mine came up like this:
<input type=”text” size=”32″ name=”label-17″ value=”Business”>
Then take the number after the “label-X” so mine is 17.
For those interested here is a break down:
At the top of the file add the following two lines:
$ab_list[‘field_id’] = “XX”; //ID from from _form_field table
$ab_list[‘heading’] = “XXXXXXX”; //Name displayed to front end users.
~Line 169:
Update the $sortOptions array withe the following:
$sortOptions=array(‘date’=>’effective_date’,’ID’=>’ticket.`number`*1′,
‘pri’=>’pri.priority_urgency’,’name’=>’user.name’,’subj’=>’cdata.subject’,
‘status’=>’status.name’,’assignee’=>’assigned’,’staff’=>’staff’,
‘dept’=>’dept.dept_name’,
‘custom1’=>’Custom1′); //AB Added
~Line 253
Append to the end of the $qselect. variable the following: (remember to move the ;)
.’ ,cdata.’.$CustomList1Name.’ as Custom1′; //AB – Custom 1
~Line 262
Add the following to the $qfrom variable straight after the line:
.’ LEFT JOIN ‘.TABLE_PREFIX.’ticket__cdata cdata ON (cdata.ticket_id = ticket.ticket_id) ‘
.’ LEFT JOIN ‘.TABLE_PREFIX.’form_entry_values fentry_val ON (cdata.field_’.$ab_list[“field_id”].’ = fentry_val.entry_id) AND fentry_val.field_id = ‘.$ab_list[“field_id”] //AB We need to link to the form values as of 1.9.4
~Line 412
Add in the following header row just above the </tr>.
<!– AB – Custom Col 1 –>
<th width=”60″ >
<a <?php echo $custom1_sort; ?> href=”tickets.php?sort=custom1&order=<?php echo $negorder; ?><?php echo $qstr; ?>”
title=”Sort By <?php echo $CustomList1Desc; ?> <?php echo $negorder; ?>”><?php echo $CustomList1Desc; ?></a></th>
<!– AB – Custom Col 1 -–>
~Line 498
Add in the data row just about the </tr>
<!– AB – Custom Col 1 –>
<td nowrap> <?php echo $row[‘Custom1’]; ?> </td>
<!– AB – Custom Col 1 –>
~ Line 511
Finally update the footer colspan to make everything balanced.
<td colspan=”8″>