- Edited
After several days of dissecting osTicket Code I finally figured this out!
You should be able to simply Copy & Paste the Modded files into your osTicket Folder to get this working. You will notice that My MODed files also include a new field called PCNAME. If you are interested in adding an additional field, I highly recommend ntoziers guide @ (http://www.tmib.net/adding-custom-text-fields-tickets)
include/ajax.users.php
$limit = isset($_REQUEST) ? (int) $_REQUEST:<STRONG><s>**</s>1<e>**</e></STRONG>;
$users=array();
$sql='SELECT DISTINCT email, name, pcname, phone'
.' FROM '.TICKET_TABLE
.' WHERE email LIKE \'%'.db_input(strtolower($_REQUEST), false).'%\' '
.' ORDER BY created DESC'
.' LIMIT '.$limit;
if(($res=db_query($sql)) && db_num_rows($res)){
while(list($email,$name,$pcname,$phone)=db_fetch_row($res)) {
$users = array('email'=>$email, 'name'=>$name, 'pcname'=>$pcname, 'phone'=>$phone, 'info'=>"$email - $name - $pcname - $phone");
}
}
Changing the limit above to "1" and setting the sort to order by DESC means that results will only show the most recent entry for that user.
scp/js/scp.js - Line 316
/* Typeahead user lookup */
$('#email.typeahead').typeahead({
source: function (typeahead, query) {
if(query.length > 2) {
$.ajax({
url: "ajax.php/users?q="+query,
dataType: 'json',
success: function (data) {
typeahead.process(data);
}
});
}
},
onselect: function (obj) {
var fObj=$('#email.typeahead').closest('form');
if(obj.name)
$('#name', fObj).val(obj.name);
if(obj.pcname)
$('#pcname', fObj).val(obj.pcname);
if(obj.phone)
$('#phone', fObj).val(obj.phone);
},
I think those are the only files necessary, I MODDED a lot of different files trying to get this working so if someone could please confirm! I will verify on a new install in 1.7 soon :)
UPDATE:
Verified on 1.7 fresh install. I would recommend manually opening the above files and making the modifcations yourself in order to avoid permission related issues. You can of course still feel free to copy / paste the MODed files below - Just make sure to double check permissions.
--------------------------------------------------------------------------------------------------------------------------
Check out My (1.7 Setup & MODS Guide)