diff --git a/lib/Db/SignRequestMapper.php b/lib/Db/SignRequestMapper.php index 0ddc992e5..10b00d615 100644 --- a/lib/Db/SignRequestMapper.php +++ b/lib/Db/SignRequestMapper.php @@ -514,11 +514,21 @@ private function getFilesAssociatedFilesWithMeStmt( ?array $sort = [], ): Pagination { $qb = $this->getFilesAssociatedFilesWithMeQueryBuilder($userId, $filter); - if (!empty($sort) && in_array($sort['sortBy'], ['name', 'status', 'created_at'])) { - $qb->orderBy( - $qb->func()->lower('f.' . $sort['sortBy']), - $sort['sortDirection'] == 'asc' ? 'asc' : 'desc' - ); + if (!empty($sort['sortBy'])) { + switch ($sort['sortBy']) { + case 'name': + case 'status': + $qb->orderBy( + $qb->func()->lower('f.' . $sort['sortBy']), + $sort['sortDirection'] == 'asc' ? 'asc' : 'desc' + ); + break; + case 'created_at': + $qb->orderBy( + 'f.' . $sort['sortBy'], + $sort['sortDirection'] == 'asc' ? 'asc' : 'desc' + ); + } } $countQb = $this->getFilesAssociatedFilesWithMeQueryBuilder(