Tickets will be automatically assigned to the staff member and their department when running "Assign To Staff" and set back to support if the ticket is released.
See pics for demonstration:
Ticket arrives and is automatically in the default "Support" department:

Ticket is opened and assigned to staff member:

Ticket reflects change to staff member AND department assignment:

Ticket is released by staff member (or Admin):

Ticket is completely unassigned and back to default arrival:
(See first pic again - cannot include 5 pictures)
Code:
include/class.ticket.php
Comment out or remove the original code:
//set staff ID...assign/unassign/release (staff id can be 0)
//function setStaffId($staffId){
// $sql= 'UPDATE '.TICKET_TABLE.' SET staff_id='.db_input($staffId).' WHERE ticket_id='.db_input($this->getId());
// return (db_query($sql) && db_affected_rows())?true;
//}
and replace with:
//set staff ID...assign/unassign/release (staff id can be 0)
function setStaffId($staffId){
$getDEPT = mysql_query( "SELECT dept_id from ost_staff WHERE staff_id='$staffId' LIMIT 1" );
$setDept = mysql_fetch_assoc($getDEPT);
if(!$setDept){
$sql= 'UPDATE '.TICKET_TABLE.' SET staff_id=0, dept_id=1 WHERE ticket_id='.db_input($this->getId());
}else{
$sql= 'UPDATE '.TICKET_TABLE.' SET staff_id='.db_input($staffId).', dept_id='.$setDept.' WHERE ticket_id='.db_input($this->getId());
}
return (db_query($sql) && db_affected_rows())?true;
}