diff --git a/app/controllers/admin/user.php b/app/controllers/admin/user.php index c73076aa9e9baf217ce004747ef2f4eb2434376d..4e8b2fe2e22a40b660d016fbbe8b50bba4da9ffc 100644 --- a/app/controllers/admin/user.php +++ b/app/controllers/admin/user.php @@ -123,6 +123,9 @@ class Admin_UserController extends AuthenticatedController $this->order = $this->order == 'desc' ? 'asc' : 'desc'; } + $request['sortby'] = $this->sortby; + $request['order'] = $this->order; + $empty_search = $request['perm'] === 'alle'; $values = [ diff --git a/lib/models/User.class.php b/lib/models/User.class.php index 7ec24aa2cfb650e7d97bec3f1d5d640e8f19b91f..30c38ad19dd6c0a3063e5488f150abebdd25c87d 100644 --- a/lib/models/User.class.php +++ b/lib/models/User.class.php @@ -448,31 +448,33 @@ class User extends AuthUserMd5 implements Range, PrivacyObject $query .= implode(' AND ', $where); $query .= " GROUP BY au.`user_id` "; - //sortieren - switch ($attributes['sort']) { - case "perms": - $query .= "ORDER BY au.`perms` {$attributes['order']}, au.`username`"; - break; - case "Vorname": - $query .= "ORDER BY au.`Vorname` {$attributes['order']}, au.`Nachname`"; - break; - case "Nachname": - $query .= "ORDER BY au.`Nachname` {$attributes['order']}, au.`Vorname`"; - break; - case "Email": - $query .= "ORDER BY au.`Email` {$attributes['order']}, au.`username`"; - break; - case "changed": - $query .= "ORDER BY uo.`last_lifesign` {$attributes['order']}, au.`username`"; - break; - case "mkdate": - $query .= "ORDER BY ui.`mkdate` {$attributes['order']}, au.`username`"; - break; - case "auth_plugin": - $query .= "ORDER BY `auth_plugin` {$attributes['order']}, au.`username`"; - break; - default: - $query .= " ORDER BY au.`username` {$attributes['order']}"; + if (!empty($attributes['sortby'])) { + //sortieren + switch ($attributes['sortby']) { + case "perms": + $query .= "ORDER BY au.`perms` {$attributes['order']}, au.`username`"; + break; + case "Vorname": + $query .= "ORDER BY au.`Vorname` {$attributes['order']}, au.`Nachname`"; + break; + case "Nachname": + $query .= "ORDER BY au.`Nachname` {$attributes['order']}, au.`Vorname`"; + break; + case "Email": + $query .= "ORDER BY au.`Email` {$attributes['order']}, au.`username`"; + break; + case "changed": + $query .= "ORDER BY uo.`last_lifesign` {$attributes['order']}, au.`username`"; + break; + case "mkdate": + $query .= "ORDER BY ui.`mkdate` {$attributes['order']}, au.`username`"; + break; + case "auth_plugin": + $query .= "ORDER BY `auth_plugin` {$attributes['order']}, au.`username`"; + break; + default: + $query .= " ORDER BY au.`username` {$attributes['order']}"; + } } return DBManager::get()->fetchAll($query, $params, __CLASS__ . '::buildExisting');