- Edited
We use OST pretty heavily in my workplace and we have an inventory system that somebody wrote a while back that works but doesn't integrate with our tickets and frankly is a bit difficult to use. So I decided that I would start to build an inventory system that integrates with OSTicket. I'm probably 30% of the way done and I've hit a brick wall and need some help. I promise once I'm finished I'll do a full write-up and post all of the source, but until I get there, I'm gonna need some help.
In /include/staff/viewticket.inc.php I've added another tab beside the reassign to tab. In there I have the following code:
<div id="devices" class="tabbertab" align="left">
<h2>Attach Devices</h2>
<p>
<form action="../include/staff/ticketrel.inc.php" name="ticketrel" method='post'>
<table>
<tr>
<td>Enter Device Barcode to Attach to Ticket: </td>
<td><input type='text' id='barcode' name='barcode' size=30></td>
<input type='hidden' name='ticketnum' value='<?=$ticket->getExtId()?>'>
<input type='hidden' name='ticketint' value='<?=$ticket->getId()?>'>
<td><input type='submit' class='button' value='Attach'></td>
</tr>
</table>
</form>
</p>
I'm having problems selecting the deviceuid from the inv_devices table in my post script. Here is an excerpt from it:
$con = mysql_connect("localhost","root","hcserv1!");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("netops", $con);
$ticketint=$_POST;
$ticketnum=$_POST;
$barcode=$_POST;
$select="SELECT `deviceuid` FROM `inv_devices` WHERE `barcode` like '".$barcode."'";
$select2=mysql_query($select);
$result=mysql_result($select2);
$insert="INSERT INTO inv_reltickets (ticketnum,deviceuid) VALUES ('".$ticketnum."','".$result."')";
if (!mysql_query($insert,$con))
{
die('Insert Error: ' . mysql_error());
}
Basically the idea for this section is to attach a device or device(s) to a specific ticket. I have a table inv_reltickets (related tickets) with the following columns:
rid (related id - Auto Increment)
ticketnum
deviceuid
rid populates fine on its own and the ticketnum works just fine as well.
I hope this makes sense... if not let me know and I'll try to explain better.
My plan is to offer the following features in my inventory system:
Linking devices to tickets
Adding devices quickly and easily
When viewing a device's details you will see related tickets
Setting a device's status (In the field, IS Cage, In for Repair, 3rd Party Repair, etc)
Running reports by office/location to see related devices
Show devices available for deployment into the field
Have a department/location Billing system (to mark that a device has been charged out to the proper location)
Among others.......
Let me know what you guys would like to see in the inventory system!