mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Fix filtres and scopes to take into account job and scope when the refferrer is add to the accompanying period work
This commit is contained in:
parent
63e9d1a96f
commit
68d28f3e28
@ -57,7 +57,7 @@ class ListActivityHelper
|
|||||||
->addSelect('AGGREGATE(actPerson.id) AS personsNames')
|
->addSelect('AGGREGATE(actPerson.id) AS personsNames')
|
||||||
->leftJoin('activity.users', 'users_u')
|
->leftJoin('activity.users', 'users_u')
|
||||||
->addSelect('AGGREGATE(users_u.id) AS usersIds')
|
->addSelect('AGGREGATE(users_u.id) AS usersIds')
|
||||||
->addSelect('AGGREGATE(users_u.id) AS usersNames')
|
->addSelect('AGGREGATE(JSON_BUILD_OBJECT(\'uid\', users_u.id, \'d\', activity.date)) AS usersNames')
|
||||||
->leftJoin('activity.thirdParties', 'thirdparty')
|
->leftJoin('activity.thirdParties', 'thirdparty')
|
||||||
->addSelect('AGGREGATE(thirdparty.id) AS thirdPartiesIds')
|
->addSelect('AGGREGATE(thirdparty.id) AS thirdPartiesIds')
|
||||||
->addSelect('AGGREGATE(thirdparty.id) AS thirdPartiesNames')
|
->addSelect('AGGREGATE(thirdparty.id) AS thirdPartiesNames')
|
||||||
@ -68,9 +68,9 @@ class ListActivityHelper
|
|||||||
->leftJoin('activity.location', 'location')
|
->leftJoin('activity.location', 'location')
|
||||||
->addSelect('location.name AS locationName')
|
->addSelect('location.name AS locationName')
|
||||||
->addSelect('activity.sentReceived')
|
->addSelect('activity.sentReceived')
|
||||||
->addSelect('IDENTITY(activity.createdBy) AS createdBy')
|
->addSelect('JSON_BUILD_OBJECT(\'uid\', IDENTITY(activity.createdBy), \'d\', activity.createdAt) AS createdBy')
|
||||||
->addSelect('activity.createdAt')
|
->addSelect('activity.createdAt')
|
||||||
->addSelect('IDENTITY(activity.updatedBy) AS updatedBy')
|
->addSelect('JSON_BUILD_OBJECT(\'uid\', IDENTITY(activity.updatedBy), \'d\', activity.updatedAt) AS updatedBy')
|
||||||
->addSelect('activity.updatedAt')
|
->addSelect('activity.updatedAt')
|
||||||
->addGroupBy('activity.id')
|
->addGroupBy('activity.id')
|
||||||
->addGroupBy('location.id');
|
->addGroupBy('location.id');
|
||||||
|
@ -395,6 +395,9 @@ export:
|
|||||||
by_creator_scope:
|
by_creator_scope:
|
||||||
Group activity by creator scope: Grouper les échanges par service du créateur de l'échange
|
Group activity by creator scope: Grouper les échanges par service du créateur de l'échange
|
||||||
Calc date: Date de calcul du service du créateur de l'échange
|
Calc date: Date de calcul du service du créateur de l'échange
|
||||||
|
by_creator_job:
|
||||||
|
Group activity by creator job: Grouper les échanges par service du créateur de l'échange
|
||||||
|
Calc date: Date de calcul du service du créateur de l'échange
|
||||||
|
|
||||||
generic_doc:
|
generic_doc:
|
||||||
filter:
|
filter:
|
||||||
|
@ -182,7 +182,10 @@ final readonly class ListAsideActivity implements ListInterface, GroupedExportIn
|
|||||||
{
|
{
|
||||||
$qb = $this->em->createQueryBuilder()
|
$qb = $this->em->createQueryBuilder()
|
||||||
->from(AsideActivity::class, 'aside')
|
->from(AsideActivity::class, 'aside')
|
||||||
->leftJoin('aside.agent', 'agent');
|
->leftJoin('aside.agent', 'agent')
|
||||||
|
->leftJoin('agent.scopeHistories', 'scopeHistories')
|
||||||
|
->andWhere('scopeHistories.startDate <= aside.date AND (scopeHistories.endDate IS NULL or scopeHistories.endDate > aside.date)')
|
||||||
|
;
|
||||||
|
|
||||||
$qb
|
$qb
|
||||||
->addSelect('aside.id AS id')
|
->addSelect('aside.id AS id')
|
||||||
@ -190,7 +193,7 @@ final readonly class ListAsideActivity implements ListInterface, GroupedExportIn
|
|||||||
->addSelect('aside.updatedAt AS updatedAt')
|
->addSelect('aside.updatedAt AS updatedAt')
|
||||||
->addSelect('IDENTITY(aside.agent) AS agent_id')
|
->addSelect('IDENTITY(aside.agent) AS agent_id')
|
||||||
->addSelect('IDENTITY(aside.createdBy) AS creator_id')
|
->addSelect('IDENTITY(aside.createdBy) AS creator_id')
|
||||||
->addSelect('IDENTITY(agent.mainScope) AS main_scope') ///
|
->addSelect('IDENTITY(scopeHistories.scope) AS main_scope')
|
||||||
->addSelect('IDENTITY(agent.mainCenter) AS main_center')
|
->addSelect('IDENTITY(agent.mainCenter) AS main_center')
|
||||||
->addSelect('IDENTITY(aside.type) AS aside_activity_type')
|
->addSelect('IDENTITY(aside.type) AS aside_activity_type')
|
||||||
->addSelect('aside.date')
|
->addSelect('aside.date')
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\AsideActivityBundle\Tests\Export\Export;
|
||||||
|
|
||||||
|
use Chill\AsideActivityBundle\Export\Export\ListAsideActivity;
|
||||||
|
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||||
|
use Doctrine\ORM\AbstractQuery;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
class ListAsideActivityTest extends KernelTestCase
|
||||||
|
{
|
||||||
|
private ListAsideActivity $listAsideActivity;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
self::bootKernel();
|
||||||
|
$this->listAsideActivity = self::$container->get(ListAsideActivity::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testExecuteQuery(): void
|
||||||
|
{
|
||||||
|
$qb = $this->listAsideActivity->initiateQuery([], [], [])
|
||||||
|
->setMaxResults(1);
|
||||||
|
|
||||||
|
$results = $qb->getQuery()->getResult(AbstractQuery::HYDRATE_ARRAY);
|
||||||
|
|
||||||
|
self::assertIsArray($results, "smoke test: test that the result is an array");
|
||||||
|
}
|
||||||
|
}
|
@ -292,9 +292,7 @@ class User implements UserInterface, \Stringable
|
|||||||
|
|
||||||
$sortedScopeHistories = $scopeHistories->toArray();
|
$sortedScopeHistories = $scopeHistories->toArray();
|
||||||
|
|
||||||
usort($sortedScopeHistories, function ($a, $b) {
|
usort($sortedScopeHistories, fn ($a, $b) => $a->getStartDate() < $b->getStartDate() ? 1 : -1);
|
||||||
return $a->getStartDate() < $b->getStartDate() ? 1 : -1;
|
|
||||||
});
|
|
||||||
|
|
||||||
return new ArrayCollection($sortedScopeHistories);
|
return new ArrayCollection($sortedScopeHistories);
|
||||||
}
|
}
|
||||||
@ -346,9 +344,7 @@ class User implements UserInterface, \Stringable
|
|||||||
|
|
||||||
$sortedJobHistories = $jobHistories->toArray();
|
$sortedJobHistories = $jobHistories->toArray();
|
||||||
|
|
||||||
usort($sortedJobHistories, function ($a, $b) {
|
usort($sortedJobHistories, fn ($a, $b) => $a->getStartDate() < $b->getStartDate() ? 1 : -1);
|
||||||
return $a->getStartDate() < $b->getStartDate() ? 1 : -1;
|
|
||||||
});
|
|
||||||
|
|
||||||
return new ArrayCollection($sortedJobHistories);
|
return new ArrayCollection($sortedJobHistories);
|
||||||
}
|
}
|
||||||
|
@ -281,9 +281,9 @@ class ExportAddressHelper
|
|||||||
};
|
};
|
||||||
|
|
||||||
case 'country':
|
case 'country':
|
||||||
return function ($value) use ($key) {
|
return function ($value) use ($sanitizedKey, $translationPrefix) {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'export.list.acp' . $key;
|
return $translationPrefix . $sanitizedKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $value) {
|
if (null === $value) {
|
||||||
|
@ -20,21 +20,64 @@ class UserHelper
|
|||||||
{
|
{
|
||||||
public function __construct(private readonly UserRender $userRender, private readonly UserRepositoryInterface $userRepository) {}
|
public function __construct(private readonly UserRender $userRender, private readonly UserRepositoryInterface $userRepository) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a callable that will transform a value into a string representing a user
|
||||||
|
*
|
||||||
|
* The callable may receive as argument:
|
||||||
|
*
|
||||||
|
* - an int or a string, the id of the user;
|
||||||
|
* - a string containing a json which will be decoded, and will have this structure: array{uid: int, d: string}. The job and scopes will be shown at this date
|
||||||
|
*
|
||||||
|
* @param string $key the key of the content
|
||||||
|
* @param array $values the list of values
|
||||||
|
* @param string $header the header's content
|
||||||
|
*/
|
||||||
public function getLabel($key, array $values, string $header): callable
|
public function getLabel($key, array $values, string $header): callable
|
||||||
{
|
{
|
||||||
return function ($value) use ($header) {
|
return function (null|int|string $value) use ($header) {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return $header;
|
return $header;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $value || null === $user = $this->userRepository->find($value)) {
|
if (null === $value) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->userRender->renderString($user, []);
|
if (is_numeric($value)) {
|
||||||
|
$uid = $value;
|
||||||
|
$date = null;
|
||||||
|
} else {
|
||||||
|
$decode = json_decode($value, true, 512, JSON_THROW_ON_ERROR);
|
||||||
|
$uid = $decode['uid'];
|
||||||
|
|
||||||
|
if (null === $uid) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$date = new \DateTimeImmutable($decode['d']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null === $user = $this->userRepository->find($uid)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->userRender->renderString($user, ['at' => $date]);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a callable that will transform a value into a string representing a user
|
||||||
|
*
|
||||||
|
* The callable may receive as argument:
|
||||||
|
*
|
||||||
|
* - an int or a string, the id of the user;
|
||||||
|
* - a string containing a json which will be decoded, and will have this structure: array{uid: int, d: string}. The job and scopes will be shown at this date * @param $key
|
||||||
|
*
|
||||||
|
* @param string $key the key of the element
|
||||||
|
* @param array $values a list of values
|
||||||
|
* @param string $header the header's content
|
||||||
|
* @return callable
|
||||||
|
*/
|
||||||
public function getLabelMulti($key, array $values, string $header): callable
|
public function getLabelMulti($key, array $values, string $header): callable
|
||||||
{
|
{
|
||||||
return function ($value) use ($header) {
|
return function ($value) use ($header) {
|
||||||
@ -46,31 +89,36 @@ class UserHelper
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$decoded = json_decode((string) $value, null, 512, JSON_THROW_ON_ERROR);
|
$decoded = json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR);
|
||||||
|
|
||||||
if (0 === count($decoded)) {
|
if (0 === count($decoded)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
$asStrings = [];
|
||||||
|
|
||||||
return
|
foreach ($decoded as $userId) {
|
||||||
implode(
|
if (is_array($userId)) {
|
||||||
'|',
|
$uid = $userId['uid'];
|
||||||
array_map(
|
$date = new \DateTimeImmutable($userId['d']);
|
||||||
function (int $userId) {
|
} else {
|
||||||
$user = $this->userRepository->find($userId);
|
$uid = $userId;
|
||||||
|
$date = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (null === $user) {
|
if (null === $uid) {
|
||||||
return '';
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->userRender->renderString($user, []);
|
$user = $this->userRepository->find($uid);
|
||||||
},
|
|
||||||
array_unique(
|
if (null === $user) {
|
||||||
array_filter($decoded, static fn (?int $userId) => null !== $userId),
|
continue;
|
||||||
SORT_NUMERIC
|
}
|
||||||
)
|
|
||||||
)
|
$asStrings[$uid] = $this->userRender->renderString($user, ['absence' => false, 'at' => $date]);
|
||||||
);
|
}
|
||||||
|
|
||||||
|
return implode('|', $asStrings);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<span class="chill-entity entity-user">
|
<span class="chill-entity entity-user">
|
||||||
{{- user.label }}
|
{{- user.label }}
|
||||||
{%- if opts['user_job'] and user.userJob is not null %}
|
{%- if opts['user_job'] and user.userJob(opts['at']) is not null %}
|
||||||
<span class="user-job">({{ user.userJob.label|localize_translatable_string }})</span>
|
<span class="user-job">({{ user.userJob(opts['at']).label|localize_translatable_string }})</span>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- if opts['main_scope'] and user.mainScope is not null %}
|
{%- if opts['main_scope'] and user.mainScope(opts['at']) is not null %}
|
||||||
<span class="main-scope">({{ user.mainScope.name|localize_translatable_string }})</span>
|
<span class="main-scope">({{ user.mainScope(opts['at']).name|localize_translatable_string }})</span>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- if opts['absence'] and user.isAbsent %}
|
{%- if opts['absence'] and user.isAbsent %}
|
||||||
<span class="badge bg-danger rounded-pill" title="{{ 'absence.Absent'|trans|escape('html_attr') }}">{{ 'absence.A'|trans }}</span>
|
<span class="badge bg-danger rounded-pill" title="{{ 'absence.Absent'|trans|escape('html_attr') }}">{{ 'absence.A'|trans }}</span>
|
||||||
|
@ -28,10 +28,14 @@ class UserRender implements ChillEntityRenderInterface
|
|||||||
'main_scope' => true,
|
'main_scope' => true,
|
||||||
'user_job' => true,
|
'user_job' => true,
|
||||||
'absence' => true,
|
'absence' => true,
|
||||||
|
'at' => null,
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly \Twig\Environment $engine, private readonly TranslatorInterface $translator) {}
|
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly \Twig\Environment $engine, private readonly TranslatorInterface $translator) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $entity
|
||||||
|
*/
|
||||||
public function renderBox($entity, array $options): string
|
public function renderBox($entity, array $options): string
|
||||||
{
|
{
|
||||||
$opts = array_merge(self::DEFAULT_OPTIONS, $options);
|
$opts = array_merge(self::DEFAULT_OPTIONS, $options);
|
||||||
@ -42,20 +46,23 @@ class UserRender implements ChillEntityRenderInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $entity
|
||||||
|
*/
|
||||||
public function renderString($entity, array $options): string
|
public function renderString($entity, array $options): string
|
||||||
{
|
{
|
||||||
$opts = array_merge(self::DEFAULT_OPTIONS, $options);
|
$opts = array_merge(self::DEFAULT_OPTIONS, $options);
|
||||||
|
|
||||||
$str = $entity->getLabel();
|
$str = $entity->getLabel();
|
||||||
|
|
||||||
if (null !== $entity->getUserJob() && $opts['user_job']) {
|
if (null !== $entity->getUserJob($opts['at']) && $opts['user_job']) {
|
||||||
$str .= ' (' . $this->translatableStringHelper
|
$str .= ' (' . $this->translatableStringHelper
|
||||||
->localize($entity->getUserJob()->getLabel()) . ')';
|
->localize($entity->getUserJob($opts['at'])->getLabel()) . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $entity->getMainScope() && $opts['main_scope']) {
|
if (null !== $entity->getMainScope($opts['at']) && $opts['main_scope']) {
|
||||||
$str .= ' (' . $this->translatableStringHelper
|
$str .= ' (' . $this->translatableStringHelper
|
||||||
->localize($entity->getMainScope()->getName()) . ')';
|
->localize($entity->getMainScope($opts['at'])->getName()) . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($entity->isAbsent() && $opts['absence']) {
|
if ($entity->isAbsent() && $opts['absence']) {
|
||||||
|
@ -11,13 +11,16 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators;
|
namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\Scope;
|
||||||
use Chill\MainBundle\Entity\User\UserJobHistory;
|
use Chill\MainBundle\Entity\User\UserJobHistory;
|
||||||
|
use Chill\MainBundle\Entity\UserJob;
|
||||||
use Chill\MainBundle\Export\AggregatorInterface;
|
use Chill\MainBundle\Export\AggregatorInterface;
|
||||||
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
||||||
use Chill\MainBundle\Repository\UserJobRepository;
|
use Chill\MainBundle\Repository\UserJobRepository;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverter;
|
use Chill\MainBundle\Service\RollingDate\RollingDateConverter;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkReferrerHistory;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\ORM\Query\Expr;
|
use Doctrine\ORM\Query\Expr;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
@ -29,7 +32,6 @@ final readonly class JobAggregator implements AggregatorInterface
|
|||||||
private const PREFIX = 'acp_work_action_agg_user_job';
|
private const PREFIX = 'acp_work_action_agg_user_job';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private RollingDateConverter $rollingDateConverter,
|
|
||||||
private UserJobRepository $jobRepository,
|
private UserJobRepository $jobRepository,
|
||||||
private TranslatableStringHelper $translatableStringHelper
|
private TranslatableStringHelper $translatableStringHelper
|
||||||
) {}
|
) {}
|
||||||
@ -44,27 +46,16 @@ final readonly class JobAggregator implements AggregatorInterface
|
|||||||
$p = self::PREFIX;
|
$p = self::PREFIX;
|
||||||
|
|
||||||
$qb
|
$qb
|
||||||
->leftJoin("acpw.referrers", "{$p}_user")
|
|
||||||
->leftJoin(
|
->leftJoin(
|
||||||
UserJobHistory::class,
|
UserJob::class,
|
||||||
"{$p}_history",
|
"{$p}_job",
|
||||||
Expr\Join::WITH,
|
Expr\Join::WITH,
|
||||||
$qb->expr()->eq("{$p}_history.user", "{$p}_user")
|
'EXISTS (SELECT 1 FROM ' . AccompanyingPeriodWorkReferrerHistory::class . " {$p}_ref_history
|
||||||
)
|
JOIN {$p}_ref_history.user {$p}_ref_history_user JOIN {$p}_ref_history_user.jobHistories {$p}_job_history
|
||||||
->andWhere(
|
WHERE {$p}_ref_history.accompanyingPeriodWork = acpw AND IDENTITY({$p}_job_history.job) = {$p}_job.id AND {$p}_job_history.startDate <= {$p}_ref_history.startDate
|
||||||
$qb->expr()->andX(
|
AND ({$p}_job_history.endDate IS NULL or {$p}_job_history.endDate >= {$p}_ref_history.startDate))"
|
||||||
$qb->expr()->lte("{$p}_history.startDate", ":{$p}_at"),
|
|
||||||
$qb->expr()->orX(
|
|
||||||
$qb->expr()->isNull("{$p}_history.endDate"),
|
|
||||||
$qb->expr()->gt("{$p}_history.endDate", ":{$p}_at")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
->addSelect("IDENTITY({$p}_history.job) as {$p}_select")
|
|
||||||
->setParameter(
|
|
||||||
"{$p}_at",
|
|
||||||
$this->rollingDateConverter->convert($data['job_at'])
|
|
||||||
)
|
)
|
||||||
|
->addSelect("{$p}_job.id as {$p}_select")
|
||||||
->addGroupBy("{$p}_select");
|
->addGroupBy("{$p}_select");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,17 +64,11 @@ final readonly class JobAggregator implements AggregatorInterface
|
|||||||
return Declarations::SOCIAL_WORK_ACTION_TYPE;
|
return Declarations::SOCIAL_WORK_ACTION_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder) {}
|
||||||
{
|
|
||||||
$builder->add('job_at', PickRollingDateType::class, [
|
|
||||||
'label' => 'export.aggregator.course_work.by_agent_job.Calc date',
|
|
||||||
'required' => true
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return ['job_at' => new RollingDate(RollingDate::T_TODAY)];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
|
@ -65,7 +65,7 @@ final readonly class ReferrerAggregator implements AggregatorInterface
|
|||||||
|
|
||||||
$r = $this->userRepository->find($value);
|
$r = $this->userRepository->find($value);
|
||||||
|
|
||||||
return $this->userRender->renderString($r, []);
|
return $this->userRender->renderString($r, ['absence' => false, 'user_job' => false, 'main_scope' => false]);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,13 +11,16 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators;
|
namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\Scope;
|
||||||
use Chill\MainBundle\Entity\User\UserScopeHistory;
|
use Chill\MainBundle\Entity\User\UserScopeHistory;
|
||||||
|
use Chill\MainBundle\Entity\UserJob;
|
||||||
use Chill\MainBundle\Export\AggregatorInterface;
|
use Chill\MainBundle\Export\AggregatorInterface;
|
||||||
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
||||||
use Chill\MainBundle\Repository\ScopeRepository;
|
use Chill\MainBundle\Repository\ScopeRepository;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverter;
|
use Chill\MainBundle\Service\RollingDate\RollingDateConverter;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkReferrerHistory;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\ORM\Query\Expr;
|
use Doctrine\ORM\Query\Expr;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
@ -29,7 +32,6 @@ final readonly class ScopeAggregator implements AggregatorInterface
|
|||||||
private const PREFIX = 'acp_work_action_agg_user_scope';
|
private const PREFIX = 'acp_work_action_agg_user_scope';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private RollingDateConverter $rollingDateConverter,
|
|
||||||
private ScopeRepository $scopeRepository,
|
private ScopeRepository $scopeRepository,
|
||||||
private TranslatableStringHelper $translatableStringHelper
|
private TranslatableStringHelper $translatableStringHelper
|
||||||
) {}
|
) {}
|
||||||
@ -44,27 +46,16 @@ final readonly class ScopeAggregator implements AggregatorInterface
|
|||||||
$p = self::PREFIX;
|
$p = self::PREFIX;
|
||||||
|
|
||||||
$qb
|
$qb
|
||||||
->leftJoin("acpw.referrers", "{$p}_user")
|
|
||||||
->leftJoin(
|
->leftJoin(
|
||||||
UserScopeHistory::class,
|
Scope::class,
|
||||||
"{$p}_history",
|
"{$p}_scope",
|
||||||
Expr\Join::WITH,
|
Expr\Join::WITH,
|
||||||
$qb->expr()->eq("{$p}_history.user", "{$p}_user")
|
'EXISTS (SELECT 1 FROM ' . AccompanyingPeriodWorkReferrerHistory::class . " {$p}_ref_history
|
||||||
)
|
JOIN {$p}_ref_history.user {$p}_ref_history_user JOIN {$p}_ref_history_user.scopeHistories {$p}_scope_history
|
||||||
->andWhere(
|
WHERE {$p}_ref_history.accompanyingPeriodWork = acpw AND IDENTITY({$p}_scope_history.scope) = {$p}_scope.id AND {$p}_scope_history.startDate <= {$p}_ref_history.startDate
|
||||||
$qb->expr()->andX(
|
AND ({$p}_scope_history.endDate IS NULL or {$p}_scope_history.endDate >= {$p}_ref_history.startDate))"
|
||||||
$qb->expr()->lte("{$p}_history.startDate", ":{$p}_at"),
|
|
||||||
$qb->expr()->orX(
|
|
||||||
$qb->expr()->isNull("{$p}_history.endDate"),
|
|
||||||
$qb->expr()->gt("{$p}_history.endDate", ":{$p}_at")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
->addSelect("IDENTITY({$p}_history.scope) as {$p}_select")
|
|
||||||
->setParameter(
|
|
||||||
"{$p}_at",
|
|
||||||
$this->rollingDateConverter->convert($data['scope_at'])
|
|
||||||
)
|
)
|
||||||
|
->addSelect("{$p}_scope.id as {$p}_select")
|
||||||
->addGroupBy("{$p}_select");
|
->addGroupBy("{$p}_select");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,17 +64,11 @@ final readonly class ScopeAggregator implements AggregatorInterface
|
|||||||
return Declarations::SOCIAL_WORK_ACTION_TYPE;
|
return Declarations::SOCIAL_WORK_ACTION_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder) {}
|
||||||
{
|
|
||||||
$builder->add('scope_at', PickRollingDateType::class, [
|
|
||||||
'label' => 'export.aggregator.course_work.by_agent_scope.Calc date',
|
|
||||||
'required' => true,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return ['scope_at' => new RollingDate(RollingDate::T_TODAY)];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
|
@ -132,7 +132,7 @@ class ListEvaluation implements ListInterface, GroupedExportInterface
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
'createdBy', 'updatedBy', 'acpw_acp_user' => $this->userHelper->getLabel($key, $values, 'export.list.eval.' . $key),
|
'createdBy', 'updatedBy', 'acpw_acp_user' => $this->userHelper->getLabel($key, $values, 'export.list.eval.' . $key),
|
||||||
'acpw_referrers' => $this->userHelper->getLabel($key, $values, 'export.list.eval.' . $key),
|
'acpw_referrers' => $this->userHelper->getLabelMulti($key, $values, 'export.list.eval.' . $key),
|
||||||
'acpw_persons_id' => $this->aggregateStringHelper->getLabelMulti($key, $values, 'export.list.eval.' . $key),
|
'acpw_persons_id' => $this->aggregateStringHelper->getLabelMulti($key, $values, 'export.list.eval.' . $key),
|
||||||
'acpw_persons' => $this->personHelper->getLabelMulti($key, $values, 'export.list.eval.' . $key),
|
'acpw_persons' => $this->personHelper->getLabelMulti($key, $values, 'export.list.eval.' . $key),
|
||||||
'eval_title' => $this->translatableStringExportLabelHelper
|
'eval_title' => $this->translatableStringExportLabelHelper
|
||||||
@ -252,8 +252,8 @@ class ListEvaluation implements ListInterface, GroupedExportInterface
|
|||||||
|
|
||||||
// referrers => at date XXXX
|
// referrers => at date XXXX
|
||||||
$qb
|
$qb
|
||||||
->addSelect('(SELECT IDENTITY(history.user) FROM ' . UserHistory::class . ' history ' .
|
->addSelect('(SELECT JSON_BUILD_OBJECT(\'uid\', IDENTITY(history.user), \'d\', history.startDate) FROM ' . UserHistory::class . ' history ' .
|
||||||
'WHERE history.accompanyingPeriod = acp AND history.startDate <= :calc_date AND (history.endDate IS NULL OR history.endDate > :calc_date)) AS acpw_referrers');
|
'WHERE history.accompanyingPeriod = acp AND history.startDate <= :calc_date AND (history.endDate IS NULL OR history.endDate > :calc_date)) AS referrers');
|
||||||
|
|
||||||
// persons
|
// persons
|
||||||
$qb
|
$qb
|
||||||
|
@ -18,6 +18,7 @@ use Chill\MainBundle\Form\Type\PickRollingDateType;
|
|||||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverter;
|
use Chill\MainBundle\Service\RollingDate\RollingDateConverter;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkReferrerHistory;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\ORM\Query\Expr;
|
use Doctrine\ORM\Query\Expr;
|
||||||
use Doctrine\ORM\Query\Expr\Andx;
|
use Doctrine\ORM\Query\Expr\Andx;
|
||||||
@ -32,7 +33,6 @@ class JobFilter implements FilterInterface
|
|||||||
private const PREFIX = 'acp_work_action_filter_user_job';
|
private const PREFIX = 'acp_work_action_filter_user_job';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly RollingDateConverter $rollingDateConverter,
|
|
||||||
protected TranslatorInterface $translator,
|
protected TranslatorInterface $translator,
|
||||||
private readonly TranslatableStringHelper $translatableStringHelper
|
private readonly TranslatableStringHelper $translatableStringHelper
|
||||||
) {}
|
) {}
|
||||||
@ -46,30 +46,14 @@ class JobFilter implements FilterInterface
|
|||||||
{
|
{
|
||||||
$p = self::PREFIX;
|
$p = self::PREFIX;
|
||||||
|
|
||||||
$qb
|
$qb->andWhere(
|
||||||
->leftJoin("acpw.referrers", "{$p}_user")
|
'EXISTS (SELECT 1 FROM ' . AccompanyingPeriodWorkReferrerHistory::class . " {$p}_ref_history
|
||||||
->leftJoin(
|
JOIN {$p}_ref_history.user {$p}_ref_history_user JOIN {$p}_ref_history_user.jobHistories {$p}_job_history
|
||||||
UserJobHistory::class,
|
WHERE {$p}_ref_history.accompanyingPeriodWork = acpw AND {$p}_job_history.job IN (:{$p}_job) AND {$p}_job_history.startDate <= {$p}_ref_history.startDate
|
||||||
"{$p}_history",
|
AND ({$p}_job_history.endDate IS NULL or {$p}_job_history.endDate >= {$p}_ref_history.startDate))"
|
||||||
Expr\Join::WITH,
|
);
|
||||||
$qb->expr()->eq("{$p}_history.user", "{$p}_user")
|
|
||||||
)
|
$qb->setParameter("{$p}_job", $data["job"]);
|
||||||
->andWhere(
|
|
||||||
$qb->expr()->andX(
|
|
||||||
$qb->expr()->lte("{$p}_history.startDate", ":{$p}_at"),
|
|
||||||
$qb->expr()->orX(
|
|
||||||
$qb->expr()->isNull("{$p}_history.endDate"),
|
|
||||||
$qb->expr()->gt("{$p}_history.endDate", ":{$p}_at")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
->andWhere(
|
|
||||||
$qb->expr()->in("{$p}_history.job", ":{$p}_job")
|
|
||||||
)
|
|
||||||
->setParameters([
|
|
||||||
"{$p}_job" => $data["job"],
|
|
||||||
"{$p}_at" => $this->rollingDateConverter->convert($data['job_at'])
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@ -88,10 +72,6 @@ class JobFilter implements FilterInterface
|
|||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
'expanded' => true,
|
'expanded' => true,
|
||||||
])
|
])
|
||||||
->add('job_at', PickRollingDateType::class, [
|
|
||||||
'label' => 'export.filter.work.by_user_job.Calc date',
|
|
||||||
'required' => true,
|
|
||||||
])
|
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ use Chill\MainBundle\Form\Type\PickRollingDateType;
|
|||||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverter;
|
use Chill\MainBundle\Service\RollingDate\RollingDateConverter;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkReferrerHistory;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\ORM\Query\Expr;
|
use Doctrine\ORM\Query\Expr;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
@ -30,7 +31,6 @@ class ScopeFilter implements FilterInterface
|
|||||||
private const PREFIX = 'acp_work_action_filter_user_scope';
|
private const PREFIX = 'acp_work_action_filter_user_scope';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly RollingDateConverter $rollingDateConverter,
|
|
||||||
protected TranslatorInterface $translator,
|
protected TranslatorInterface $translator,
|
||||||
private readonly TranslatableStringHelper $translatableStringHelper
|
private readonly TranslatableStringHelper $translatableStringHelper
|
||||||
) {}
|
) {}
|
||||||
@ -44,30 +44,13 @@ class ScopeFilter implements FilterInterface
|
|||||||
{
|
{
|
||||||
$p = self::PREFIX;
|
$p = self::PREFIX;
|
||||||
|
|
||||||
$qb
|
$qb->andWhere(
|
||||||
->leftJoin("acpw.referrers", "{$p}_user")
|
'EXISTS (SELECT 1 FROM ' . AccompanyingPeriodWorkReferrerHistory::class . " {$p}_ref_history
|
||||||
->leftJoin(
|
JOIN {$p}_ref_history.user {$p}_ref_history_user JOIN {$p}_ref_history_user.scopeHistories {$p}_scope_history
|
||||||
UserScopeHistory::class,
|
WHERE {$p}_ref_history.accompanyingPeriodWork = acpw AND {$p}_scope_history.scope IN (:{$p}_scope) AND {$p}_scope_history.startDate <= {$p}_ref_history.startDate
|
||||||
"{$p}_history",
|
AND ({$p}_scope_history.endDate IS NULL or {$p}_scope_history.endDate >= {$p}_ref_history.startDate))"
|
||||||
Expr\Join::WITH,
|
)
|
||||||
$qb->expr()->eq("{$p}_history.user", "{$p}_user")
|
->setParameter("{$p}_scope", $data["scope"]);
|
||||||
)
|
|
||||||
->andWhere(
|
|
||||||
$qb->expr()->andX(
|
|
||||||
$qb->expr()->lte("{$p}_history.startDate", ":{$p}_at"),
|
|
||||||
$qb->expr()->orX(
|
|
||||||
$qb->expr()->isNull("{$p}_history.endDate"),
|
|
||||||
$qb->expr()->gt("{$p}_history.endDate", ":{$p}_at")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
->andWhere(
|
|
||||||
$qb->expr()->in("{$p}_history.scope", ":{$p}_scope")
|
|
||||||
)
|
|
||||||
->setParameters([
|
|
||||||
"{$p}_scope" => $data["scope"],
|
|
||||||
"{$p}_at" => $this->rollingDateConverter->convert($data['scope_at'])
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn()
|
public function applyOn()
|
||||||
@ -86,10 +69,6 @@ class ScopeFilter implements FilterInterface
|
|||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
'expanded' => true,
|
'expanded' => true,
|
||||||
])
|
])
|
||||||
->add('scope_at', PickRollingDateType::class, [
|
|
||||||
'label' => 'export.filter.work.by_user_scope.Calc date',
|
|
||||||
'required' => true,
|
|
||||||
])
|
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\Address;
|
|||||||
use Chill\MainBundle\Entity\Scope;
|
use Chill\MainBundle\Entity\Scope;
|
||||||
use Chill\MainBundle\Export\Helper\DateTimeHelper;
|
use Chill\MainBundle\Export\Helper\DateTimeHelper;
|
||||||
use Chill\MainBundle\Export\Helper\ExportAddressHelper;
|
use Chill\MainBundle\Export\Helper\ExportAddressHelper;
|
||||||
|
use Chill\MainBundle\Export\Helper\UserHelper;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress;
|
use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress;
|
||||||
@ -59,8 +60,10 @@ final readonly class ListAccompanyingPeriodHelper
|
|||||||
'scopes',
|
'scopes',
|
||||||
'socialIssues',
|
'socialIssues',
|
||||||
'acpCreatedAt',
|
'acpCreatedAt',
|
||||||
|
'acpCreatedBy_id',
|
||||||
'acpCreatedBy',
|
'acpCreatedBy',
|
||||||
'acpUpdatedAt',
|
'acpUpdatedAt',
|
||||||
|
'acpUpdatedBy_id',
|
||||||
'acpUpdatedBy',
|
'acpUpdatedBy',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -75,6 +78,7 @@ final readonly class ListAccompanyingPeriodHelper
|
|||||||
private SocialIssueRender $socialIssueRender,
|
private SocialIssueRender $socialIssueRender,
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper,
|
private TranslatableStringHelperInterface $translatableStringHelper,
|
||||||
private TranslatorInterface $translator,
|
private TranslatorInterface $translator,
|
||||||
|
private UserHelper $userHelper,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data)
|
||||||
@ -104,6 +108,7 @@ final readonly class ListAccompanyingPeriodHelper
|
|||||||
|
|
||||||
return $this->translatableStringHelper->localize(json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR));
|
return $this->translatableStringHelper->localize(json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR));
|
||||||
},
|
},
|
||||||
|
'acpCreatedBy', 'acpUpdatedBy', 'referrer' => $this->userHelper->getLabel($key, $values, 'export.list.acp.' . $key),
|
||||||
'locationPersonName', 'requestorPerson' => function ($value) use ($key) {
|
'locationPersonName', 'requestorPerson' => function ($value) use ($key) {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'export.list.acp.' . $key;
|
return 'export.list.acp.' . $key;
|
||||||
@ -204,11 +209,11 @@ final readonly class ListAccompanyingPeriodHelper
|
|||||||
|
|
||||||
// add the field which are simple association
|
// add the field which are simple association
|
||||||
$qb
|
$qb
|
||||||
->leftJoin('acp.createdBy', "acp_created_by_t")
|
->addSelect('IDENTITY(acp.createdBy) AS acpCreatedBy_id')
|
||||||
->addSelect('acp_created_by_t.label AS acpCreatedBy');
|
->addSelect('JSON_BUILD_OBJECT(\'uid\', IDENTITY(acp.createdBy), \'d\', acp.createdAt) AS acpCreatedBy');
|
||||||
$qb
|
$qb
|
||||||
->leftJoin('acp.updatedBy', "acp_updated_by_t")
|
->addSelect('IDENTITY(acp.updatedBy) AS acpUpdatedBy_id')
|
||||||
->addSelect('acp_updated_by_t.label AS acpUpdatedBy');
|
->addSelect('JSON_BUILD_OBJECT(\'uid\', IDENTITY(acp.updatedBy), \'d\', acp.updatedAt) AS acpUpdatedBy');
|
||||||
|
|
||||||
foreach (['origin' => 'label', 'closingMotive' => 'name', 'job' => 'label', 'administrativeLocation' => 'name'] as $entity => $field) {
|
foreach (['origin' => 'label', 'closingMotive' => 'name', 'job' => 'label', 'administrativeLocation' => 'name'] as $entity => $field) {
|
||||||
$qb
|
$qb
|
||||||
@ -230,7 +235,7 @@ final readonly class ListAccompanyingPeriodHelper
|
|||||||
|
|
||||||
// referree at date
|
// referree at date
|
||||||
$qb
|
$qb
|
||||||
->addSelect('referrer_t.label AS referrer')
|
->addSelect('JSON_BUILD_OBJECT(\'uid\', IDENTITY(userHistory.user), \'d\', userHistory.startDate) AS referrer')
|
||||||
->addSelect('userHistory.startDate AS referrerSince')
|
->addSelect('userHistory.startDate AS referrerSince')
|
||||||
->leftJoin('acp.userHistories', 'userHistory')
|
->leftJoin('acp.userHistories', 'userHistory')
|
||||||
->leftJoin('userHistory.user', 'referrer_t')
|
->leftJoin('userHistory.user', 'referrer_t')
|
||||||
|
@ -40,9 +40,7 @@ final class JobAggregatorTest extends AbstractAggregatorTest
|
|||||||
public function getFormData(): array
|
public function getFormData(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[
|
[],
|
||||||
'job_at' => new RollingDate(RollingDate::T_FIXED_DATE, \DateTimeImmutable::createFromFormat('Y-m-d', '2020-01-01')),
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +55,6 @@ final class JobAggregatorTest extends AbstractAggregatorTest
|
|||||||
->select('count(acp.id)')
|
->select('count(acp.id)')
|
||||||
->from(AccompanyingPeriod::class, 'acp')
|
->from(AccompanyingPeriod::class, 'acp')
|
||||||
->join('acp.works', 'acpw')
|
->join('acp.works', 'acpw')
|
||||||
->join('acpw.referrers', 'acpwuser'),
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,7 @@ final class ScopeAggregatorTest extends AbstractAggregatorTest
|
|||||||
public function getFormData(): array
|
public function getFormData(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[
|
[],
|
||||||
'scope_at' => new RollingDate(RollingDate::T_FIXED_DATE, \DateTimeImmutable::createFromFormat('Y-m-d', '2020-01-01')),
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +55,6 @@ final class ScopeAggregatorTest extends AbstractAggregatorTest
|
|||||||
->select('count(acp.id)')
|
->select('count(acp.id)')
|
||||||
->from(AccompanyingPeriod::class, 'acp')
|
->from(AccompanyingPeriod::class, 'acp')
|
||||||
->join('acp.works', 'acpw')
|
->join('acp.works', 'acpw')
|
||||||
->join('acpw.referrers', 'acpwuser'),
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Tests\Export\Export;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\Center;
|
||||||
|
use Chill\MainBundle\Export\Formatter\SpreadsheetListFormatter;
|
||||||
|
use Chill\MainBundle\Repository\CenterRepositoryInterface;
|
||||||
|
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||||
|
use Chill\PersonBundle\Export\Export\ListAccompanyingPeriod;
|
||||||
|
use Doctrine\ORM\AbstractQuery;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
class ListAccompanyingPeriodTest extends KernelTestCase
|
||||||
|
{
|
||||||
|
private ListAccompanyingPeriod $listAccompanyingPeriod;
|
||||||
|
|
||||||
|
private CenterRepositoryInterface $centerRepository;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
self::bootKernel();
|
||||||
|
|
||||||
|
$this->listAccompanyingPeriod = self::$container->get(ListAccompanyingPeriod::class);
|
||||||
|
$this->centerRepository = self::$container->get(CenterRepositoryInterface::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testQuery(): void
|
||||||
|
{
|
||||||
|
$centers = $this->centerRepository->findAll();
|
||||||
|
|
||||||
|
$query = $this->listAccompanyingPeriod->initiateQuery([], array_map(fn (Center $c) => ['center' => $c ], $centers), $exportOpts = ['calc_date' => new RollingDate(RollingDate::T_TODAY)]);
|
||||||
|
|
||||||
|
$query->setMaxResults(1);
|
||||||
|
|
||||||
|
$actual = $query->getQuery()->getResult(AbstractQuery::HYDRATE_ARRAY);
|
||||||
|
|
||||||
|
self::assertIsArray($actual);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Tests\Export\Export;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\Center;
|
||||||
|
use Chill\MainBundle\Repository\CenterRepositoryInterface;
|
||||||
|
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||||
|
use Chill\PersonBundle\Export\Export\ListAccompanyingPeriodWork;
|
||||||
|
use Doctrine\ORM\AbstractQuery;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
class ListAccompanyingPeriodWorkTest extends KernelTestCase
|
||||||
|
{
|
||||||
|
private ListAccompanyingPeriodWork $listAccompanyingPeriodWork;
|
||||||
|
|
||||||
|
private CenterRepositoryInterface $centerRepository;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
self::bootKernel();
|
||||||
|
|
||||||
|
$this->listAccompanyingPeriodWork = self::$container->get(ListAccompanyingPeriodWork::class);
|
||||||
|
$this->centerRepository = self::$container->get(CenterRepositoryInterface::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testQuery(): void
|
||||||
|
{
|
||||||
|
$centers = $this->centerRepository->findAll();
|
||||||
|
|
||||||
|
$query = $this->listAccompanyingPeriodWork->initiateQuery([], array_map(fn (Center $c) => ['center' => $c], $centers), ['calc_date' => new RollingDate(RollingDate::T_TODAY)]);
|
||||||
|
$query->setMaxResults(1);
|
||||||
|
|
||||||
|
self::assertIsArray($query->getQuery()->getResult(AbstractQuery::HYDRATE_ARRAY));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Tests\Export\Export;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\Center;
|
||||||
|
use Chill\MainBundle\Repository\CenterRepositoryInterface;
|
||||||
|
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||||
|
use Chill\PersonBundle\Export\Export\ListEvaluation;
|
||||||
|
use Doctrine\ORM\AbstractQuery;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
class ListEvaluationTest extends KernelTestCase
|
||||||
|
{
|
||||||
|
private ListEvaluation $listEvaluation;
|
||||||
|
|
||||||
|
private CenterRepositoryInterface $centerRepository;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
self::bootKernel();
|
||||||
|
|
||||||
|
$this->listEvaluation = self::$container->get(ListEvaluation::class);
|
||||||
|
$this->centerRepository = self::$container->get(CenterRepositoryInterface::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testQuery(): void
|
||||||
|
{
|
||||||
|
$centers = $this->centerRepository->findAll();
|
||||||
|
|
||||||
|
$query = $this->listEvaluation->initiateQuery([], array_map(fn (Center $c) => ['center' => $c], $centers), ['calc_date' => new RollingDate(RollingDate::T_TODAY)]);
|
||||||
|
$query->setMaxResults(1);
|
||||||
|
|
||||||
|
self::assertIsArray($query->getQuery()->getResult(AbstractQuery::HYDRATE_ARRAY));
|
||||||
|
}
|
||||||
|
}
|
@ -51,7 +51,6 @@ final class JobFilterTest extends AbstractFilterTest
|
|||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
'job' => new ArrayCollection($jobs),
|
'job' => new ArrayCollection($jobs),
|
||||||
'job_at' => new RollingDate(RollingDate::T_FIXED_DATE, \DateTimeImmutable::createFromFormat('Y-m-d', '2020-01-01'))
|
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,6 @@ final class ScopeFilterTest extends AbstractFilterTest
|
|||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
'scope' => $scopes,
|
'scope' => $scopes,
|
||||||
'scope_at' => new RollingDate(RollingDate::T_FIXED_DATE, \DateTimeImmutable::createFromFormat('Y-m-d', '2020-01-01'))
|
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -1187,7 +1187,9 @@ export:
|
|||||||
origin: Origine du parcours
|
origin: Origine du parcours
|
||||||
acpClosingMotive: Motif de fermeture
|
acpClosingMotive: Motif de fermeture
|
||||||
acpJob: Métier du parcours
|
acpJob: Métier du parcours
|
||||||
|
acpCreatedBy_id: Créé par (identifiant)
|
||||||
acpCreatedBy: Créé par
|
acpCreatedBy: Créé par
|
||||||
|
acpUpdatedBy_id: Dernière modificaton par (identifiant)
|
||||||
acpUpdatedBy: Dernière modification par
|
acpUpdatedBy: Dernière modification par
|
||||||
administrativeLocation: Location administrative
|
administrativeLocation: Location administrative
|
||||||
step: Etape
|
step: Etape
|
||||||
|
Loading…
x
Reference in New Issue
Block a user