PDA

View Full Version : Starting : Create Custom Fields for When Users Open New Tickets


Pfranco
02-07-2008, 05:06 PM
Hi. I started using OSTicket a while back.
I have begun work on a mod that will allow Admins to create custom fields VIA the control Panel.

I will be straight foreward .
I am cloning the help_topic for the most part. I figure what is the point in writing all new scripting for a mod when the help_topic piece will suit the needs with some spiffy modifications.

The initial release of this mod will consist of the Admins will only be able to edit a predefined field. This is only for initial beta purposes. When I have the admin side to the point where all edits are flawless I will then add the functionablilty to add and edit new fields.

Admins do at this time have the ability to add as many different options to the single custom field as they wish.

For demo please visit http://PulseWebSolutions.com/octest
if the site is not up it will not be down long so please keep trying.

I do however need one thing from the developers if possible.
Can I please have a listing of the Files that have any pertinance to the
help_topics module.
Preferrably a directoy structure and file name

For example.
root/includes/client/open.inc.php
Becasue it has direct relevance to the Help Topics mod that comes stock with OSTicket.
Obviously since I am using the Help Topics Mod for a template I need to know every file used for its structure.
Most I have found but some help would be much appreciated.

Once project is finished I wll submit to OSTicket Developers for Deployment should they choose to utalize.

Please any and all feedback is welcomed and needed. I cannot stress how important it really is to get solid feedback and suggestions to make this a succesfull mod.

Thanks in advance..
Pfranco
I/T Manager , Systems Admin, Network Admin

Wicher
05-21-2008, 03:23 AM
Hello, I see your message was from quite long ago... I wonder if you will read this...

Anyway I am desperatly trying to figure out how I can add some extra fields to the open.inc.php....

I think this is something that many people would like to know.. Lets try to figure it out together!

Here is how I started....

As far as I could understand / figure out these things need to be modified?? please let me know if ther eis more..
- table ---> ost_ticket
- support/include/class.ticket.php
- support/include/client/open.inc.php

I would like my customers to also fill in their Adress, Postal Code and City..

First I created these 3 fields in the database table ost_ticket (I did the same properties on these fields as the already excisting email field).

I am not sure if I am doing this correctly... then I have made an INDEX for the fields too, the key name is the same as the field name.. (as I noticed that the email field is also indexed)

Now I started to modify the open.inc.php (in support/include/client/)
I simply copied the excisting lines for the email field and adjusted those to point to the fields I created for "Postal Code"

like this..
<tr>
<th width="20%">Postcode:</th>
<td>
<?if ($thisclient && ($postcode=$thisclient->getPostcode())) {
?>
<input type="hidden" name="Postcode" value="<?=$postcode?>"><?=$postcode?>
<?}else {?>
<input type="text" name="postcode" size="25" value="<?=$info['postcode']?>">
<?}?>
&nbsp;<font class="error">*&nbsp;<?=$errors['postcode']?></font>
</td>
</tr>




then I went to class.ticket.php to add the variables??

like this (not pasting everything... just partly)
class Ticket{

var $id;
var $extid;
var $email;
var $status;
var $postcode

then in this same file I found these parts... and I added that too..

}

function getPostcode(){
return $this->postcode;
}
Doing this doesn't make it work... It isn't as easy as I hoped it would be... I hope someone that knows PHP can help the community! I am so stuck...

fadi
06-17-2008, 12:55 AM
We can now customize fields while the user opens tickets.
follow the following steps
1) create new fields on the page newticket.php in the staff direcotry
2) open class.ticket and go to create function and add new variables

function create($var,&$errors,$origin,$autorespond=true,$alertstaff=true ) {

//$Category = $_POST['cmb_1'];
global $cfg,$thisclient,$_FILES;
$HDcategory=$_POST['cmb_1'];
$HDtype=$_POST['cmb_2'];
$HDitem=$_POST['cmb_3'];

$HDcenter=$_POST['cmb_4'];
$HDsystem=$_POST['cmb_5'];

$HDclient=$_POST['cmb_6'];
$HDmid=$_POST['cmb_7'];


//and simply insert the values where he inserts his values


',HDCat='.db_input($HDcategory).
',HDType='.db_input($HDtype).
',HDItem='.db_input($HDitem).

',HDCentre='.db_input($HDcenter).
',HDSystem='.db_input($HDsystem).

',HDClient='.db_input($HDclient).
',HDMid='.db_input($HDmid).

',HDRootCauseCat='.db_input($HDrootcausecat).
',HDRootCauseType='.db_input($HDrootcausetype);


let me know if there are any concerns
________
RZ350 (http://www.cyclechaos.com/wiki/Yamaha_RZ350)

Frink09
06-17-2008, 03:59 PM
this might be of some use

http://osticket.com/forums/showthread.php?t=873