diff --git a/typo3/sysext/impexp/Classes/Controller/ExportController.php b/typo3/sysext/impexp/Classes/Controller/ExportController.php index 73bf7a8e6312824a7969bde8b4f4ddcc35596eea..15b53a1d502a310a059681a510f5f56d57f9938b 100644 --- a/typo3/sysext/impexp/Classes/Controller/ExportController.php +++ b/typo3/sysext/impexp/Classes/Controller/ExportController.php @@ -129,8 +129,9 @@ class ExportController extends ImportExportController if (!array_key_exists('excludeDisabled', $inData)) { $inData['excludeDisabled'] = 1; } - // Set exclude fields in export object: - $inData['exclude'] ??= []; + if ($inData['resetExclude'] ?? false) { + $inData['exclude'] = []; + } $inData['preset']['public'] = (int)($inData['preset']['public'] ?? 0); return $inData; } diff --git a/typo3/sysext/impexp/Resources/Private/Partials/Export/Configuration.html b/typo3/sysext/impexp/Resources/Private/Partials/Export/Configuration.html index 16996de357c60af81ce76a9c44ba292fa665484a..fc74e313c23222f6f914fd3d5057577fa61d8bab 100644 --- a/typo3/sysext/impexp/Resources/Private/Partials/Export/Configuration.html +++ b/typo3/sysext/impexp/Resources/Private/Partials/Export/Configuration.html @@ -150,9 +150,9 @@ </f:if> </f:for> <div class="form-check"> - <input type="checkbox" name="tx_impexp[exclude]" id="checkExclude" value="1" + <input type="checkbox" name="tx_impexp[resetExclude]" id="checkResetExclude" value="1" class="form-check-input" /> - <label for="checkExclude" class="form-check-label"> + <label for="checkResetExclude" class="form-check-label"> <f:translate key="makeconfig_clearAllManualExclusions" /> </label> </div> diff --git a/typo3/sysext/impexp/Tests/Functional/Export/ExportControllerTest.php b/typo3/sysext/impexp/Tests/Functional/Export/ExportControllerTest.php index 85409e283366189d2d5e59eac578ecded3c75778..c0fac55fd79aa4021a3a921e72d88f570ac651c1 100644 --- a/typo3/sysext/impexp/Tests/Functional/Export/ExportControllerTest.php +++ b/typo3/sysext/impexp/Tests/Functional/Export/ExportControllerTest.php @@ -27,6 +27,7 @@ use TYPO3\CMS\Core\Http\ServerRequest; use TYPO3\CMS\Core\Imaging\IconFactory; use TYPO3\CMS\Core\Page\PageRenderer; use TYPO3\CMS\Impexp\Controller\ExportController; +use TYPO3\CMS\Impexp\Export; use TYPO3\CMS\Impexp\Tests\Functional\AbstractImportExportTestCase; use TYPO3\TestingFramework\Core\AccessibleObjectInterface; @@ -63,6 +64,44 @@ class ExportControllerTest extends AbstractImportExportTestCase self::assertArrayHasKey('tx_impexp_presets', $tables); } + public function resetExcludedRecordsDataProvider(): array + { + return [ + [ + ['exclude' => ['tt_content:1' => '1', 'tt_content:2' => '1']], + ['tt_content:1' => '1', 'tt_content:2' => '1'] + ], + [ + ['exclude' => ['tt_content:1' => '1', 'tt_content:2' => '1'], 'resetExclude' => 1], + [] + ] + ]; + } + + /** + * @test + * @dataProvider resetExcludedRecordsDataProvider + */ + public function resetExcludedRecords(array $requestParams, array $expected): void + { + $request = (new ServerRequest()) + ->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_BE) + ->withParsedBody([ + 'tx_impexp' => array_merge(['download_export' => 1], $requestParams) + ]); + + try { + $this->exportControllerMock->mainAction($request); + } catch (PropagateResponseException $e) { + // This exception is expected and not part of this test. + // It serves to prevent rendering the view. + } + + /** @var Export $export */ + $export = $this->exportControllerMock->_get('export'); + self::assertEquals($expected, $export->getExcludeMap()); + } + /** * @test */