View Full Version : Preifill data in the open ticket form
I have recently upgrade from 1.3 (supplied with Parallels Cpanel) to 1.6 ~RC4.
Previously I was able to pre-fill the Name and email options by URL variables.
www.xyz.com/index.php?name=me&email=me@xyz.com.
On the new version this does not seem to work.
I have tried:
www.xyz.com/index.php?name=me&email=me@xyz.com.
www.xyz.com/open.php?name=me&email=me@xyz.com.
Any suggestions as to how to get this to work?
jpowers40828
10-26-2008, 06:24 PM
Sure in include/client/open.inc.php ~ line 3 ADD
if($_GET['name']) $info['name'] = $_GET['name'];
if($_GET['email']) $info['email'] = $_GET['email'];
Then reference www.xyz.com/open.php?name=me&email=me@xyz.com
jpowers
Thanks, have tried this but it does not seem to work.
The first few lines on include/client/open.inc.php now read
<?php
if(!defined('OSTCLIENTINC')) die('Kwaheri rafiki wangu?'); //Say bye to our friend..
if($_GET['name']) $name = $_GET['name'];
if($_GET['email']) $email = $_GET['email'];
$info=($_POST && $errors)?Format::htmlchars($_POST):array(); //on error...use the post data
?>
If I changed the code around the input box from:
<?if ($thisclient && ($name=$thisclient->getName())) {
?>
<input type="hidden" name="name" value="<?=$name?>"><?=$name?>
<?}else {?>
<input type="text" name="name" size="25" value="<?=$info['name']?>">
<?}?>
to:
<input type="hidden" name="name" value="<?=$name?>"><?=$name?>
It then shows as text, not as an input box.
This ok for what I want for now but would like the option to have an input box prefilled. Can this be done?
Think I got it, if i use
<input type="text" name="name" size="25" value="<?=$name?>">
It works. Can you tell me what the thisclient/getname is all about and what I am doing by losing it?
Thanks again
jpowers40828
10-27-2008, 02:10 PM
I edited my original post, that should work now. What you changed that made it work wasn't getting rid of the thisclient part, its changing the <?=$info['name']?> to <?=$name?> which is the variable I was setting the variables from the link to. The thisclient part automatically fills in the data when the person is logged in.
Thanks again worka perfectly now
blorenzo
10-31-2008, 11:13 AM
I am looking for something similar, for the most part what i was looking to do was to be able to type someones name and it bring up all of their information in the new ticket fields for me.
Another way I kind of wanted to make it was that if we receive a call from "John Doe" and we Query "John Doe" to see all of the tickets we have opened for him in the past. Once we are viewing the ticket if their could be an option to "Open New Ticket for this person" and once we click that it opens a new ticket and fills in all of the fields like Name, Phone Number, Email for us. I have many custom fields that are different for everyone such as Serial Number and Salesman Number. Being able to auto fill this according to name or the press of a button on a previously open ticket would make everything easier. Any ideas??? And did i clearly explain what i am looking for?
jpowers40828
10-31-2008, 12:53 PM
I understand what you are saying. However, you probably wouldn't want this information available on the client side (otherwise anybody could get your client information). What might work for you is better is I wrote a mod for someone so that client information could be stored in the database, edited in the admin side, and can be implemented on either the client or staff client creation pages.
http://www.osticket.com/forums/showthread.php?t=1105
Maybe install the mod, if its close to something you are looking for, we can go from there.
blorenzo
11-04-2008, 11:51 AM
Sorry for the late response.
Yes you are correct. I do not want the clients to be able to use this function. Well not yet atleast, We take alot of phone calls and manually enter them in as tickets using the staff new ticket option. What you showed me is close to what I wanted.
It is policy/habit that when we receive a call that you Query the persons name which should bring up all tickets ever created for that particular person. They then review past problems and decide wheter to re-open a past ticket or if they should create a new one. I would like to make it easier on the staff (staff only) by having an option to "Open a New Ticket for this person". Primarily because we've added many custom fields and I feel our staff shound not have to type this out each time. I am not much of a PHP expert, I pretty much copy and paste code and scripts and try to modify them to the best of my ability. What you showed me is pretty efficient and could me implimented to save time. In a sense what im tryin to do is take information from one ticket and import it into a new ticket. Is this possible? Can this button/link be constructed?
Thank you for your time.
jpowers40828
11-04-2008, 01:04 PM
The best way it would be possible is while actually looking at a ticket that has been created, not just looking at the search. This is just because the search may be for different items, where looking at a ticket the same data can be used to create the ticket each time. The way the mod i wrote works is by storing the data in a seperate table, so each client can have as much information stored as needed. This is then referenced on when displaying each ticket. That said, you would want any data that is going to stay the same or be immaterial if changed to be stored in the client table and data that may vary from call to call or even when a client upgrades (so old tickets don't show the new upgrades, they show what was there when the ticket was created) doesn't change historical data. However, the data that should not change over time, such as hardware and software information, could be stored in both places, so that when a new ticket it is created the field is automatically filled in from the client table but referenced from the ticket table in the future. I guess to proceed, you can either modify the mod to work for you, or if you don't feel comfortable, you can send me a list of fields you want and I can change it for you.
jpowers40828
11-04-2008, 01:07 PM
Otherwise it would be possible to just make a link that includes all the information from the ticket you are looking at and use it to create the new ticket. Only downfall would be if that ticket is lacking some information. If that is more what you are looking for.
blorenzo
11-04-2008, 09:52 PM
Otherwise it would be possible to just make a link that includes all the information from the ticket you are looking at and use it to create the new ticket. Only downfall would be if that ticket is lacking some information. If that is more what you are looking for.
Right on the money, If I open and view a past ticket and want to be able to press a link that opens a new ticket for that person including all of the information in the old ticket into a new one. And if it does lack information I assume they will be able to enter it if they have it avilable?
As for the MOD you wrote, it is pretty awesome and I intend to use it for the people who literally call us every other day and for them the drop down option is pretty sweet. However we have about 350 people who can call in at anytime so having a massive drop down menu isnt really appealing.
If you could give me a hand with the link that will import information from the ticket you are viewing to a new ticket it would be highly appreciated. I have no idea how to go about making it.
And again thanks alot.
jpowers40828
11-05-2008, 01:17 AM
In viewticket.inc.php ~ line 31 REPLACE
<td colspan=2 class="msg">
Ticket #<?=$ticket->getExtId()?> <a href="tickets.php?id=<?=$id?>" title="Reload"><span class="Icon refresh"> </span></a></td>
WITH
<td class="msg">
Ticket #<?=$ticket->getExtId()?> <a href="tickets.php?id=<?=$id?>" title="Reload"><span class="Icon refresh"> </span></a></td>
<td class="msg"><a href="tickets.php?a=open&name=<?=Format::htmlchars($ticket->getName())?>&email=<?=$ticket->getEmail()?>&phone=<?=Format::phone($ticket->getPhone())?>">Open New Ticket</a>
</td>
You should be able to get the idea from the link that was created of how to pull in the variables from the ticket. If not, upload your viewticket.inc.php and newticket.inc.php files and I can show you how.
Then in newticket.inc.php ~ line 4 AFTER
<?php
if(!defined('OSTSCPINC') || !is_object($thisuser) || !$thisuser->isStaff()) die('Access Denied');
$info=($_POST && $errors)?Format::htmlchars($_POST):array(); //on error...use the post data
ADD
if($_GET['name']) $info['name']=$_GET['name'];
if($_GET['email']) $info['email']=$_GET['email'];
if($_GET['phone']) $info['phone']=$_GET['phone'];
Should be that simple. I tested it with those 3 variables.
blorenzo
11-06-2008, 10:17 AM
Works like a charm! Perfect! Thanks! we are thrilled to have this in place and as for the client MOD we are going to use that also I just need to give it to my staff so they can add and delete clients.
Any hint on where i would put the code for the client mod if i wanted the staff to be able to view, add and delete clients?
jpowers40828
11-06-2008, 01:01 PM
Upload the zip files.
in include/class.nav.php ~ line 40 AFTER
$tabs['directory']=array('desc'=>'Directory','href'=>'directory.php','title'=>'Staff Directory');
ADD
$tabs['clients']=array('desc'=>'Clients','href'=>clients.php','title'=>'Clients');
in main.inc.php ~ line 107 AFTER
define('TOPIC_TABLE',TABLE_PREFIX.'help_topic');
define('GROUP_TABLE',TABLE_PREFIX.'groups');
ADD
define('CLIENT_TABLE',TABLE_PREFIX.'clients');
blorenzo
11-06-2008, 03:18 PM
I just attempted that and I got some kind of error... I will re-attempt it again tonight, maybe i did something wrong.
Also I would like to add that I tried adding custom fields to the client mod earlier while it was just in the admin pannel and those fields were not saving the information. What I did was add the tables to the database that i wanted to create then i modified the client.inc.php and clients.inc.php and successfully added the fields but when i went to save them it did not save.
The server i am using to host is down so im stuck waiting.......... :mad:
jpowers40828
11-06-2008, 04:02 PM
You are right, I missed changing one line. I reuploaded the files. The error was in scp/clients.php at the end, subnav was referencing admin.php instead of clients.php