I'm tryng to add a custom field in the osticket, something like Serial No. Company Name and so on...
I've allready done it in osticket 1.6 but after the upgrade in 1.6 i've find some trouble, there's anyone that have allready do it?
First step is for sure:
ALTER TABLE ost_ticket ADD COLUMN `serial` VARCHAR(45) NULL AFTER `updated` ;
If you need some other fields, just replace 'serial' with a name of the field that you required.
Then we need to change the following file:
/osticket dir/include/class.ticket.php
Where the '....' are the other var of the class
class ticket {
....
....
var $serial; // Mod For a Custom Field by LarsSalazar
After this changes we need to add a function get in getter section.
class ticket {
// Mod function for get serial by LarsSalazar
function getSerial(){
return $this->ht;
}
Still in the getter section find the function getUpdateInfo() in $info array
class ticket {
$info=array('name' => $this->getName(),
...........
...........
'subject' => $this->getSubject(),
//mod for serial field by LarsSalazar
'serial' => $this->getSerial(),
............
Still in the same file, in function update() in $fields array add this string after $fields
// Mod for new field by LarsSalazar
$fields = array('type'=>'text', 'required'=>0, 'error'=>'Invalid Serial');
in fucntion create() in $fields array add this string after $fields
//Mod for new field by LarsSalazar
$fields = array('type'=>'text', 'required'=>0, 'error'=>'Invalid Serial');
Still in function create find the following code
$sql = 'INSERT INTO'
......
.' ,email='.db_input($vars)
and add
// Mod add field by LarsSalazar
.' ,serial='.db_input($vars)
/osticket dir/include/client/open.inc.php after the following code
<tr>
<th>Telephone:</th>
<td>
<input id="phone" type="text" name="phone" size="17" value="<?php echo $info; ?>">
<label for="ext" class="inline">Ext.:</label>
<input id="ext" type="text" name="phone_ext" size="3" value="<?php echo $info; ?>">
<font class="error"> <?php echo $errors; ?> <?php echo $errors; ?></font>
</td>
</tr>
add
Mod for new field by LarsSalazar
<tr>
<th>Serial:</th>
<td>
<input id="serial" type="text" name="serial" size="17" value="<?php echo $info; ?>">
<font class="error">* <?php echo $errors; ?></font>
</td>
</tr>
Mod for new field by LarsSalazar
/osticket dir/include/client/view.inc.php after the following code
<tr>
<th>Phone:</th>
<td><?php echo $ticket->getPhoneNumber(); ?></td>
</tr>
add
Start Mod custom Field by LarsSalazar
<tr>
<th>Serial:</th>
<td><?php echo $ticket->getSerial(); ?></td>
</tr>
End Mod custom Field by LarsSalazar
/osticket dir/include/staff/ticket-view.inc.php
<tr>
<th>Phone:</th>
<td><?php echo $ticket->getPhoneNumber(); ?></td>
</tr>
add
Start Mod custom Field by LarsSalazar
<tr>
<th>Serial:</th>
<td><?php echo $ticket->getSerial(); ?></td>
</tr>
End Mod custom Field by LarsSalazar