fix some remarks in 111_export review

This commit is contained in:
Mathieu Jaumotte 2022-08-31 15:27:03 +02:00
parent bee5336c1d
commit d86b86487f
3 changed files with 20 additions and 8 deletions

View File

@ -59,9 +59,9 @@ class BetweenDatesFilter implements FilterInterface
}
$qb->add('where', $where);
$qb->setParameter('dateFrom', $data['date_from']);
$qb->setParameter('dateFrom', $data['date_from'], Types::DATE_MUTABLE);
// modify dateTo so that entire day is also taken into account up until the beginning of the next day.
$qb->setParameter('dateTo', $data['date_to']->modify('+1 day'));
$qb->setParameter('dateTo', $data['date_to']->modify('+1 day'), Types::DATE_MUTABLE);
}
public function applyOn(): string

View File

@ -5,6 +5,8 @@ namespace Chill\PersonBundle\Export\Aggregator\HouseholdAggregators;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Query\Expr\Andx;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
@ -100,6 +102,15 @@ class ChildrenNumberAggregator implements AggregatorInterface
$qb->expr()->isNull('composition.endDate')
)
);
if ($where instanceof Andx) {
$where->add($clause);
} else {
$where = $qb->expr()->andX($clause);
}
$qb->add('where', $where);
$qb->setParameter('ondate', $data['on_date'], Types::DATE_MUTABLE);
}
/**

View File

@ -15,6 +15,7 @@ use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository;
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
@ -22,12 +23,13 @@ final class ActionTypeAggregator implements AggregatorInterface
{
private SocialActionRepository $socialActionRepository;
private TranslatableStringHelper $translatableStringHelper;
private SocialActionRender $actionRender;
public function __construct(SocialActionRepository $socialActionRepository, TranslatableStringHelper $translatableStringHelper)
{
public function __construct(
SocialActionRepository $socialActionRepository,
SocialActionRender $actionRender
) {
$this->socialActionRepository = $socialActionRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole()
@ -62,7 +64,6 @@ final class ActionTypeAggregator implements AggregatorInterface
public function getLabels($key, array $values, $data)
{
//TODO certain social actions have the same title as other, but are linked to different social issues, should we make a visual distinction?
return function ($value): string {
if ('_header' === $value) {
return 'Social Action Type';
@ -70,7 +71,7 @@ final class ActionTypeAggregator implements AggregatorInterface
$sa = $this->socialActionRepository->find($value);
return $this->translatableStringHelper->localize($sa->getTitle());
return $this->actionRender->renderString($sa, []);
};
}