From a3cead40c0f7eb1f2ecb1e52be438176d8f90ccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20B=C3=B6ttcher?= Date: Thu, 5 Sep 2024 13:12:04 +0200 Subject: [PATCH] [BUGFIX] Fix pagination in module for email list Related: in2code-de/powermail#1119 --- Classes/Controller/ModuleController.php | 9 +- .../Private/Partials/Module/Pagination.html | 128 +++++++++++++----- 2 files changed, 93 insertions(+), 44 deletions(-) diff --git a/Classes/Controller/ModuleController.php b/Classes/Controller/ModuleController.php index af7e76e16..7efa72a4f 100644 --- a/Classes/Controller/ModuleController.php +++ b/Classes/Controller/ModuleController.php @@ -93,13 +93,8 @@ public function listAction(): ResponseInterface $formUids = $this->mailRepository->findGroupedFormUidsToGivenPageUid((int)$this->id); $mails = $this->mailRepository->findAllInPid((int)$this->id, $this->settings, $this->piVars); - $currentPage = 1; - if ($this->request->hasArgument('tx_powermail_web_powermailm1')) { - $moduleArguments = $this->request->getArgument('tx_powermail_web_powermailm1'); - if (array_key_exists('currentPage', $moduleArguments)) { - $currentPage = (int)$moduleArguments['currentPage']; - } - } + $currentPage = (int)($this->request->getQueryParams()['currentPage'] ?? 1); + $currentPage = $currentPage > 0 ? $currentPage : 1; $itemsPerPage = (int)($this->settings['perPage'] ?? 10); $paginator = GeneralUtility::makeInstance(QueryResultPaginator::class, $mails, $currentPage, $itemsPerPage); diff --git a/Resources/Private/Partials/Module/Pagination.html b/Resources/Private/Partials/Module/Pagination.html index c09eec84b..a85d2429e 100644 --- a/Resources/Private/Partials/Module/Pagination.html +++ b/Resources/Private/Partials/Module/Pagination.html @@ -1,39 +1,93 @@