? .class.contacts_sql.inc.php.swp
Index: class.categories.inc.php
===================================================================
RCS file: /var/cvs/phpgroupware/phpgwapi/inc/class.categories.inc.php,v
retrieving revision 1.74.2.20.2.20.50.1
diff -r1.74.2.20.2.20.50.1 class.categories.inc.php
242c242
< 		function return_sorted_array($start,$limit = True,$query = '',$sort = '',$order = '',$globals = False, $parent_id = '')
---
> 		function return_sorted_array($start,$limit = True,$query = '',$sort = '',$order = '',$globals = False, $parent_id = -1)
280c280,283
< 			$parent_select = ' AND cat_parent=' . $parent_id;
---
> 			if($parent_id != -1)
> 			{
> 				$parent_select = ' AND cat_parent=' . $parent_id;
> 			}
287,288c290,294
< 			$sql = "SELECT * from phpgw_categories WHERE (cat_appname='" . $this->app_name . "' AND" . $grant_cats . $global_cats . ")"
< 					. $querymethod;
---
> 			$sql = 'SELECT * from phpgw_categories '
> 				. "WHERE (cat_appname='" . $this->app_name . "'"
> 					. ' AND ' . $grant_cats 
> 					. $global_cats . ')'
> 				. $querymethod;
307a314
> 				$ids[] = (int)$this->db->f('cat_id');
313c320,322
< 				$sub_select = ' AND cat_parent=' . $cats[$i]['id'] . ' AND cat_level=' . ($cats[$i]['level']+1);
---
> 				$sub_select = ' AND cat_parent=' . $cats[$i]['id'] 
> 						. ' AND cat_level=' . ($cats[$i]['level']+1)
> 						. ' AND cat_id NOT IN(' . implode(',', $ids) . ')';
