diff -Nur osticket_1.6.rc2/upload/include/staff/dept.inc.php osticket_1.6.rc2-patch7/upload/include/staff/dept.inc.php --- osticket_1.6.rc2/upload/include/staff/dept.inc.php 2008-01-01 04:40:46.000000000 +0100 +++ osticket_1.6.rc2-patch7/upload/include/staff/dept.inc.php 2008-01-24 13:12:36.000000000 +0100 @@ -53,7 +53,13 @@ if($info['dept_id']) { //update - $users= db_query('SELECT staff_id,CONCAT_WS(" ",firstname,lastname) as name FROM '.STAFF_TABLE.' WHERE dept_id='.db_input($info['dept_id'])); + //$users= db_query('SELECT staff_id,CONCAT_WS(" ",firstname,lastname) as name FROM '.STAFF_TABLE.' WHERE dept_id='.db_input($info['dept_id'])); + // Allow every user that have access to dept to be manager of this dept, not only dept members (enable single member to manage several teams) + // For now on, exclude admins. (Why ?) + $users= db_query('SELECT distinct staff_id,CONCAT_WS(" ",firstname,lastname) AS name FROM '.STAFF_TABLE.' staff '. + 'LEFT JOIN '.GROUP_TABLE.' grp ON staff.group_id=grp.group_id '. + 'WHERE staff.dept_id='.db_input($info['dept_id']).' OR '. + '(grp.dept_access REGEXP \'(^|,)'.db_input($info['dept_id']).'(,|$)\' AND staff.isadmin=0);'); ?>