diff --git a/includes/model/UserAngelTypes_model.php b/includes/model/UserAngelTypes_model.php index 98a0d648..b4339238 100644 --- a/includes/model/UserAngelTypes_model.php +++ b/includes/model/UserAngelTypes_model.php @@ -238,18 +238,20 @@ function UserAngelType_by_User_and_AngelType($userId, $angeltype) * Get an UserAngelTypes by user * * @param int $userId + * @param bool $onlyConfirmed * @return array[]|null */ function UserAngelTypes_by_User($userId, $onlyConfirmed=false) { - return DB::select(' + return DB::select( + ' SELECT * FROM `UserAngelTypes` - '.($onlyConfirmed ? 'LEFT JOIN AngelTypes AS a ON a.id=UserAngelTypes.angeltype_id' : '').' + ' . ($onlyConfirmed ? 'LEFT JOIN AngelTypes AS a ON a.id=UserAngelTypes.angeltype_id' : '') . ' WHERE `user_id`=? ' . ( - $onlyConfirmed ? 'AND ( + $onlyConfirmed ? 'AND ( a.`restricted`=0 OR ( NOT `UserAngelTypes`.`confirm_user_id` IS NULL diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index 1c792f1c..8d6f17eb 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -195,7 +195,7 @@ function view_user_shifts() $rooms = load_rooms(); $types = load_types(); $ownTypes = []; - foreach (UserAngelTypes_by_User($user->id, FALSE) as $type) { + foreach (UserAngelTypes_by_User($user->id, true) as $type) { $ownTypes[] = (int)$type['angeltype_id']; }