Showing Staff Members of Current Department on Batch Ticket Assign Modification in osTicket v1.6 RC5

For those of you who have implemented the modification I created about how to Add Batch Ticket Assign Feature into osTicket v1.6 RC5, and you want to display or show only staff members of current department on the staff selection list, then this modification is for you! Before you apply the following code, please remember that you have to implement the previous modification that shown via the link above.

Open your \include\staff\tickets.inc.php file, and find this code:

491
492
                                $sql=' SELECT staff_id,CONCAT_WS(", ",lastname,firstname) as name FROM '.STAFF_TABLE.
                                     ' WHERE isactive=1 AND onvacation=0 ';

then replace with this following code:

491
492
493
494
495
496
497
498
499
500
                                $depts=$thisuser->getDepts();
                                if ($thisuser->isadmin()) {
                                	$where = 'WHERE isactive=1 AND onvacation=0 AND dept.dept_id=staff.dept_id ';
                                } else {
                                	$where = 'WHERE isactive=1 AND onvacation=0 AND dept.dept_id=staff.dept_id '.
		                                      'AND (staff.dept_id IN ('.implode(',',$depts).') OR staff.staff_id='.$thisuser->getId().') ';
                                }
                                $sql='SELECT staff.staff_id,CONCAT_WS(", ",staff.lastname,staff.firstname) as name '.
				       ' FROM '.DEPT_TABLE.' dept, '.STAFF_TABLE.' staff '.
                                       ' '.$where.' ';
Share

321 viewsPrint This Post Print This Post

Speak Your Mind

*


*