[BUGFIX] Fix wrong total count in record list 43/49243/5
authorGeorg Ringer <georg.ringer@gmail.com>
Thu, 28 Jul 2016 11:37:39 +0000 (13:37 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Thu, 28 Jul 2016 14:32:27 +0000 (16:32 +0200)
Remove the offset and limit constraints to get the full count of records
in the record list.

Resolves: #77286
Resolves: #77278
Releases: master
Change-Id: I31ba1b6648b0f7caf0a633ab0d90a99e7880797a
Reviewed-on: https://review.typo3.org/49243
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php

index 0d70427..47f786d 100755 (executable)
@@ -869,7 +869,17 @@ class AbstractDatabaseRecordList extends AbstractRecordList
      */
     public function setTotalItems(string $table, int $pageId, array $constraints)
     {
-        $queryBuilder = $this->getQueryBuilder($table, $pageId, $constraints);
+        $queryParameters = $this->buildQueryParameters($table, $pageId, ['*'], $constraints);
+        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
+            ->getQueryBuilderForTable($queryParameters['table']);
+        $queryBuilder->getRestrictions()
+            ->removeAll()
+            ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
+            ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
+        $queryBuilder
+            ->from($queryParameters['table'])
+            ->where(...$queryParameters['where']);
+
         $this->totalItems = (int)$queryBuilder->count('*')
             ->execute()
             ->fetchColumn();