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)

[AutoFill_New Tickets MOD.zip](https://forum.osticket.com/assets/files/migrated/5/10112277769d8fbf52d06e22af2bedb.zip)

Before_vs_After_Autofill.jpg

5 days later

Works great in IE10 . Doesn't work for me in Firefox 20.0.1, it pulls the data in preview, but doesn't insert anything other than the name and email into the fields.

Is there a similar mod for the User side ticket creation?

Interesting...It works for me in Firefox 20.0.1 and IE 9.0.8. I would try to clear all your Cached files in Firefox. But i'm glad to hear you got it working in IE!

The LDAP authentication MOD has client side autofill built into it. You can find that MOD @ (http://osticket.com/forums/showthread.php?t=13731)

If you aren't interested in the MOD and only want the client Side auto-fill feature you may be able to dissect the code you need from the above MOD...

~Cheers

Interesting...It works for me in Firefox 20.0.1 and IE 9.0.8. I would try to clear all your Cached files in Firefox. But i'm glad to hear you got it working in IE!

The LDAP authentication MOD has client side autofill built into it. You can find that MOD @ (http://osticket.com/forums/showthread.php?t=13731)

If you aren't interested in the MOD and only want the client Side auto-fill feature you may be able to dissect the code you need from the above MOD...

~Cheers

You were right about clearing the cache! Works great! Thanks for this mod!

And thanks for pointing me to the LDAP mod, I will check it out next.

You were right about clearing the cache! Works great! Thanks for this mod!

And thanks for pointing me to the LDAP mod, I will check it out next.

Awesome, Glad to hear that did the trick.

8 days later

Interesting mod.

Would this work if I wanted to pull information ( user name, account number ) from wordpress if a user had the need to open a ticket ?

Would this work if I wanted to pull information ( user name, account number ) from wordpress if a user had the need to open a ticket ?

I'm not sure I understand the question... Are you asking if this will autofill for user created tickets Client side?

No, sorry for not being clear. I will have a word press reverse auction site running in a few weeks and right now all I can do is link the auction site to osTicket and then customer can open tickets. What I am wondering is if there is a way to capture the customer user name or client number and then the ticket automatically populates . I guess it would take some form of database connector. I am new to php Mysql so again I apologizes.

Barron

Customer name and client number are being stored in Mysql then? I would imagine this is possible - but it is really beyond the scope of this MOD and my PHP knowledge.

I would try to post this again under Troubleshooting and Problems Forum Section.

~Good Luck

Thanks man. I appreciate you entertaining my thought.

Barron

3 months later

Fab thanks! Nice work :)

Any ideas on how to do this search/behaviour for other fields, like the 'name' field or your pcname field?

Write a Reply...