diff --git a/Configuration/TypoScript/setup.typoscript b/Configuration/TypoScript/setup.typoscript old mode 100755 new mode 100644 index 94728d2f..f61bd8f2 --- a/Configuration/TypoScript/setup.typoscript +++ b/Configuration/TypoScript/setup.typoscript @@ -127,6 +127,30 @@ plugin { @import 'EXT:cart/Configuration/TypoScript/Payments/setup.typoscript' @import 'EXT:cart/Configuration/TypoScript/Shippings/setup.typoscript' +module { + # settings of the backend module, Extbase reads them from the TypoScript setup (not from page TSconfig) + tx_cart { + settings { + format.currency { + currencySign = {$plugin.tx_cart.settings.format.currency.currencySign} + decimalSeparator = {$plugin.tx_cart.settings.format.currency.decimalSeparator} + thousandsSeparator = {$plugin.tx_cart.settings.format.currency.thousandsSeparator} + prependCurrency = {$plugin.tx_cart.settings.format.currency.prependCurrency} + separateCurrency = {$plugin.tx_cart.settings.format.currency.separateCurrency} + decimals = {$plugin.tx_cart.settings.format.currency.decimals} + } + + backend { + dateFormat = {$plugin.tx_cart.settings.backend.dateFormat} + } + } + } + + tx_form.settings.yamlConfigurations { + 1543219101 = EXT:cart/Configuration/Yaml/FormSetup.yaml + } +} + # use this lib to add custom information or content elements to your email template temp.cartMailContentElement = RECORDS @@ -178,7 +202,3 @@ lib { source = {$plugin.tx_cart.uids.lib.cartMailFooterImpress} } } - -module.tx_form.settings.yamlConfigurations { - 1543219101 = EXT:cart/Configuration/Yaml/FormSetup.yaml -} diff --git a/Configuration/page.tsconfig b/Configuration/page.tsconfig deleted file mode 100644 index b9f21f13..00000000 --- a/Configuration/page.tsconfig +++ /dev/null @@ -1,20 +0,0 @@ -tx_cart { - persistence { - storagePid = {$module.tx_cart.persistence.storagePid} - } - - settings { - format.currency { - currencySign = {$plugin.tx_cart.settings.format.currency.currencySign} - decimalSeparator = {$plugin.tx_cart.settings.format.currency.decimalSeparator} - thousandsSeparator = {$plugin.tx_cart.settings.format.currency.thousandsSeparator} - prependCurrency = {$plugin.tx_cart.settings.format.currency.prependCurrency} - separateCurrency = {$plugin.tx_cart.settings.format.currency.separateCurrency} - decimals = {$plugin.tx_cart.settings.format.currency.decimals} - } - - backend { - dateFormat = {$plugin.tx_cart.settings.backend.dateFormat} - } - } -} diff --git a/Tests/Functional/Controller/Backend/Order/OrderControllerTest.php b/Tests/Functional/Controller/Backend/Order/OrderControllerTest.php index 1d737db7..55f9d599 100644 --- a/Tests/Functional/Controller/Backend/Order/OrderControllerTest.php +++ b/Tests/Functional/Controller/Backend/Order/OrderControllerTest.php @@ -379,6 +379,23 @@ public function listActionRendersTheResetLinkOnlyIfThereIsAnActiveSearch(): void ); } + #[Test] + public function listActionFormatsPricesAndDatesWithTheSettingsOfTheTypoScriptOfCart(): void + { + $this->importPHPDataSet(__DIR__ . '/../../../../Fixtures/Orders.php'); + $this->includeTypoScriptOfCart(); + + $html = self::normalizeWhitespace( + (string) self::dispatchListAction(1, ['orderNumber' => 'O-20260222-1'])->getBody() + ); + + // order number and date, invoice number and date, total gross and net of the order in Tests/Fixtures/Orders.php + self::assertSame( + ['O-20260222-1', '2026-02-22', 'I-20260224-1', '2026-02-24', '21,52 €', '18,08 €'], + array_slice(self::getCellsOfOrderRow($html, 'O-20260222-1'), 3, 6) + ); + } + #[Test] public function listActionRendersOnlyTheOrdersOfTheMonthGivenAsOrderNumberSearchArgumentOnAllPages(): void { @@ -704,6 +721,41 @@ private function setItemsPerPage(int $itemsPerPage): void ); } + /** + * The static TypoScript of cart on the root page of the order storage, like a shop includes it. + */ + private function includeTypoScriptOfCart(): void + { + $this->getConnectionPool()->getConnectionForTable('sys_template')->insert( + 'sys_template', + [ + 'uid' => 1, + 'pid' => self::SHOP_ROOT_PID, + 'title' => 'Shop', + 'root' => 1, + 'clear' => 3, + 'include_static_file' => 'EXT:cart/Configuration/TypoScript', + ] + ); + } + + /** + * @return list the text of the cells of the row of the order in the order list + */ + private static function getCellsOfOrderRow(string $html, string $orderNumber): array + { + $orderList = mb_strstr($html, ']*>(?:(?!<\/tr>).)*' . preg_quote($orderNumber, '/') . '.*?<\/tr>/s', $orderList, $rowMatches); + self::assertArrayHasKey(0, $rowMatches, 'The order ' . $orderNumber . ' has not been rendered.'); + + preg_match_all('/]*>(.*?)<\/td>/s', $rowMatches[0], $cellMatches); + + return array_map( + static fn (string $cell): string => mb_trim(str_replace("\u{a0}", ' ', html_entity_decode(strip_tags($cell)))), + $cellMatches[1] + ); + } + private function createOrders(int $numberOfOrders): void { $connectionPool = $this->getConnectionPool();