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

Adding Reports To Organizations

Hi, Guys...
I'm using osTicket 1.10 and sadly it is missing an Organization report, like how many ticket are opened and closed per organizations.

This is my first attempt on modifying codes and to be honest I'm not that good about coding. What I'm about to do is adding report below the organization details like this:


image

And then when we clicked the Reports tab, it will show this tabular data:


image


First thing to do, I'm adding the tab menu on 'org-view.inc.php'. Go to line 78-87 and then add Report tab below the Notes tab like this:

<ul class="clean tabs" id="orgtabs">
    <li class="active"><a href="#users"><i
    class="icon-user"></i>&nbsp;<?php echo __('Users'); ?></a></li>
    <li><a href="#tickets"><i
    class="icon-list-alt"></i>&nbsp;<?php echo __('Tickets'); ?></a></li>
    <li><a href="#notes"><i
    class="icon-pushpin"></i>&nbsp;<?php echo __('Notes'); ?></a></li>
    <li><a href="#reports"><i
    class="icon-bar-chart"></i>&nbsp;<?php echo __('Report'); ?></a></li>
</ul>

and then we will include the template data for the Report below the Notes template on line 100-106 like this:

<div class="hidden tab_content" id="notes">
<?php
$notes = QuickNote::forOrganization($org);
$create_note_url = 'orgs/'.$org->getId().'/note';
include STAFFINC_DIR . 'templates/notes.tmpl.php';
?>
</div>

<div class="hidden tab_content" id="reports">
<?php
include STAFFINC_DIR . 'templates/org-report.tmpl.php';
?>
</div>



Next, go to 'include/staff/templates' and create a new file 'org-report.tmpl.php'.

Now, at the moment I'm extremely confused since I don't know how osTicket linked (or JOIN) ticket ID with the associated organization ID, I can't find the exact code showing that. After checked out the database table, no org_id field on the ticket's table, so how did the osTicket know which ticket belongs to specific organization?

TO BE CONTINUED (I'm hungry, and I will post again after experimenting some codes)

Comments

  • You might want to check out software-mods.com (previously sudobash.net) Reports plugin.

    It's written and maintained by forum use @scottro here:
  • Thanks, ntozier

    This is a really good tips!
    I will check it out and hopefully this will suit my needs.
  • Olson, I suppose you have solved it but nyway, tickets are joined to users and users to Organizations, so you could get Org from the user-ticket.
    Unfortunelly, help topics are not joined to Org. I've done some indipients code modifications for selecting help topics depending on Org.
    Thanks Olson for your code.
Sign In or Register to comment.