Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

[MOD] - In progress - Inventory System

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['ticketint'];
$ticketnum=$_POST['ticketnum'];
$barcode=$_POST['barcode'];

$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!

Comments

  • Hi,

    Seems like a great mod to me!
    Success with programming it!

    Cheers,
    Eric
  • Cloudpointoh,

    do you have the structure of the inv_devices table?

    does the $barcode variable contains exactly what is in the barcode field in the database? Otherwise you probably need to use % with your LIKE...

    Where does your PHP fall over or does the query return no results? Have you tried to print out the query and run it manually in MySQL? Does the query return any results then?

    Cheers

    Jonas
  • What is the status of this mod. I would really like to implement it. Thanks for your efforts.
  • cloudpointoh;23698 said:
    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['ticketint'];
    $ticketnum=$_POST['ticketnum'];
    $barcode=$_POST['barcode'];

    $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!


    Where is this system/ MOD sitting? Did you still need help? Is it done?
  • Just bumping with interest. I hope this mod isn't abandoned as I think it would be extremely useful.
  • I am possibly going to look at a MOD which will import from a third-party (perhaps OCS) so that people and assets appear in the same view. Has anyone heard anything about package distribution being looked at by any of the community mods?
  • bump

    +1 interest bumps. Nothing more?
  • I have not had a chance to look into this any further myself. It is on my todo list. I get the impression that people are looking for two different inventory systems however.

    1. would be a simplistic lookup to figure out basic machine info the person is using to when raising the ticket.

    2. would be a more advanced system which would be all-encompassing. Pulling in Printers, etc etc.

    I am personally interested in #2.
  • I am also interested in #2 Rick, but unfortunately paying projects have taken the priority...
  • This is likely going to be a phase two of my OS ticket implementation. I currently have OCS Inventory working in my environment so what I will need to do is work on or pay to have the bridge between OCS and OS ticket developed. A major hurdle (Peter has called this out as well) is that OS ticket does not use profiles for people. They leverage the email and the email link to build a list of common issues for a specific individual. When you're trying to build out option # 2 above there will need to be a fundamental shift in how OS ticket manages people and accounts. Almost like a contact table. For ease of integration it might be easier to use an email as the key to link but aside from that I have not given it more thought.

    In the coming months I will be posting some MODS to add features to OS ticket (not inventory) but they might be useful for others.
  • Thanks. Where is this you promised:"In the coming months I will be posting some MODS to add features to OS ticket (not inventory) "
  • ticksewee;42795 said:
    Thanks. Where is this you promised:"In the coming months I will be posting some MODS to add features to OS ticket (not inventory) "
    I posted my ticket linkage and categorization MODS (v 1.6 for now but 1.7 is almost done).
  • Rich_C,

    I have to say that 1.6 version looks pretty epic and I am looking forward to seeing the 1.7 version. :)
  • ntozier;42840 said:
    Rich_C,

    I have to say that 1.6 version looks pretty epic and I am looking forward to seeing the 1.7 version. :)

    I am literally putting the final touches on the MOD now. I am not sure if the core team would be interested in including it...i"d love for it to me included.
  • You can add it on github and try if you want. :) They might.
Sign In or Register to comment.