[BUGFIX] Sql query export to use search_result_labels setting 39/58839/2
authorlsascha <lsascha@gmail.com>
Wed, 26 Sep 2018 22:43:34 +0000 (00:43 +0200)
committerBenni Mack <benni@typo3.org>
Fri, 4 Jan 2019 19:21:34 +0000 (20:21 +0100)
Releases: master, 8.7
Resolves: #86396
Change-Id: I198fe52a8024dcf392582a78c3fce0f134ed6b7a
Reviewed-on: https://review.typo3.org/58839
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/sys_action/Classes/ActionTask.php

index 92bcc0c..e39d49f 100644 (file)
@@ -795,9 +795,6 @@ class ActionTask implements \TYPO3\CMS\Taskcenter\TaskInterface
             $sql_query = unserialize($record['t2_data']);
             if (!is_array($sql_query) || is_array($sql_query) && strtoupper(substr(trim($sql_query['qSelect']), 0, 6)) === 'SELECT') {
                 $actionContent = '';
-                $fullsearch = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\QueryView::class);
-                $fullsearch->formW = 40;
-                $fullsearch->noDownloadB = 1;
                 $type = $sql_query['qC']['search_query_makeQuery'];
                 if ($sql_query['qC']['labels_noprefix'] === 'on') {
                     $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] = 'on';
@@ -809,10 +806,13 @@ class ActionTask implements \TYPO3\CMS\Taskcenter\TaskInterface
                         $dataRows = GeneralUtility::makeInstance(ConnectionPool::class)
                             ->getConnectionForTable($sql_query['qC']['queryTable'])
                             ->executeQuery($sqlQuery)->fetchAll();
-                        $fullsearch->formW = 48;
                         // Additional configuration
-                        $GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels'] = 1;
+                        $GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels'] = $sql_query['qC']['search_result_labels'];
                         $GLOBALS['SOBE']->MOD_SETTINGS['queryFields'] = $sql_query['qC']['queryFields'];
+
+                        $fullsearch = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\QueryView::class, $GLOBALS['SOBE']->MOD_SETTINGS);
+                        $fullsearch->noDownloadB = 1;
+                        $fullsearch->formW = 48;
                         $cP = $fullsearch->getQueryResultCode($type, $dataRows, $sql_query['qC']['queryTable']);
                         $actionContent = $cP['content'];
                         // If the result is rendered as csv or xml, show a download link