From 78a4d183a5989cc4e82f9714b0edf815f46382e3 Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Sat, 21 Jul 2012 16:23:07 -0400 Subject: [PATCH] Remove unnecessary 'staff_id IS NOT NULL' and make sure is array in updateDeptAccess --- include/class.group.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/class.group.php b/include/class.group.php index e53cb8538..b13082be9 100644 --- a/include/class.group.php +++ b/include/class.group.php @@ -86,7 +86,7 @@ class Group { if(!$this->members && $this->getNumUsers()) { $sql='SELECT staff_id FROM '.STAFF_TABLE - .' WHERE group_id='.db_input($this->getId()).' AND staff_id IS NOT NULL ' + .' WHERE group_id='.db_input($this->getId()) .' ORDER BY lastname, firstname'; if(($res=db_query($sql)) && db_num_rows($res)) { while(list($id)=db_fetch_row($res)) @@ -116,7 +116,8 @@ class Group { function updateDeptAccess($depts) { - if($depts) { + + if($depts && is_array($depts)) { foreach($depts as $k=>$id) { $sql='INSERT IGNORE INTO '.GROUP_DEPT_TABLE .' SET group_id='.db_input($this->getId()) @@ -126,7 +127,7 @@ class Group { } $sql='DELETE FROM '.GROUP_DEPT_TABLE.' WHERE group_id='.db_input($this->getId()); - if($depts) // just inserted departments IF any. + if($depts && is_array($depts)) // just inserted departments IF any. $sql.=' AND dept_id NOT IN('.implode(',', db_input($depts)).')'; db_query($sql); -- GitLab