Hi,
Requested this about a week ago or so.. Sorted it, so if it's of any use to anyone else, here's the mod.
What it does is add a button to the staff tickets page that toggles whether tickets are shown from just that user (or that users' department) or whether all tickets are shown.
Note: I did this on osTicket 1.6ST with all users set as admin.. don't ask me why, but it shouldn't be too hard to go through and add suitable " || showall=true" tags to anything with $thisuser->isAdmin(). :-)
Hope it's of use to someone.
+= Prerequisites =+
- Existing install
- Existing database
+= Config =+
- Log in as root/sudo up and edit ./main.inc.php
- Find:
define('SESSION_TTL', 86400); //Default 24 hours
- Below, add:
define('showall', NULL);
- Save and close;
- Open ./include/staff/tickets.inc.php
- Insert (~ 15)
$showall=$_SESSION;
- Find the following lines:
//limited depts....user can access tickets assigned to them regardless of the dept.
$qwhere =' WHERE (ticket.dept_id IN ('.implode(',',$depts).') OR ticket.staff_id='.$thisuser->getId().')';
- Replace with:
if($showall) {
$qwhere =' WHERE 1';
} else {
$qwhere =' WHERE (ticket.dept_id = '.$thisuser->getDeptId().' OR ticket.staff_id = '.$thisuser->getId().')';
- Find the first "" after " SEARCH FORM START "
- Below, insert:
<?php
$showbtn= $_POST;
switch( $showbtn ) {
case 'Show own tickets only':
showalloff();
break;
case 'Show all tickets':
showallon();
break;
default:
showButtons();
}
function showButtons()
{
?>
<form method="post" action=""> <?php
if($_SESSION == 'on'){?>
<input type="submit" name="showbtn" value="Show own tickets only">
<?php
}else{
if($_SESSION == NULL){?>
<input type="submit" name="showbtn" value="Show all tickets"> <?php
}}?>
</form>
<?php
}
function showallon() {
$_SESSION='on';
header("Location: #");
}
function showalloff() {
unset($_SESSION);
header("Location: #");
}
?>
Hope that helps someone. :-)