From 6a8c9a5c7f6b75fd76efe15b48c0b0509e644899 Mon Sep 17 00:00:00 2001 From: Siva Date: Tue, 9 May 2023 14:57:32 +0200 Subject: [PATCH] [BUGFIX] Fix issue with download csv and filter params Tasks: * Add functionality to check normalised params and the get the query values * Add condition to check array before processing Resolves: #14 --- Classes/Hooks/DatabaseRecordList.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Classes/Hooks/DatabaseRecordList.php b/Classes/Hooks/DatabaseRecordList.php index 158dda1..4b53a2c 100644 --- a/Classes/Hooks/DatabaseRecordList.php +++ b/Classes/Hooks/DatabaseRecordList.php @@ -45,10 +45,24 @@ public function modifyQuery( $route = $queryParams['route'] ?? ''; if (!empty($table) && $route === '/module/web/list') { $query = $queryParams['query'] ?? ''; - if ($query !== null) { + if (!empty($query)) { $filter = json_decode($query); - $filter ? $queryBuilder = GeneralUtility::makeInstance(QueryParser::class)->parse($filter, $queryBuilder) : null; + }else{ + $normalizedParams = $request->getAttribute('normalizedParams'); + $httpReferer = $normalizedParams->getHttpReferer(); + $query = parse_url($httpReferer); + if(!empty($query['query'])){ + $response = rawurldecode($query['query']); + // Recommended + parse_str($response, $output); + if(!empty($output['query'])){ + $filter = json_decode($output['query']); + } + } + } + + $filter ? $queryBuilder = GeneralUtility::makeInstance(QueryParser::class)->parse($filter, $queryBuilder) : null; } return $queryBuilder; }