diff --git a/Controller/ReportController.php b/Controller/ReportController.php index 110e784..8ff176e 100644 --- a/Controller/ReportController.php +++ b/Controller/ReportController.php @@ -46,7 +46,7 @@ public function renderAction(Request $request) ); if ($request->query->has('configuration')) { - $configurationForm->submit($request->request->get($configurationForm->getName())); + $configurationForm->submit($request->query->get($configurationForm->getName())); } return $this->container->get('templating')->renderResponse($configuration->getTemplate('show.html'), [ @@ -75,7 +75,7 @@ public function embedAction(Request $request, $report, array $configuration = [] return $this->container->get('templating')->renderResponse('SyliusReportBundle::noDataTemplate.html.twig'); } - $configuration = ($request->query->has('configuration')) ? $request->query->get('configuration', $configuration) : $report->getDataFetcherConfiguration(); + $configuration = empty($configuration) ? $report->getDataFetcherConfiguration() : $configuration; $configuration['baseCurrency'] = $currencyProvider->getDefaultCurrencyCode(); $data = $this->getReportDataFetcher()->fetch($report, $configuration); diff --git a/DataFetcher/TimePeriod.php b/DataFetcher/TimePeriod.php index 8c09045..2307146 100644 --- a/DataFetcher/TimePeriod.php +++ b/DataFetcher/TimePeriod.php @@ -22,6 +22,7 @@ abstract class TimePeriod implements DataFetcherInterface { const PERIOD_DAY = 'day'; + const PERIOD_WEEK = 'week'; const PERIOD_MONTH = 'month'; const PERIOD_YEAR = 'year'; @@ -32,6 +33,7 @@ public static function getPeriodChoices() { return [ 'Daily' => self::PERIOD_DAY, + 'Weekly' => self::PERIOD_WEEK, 'Monthly' => self::PERIOD_MONTH, 'Yearly' => self::PERIOD_YEAR, ]; @@ -52,6 +54,9 @@ public function fetch(array $configuration) case self::PERIOD_DAY: $this->setExtraConfiguration($configuration, 'P1D', '%a', 'Y-m-d', ['date']); break; + case self::PERIOD_WEEK: + $this->setExtraConfiguration($configuration, 'P1W', '%W', 'W', ['week']); + break; case self::PERIOD_MONTH: $this->setExtraConfiguration($configuration, 'P1M', '%m', 'F Y', ['month', 'year']); break;