$left_joins .= ' left join tt_roles r on (u.role_id = r.id)';
$where_part = " where u.team_id = $this->team_id";
- if (isset($options['status'])) $where_part .= ' and u.status = '.(int)$options['status'];
+ if (isset($options['status']))
+ $where_part .= ' and u.status = '.(int)$options['status'];
+ else
+ $where_part .= ' and u.status is not null';
if ($includeSelf) {
$where_part .= " and (u.id = $this->id || r.rank <= ".(int)$options['max_rank'].')';
} else {
if (isset($options['max_rank'])) $where_part .= ' and r.rank <= '.(int)$options['max_rank'];
}
- $sql = $select_part.$from_part.$left_joins.$where_part;
+ $order_part = " order by upper(u.name)";
+
+ $sql = $select_part.$from_part.$left_joins.$where_part.$order_part;
$res = $mdb2->query($sql);
$user_list = array();
if (is_a($res, 'PEAR_Error'))