Skip to content
Snippets Groups Projects
Commit 78a4d183 authored by Peter Rotich's avatar Peter Rotich
Browse files

Remove unnecessary 'staff_id IS NOT NULL' and make sure is array in updateDeptAccess

parent 09a27654
Branches
Tags
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment