osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now
Adding Reports To Organizations
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:
And then when we clicked the Reports tab, it will show this tabular data:
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> <?php echo __('Users'); ?></a></li>
class="icon-list-alt"></i> <?php echo __('Tickets'); ?></a></li>
class="icon-pushpin"></i> <?php echo __('Notes'); ?></a></li>
class="icon-bar-chart"></i> <?php echo __('Report'); ?></a></li>
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">
$notes = QuickNote::forOrganization($org);
$create_note_url = 'orgs/'.$org->getId().'/note';
include STAFFINC_DIR . 'templates/notes.tmpl.php';
<div class="hidden tab_content" id="reports">
include STAFFINC_DIR . 'templates/org-report.tmpl.php';
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)