Skip to content

Commit

Permalink
Merge pull request #2 from Pitoune/fix/backend-filter
Browse files Browse the repository at this point in the history
Fix backend filter
  • Loading branch information
Pierre Ducoudray authored Jan 17, 2017
2 parents 065205e + 981301d commit b796769
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Controller/ReportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'), [
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions DataFetcher/TimePeriod.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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,
];
Expand All @@ -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;
Expand Down

0 comments on commit b796769

Please sign in to comment.