mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-05 22:35:01 +00:00
Merge branch 'testing' of gitlab.com:Chill-Projet/chill-bundles into testing
This commit is contained in:
@@ -14,12 +14,13 @@ namespace Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators;
|
||||
use Chill\MainBundle\Entity\Address;
|
||||
use Chill\MainBundle\Entity\GeographicalUnitLayer;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
||||
use Chill\MainBundle\Repository\GeographicalUnitLayerRepositoryInterface;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ORM\Query\Expr\Join;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
@@ -30,14 +31,18 @@ final class GeographicalUnitStatAggregator implements AggregatorInterface
|
||||
{
|
||||
private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository;
|
||||
|
||||
private RollingDateConverterInterface $rollingDateConverter;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository,
|
||||
TranslatableStringHelperInterface $translatableStringHelper
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
RollingDateConverterInterface $rollingDateConverter
|
||||
) {
|
||||
$this->geographicalUnitLayerRepository = $geographicalUnitLayerRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->rollingDateConverter = $rollingDateConverter;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
@@ -59,8 +64,6 @@ final class GeographicalUnitStatAggregator implements AggregatorInterface
|
||||
)
|
||||
);
|
||||
|
||||
$qb->setParameter('acp_geog_aggregator_date', $data['date_calc']);
|
||||
|
||||
// link between location history and person
|
||||
$qb->leftJoin(
|
||||
PersonHouseholdAddress::class,
|
||||
@@ -76,7 +79,10 @@ final class GeographicalUnitStatAggregator implements AggregatorInterface
|
||||
)
|
||||
);
|
||||
|
||||
$qb->setParameter('acp_geog_aggregator_date', $data['date_calc']);
|
||||
$qb->setParameter(
|
||||
'acp_geog_aggregator_date',
|
||||
$this->rollingDateConverter->convert($data['date_calc'])
|
||||
);
|
||||
|
||||
// we finally find an address
|
||||
$qb->leftJoin(
|
||||
@@ -112,11 +118,10 @@ final class GeographicalUnitStatAggregator implements AggregatorInterface
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder
|
||||
->add('date_calc', ChillDateType::class, [
|
||||
->add('date_calc', PickRollingDateType::class, [
|
||||
'label' => 'Compute geographical location at date',
|
||||
'required' => true,
|
||||
'data' => new DateTimeImmutable('today'),
|
||||
'input' => 'datetime_immutable',
|
||||
'data' => new RollingDate(RollingDate::T_TODAY),
|
||||
])
|
||||
->add('level', EntityType::class, [
|
||||
'label' => 'Geographical layer',
|
||||
|
@@ -12,11 +12,12 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators;
|
||||
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
||||
use Chill\MainBundle\Repository\UserRepository;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||
use Chill\MainBundle\Templating\Entity\UserRender;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
@@ -26,16 +27,20 @@ final class ReferrerAggregator implements AggregatorInterface
|
||||
|
||||
private const P = 'acp_ref_agg_date';
|
||||
|
||||
private RollingDateConverterInterface $rollingDateConverter;
|
||||
|
||||
private UserRender $userRender;
|
||||
|
||||
private UserRepository $userRepository;
|
||||
|
||||
public function __construct(
|
||||
UserRepository $userRepository,
|
||||
UserRender $userRender
|
||||
UserRender $userRender,
|
||||
RollingDateConverterInterface $rollingDateConverter
|
||||
) {
|
||||
$this->userRepository = $userRepository;
|
||||
$this->userRender = $userRender;
|
||||
$this->rollingDateConverter = $rollingDateConverter;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
@@ -61,7 +66,10 @@ final class ReferrerAggregator implements AggregatorInterface
|
||||
)
|
||||
)
|
||||
)
|
||||
->setParameter(self::P, $data['date_calc']);
|
||||
->setParameter(
|
||||
self::P,
|
||||
$this->rollingDateConverter->convert($data['date_calc'])
|
||||
);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@@ -72,9 +80,8 @@ final class ReferrerAggregator implements AggregatorInterface
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder
|
||||
->add('date_calc', ChillDateType::class, [
|
||||
'input' => 'datetime_immutable',
|
||||
'data' => new DateTimeImmutable('now'),
|
||||
->add('date_calc', PickRollingDateType::class, [
|
||||
'data' => new RollingDate(RollingDate::T_TODAY),
|
||||
'label' => 'export.aggregator.course.by_referrer.Computation date for referrer',
|
||||
'required' => true,
|
||||
]);
|
||||
|
@@ -12,11 +12,12 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators;
|
||||
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
||||
use Chill\MainBundle\Repository\ScopeRepositoryInterface;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use LogicException;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
@@ -25,16 +26,20 @@ class ReferrerScopeAggregator implements AggregatorInterface
|
||||
{
|
||||
private const SCOPE_KEY = 'acp_agg_refscope_user_history_ref_scope_name';
|
||||
|
||||
private RollingDateConverterInterface $rollingDateConverter;
|
||||
|
||||
private ScopeRepositoryInterface $scopeRepository;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
ScopeRepositoryInterface $scopeRepository,
|
||||
TranslatableStringHelperInterface $translatableStringHelper
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
RollingDateConverterInterface $rollingDateConverter
|
||||
) {
|
||||
$this->scopeRepository = $scopeRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->rollingDateConverter = $rollingDateConverter;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
@@ -64,7 +69,10 @@ class ReferrerScopeAggregator implements AggregatorInterface
|
||||
)
|
||||
)
|
||||
)
|
||||
->setParameter($dateCalc, $data['date_calc']);
|
||||
->setParameter(
|
||||
$dateCalc,
|
||||
$this->rollingDateConverter->convert($data['date_calc'])
|
||||
);
|
||||
|
||||
// add groups
|
||||
$qb
|
||||
@@ -79,9 +87,8 @@ class ReferrerScopeAggregator implements AggregatorInterface
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('date_calc', ChillDateType::class, [
|
||||
'input' => 'datetime_immutable',
|
||||
'data' => new DateTimeImmutable('now'),
|
||||
$builder->add('date_calc', PickRollingDateType::class, [
|
||||
'data' => new RollingDate(RollingDate::T_TODAY),
|
||||
'label' => 'export.aggregator.course.by_user_scope.Computation date for referrer',
|
||||
'required' => true,
|
||||
]);
|
||||
|
Reference in New Issue
Block a user