mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-11-09 21:58:28 +00:00
Compare commits
21 Commits
2.15.1
...
issue178_1
| Author | SHA1 | Date | |
|---|---|---|---|
| 26a5de9958 | |||
| 4e35bcbd93 | |||
| 7587472785 | |||
| 9ba33f3df4 | |||
| e0de10b7a8 | |||
| 33235d3541 | |||
| 817ca7e148 | |||
| 382f275719 | |||
| f78c1c0512 | |||
| c3ced7fb6e | |||
| 96a9be39c3 | |||
| 792ad394c8 | |||
| a7141ef771 | |||
| bc638e5eb9 | |||
| b0171e3093 | |||
| b317daf779 | |||
| 27bf2893d0 | |||
| e2a12968ce | |||
| fe9ce1a356 | |||
| 9c04212c45 | |||
| 85504d72c2 |
@@ -1,9 +0,0 @@
|
|||||||
## v2.13.0 - 2023-11-21
|
|
||||||
### Feature
|
|
||||||
* ([#173](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/173)) Allow user to add a phonenumber to their profile which will be included in automatically generated documents
|
|
||||||
### Fixed
|
|
||||||
* ([#211](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/211)) Export: fix loading of "Group activity by type"
|
|
||||||
* ([#190](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/190)) Export: fix loading of "group activity by reasons"
|
|
||||||
* ([#213](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/213)) Export: fix usage of some Collection returned instead of array in export filters
|
|
||||||
* ([#215](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/215)) Use only the string 'both' for gender (with a database migration)
|
|
||||||
* ([#212](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/212)) Clean the database to make working the "Group people by gender" aggregator
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
## v2.14.0 - 2023-11-24
|
|
||||||
### Feature
|
|
||||||
* ([#161](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/161)) Export: in filter "Filter accompanying period work (social action) by type, goal and result", order the items alphabetically or with the defined order
|
|
||||||
### Fixed
|
|
||||||
* ([#141](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/141)) Export: on filter "action by type goals, and results", restore the fields when editing a saved export
|
|
||||||
* ([#219](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/219)) Export: fix the list of accompanying period work, when the "calc date" is null
|
|
||||||
* ([#222](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/222)) Fix rendering of custom fields
|
|
||||||
* Fix various errors in custom fields administration
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
## v2.14.1 - 2023-11-29
|
|
||||||
### Fixed
|
|
||||||
* Export: fix list person with custom fields
|
|
||||||
* ([#100](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/100)) Add a paginator to budget elements (resource and charge types) in the admin
|
|
||||||
* Fix error in ListEvaluation when "handling agents" are alone
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
## v2.15.0 - 2023-12-11
|
|
||||||
### Feature
|
|
||||||
* ([#191](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/191)) Add export "number of household associate with an exchange"
|
|
||||||
* ([#235](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/235)) Export: add dates on the filter "filter course by activity type"
|
|
||||||
### Fixed
|
|
||||||
* ([#214](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/214)) Fix error when posting an empty comment on an accompanying period.
|
|
||||||
* ([#233](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/233)) Fix "filter evaluation by evaluation type" (and add select2 to the list of evaluation types to pick)
|
|
||||||
* ([#234](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/234)) Fix "filter aside activity by date"
|
|
||||||
|
|
||||||
* ([#228](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/228)) Fix export of activity for people created before the introduction of the createdAt column on person (during v1)
|
|
||||||
* ([#246](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/246)) Do not show activities, evaluations and social work when associated to a confidential accompanying period, except for the users which are allowed to see them
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
## v2.15.1 - 2023-12-20
|
|
||||||
### Fixed
|
|
||||||
* Fix the household export query to exclude accompanying periods that are in draft state.
|
|
||||||
### DX
|
|
||||||
* ([#167](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/167)) Fixed readthedocs compilation by updating readthedocs config file and requirements for Sphinx
|
|
||||||
@@ -1,14 +1,10 @@
|
|||||||
---
|
---
|
||||||
version: 2
|
version: 2
|
||||||
|
|
||||||
build:
|
|
||||||
os: ubuntu-22.04
|
|
||||||
tools:
|
|
||||||
python: "3.7"
|
|
||||||
|
|
||||||
sphinx:
|
sphinx:
|
||||||
configuration: docs/source/conf.py
|
configuration: docs/source/conf.py
|
||||||
|
|
||||||
python:
|
python:
|
||||||
|
version: 3.7
|
||||||
install:
|
install:
|
||||||
- requirements: docs/requirements.txt
|
- requirements: docs/requirements.txt
|
||||||
|
|||||||
74
CHANGELOG.md
74
CHANGELOG.md
@@ -6,80 +6,6 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
|
|||||||
and is generated by [Changie](https://github.com/miniscruff/changie).
|
and is generated by [Changie](https://github.com/miniscruff/changie).
|
||||||
|
|
||||||
|
|
||||||
## v2.15.1 - 2023-12-20
|
|
||||||
### Fixed
|
|
||||||
* Fix the household export query to exclude accompanying periods that are in draft state.
|
|
||||||
### DX
|
|
||||||
* ([#167](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/167)) Fixed readthedocs compilation by updating readthedocs config file and requirements for Sphinx
|
|
||||||
|
|
||||||
## v2.15.0 - 2023-12-11
|
|
||||||
### Feature
|
|
||||||
* ([#191](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/191)) Add export "number of household associate with an exchange"
|
|
||||||
* ([#235](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/235)) Export: add dates on the filter "filter course by activity type"
|
|
||||||
### Fixed
|
|
||||||
* ([#214](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/214)) Fix error when posting an empty comment on an accompanying period.
|
|
||||||
* ([#233](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/233)) Fix "filter evaluation by evaluation type" (and add select2 to the list of evaluation types to pick)
|
|
||||||
* ([#234](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/234)) Fix "filter aside activity by date"
|
|
||||||
|
|
||||||
* ([#228](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/228)) Fix export of activity for people created before the introduction of the createdAt column on person (during v1)
|
|
||||||
* ([#246](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/246)) Do not show activities, evaluations and social work when associated to a confidential accompanying period, except for the users which are allowed to see them
|
|
||||||
|
|
||||||
## v2.14.1 - 2023-11-29
|
|
||||||
### Fixed
|
|
||||||
* Export: fix list person with custom fields
|
|
||||||
* ([#100](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/100)) Add a paginator to budget elements (resource and charge types) in the admin
|
|
||||||
* Fix error in ListEvaluation when "handling agents" are alone
|
|
||||||
|
|
||||||
## v2.14.0 - 2023-11-24
|
|
||||||
### Feature
|
|
||||||
* ([#161](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/161)) Export: in filter "Filter accompanying period work (social action) by type, goal and result", order the items alphabetically or with the defined order
|
|
||||||
### Fixed
|
|
||||||
* ([#141](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/141)) Export: on filter "action by type goals, and results", restore the fields when editing a saved export
|
|
||||||
* ([#219](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/219)) Export: fix the list of accompanying period work, when the "calc date" is null
|
|
||||||
* ([#222](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/222)) Fix rendering of custom fields
|
|
||||||
* Fix various errors in custom fields administration
|
|
||||||
|
|
||||||
## v2.13.0 - 2023-11-21
|
|
||||||
### Feature
|
|
||||||
* ([#173](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/173)) Allow user to add a phonenumber to their profile which will be included in automatically generated documents
|
|
||||||
### Fixed
|
|
||||||
* ([#211](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/211)) Export: fix loading of "Group activity by type"
|
|
||||||
* ([#190](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/190)) Export: fix loading of "group activity by reasons"
|
|
||||||
* ([#213](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/213)) Export: fix usage of some Collection returned instead of array in export filters
|
|
||||||
* ([#215](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/215)) Use only the string 'both' for gender (with a database migration)
|
|
||||||
* ([#212](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/212)) Clean the database to make working the "Group people by gender" aggregator
|
|
||||||
|
|
||||||
## v2.12.1 - 2023-11-16
|
|
||||||
### Fixed
|
|
||||||
* ([#208](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/208)) Export: fix loading of form for "filter action by type, goal and result"
|
|
||||||
|
|
||||||
## v2.12.0 - 2023-11-15
|
|
||||||
### Feature
|
|
||||||
* ([#199](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/199)) Export: add an aggregator "group activities by presence"
|
|
||||||
* ([#199](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/199)) Export: add a filter "filter activity by activity presence"
|
|
||||||
* ([#199](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/199)) Export: add an aggregator "group activities by person" (only for the activities saved in a person context)
|
|
||||||
* ([#199](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/199)) Export: add a new aggregator "group peoples by postal code"
|
|
||||||
* ([#200](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/200)) Export: split export about person on accompanying period work: one with the people associated with the work, another one with the people associated with the accompanying period
|
|
||||||
* ([#204](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/204)) Add 3 new filters and 3 new aggregators for work action creator (with jobs and scopes)
|
|
||||||
|
|
||||||
* ([#202](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/202)) Create export for the average duration of social work actions
|
|
||||||
* ([#206](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/206)) Export: add a export which count persons on accompanying period work
|
|
||||||
* ([#206](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/206)) Export: add an export which count persons on activity
|
|
||||||
* ([#203](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/203)) Export: add clauses on the social work start date and end date within the filter "Filter accompanying period by accompanying period work"
|
|
||||||
### Fixed
|
|
||||||
* Export: fix typo in filter "filter accompanying period work on end date"
|
|
||||||
* ([#189](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/189)) Export: Fix failure in export linked to household
|
|
||||||
* ([#205](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/205)) Fix loading of accompanying period work referrers
|
|
||||||
### Traduction francophone des principaux changements
|
|
||||||
* export: ajout d'un regroupement "grouper les échanges par présence de l'usager";
|
|
||||||
* export: ajout d'un filtre "filtre les échanges par présence de l'usager";
|
|
||||||
* export: ajout d'un regroupement "regrouper les échanges par personne" (seulement pour les échanges enregistrés dans le contexte de l'usager);
|
|
||||||
* export: ajout d'un regroupement "grouper les usagers par codes postaux"
|
|
||||||
* export: séparation des exports sur les actions: dans l'un, les filtres des usagers portent sur les usagers concernés par l'action, dans l'autre, les filtres portent sur les usagers concernés par le parcours de l'action;
|
|
||||||
* export: ajout de 3 nouveaux filtres et regroupements sur le créateur de l'action, son métier et son service;
|
|
||||||
* export: correction de l'export sur les ménages liés aux parcours;
|
|
||||||
* correction du chargement des actions d'accompagnement
|
|
||||||
|
|
||||||
## v2.11.0 - 2023-11-07
|
## v2.11.0 - 2023-11-07
|
||||||
### Feature
|
### Feature
|
||||||
* ([#194](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/194)) Export: add a filter "filter activity by creator job"
|
* ([#194](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/194)) Export: add a filter "filter activity by creator job"
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ To compile this documentation :
|
|||||||
Contribute
|
Contribute
|
||||||
===========
|
===========
|
||||||
|
|
||||||
Issue tracker : https://gitlab.com/Chill-Projet/chill-bundles/-/issues
|
Issue tracker : https://git.framasoft.org/groups/Chill-project/issues
|
||||||
|
|
||||||
Licence
|
Licence
|
||||||
=======
|
=======
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
docutils==0.13.1
|
docutils==0.13.1
|
||||||
Pygments==2.2.0
|
Pygments==2.2.0
|
||||||
sphinx==1.8.5
|
sphinx==1.8.5
|
||||||
Jinja2<3.1
|
|
||||||
git+https://github.com/fabpot/sphinx-php.git@v2.0.2#egg_name=sphinx-php
|
git+https://github.com/fabpot/sphinx-php.git@v2.0.2#egg_name=sphinx-php
|
||||||
jsx-lexer===0.0.8
|
jsx-lexer===0.0.8
|
||||||
sphinx_rtd_theme==0.5.0
|
sphinx_rtd_theme==0.5.0
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ Clone or download the chill-skeleton project and `cd` into the main directory.
|
|||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
git clone https://gitlab.com/Chill-Projet/chill-skeleton-basic.git
|
git clone https://gitlab.com/Chill-Projet/chill-skeleton-basic.git
|
||||||
cd chill-skeleton-basic
|
cd chill-app
|
||||||
|
|
||||||
|
|
||||||
As a developer, the code will stay on your computer and will be executed in docker container. To avoid permission problem, the code should be run with the same uid/gid from your current user. This is why we get your current user id with the command ``id -u`` in each following scripts.
|
As a developer, the code will stay on your computer and will be executed in docker container. To avoid permission problem, the code should be run with the same uid/gid from your current user. This is why we get your current user id with the command ``id -u`` in each following scripts.
|
||||||
|
|||||||
@@ -56,15 +56,20 @@ class ActivityTypeAggregator implements AggregatorInterface
|
|||||||
|
|
||||||
public function getLabels($key, array $values, $data): \Closure
|
public function getLabels($key, array $values, $data): \Closure
|
||||||
{
|
{
|
||||||
return function (null|int|string $value): string {
|
// for performance reason, we load data from db only once
|
||||||
|
$this->activityTypeRepository->findBy(['id' => $values]);
|
||||||
|
|
||||||
|
return function ($value): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'Activity type';
|
return 'Activity type';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $value || '' === $value || null === $t = $this->activityTypeRepository->find($value)) {
|
if (null === $value || '' === $value) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$t = $this->activityTypeRepository->find($value);
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize($t->getName());
|
return $this->translatableStringHelper->localize($t->getName());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,6 +99,12 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
|||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
|
match ($data['level']) {
|
||||||
|
'reasons' => $this->activityReasonRepository->findBy(['id' => $values]),
|
||||||
|
'categories' => $this->activityReasonCategoryRepository->findBy(['id' => $values]),
|
||||||
|
default => throw new \RuntimeException(sprintf("The level data '%s' is invalid.", $data['level'])),
|
||||||
|
};
|
||||||
|
|
||||||
return function ($value) use ($data) {
|
return function ($value) use ($data) {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'reasons' === $data['level'] ? 'Group by reasons' : 'Group by categories of reason';
|
return 'reasons' === $data['level'] ? 'Group by reasons' : 'Group by categories of reason';
|
||||||
|
|||||||
@@ -1,147 +0,0 @@
|
|||||||
<?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\ActivityBundle\Export\Export\LinkedToACP;
|
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
|
||||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
|
||||||
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
|
|
||||||
use Chill\MainBundle\Export\ExportInterface;
|
|
||||||
use Chill\MainBundle\Export\FormatterInterface;
|
|
||||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
|
||||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
|
||||||
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
|
||||||
use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Doctrine\ORM\EntityRepository;
|
|
||||||
use Doctrine\ORM\Query;
|
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
|
|
||||||
final readonly class CountHouseholdOnActivity implements ExportInterface, GroupedExportInterface
|
|
||||||
{
|
|
||||||
private EntityRepository $repository;
|
|
||||||
|
|
||||||
private bool $filterStatsByCenters;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
EntityManagerInterface $em,
|
|
||||||
ParameterBagInterface $parameterBag,
|
|
||||||
) {
|
|
||||||
$this->repository = $em->getRepository(Activity::class);
|
|
||||||
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder) {}
|
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getAllowedFormattersTypes(): array
|
|
||||||
{
|
|
||||||
return [FormatterInterface::TYPE_TABULAR];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDescription(): string
|
|
||||||
{
|
|
||||||
return 'export.export.count_household_on_activity.description';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getGroup(): string
|
|
||||||
{
|
|
||||||
return 'Exports of activities linked to an accompanying period';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
|
||||||
{
|
|
||||||
if ('export_count_activity' !== $key) {
|
|
||||||
throw new \LogicException("the key {$key} is not used by this export");
|
|
||||||
}
|
|
||||||
|
|
||||||
return static fn ($value) => '_header' === $value ? 'export.export.count_household_on_activity.header' : $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getQueryKeys($data): array
|
|
||||||
{
|
|
||||||
return ['export_count_activity'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getResult($query, $data)
|
|
||||||
{
|
|
||||||
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTitle(): string
|
|
||||||
{
|
|
||||||
return 'export.export.count_household_on_activity.title';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getType(): string
|
|
||||||
{
|
|
||||||
return Declarations::ACTIVITY;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
|
||||||
{
|
|
||||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
|
||||||
|
|
||||||
$qb = $this->repository
|
|
||||||
->createQueryBuilder('activity')
|
|
||||||
->join('activity.persons', 'person')
|
|
||||||
->join('activity.accompanyingPeriod', 'acp')
|
|
||||||
->join(
|
|
||||||
HouseholdMember::class,
|
|
||||||
'householdmember',
|
|
||||||
Query\Expr\Join::WITH,
|
|
||||||
'person.id = IDENTITY(householdmember.person) AND householdmember.startDate <= activity.date AND (householdmember.endDate IS NULL OR householdmember.endDate > activity.date)'
|
|
||||||
)
|
|
||||||
->join('householdmember.household', 'household');
|
|
||||||
|
|
||||||
if ($this->filterStatsByCenters) {
|
|
||||||
$qb
|
|
||||||
->andWhere(
|
|
||||||
$qb->expr()->exists(
|
|
||||||
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
|
||||||
JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
|
||||||
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
|
||||||
'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
->setParameter('authorized_centers', $centers);
|
|
||||||
}
|
|
||||||
|
|
||||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
|
||||||
|
|
||||||
$qb->select('COUNT(DISTINCT household.id) as export_count_activity');
|
|
||||||
|
|
||||||
return $qb;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function requiredRole(): string
|
|
||||||
{
|
|
||||||
return ActivityStatsVoter::STATS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function supportsModifiers(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
Declarations::ACTIVITY,
|
|
||||||
Declarations::ACTIVITY_ACP,
|
|
||||||
PersonDeclarations::ACP_TYPE,
|
|
||||||
PersonDeclarations::PERSON_TYPE,
|
|
||||||
PersonDeclarations::HOUSEHOLD_TYPE,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -20,18 +20,23 @@ use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
|
|||||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||||
use Chill\MainBundle\Export\Helper\TranslatableStringExportLabelHelper;
|
use Chill\MainBundle\Export\Helper\TranslatableStringExportLabelHelper;
|
||||||
use Chill\MainBundle\Export\ListInterface;
|
use Chill\MainBundle\Export\ListInterface;
|
||||||
use Chill\PersonBundle\Export\Helper\FilterListAccompanyingPeriodHelperInterface;
|
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
final readonly class ListActivity implements ListInterface, GroupedExportInterface
|
class ListActivity implements ListInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
|
private readonly bool $filterStatsByCenters;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private ListActivityHelper $helper,
|
private readonly ListActivityHelper $helper,
|
||||||
private EntityManagerInterface $entityManager,
|
private readonly EntityManagerInterface $entityManager,
|
||||||
private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper,
|
private readonly TranslatableStringExportLabelHelper $translatableStringExportLabelHelper,
|
||||||
private FilterListAccompanyingPeriodHelperInterface $filterListAccompanyingPeriodHelper,
|
ParameterBagInterface $parameterBag,
|
||||||
) {}
|
) {
|
||||||
|
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
||||||
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
{
|
{
|
||||||
@@ -114,7 +119,19 @@ final readonly class ListActivity implements ListInterface, GroupedExportInterfa
|
|||||||
->leftJoin('acppart.person', 'person')
|
->leftJoin('acppart.person', 'person')
|
||||||
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL');
|
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL');
|
||||||
|
|
||||||
$this->filterListAccompanyingPeriodHelper->addFilterAccompanyingPeriods($qb, $requiredModifiers, $acl, $data);
|
if ($this->filterStatsByCenters) {
|
||||||
|
$qb
|
||||||
|
->andWhere(
|
||||||
|
$qb->expr()->exists(
|
||||||
|
'SELECT 1
|
||||||
|
FROM '.PersonCenterHistory::class.' acl_count_person_history
|
||||||
|
WHERE acl_count_person_history.person = person
|
||||||
|
AND acl_count_person_history.center IN (:authorized_centers)
|
||||||
|
'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
->setParameter('authorized_centers', $centers);
|
||||||
|
}
|
||||||
|
|
||||||
$qb
|
$qb
|
||||||
// some grouping are necessary
|
// some grouping are necessary
|
||||||
|
|||||||
@@ -15,22 +15,17 @@ use Chill\ActivityBundle\Entity\Activity;
|
|||||||
use Chill\ActivityBundle\Entity\ActivityType;
|
use Chill\ActivityBundle\Entity\ActivityType;
|
||||||
use Chill\ActivityBundle\Repository\ActivityTypeRepositoryInterface;
|
use Chill\ActivityBundle\Repository\ActivityTypeRepositoryInterface;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
final readonly class ActivityTypeFilter implements FilterInterface
|
class ActivityTypeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private const BASE_EXISTS = 'SELECT 1 FROM '.Activity::class.' act_type_filter_activity WHERE act_type_filter_activity.accompanyingPeriod = acp';
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private ActivityTypeRepositoryInterface $activityTypeRepository,
|
private readonly ActivityTypeRepositoryInterface $activityTypeRepository,
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper,
|
private readonly TranslatableStringHelperInterface $translatableStringHelper
|
||||||
private RollingDateConverterInterface $rollingDateConverter,
|
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
@@ -40,26 +35,13 @@ final readonly class ActivityTypeFilter implements FilterInterface
|
|||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
$exists = self::BASE_EXISTS;
|
$qb->andWhere(
|
||||||
|
$qb->expr()->exists(
|
||||||
if (count($data['accepted_activitytypes']) > 0) {
|
'SELECT 1 FROM '.Activity::class.' act_type_filter_activity
|
||||||
$exists .= ' AND act_type_filter_activity.activityType IN (:act_type_filter_activity_types)';
|
WHERE act_type_filter_activity.activityType IN (:act_type_filter_activity_types) AND act_type_filter_activity.accompanyingPeriod = acp'
|
||||||
$qb->setParameter('act_type_filter_activity_types', $data['accepted_activitytypes']);
|
)
|
||||||
}
|
);
|
||||||
|
$qb->setParameter('act_type_filter_activity_types', $data['accepted_activitytypes']);
|
||||||
if (null !== $data['date_after']) {
|
|
||||||
$exists .= ' AND act_type_filter_activity.date >= :act_type_filter_activity_date_after';
|
|
||||||
$qb->setParameter('act_type_filter_activity_date_after', $this->rollingDateConverter->convert($data['date_after']));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null !== $data['date_before']) {
|
|
||||||
$exists .= ' AND act_type_filter_activity.date >= :act_type_filter_activity_date_before';
|
|
||||||
$qb->setParameter('act_type_filter_activity_date_before', $this->rollingDateConverter->convert($data['date_before']));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (self::BASE_EXISTS !== $exists) {
|
|
||||||
$qb->andWhere($qb->expr()->exists($exists));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn()
|
public function applyOn()
|
||||||
@@ -78,27 +60,11 @@ final readonly class ActivityTypeFilter implements FilterInterface
|
|||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
'expanded' => true,
|
'expanded' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('date_after', PickRollingDateType::class, [
|
|
||||||
'label' => 'export.filter.activity.acp_by_activity_type.activity after',
|
|
||||||
'help' => 'export.filter.activity.acp_by_activity_type.activity after help',
|
|
||||||
'required' => false,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$builder->add('date_before', PickRollingDateType::class, [
|
|
||||||
'label' => 'export.filter.activity.acp_by_activity_type.activity before',
|
|
||||||
'help' => 'export.filter.activity.acp_by_activity_type.activity before help',
|
|
||||||
'required' => false,
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [
|
return [];
|
||||||
'accepted_activitytypes' => [],
|
|
||||||
'date_after' => null,
|
|
||||||
'date_before' => null,
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string'): array
|
public function describeAction($data, $format = 'string'): array
|
||||||
@@ -109,12 +75,8 @@ final readonly class ActivityTypeFilter implements FilterInterface
|
|||||||
$types[] = $this->translatableStringHelper->localize($aty->getName());
|
$types[] = $this->translatableStringHelper->localize($aty->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ['export.filter.activity.acp_by_activity_type.acp_containing_at_least_one_activitytypes', [
|
return ['export.filter.activity.acp_by_activity_type.acp_containing_at_least_one_%activitytypes%', [
|
||||||
'activitytypes' => implode(', ', $types),
|
'%activitytypes%' => implode(', ', $types),
|
||||||
'has_date_after' => null !== $data['date_after'] ? 1 : 0,
|
|
||||||
'date_after' => $this->rollingDateConverter->convert($data['date_after']),
|
|
||||||
'has_date_before' => null !== $data['date_before'] ? 1 : 0,
|
|
||||||
'date_before' => $this->rollingDateConverter->convert($data['date_before']),
|
|
||||||
]];
|
]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
<?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\ActivityBundle\Tests\Export\Export\LinkedToACP;
|
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
|
||||||
use Chill\ActivityBundle\Export\Export\LinkedToACP\CountHouseholdOnActivity;
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
|
||||||
use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*
|
|
||||||
* @coversNothing
|
|
||||||
*/
|
|
||||||
class CountHouseholdOnActivityTest extends AbstractExportTest
|
|
||||||
{
|
|
||||||
private EntityManagerInterface $entityManager;
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
self::bootKernel();
|
|
||||||
$this->entityManager = self::$container->get(EntityManagerInterface::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getExport()
|
|
||||||
{
|
|
||||||
yield new CountHouseholdOnActivity($this->entityManager, $this->getParameters(true));
|
|
||||||
yield new CountHouseholdOnActivity($this->entityManager, $this->getParameters(false));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormData()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
[],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getModifiersCombination()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
[
|
|
||||||
Declarations::ACTIVITY,
|
|
||||||
Declarations::ACTIVITY_ACP,
|
|
||||||
PersonDeclarations::ACP_TYPE,
|
|
||||||
PersonDeclarations::PERSON_TYPE,
|
|
||||||
PersonDeclarations::HOUSEHOLD_TYPE,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
<?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\ActivityBundle\Tests\Export\Export\LinkedToPerson;
|
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
|
||||||
use Chill\ActivityBundle\Export\Export\LinkedToPerson\CountHouseholdOnActivity;
|
|
||||||
use Chill\ActivityBundle\Repository\ActivityRepository;
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
|
||||||
use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*
|
|
||||||
* @coversNothing
|
|
||||||
*/
|
|
||||||
class CountHouseholdOnActivityTest extends AbstractExportTest
|
|
||||||
{
|
|
||||||
private ActivityRepository $activityRepository;
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
self::bootKernel();
|
|
||||||
$this->activityRepository = self::$container->get(ActivityRepository::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getExport()
|
|
||||||
{
|
|
||||||
yield new CountHouseholdOnActivity($this->activityRepository, $this->getParameters(true));
|
|
||||||
yield new CountHouseholdOnActivity($this->activityRepository, $this->getParameters(false));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormData()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
[],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getModifiersCombination()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
[
|
|
||||||
Declarations::ACTIVITY,
|
|
||||||
Declarations::ACTIVITY_PERSON,
|
|
||||||
PersonDeclarations::PERSON_TYPE,
|
|
||||||
PersonDeclarations::HOUSEHOLD_TYPE,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -13,7 +13,6 @@ namespace Chill\ActivityBundle\Tests\Export\Filter\ACPFilters;
|
|||||||
|
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
use Chill\ActivityBundle\Entity\ActivityType;
|
use Chill\ActivityBundle\Entity\ActivityType;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
@@ -56,30 +55,8 @@ final class ActivityTypeFilterTest extends AbstractFilterTest
|
|||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
foreach ($array as $a) {
|
foreach ($array as $a) {
|
||||||
$data[] = [
|
|
||||||
'accepted_activitytypes' => [],
|
|
||||||
'date_after' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START),
|
|
||||||
'date_before' => new RollingDate(RollingDate::T_TODAY),
|
|
||||||
];
|
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'accepted_activitytypes' => new ArrayCollection([$a]),
|
'accepted_activitytypes' => new ArrayCollection([$a]),
|
||||||
'date_after' => null,
|
|
||||||
'date_before' => null,
|
|
||||||
];
|
|
||||||
$data[] = [
|
|
||||||
'accepted_activitytypes' => [$a],
|
|
||||||
'date_after' => null,
|
|
||||||
'date_before' => null,
|
|
||||||
];
|
|
||||||
$data[] = [
|
|
||||||
'accepted_activitytypes' => [$a],
|
|
||||||
'date_after' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START),
|
|
||||||
'date_before' => new RollingDate(RollingDate::T_TODAY),
|
|
||||||
];
|
|
||||||
$data[] = [
|
|
||||||
'accepted_activitytypes' => [],
|
|
||||||
'date_after' => null,
|
|
||||||
'date_before' => null,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,14 +20,6 @@ services:
|
|||||||
tags:
|
tags:
|
||||||
- { name: chill.export, alias: 'count_person_on_activity' }
|
- { name: chill.export, alias: 'count_person_on_activity' }
|
||||||
|
|
||||||
Chill\ActivityBundle\Export\Export\LinkedToACP\CountHouseholdOnActivity:
|
|
||||||
tags:
|
|
||||||
- { name: chill.export, alias: 'count_household_on_activity_acp' }
|
|
||||||
|
|
||||||
Chill\ActivityBundle\Export\Export\LinkedToPerson\CountHouseholdOnActivity:
|
|
||||||
tags:
|
|
||||||
- { name: chill.export, alias: 'count_household_on_activity_person' }
|
|
||||||
|
|
||||||
chill.activity.export.count_activity_linked_to_acp:
|
chill.activity.export.count_activity_linked_to_acp:
|
||||||
class: Chill\ActivityBundle\Export\Export\LinkedToACP\CountActivity
|
class: Chill\ActivityBundle\Export\Export\LinkedToACP\CountActivity
|
||||||
tags:
|
tags:
|
||||||
|
|||||||
@@ -3,12 +3,7 @@ export:
|
|||||||
activity:
|
activity:
|
||||||
course_having_activity_between_date:
|
course_having_activity_between_date:
|
||||||
Only course having an activity between from and to: Seulement les parcours ayant reçu au moins un échange entre le {from, date, short} et le {to, date, short}
|
Only course having an activity between from and to: Seulement les parcours ayant reçu au moins un échange entre le {from, date, short} et le {to, date, short}
|
||||||
|
person_between_dates:
|
||||||
acp_by_activity_type:
|
|
||||||
'acp_containing_at_least_one_activitytypes': >-
|
|
||||||
Parcours filtrés: uniquement ceux qui contiennent au moins un échange d'un des types suivants: {activitytypes}
|
|
||||||
{has_date_after, select, 1 {, après le {date_after, date}} other {}}
|
|
||||||
{has_date_before, select, 1 {, avant le {date_before, date}} other {}}
|
|
||||||
describe_action_with_no_subject: >-
|
describe_action_with_no_subject: >-
|
||||||
Filtré par personne ayant eu un échange entre le {date_from, date} et le {date_to, date}
|
Filtré par personne ayant eu un échange entre le {date_from, date} et le {date_to, date}
|
||||||
describe_action_with_subject: >-
|
describe_action_with_subject: >-
|
||||||
|
|||||||
@@ -337,14 +337,6 @@ export:
|
|||||||
title: Nombre d'usagers concernés par les échanges
|
title: Nombre d'usagers concernés par les échanges
|
||||||
description: Compte le nombre d'usagers concernés par les échanges. Si un usager est présent dans plusieurs échanges, il n'est comptabilisé qu'une seule fois.
|
description: Compte le nombre d'usagers concernés par les échanges. Si un usager est présent dans plusieurs échanges, il n'est comptabilisé qu'une seule fois.
|
||||||
header: Nombre d'usagers concernés par des échanges
|
header: Nombre d'usagers concernés par des échanges
|
||||||
count_household_on_activity:
|
|
||||||
title: Nombre de ménages concernés par les échanges
|
|
||||||
description: Compte le nombre de ménages concernés par les échanges. Si un ménage est présent dans plusieurs échanges, il n'est comptabilisé qu'une seule fois. Les usagers sans ménages ne sont pas comptabilisés.
|
|
||||||
header: Nombre de ménage concernés par des échanges
|
|
||||||
count_household_on_activity_person:
|
|
||||||
title: Nombre de ménages concernés par les échanges
|
|
||||||
description: Compte le nombre de ménages concernés par les échanges. Si un ménage est présent dans plusieurs échanges, il n'est comptabilisé qu'une seule fois. Les usagers sans ménages ne sont pas comptabilisés. Lorsqu'un usager change de ménage, chaque ménage est comptabilisé une fois.
|
|
||||||
header: Nombre de ménage concernés par des échanges
|
|
||||||
list:
|
list:
|
||||||
activity:
|
activity:
|
||||||
users name: Nom des utilisateurs
|
users name: Nom des utilisateurs
|
||||||
@@ -379,10 +371,7 @@ export:
|
|||||||
Receiving an activity after: Ayant reçu un échange après le
|
Receiving an activity after: Ayant reçu un échange après le
|
||||||
Receiving an activity before: Ayant reçu un échange avant le
|
Receiving an activity before: Ayant reçu un échange avant le
|
||||||
acp_by_activity_type:
|
acp_by_activity_type:
|
||||||
'activity after': Échanges après le
|
'acp_containing_at_least_one_%activitytypes%': 'Parcours filtrés: uniquement ceux qui contiennent au moins un échange d''un des types suivants: %activitytypes%'
|
||||||
activity after help: Si laissé vide, ne sera pas pris en compte
|
|
||||||
activity before: Echanges avant le
|
|
||||||
activity before help: Si laissé vide, ne sera pas pris en compte
|
|
||||||
person_between_dates:
|
person_between_dates:
|
||||||
Implied in an activity after this date: Impliqué dans un échange après cette date
|
Implied in an activity after this date: Impliqué dans un échange après cette date
|
||||||
Implied in an activity before this date: Impliqué dans un échange avant cette date
|
Implied in an activity before this date: Impliqué dans un échange avant cette date
|
||||||
|
|||||||
@@ -13,11 +13,15 @@ namespace Chill\AsideActivityBundle\Export\Filter;
|
|||||||
|
|
||||||
use Chill\AsideActivityBundle\Export\Declarations;
|
use Chill\AsideActivityBundle\Export\Declarations;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
|
use Chill\MainBundle\Form\Type\Export\FilterType;
|
||||||
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\Form\FormError;
|
||||||
|
use Symfony\Component\Form\FormEvent;
|
||||||
|
use Symfony\Component\Form\FormEvents;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
class ByDateFilter implements FilterInterface
|
class ByDateFilter implements FilterInterface
|
||||||
@@ -62,14 +66,51 @@ class ByDateFilter implements FilterInterface
|
|||||||
->add('date_to', PickRollingDateType::class, [
|
->add('date_to', PickRollingDateType::class, [
|
||||||
'label' => 'export.filter.Aside activities before this date',
|
'label' => 'export.filter.Aside activities before this date',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
|
||||||
|
/** @var \Symfony\Component\Form\FormInterface $filterForm */
|
||||||
|
$filterForm = $event->getForm()->getParent();
|
||||||
|
$enabled = $filterForm->get(FilterType::ENABLED_FIELD)->getData();
|
||||||
|
|
||||||
|
if (true === $enabled) {
|
||||||
|
// if the filter is enabled, add some validation
|
||||||
|
$form = $event->getForm();
|
||||||
|
$date_from = $form->get('date_from')->getData();
|
||||||
|
$date_to = $form->get('date_to')->getData();
|
||||||
|
|
||||||
|
// check that fields are not empty
|
||||||
|
if (null === $date_from) {
|
||||||
|
$form->get('date_from')->addError(new FormError(
|
||||||
|
$this->translator->trans('This field '
|
||||||
|
.'should not be empty')
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null === $date_to) {
|
||||||
|
$form->get('date_to')->addError(new FormError(
|
||||||
|
$this->translator->trans('This field '
|
||||||
|
.'should not be empty')
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// check that date_from is before date_to
|
||||||
|
if (
|
||||||
|
(null !== $date_from && null !== $date_to)
|
||||||
|
&& $date_from >= $date_to
|
||||||
|
) {
|
||||||
|
$form->get('date_to')->addError(new FormError(
|
||||||
|
$this->translator->trans('export.filter.This date should be after '
|
||||||
|
.'the date given in "Implied in an aside activity after '
|
||||||
|
.'this date" field')
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [
|
return ['date_from' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), 'date_to' => new RollingDate(RollingDate::T_TODAY)];
|
||||||
'date_from' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START),
|
|
||||||
'date_to' => new RollingDate(RollingDate::T_TODAY),
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string'): array
|
public function describeAction($data, $format = 'string'): array
|
||||||
|
|||||||
@@ -23,6 +23,6 @@ class ChargeKindController extends CRUDController
|
|||||||
/* @var QueryBuilder $query */
|
/* @var QueryBuilder $query */
|
||||||
$query->addOrderBy('e.ordering', 'ASC');
|
$query->addOrderBy('e.ordering', 'ASC');
|
||||||
|
|
||||||
return parent::orderQuery($action, $query, $request, $paginator);
|
return $query;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,6 @@ class ResourceKindController extends CRUDController
|
|||||||
/* @var QueryBuilder $query */
|
/* @var QueryBuilder $query */
|
||||||
$query->addOrderBy('e.ordering', 'ASC');
|
$query->addOrderBy('e.ordering', 'ASC');
|
||||||
|
|
||||||
return parent::orderQuery($action, $query, $request, $paginator);
|
return $query;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ declare(strict_types=1);
|
|||||||
* the LICENSE file that was distributed with this source code.
|
* the LICENSE file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Chill\CalendarBundle\Export\Export;
|
namespace Chill\CalendarBundle\Export\Export\LinkedToAcp;
|
||||||
|
|
||||||
use Chill\CalendarBundle\Export\Declarations;
|
use Chill\CalendarBundle\Export\Declarations;
|
||||||
use Chill\CalendarBundle\Repository\CalendarRepository;
|
use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||||
@@ -17,17 +17,25 @@ use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
|
|||||||
use Chill\MainBundle\Export\ExportInterface;
|
use Chill\MainBundle\Export\ExportInterface;
|
||||||
use Chill\MainBundle\Export\FormatterInterface;
|
use Chill\MainBundle\Export\FormatterInterface;
|
||||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||||
|
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||||
use Doctrine\ORM\AbstractQuery;
|
use Doctrine\ORM\AbstractQuery;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Validator\Exception\LogicException;
|
use Symfony\Component\Validator\Exception\LogicException;
|
||||||
|
|
||||||
class CountCalendars implements ExportInterface, GroupedExportInterface
|
class CountCalendars implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
|
private readonly bool $filterStatsByCenters;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly CalendarRepository $calendarRepository,
|
private readonly CalendarRepository $calendarRepository,
|
||||||
) {}
|
ParameterBagInterface $parameterBag,
|
||||||
|
) {
|
||||||
|
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
||||||
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
{
|
{
|
||||||
@@ -46,12 +54,12 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function getDescription(): string
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
return 'Count calendars by various parameters.';
|
return 'export.export.count_calendar_linked_to_acp.description';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGroup(): string
|
public function getGroup(): string
|
||||||
{
|
{
|
||||||
return 'Exports of calendar';
|
return 'export.export.calendar_linked_to_acp.group';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
@@ -78,7 +86,7 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function getTitle(): string
|
public function getTitle(): string
|
||||||
{
|
{
|
||||||
return 'Count calendars';
|
return 'export.export.count_calendar_linked_to_acp.title';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getType(): string
|
public function getType(): string
|
||||||
@@ -98,6 +106,19 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
|
|||||||
$qb->select('COUNT(cal.id) AS export_result');
|
$qb->select('COUNT(cal.id) AS export_result');
|
||||||
$qb->leftJoin('cal.accompanyingPeriod', 'acp');
|
$qb->leftJoin('cal.accompanyingPeriod', 'acp');
|
||||||
|
|
||||||
|
if ($this->filterStatsByCenters) {
|
||||||
|
$qb
|
||||||
|
->andWhere(
|
||||||
|
$qb->expr()->exists(
|
||||||
|
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
||||||
|
JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
||||||
|
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||||
|
'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
->setParameter('authorized_centers', $centers);
|
||||||
|
}
|
||||||
|
|
||||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
@@ -9,7 +9,7 @@ declare(strict_types=1);
|
|||||||
* the LICENSE file that was distributed with this source code.
|
* the LICENSE file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Chill\CalendarBundle\Export\Export;
|
namespace Chill\CalendarBundle\Export\Export\LinkedToAcp;
|
||||||
|
|
||||||
use Chill\CalendarBundle\Export\Declarations;
|
use Chill\CalendarBundle\Export\Declarations;
|
||||||
use Chill\CalendarBundle\Repository\CalendarRepository;
|
use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||||
@@ -17,14 +17,24 @@ use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
|
|||||||
use Chill\MainBundle\Export\ExportInterface;
|
use Chill\MainBundle\Export\ExportInterface;
|
||||||
use Chill\MainBundle\Export\FormatterInterface;
|
use Chill\MainBundle\Export\FormatterInterface;
|
||||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||||
|
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
|
class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
public function __construct(private readonly CalendarRepository $calendarRepository) {}
|
private readonly bool $filterStatsByCenters;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
private readonly CalendarRepository $calendarRepository,
|
||||||
|
ParameterBagInterface $parameterBag,
|
||||||
|
) {
|
||||||
|
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
||||||
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder): void
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
@@ -43,12 +53,12 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function getDescription(): string
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
return 'Get the average of calendar duration according to various filters';
|
return 'export.export.avg_duration_calendar_linked_to_acp.description';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGroup(): string
|
public function getGroup(): string
|
||||||
{
|
{
|
||||||
return 'Exports of calendar';
|
return 'export.export.calendar_linked_to_acp.group';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
@@ -75,7 +85,7 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function getTitle(): string
|
public function getTitle(): string
|
||||||
{
|
{
|
||||||
return 'Average calendar duration';
|
return 'export.export.avg_duration_calendar_linked_to_acp.title';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getType(): string
|
public function getType(): string
|
||||||
@@ -85,11 +95,26 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
|
||||||
{
|
{
|
||||||
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
|
||||||
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
||||||
|
|
||||||
$qb->select('AVG(cal.endDate - cal.startDate) AS export_result');
|
$qb->select('AVG(cal.endDate - cal.startDate) AS export_result');
|
||||||
$qb->join('cal.accompanyingPeriod', 'acp');
|
$qb->join('cal.accompanyingPeriod', 'acp');
|
||||||
|
|
||||||
|
if ($this->filterStatsByCenters) {
|
||||||
|
$qb
|
||||||
|
->andWhere(
|
||||||
|
$qb->expr()->exists(
|
||||||
|
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
||||||
|
JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
||||||
|
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||||
|
'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
->setParameter('authorized_centers', $centers);
|
||||||
|
}
|
||||||
|
|
||||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
@@ -9,7 +9,7 @@ declare(strict_types=1);
|
|||||||
* the LICENSE file that was distributed with this source code.
|
* the LICENSE file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Chill\CalendarBundle\Export\Export;
|
namespace Chill\CalendarBundle\Export\Export\LinkedToAcp;
|
||||||
|
|
||||||
use Chill\CalendarBundle\Export\Declarations;
|
use Chill\CalendarBundle\Export\Declarations;
|
||||||
use Chill\CalendarBundle\Repository\CalendarRepository;
|
use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||||
@@ -17,14 +17,24 @@ use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
|
|||||||
use Chill\MainBundle\Export\ExportInterface;
|
use Chill\MainBundle\Export\ExportInterface;
|
||||||
use Chill\MainBundle\Export\FormatterInterface;
|
use Chill\MainBundle\Export\FormatterInterface;
|
||||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||||
|
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
|
class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
public function __construct(private readonly CalendarRepository $calendarRepository) {}
|
private readonly bool $filterStatsByCenters;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
private readonly CalendarRepository $calendarRepository,
|
||||||
|
ParameterBagInterface $parameterBag,
|
||||||
|
) {
|
||||||
|
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
||||||
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder): void
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
@@ -43,12 +53,12 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function getDescription(): string
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
return 'Get the sum of calendar durations according to various filters';
|
return 'export.export.sum_duration_calendar_linked_to_acp.description';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGroup(): string
|
public function getGroup(): string
|
||||||
{
|
{
|
||||||
return 'Exports of calendar';
|
return 'export.export.calendar_linked_to_acp.group';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
@@ -75,7 +85,7 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function getTitle(): string
|
public function getTitle(): string
|
||||||
{
|
{
|
||||||
return 'Sum of calendar durations';
|
return 'export.export.sum_duration_calendar_linked_to_acp.description';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getType(): string
|
public function getType(): string
|
||||||
@@ -85,11 +95,26 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
|
||||||
{
|
{
|
||||||
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
|
||||||
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
||||||
|
|
||||||
$qb->select('SUM(cal.endDate - cal.startDate) AS export_result');
|
$qb->select('SUM(cal.endDate - cal.startDate) AS export_result');
|
||||||
$qb->join('cal.accompanyingPeriod', 'acp');
|
$qb->join('cal.accompanyingPeriod', 'acp');
|
||||||
|
|
||||||
|
if ($this->filterStatsByCenters) {
|
||||||
|
$qb
|
||||||
|
->andWhere(
|
||||||
|
$qb->expr()->exists(
|
||||||
|
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
||||||
|
JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
||||||
|
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||||
|
'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
->setParameter('authorized_centers', $centers);
|
||||||
|
}
|
||||||
|
|
||||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
@@ -0,0 +1,137 @@
|
|||||||
|
<?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\CalendarBundle\Export\Export\LinkedToPerson;
|
||||||
|
|
||||||
|
use Chill\CalendarBundle\Export\Declarations;
|
||||||
|
use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||||
|
use Chill\MainBundle\Export\ExportInterface;
|
||||||
|
use Chill\MainBundle\Export\FormatterInterface;
|
||||||
|
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||||
|
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||||
|
use Doctrine\ORM\AbstractQuery;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\Validator\Exception\LogicException;
|
||||||
|
|
||||||
|
class CountCalendars implements ExportInterface, GroupedExportInterface
|
||||||
|
{
|
||||||
|
private readonly bool $filterStatsByCenters;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
private readonly CalendarRepository $calendarRepository,
|
||||||
|
ParameterBagInterface $parameterBag,
|
||||||
|
) {
|
||||||
|
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
{
|
||||||
|
// No form necessary
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFormDefaultData(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAllowedFormattersTypes(): array
|
||||||
|
{
|
||||||
|
return [FormatterInterface::TYPE_TABULAR];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'export.export.count_calendar_linked_to_person.description';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getGroup(): string
|
||||||
|
{
|
||||||
|
return 'export.export.calendar_linked_to_person.group';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLabels($key, array $values, $data)
|
||||||
|
{
|
||||||
|
if ('export_result' !== $key) {
|
||||||
|
throw new LogicException("the key {$key} is not used by this export");
|
||||||
|
}
|
||||||
|
|
||||||
|
$labels = array_combine($values, $values);
|
||||||
|
$labels['_header'] = $this->getTitle();
|
||||||
|
|
||||||
|
return static fn ($value) => $labels[$value];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getQueryKeys($data): array
|
||||||
|
{
|
||||||
|
return ['export_result'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getResult($query, $data)
|
||||||
|
{
|
||||||
|
return $query->getQuery()->getResult(AbstractQuery::HYDRATE_SCALAR);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitle(): string
|
||||||
|
{
|
||||||
|
return 'export.export.count_calendar_linked_to_person.title';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getType(): string
|
||||||
|
{
|
||||||
|
return Declarations::CALENDAR_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiate the query.
|
||||||
|
*/
|
||||||
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
|
||||||
|
{
|
||||||
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
|
||||||
|
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
||||||
|
|
||||||
|
$qb->select('COUNT(cal.id) AS export_result');
|
||||||
|
$qb->leftJoin('cal.person', 'person');
|
||||||
|
|
||||||
|
if ($this->filterStatsByCenters) {
|
||||||
|
$qb
|
||||||
|
->join('person.centerHistory', 'centerHistory')
|
||||||
|
->where(
|
||||||
|
$qb->expr()->andX(
|
||||||
|
$qb->expr()->lte('centerHistory.startDate', 'cal.startDate'),
|
||||||
|
$qb->expr()->orX(
|
||||||
|
$qb->expr()->isNull('centerHistory.endDate'),
|
||||||
|
$qb->expr()->gt('centerHistory.endDate', 'cal.endDate')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
->andWhere($qb->expr()->in('centerHistory.center', ':centers'))
|
||||||
|
->setParameter('centers', $centers);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $qb;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function requiredRole(): string
|
||||||
|
{
|
||||||
|
// which role should we give here?
|
||||||
|
return PersonVoter::STATS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function supportsModifiers(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Declarations::CALENDAR_TYPE,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,65 +9,70 @@ declare(strict_types=1);
|
|||||||
* the LICENSE file that was distributed with this source code.
|
* the LICENSE file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Chill\ActivityBundle\Export\Export\LinkedToPerson;
|
namespace Chill\CalendarBundle\Export\Export\LinkedToPerson;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\CalendarBundle\Export\Declarations;
|
||||||
use Chill\ActivityBundle\Repository\ActivityRepository;
|
use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
|
||||||
use Chill\MainBundle\Export\ExportInterface;
|
use Chill\MainBundle\Export\ExportInterface;
|
||||||
use Chill\MainBundle\Export\FormatterInterface;
|
use Chill\MainBundle\Export\FormatterInterface;
|
||||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||||
use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
final readonly class CountHouseholdOnActivity implements ExportInterface, GroupedExportInterface
|
class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
private bool $filterStatsByCenters;
|
private readonly bool $filterStatsByCenters;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private ActivityRepository $activityRepository,
|
private readonly CalendarRepository $calendarRepository,
|
||||||
ParameterBagInterface $parameterBag,
|
ParameterBagInterface $parameterBag,
|
||||||
) {
|
) {
|
||||||
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder) {}
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
|
{
|
||||||
|
// no form needed
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAllowedFormattersTypes()
|
public function getAllowedFormattersTypes(): array
|
||||||
{
|
{
|
||||||
return [FormatterInterface::TYPE_TABULAR];
|
return [FormatterInterface::TYPE_TABULAR];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDescription()
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
return 'export.export.count_household_on_activity_person.description';
|
return 'export.export.stat_calendar_avg_duration_linked_to_person.description';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGroup(): string
|
public function getGroup(): string
|
||||||
{
|
{
|
||||||
return 'Exports of activities linked to a person';
|
return 'export.export.calendar_linked_to_person.group';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
if ('export_count_activity' !== $key) {
|
if ('export_result' !== $key) {
|
||||||
throw new \LogicException("the key {$key} is not used by this export");
|
throw new \LogicException("the key {$key} is not used by this export");
|
||||||
}
|
}
|
||||||
|
|
||||||
return static fn ($value) => '_header' === $value ? 'export.export.count_household_on_activity_person.header' : $value;
|
$labels = array_combine($values, $values);
|
||||||
|
$labels['_header'] = $this->getTitle();
|
||||||
|
|
||||||
|
return static fn ($value) => $labels[$value];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data): array
|
||||||
{
|
{
|
||||||
return ['export_count_activity'];
|
return ['export_result'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResult($query, $data)
|
public function getResult($query, $data)
|
||||||
@@ -75,42 +80,34 @@ final readonly class CountHouseholdOnActivity implements ExportInterface, Groupe
|
|||||||
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string
|
||||||
{
|
{
|
||||||
return 'export.export.count_household_on_activity_person.title';
|
return 'export.export.stat_calendar_avg_duration_linked_to_person.title';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getType(): string
|
public function getType(): string
|
||||||
{
|
{
|
||||||
return Declarations::ACTIVITY;
|
return Declarations::CALENDAR_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
|
||||||
{
|
{
|
||||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
|
||||||
$qb = $this->activityRepository
|
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
||||||
->createQueryBuilder('activity')
|
|
||||||
->join('activity.person', 'person')
|
|
||||||
->join(
|
|
||||||
HouseholdMember::class,
|
|
||||||
'householdmember',
|
|
||||||
Query\Expr\Join::WITH,
|
|
||||||
'person = householdmember.person AND householdmember.startDate <= activity.date AND (householdmember.endDate IS NULL OR householdmember.endDate > activity.date)'
|
|
||||||
)
|
|
||||||
->join('householdmember.household', 'household');
|
|
||||||
|
|
||||||
$qb->select('COUNT(DISTINCT household.id) as export_count_activity');
|
$qb->select('AVG(cal.endDate - cal.startDate) AS export_result');
|
||||||
|
$qb->join('cal.person', 'person');
|
||||||
|
|
||||||
if ($this->filterStatsByCenters) {
|
if ($this->filterStatsByCenters) {
|
||||||
$qb
|
$qb
|
||||||
->join('person.centerHistory', 'centerHistory')
|
->join('person.centerHistory', 'centerHistory')
|
||||||
->where(
|
->where(
|
||||||
$qb->expr()->andX(
|
$qb->expr()->andX(
|
||||||
$qb->expr()->lte('centerHistory.startDate', 'activity.date'),
|
$qb->expr()->lte('centerHistory.startDate', 'cal.startDate'),
|
||||||
$qb->expr()->orX(
|
$qb->expr()->orX(
|
||||||
$qb->expr()->isNull('centerHistory.endDate'),
|
$qb->expr()->isNull('centerHistory.endDate'),
|
||||||
$qb->expr()->gt('centerHistory.endDate', 'activity.date')
|
$qb->expr()->gt('centerHistory.endDate', 'cal.endDate')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -123,16 +120,13 @@ final readonly class CountHouseholdOnActivity implements ExportInterface, Groupe
|
|||||||
|
|
||||||
public function requiredRole(): string
|
public function requiredRole(): string
|
||||||
{
|
{
|
||||||
return ActivityStatsVoter::STATS;
|
return AccompanyingPeriodVoter::STATS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function supportsModifiers()
|
public function supportsModifiers(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Declarations::ACTIVITY,
|
Declarations::CALENDAR_TYPE,
|
||||||
Declarations::ACTIVITY_PERSON,
|
|
||||||
PersonDeclarations::PERSON_TYPE,
|
|
||||||
PersonDeclarations::HOUSEHOLD_TYPE,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
<?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\CalendarBundle\Export\Export\LinkedToPerson;
|
||||||
|
|
||||||
|
use Chill\CalendarBundle\Export\Declarations;
|
||||||
|
use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||||
|
use Chill\MainBundle\Export\ExportInterface;
|
||||||
|
use Chill\MainBundle\Export\FormatterInterface;
|
||||||
|
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||||
|
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||||
|
use Doctrine\ORM\Query;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
|
class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
|
||||||
|
{
|
||||||
|
private readonly bool $filterStatsByCenters;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
private readonly CalendarRepository $calendarRepository,
|
||||||
|
ParameterBagInterface $parameterBag,
|
||||||
|
) {
|
||||||
|
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
|
{
|
||||||
|
// no form needed
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFormDefaultData(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAllowedFormattersTypes(): array
|
||||||
|
{
|
||||||
|
return [FormatterInterface::TYPE_TABULAR];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'export.export.stat_calendar_sum_duration_linked_to_person.description';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getGroup(): string
|
||||||
|
{
|
||||||
|
return 'export.export.calendar_linked_to_person.group';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLabels($key, array $values, $data)
|
||||||
|
{
|
||||||
|
if ('export_result' !== $key) {
|
||||||
|
throw new \LogicException("the key {$key} is not used by this export");
|
||||||
|
}
|
||||||
|
|
||||||
|
$labels = array_combine($values, $values);
|
||||||
|
$labels['_header'] = $this->getTitle();
|
||||||
|
|
||||||
|
return static fn ($value) => $labels[$value];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getQueryKeys($data): array
|
||||||
|
{
|
||||||
|
return ['export_result'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getResult($query, $data)
|
||||||
|
{
|
||||||
|
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitle(): string
|
||||||
|
{
|
||||||
|
return 'export.export.stat_calendar_sum_duration_linked_to_person.title';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getType(): string
|
||||||
|
{
|
||||||
|
return Declarations::CALENDAR_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
|
||||||
|
{
|
||||||
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
|
||||||
|
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
||||||
|
|
||||||
|
$qb->select('SUM(cal.endDate - cal.startDate) AS export_result');
|
||||||
|
$qb->join('cal.person', 'person');
|
||||||
|
|
||||||
|
if ($this->filterStatsByCenters) {
|
||||||
|
$qb
|
||||||
|
->join('person.centerHistory', 'centerHistory')
|
||||||
|
->where(
|
||||||
|
$qb->expr()->andX(
|
||||||
|
$qb->expr()->lte('centerHistory.startDate', 'cal.startDate'),
|
||||||
|
$qb->expr()->orX(
|
||||||
|
$qb->expr()->isNull('centerHistory.endDate'),
|
||||||
|
$qb->expr()->gt('centerHistory.endDate', 'cal.endDate')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
->andWhere($qb->expr()->in('centerHistory.center', ':centers'))
|
||||||
|
->setParameter('centers', $centers);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $qb;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function requiredRole(): string
|
||||||
|
{
|
||||||
|
return AccompanyingPeriodVoter::STATS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function supportsModifiers(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Declarations::CALENDAR_TYPE,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,118 +1,139 @@
|
|||||||
services:
|
services:
|
||||||
|
|
||||||
## Indicators
|
## Indicators
|
||||||
chill.calendar.export.count_calendars:
|
chill.calendar.export.count_calendars_linked_to_acp:
|
||||||
class: Chill\CalendarBundle\Export\Export\CountCalendars
|
class: Chill\CalendarBundle\Export\Export\LinkedToAcp\CountCalendars
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export, alias: count_calendars }
|
- { name: chill.export, alias: count_calendars_linked_to_acp }
|
||||||
|
|
||||||
chill.calendar.export.average_duration_calendars:
|
chill.calendar.export.average_duration_calendars_linked_to_acp:
|
||||||
class: Chill\CalendarBundle\Export\Export\StatCalendarAvgDuration
|
class: Chill\CalendarBundle\Export\Export\LinkedToAcp\StatCalendarAvgDuration
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export, alias: average_duration_calendars }
|
- { name: chill.export, alias: average_duration_calendars_linked_to_acp }
|
||||||
|
|
||||||
chill.calendar.export.sum_duration_calendars:
|
chill.calendar.export.sum_duration_calendars_linked_to_acp:
|
||||||
class: Chill\CalendarBundle\Export\Export\StatCalendarSumDuration
|
class: Chill\CalendarBundle\Export\Export\LinkedToAcp\StatCalendarSumDuration
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export, alias: sum_duration_calendars }
|
- { name: chill.export, alias: sum_duration_calendars_linked_to_acp }
|
||||||
|
|
||||||
## Filters
|
chill.calendar.export.count_calendars_linked_to_person:
|
||||||
|
class: Chill\CalendarBundle\Export\Export\LinkedToPerson\CountCalendars
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
tags:
|
||||||
|
- { name: chill.export, alias: count_calendars_linked_to_person }
|
||||||
|
|
||||||
chill.calendar.export.agent_filter:
|
chill.calendar.export.average_duration_calendars_linked_to_person:
|
||||||
class: Chill\CalendarBundle\Export\Filter\AgentFilter
|
class: Chill\CalendarBundle\Export\Export\LinkedToPerson\StatCalendarAvgDuration
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_filter, alias: agent_filter }
|
- { name: chill.export, alias: average_duration_calendars_linked_to_person }
|
||||||
|
|
||||||
chill.calendar.export.job_filter:
|
chill.calendar.export.sum_duration_calendars_linked_to_person:
|
||||||
class: Chill\CalendarBundle\Export\Filter\JobFilter
|
class: Chill\CalendarBundle\Export\Export\LinkedToPerson\StatCalendarSumDuration
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_filter, alias: job_filter }
|
- { name: chill.export, alias: sum_duration_calendars_linked_to_person }
|
||||||
|
|
||||||
chill.calendar.export.scope_filter:
|
## Filters
|
||||||
class: Chill\CalendarBundle\Export\Filter\ScopeFilter
|
|
||||||
autowire: true
|
|
||||||
autoconfigure: true
|
|
||||||
tags:
|
|
||||||
- { name: chill.export_filter, alias: scope_filter }
|
|
||||||
|
|
||||||
chill.calendar.export.between_dates_filter:
|
chill.calendar.export.agent_filter:
|
||||||
class: Chill\CalendarBundle\Export\Filter\BetweenDatesFilter
|
class: Chill\CalendarBundle\Export\Filter\AgentFilter
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_filter, alias: between_dates_filter }
|
- { name: chill.export_filter, alias: agent_filter }
|
||||||
|
|
||||||
chill.calendar.export.calendar_range_filter:
|
chill.calendar.export.job_filter:
|
||||||
class: Chill\CalendarBundle\Export\Filter\CalendarRangeFilter
|
class: Chill\CalendarBundle\Export\Filter\JobFilter
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_filter, alias: calendar_range_filter }
|
- { name: chill.export_filter, alias: job_filter }
|
||||||
|
|
||||||
## Aggregator
|
chill.calendar.export.scope_filter:
|
||||||
|
class: Chill\CalendarBundle\Export\Filter\ScopeFilter
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
tags:
|
||||||
|
- { name: chill.export_filter, alias: scope_filter }
|
||||||
|
|
||||||
chill.calendar.export.agent_aggregator:
|
chill.calendar.export.between_dates_filter:
|
||||||
class: Chill\CalendarBundle\Export\Aggregator\AgentAggregator
|
class: Chill\CalendarBundle\Export\Filter\BetweenDatesFilter
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: agent_aggregator }
|
- { name: chill.export_filter, alias: between_dates_filter }
|
||||||
|
|
||||||
chill.calendar.export.job_aggregator:
|
chill.calendar.export.calendar_range_filter:
|
||||||
class: Chill\CalendarBundle\Export\Aggregator\JobAggregator
|
class: Chill\CalendarBundle\Export\Filter\CalendarRangeFilter
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: job_aggregator }
|
- { name: chill.export_filter, alias: calendar_range_filter }
|
||||||
|
|
||||||
chill.calendar.export.scope_aggregator:
|
## Aggregator
|
||||||
class: Chill\CalendarBundle\Export\Aggregator\ScopeAggregator
|
|
||||||
autowire: true
|
|
||||||
autoconfigure: true
|
|
||||||
tags:
|
|
||||||
- { name: chill.export_aggregator, alias: scope_aggregator }
|
|
||||||
|
|
||||||
chill.calendar.export.location_type_aggregator:
|
chill.calendar.export.agent_aggregator:
|
||||||
class: Chill\CalendarBundle\Export\Aggregator\LocationTypeAggregator
|
class: Chill\CalendarBundle\Export\Aggregator\AgentAggregator
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: location_type_aggregator }
|
- { name: chill.export_aggregator, alias: agent_aggregator }
|
||||||
|
|
||||||
chill.calendar.export.location_aggregator:
|
chill.calendar.export.job_aggregator:
|
||||||
class: Chill\CalendarBundle\Export\Aggregator\LocationAggregator
|
class: Chill\CalendarBundle\Export\Aggregator\JobAggregator
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: location_aggregator }
|
- { name: chill.export_aggregator, alias: job_aggregator }
|
||||||
|
|
||||||
chill.calendar.export.cancel_reason_aggregator:
|
chill.calendar.export.scope_aggregator:
|
||||||
class: Chill\CalendarBundle\Export\Aggregator\CancelReasonAggregator
|
class: Chill\CalendarBundle\Export\Aggregator\ScopeAggregator
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: cancel_reason_aggregator }
|
- { name: chill.export_aggregator, alias: scope_aggregator }
|
||||||
|
|
||||||
chill.calendar.export.month_aggregator:
|
chill.calendar.export.location_type_aggregator:
|
||||||
class: Chill\CalendarBundle\Export\Aggregator\MonthYearAggregator
|
class: Chill\CalendarBundle\Export\Aggregator\LocationTypeAggregator
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: month_aggregator }
|
- { name: chill.export_aggregator, alias: location_type_aggregator }
|
||||||
|
|
||||||
chill.calendar.export.urgency_aggregator:
|
chill.calendar.export.location_aggregator:
|
||||||
class: Chill\CalendarBundle\Export\Aggregator\UrgencyAggregator
|
class: Chill\CalendarBundle\Export\Aggregator\LocationAggregator
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: urgency_aggregator }
|
- { name: chill.export_aggregator, alias: location_aggregator }
|
||||||
|
|
||||||
|
chill.calendar.export.cancel_reason_aggregator:
|
||||||
|
class: Chill\CalendarBundle\Export\Aggregator\CancelReasonAggregator
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
tags:
|
||||||
|
- { name: chill.export_aggregator, alias: cancel_reason_aggregator }
|
||||||
|
|
||||||
|
chill.calendar.export.month_aggregator:
|
||||||
|
class: Chill\CalendarBundle\Export\Aggregator\MonthYearAggregator
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
tags:
|
||||||
|
- { name: chill.export_aggregator, alias: month_aggregator }
|
||||||
|
|
||||||
|
chill.calendar.export.urgency_aggregator:
|
||||||
|
class: Chill\CalendarBundle\Export\Aggregator\UrgencyAggregator
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
tags:
|
||||||
|
- { name: chill.export_aggregator, alias: urgency_aggregator }
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
<?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\CalendarBundle\Tests\Export\Export;
|
||||||
|
|
||||||
|
use Chill\CalendarBundle\Export\Declarations;
|
||||||
|
use Chill\CalendarBundle\Export\Export\LinkedToAcp\CountCalendars as CountCalendarsLinkedToAcp;
|
||||||
|
use Chill\CalendarBundle\Export\Export\LinkedToPerson\CountCalendars as CountCalendarsLinkedToPerson;
|
||||||
|
use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||||
|
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
class CountCalendarsTest extends AbstractExportTest
|
||||||
|
{
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getExport()
|
||||||
|
{
|
||||||
|
$repository = self::$container->get(CalendarRepository::class);
|
||||||
|
|
||||||
|
yield new CountCalendarsLinkedToAcp($repository, $this->getParameters(true));
|
||||||
|
yield new CountCalendarsLinkedToAcp($repository, $this->getParameters(false));
|
||||||
|
|
||||||
|
yield new CountCalendarsLinkedToPerson($repository, $this->getParameters(true));
|
||||||
|
yield new CountCalendarsLinkedToPerson($repository, $this->getParameters(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFormData()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getModifiersCombination()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
Declarations::CALENDAR_TYPE,
|
||||||
|
]];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
<?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\CalendarBundle\Tests\Export\Export;
|
||||||
|
|
||||||
|
use Chill\CalendarBundle\Export\Declarations;
|
||||||
|
use Chill\CalendarBundle\Export\Export\LinkedToAcp\StatCalendarAvgDuration as StatCalendarAvgDurationLinkedToAcp;
|
||||||
|
use Chill\CalendarBundle\Export\Export\LinkedToPerson\StatCalendarAvgDuration as StatCalendarAvgDurationLinkedToPerson;
|
||||||
|
use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||||
|
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
class StatCalendarAvgDurationTest extends AbstractExportTest
|
||||||
|
{
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getExport()
|
||||||
|
{
|
||||||
|
$repository = self::$container->get(CalendarRepository::class);
|
||||||
|
|
||||||
|
yield new StatCalendarAvgDurationLinkedToAcp($repository, $this->getParameters(true));
|
||||||
|
yield new StatCalendarAvgDurationLinkedToAcp($repository, $this->getParameters(false));
|
||||||
|
|
||||||
|
yield new StatCalendarAvgDurationLinkedToPerson($repository, $this->getParameters(true));
|
||||||
|
yield new StatCalendarAvgDurationLinkedToPerson($repository, $this->getParameters(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFormData()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getModifiersCombination()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
Declarations::CALENDAR_TYPE,
|
||||||
|
]];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
<?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\CalendarBundle\Tests\Export\Export;
|
||||||
|
|
||||||
|
use Chill\CalendarBundle\Export\Declarations;
|
||||||
|
use Chill\CalendarBundle\Export\Export\LinkedToAcp\StatCalendarSumDuration as StatCalendarSumDurationLinkedToAcp;
|
||||||
|
use Chill\CalendarBundle\Export\Export\LinkedToPerson\StatCalendarSumDuration as StatCalendarSumDurationLinkedToPerson;
|
||||||
|
use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||||
|
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
class StatCalendarSumDurationTest extends AbstractExportTest
|
||||||
|
{
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getExport()
|
||||||
|
{
|
||||||
|
$repository = self::$container->get(CalendarRepository::class);
|
||||||
|
|
||||||
|
yield new StatCalendarSumDurationLinkedToAcp($repository, $this->getParameters(true));
|
||||||
|
yield new StatCalendarSumDurationLinkedToAcp($repository, $this->getParameters(false));
|
||||||
|
|
||||||
|
yield new StatCalendarSumDurationLinkedToPerson($repository, $this->getParameters(true));
|
||||||
|
yield new StatCalendarSumDurationLinkedToPerson($repository, $this->getParameters(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFormData()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getModifiersCombination()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
Declarations::CALENDAR_TYPE,
|
||||||
|
]];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -112,6 +112,31 @@ Group calendars by month and year: Grouper les rendez-vous par mois et année
|
|||||||
Group calendars by urgency: Grouper les rendez-vous par urgent ou non
|
Group calendars by urgency: Grouper les rendez-vous par urgent ou non
|
||||||
|
|
||||||
export:
|
export:
|
||||||
|
export:
|
||||||
|
calendar_linked_to_person:
|
||||||
|
group: Exports des rendez-vous liés à un usager
|
||||||
|
calendar_linked_to_acp:
|
||||||
|
group: Exports des rendez-vous liés à un parcours
|
||||||
|
stat_calendar_sum_duration_linked_to_person:
|
||||||
|
title: Somme de la durée des rendez-vous
|
||||||
|
description: Additionne la durée des rendez-vous en fonction de différents paramètres.
|
||||||
|
stat_calendar_avg_duration_linked_to_person:
|
||||||
|
title: Moyenne de la durée des rendez-vous
|
||||||
|
description: Moyenne de la durée des rendez-vous en fonction de différents paramètres.
|
||||||
|
count_calendar_linked_to_person:
|
||||||
|
title: Nombre des rendez-vous
|
||||||
|
description: Compte le nombre des rendez-vous enregistrés et liés à un usager en fonction de différents paramètres.
|
||||||
|
count_calendar_linked_to_acp:
|
||||||
|
title: Nombre des rendez-vous
|
||||||
|
description: Compte le nombre des rendez-vous enregistrés et liées à un parcours en fonction de différents paramètres.
|
||||||
|
avg_duration_calendar_linked_to_acp:
|
||||||
|
title: Moyenne de la durée des rendez-vous
|
||||||
|
description: Moyenne de la durée des rendez-vous en fonction de différents paramètres.
|
||||||
|
sum_duration_calendar_linked_to_acp:
|
||||||
|
title: Somme de la durée des rendez-vous
|
||||||
|
description: Additionne la durée des rendez-vous en fonction de différents paramètres.
|
||||||
|
|
||||||
|
|
||||||
aggregator.calendar:
|
aggregator.calendar:
|
||||||
agent_job:
|
agent_job:
|
||||||
Group calendars by agent job: Grouper les rendez-vous par métier de l'agent
|
Group calendars by agent job: Grouper les rendez-vous par métier de l'agent
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class CustomFieldController extends AbstractController
|
|||||||
/**
|
/**
|
||||||
* Creates a new CustomField entity.
|
* Creates a new CustomField entity.
|
||||||
*
|
*
|
||||||
* @Route("/{_locale}/admin/customfield/new", name="customfield_create")
|
* @Route("/{_locale}/admin/customfield/new", name="customfield_new")
|
||||||
*/
|
*/
|
||||||
public function createAction(Request $request)
|
public function createAction(Request $request)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ class CustomFieldsGroupController extends AbstractController
|
|||||||
/**
|
/**
|
||||||
* Finds and displays a CustomFieldsGroup entity.
|
* Finds and displays a CustomFieldsGroup entity.
|
||||||
*
|
*
|
||||||
* @Route("/{_locale}/admin/customfieldsgroup/{id}/show", name="customfieldsgroup_show")
|
* @Route("/{_locale}/admin/customfieldsgroup/{id}/show", name="customfieldsgroup/show")
|
||||||
*/
|
*/
|
||||||
public function showAction(mixed $id)
|
public function showAction(mixed $id)
|
||||||
{
|
{
|
||||||
@@ -256,7 +256,7 @@ class CustomFieldsGroupController extends AbstractController
|
|||||||
/**
|
/**
|
||||||
* Edits an existing CustomFieldsGroup entity.
|
* Edits an existing CustomFieldsGroup entity.
|
||||||
*
|
*
|
||||||
* @Route("/{_locale}/admin/customfieldsgroup/{id}/update", name="customfieldsgroup_update")
|
* @Route("/{_locale}/admin/customfieldsgroup/{id}/update", name="customfieldsgroup/update")
|
||||||
*/
|
*/
|
||||||
public function updateAction(Request $request, mixed $id)
|
public function updateAction(Request $request, mixed $id)
|
||||||
{
|
{
|
||||||
@@ -383,7 +383,7 @@ class CustomFieldsGroupController extends AbstractController
|
|||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
$customFieldsGroupIds = $em->createQuery('SELECT g.id FROM '
|
$customFieldsGroupIds = $em->createQuery('SELECT g.id FROM '
|
||||||
.CustomFieldsDefaultGroup::class.' d '
|
.'ChillCustomFieldsBundle:CustomFieldsDefaultGroup d '
|
||||||
.'JOIN d.customFieldsGroup g')
|
.'JOIN d.customFieldsGroup g')
|
||||||
->getResult(Query::HYDRATE_SCALAR);
|
->getResult(Query::HYDRATE_SCALAR);
|
||||||
|
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ class CustomFieldChoice extends AbstractCustomField
|
|||||||
$template = '@ChillCustomFields/CustomFieldsRendering/choice.html.twig';
|
$template = '@ChillCustomFields/CustomFieldsRendering/choice.html.twig';
|
||||||
|
|
||||||
if ('csv' === $documentType) {
|
if ('csv' === $documentType) {
|
||||||
$template = '@ChillCustomFields/CustomFieldsRendering/choice.csv.twig';
|
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:choice.csv.twig';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->templating
|
return $this->templating
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class CustomFieldDate extends AbstractCustomField
|
|||||||
{
|
{
|
||||||
$validatorFunction = static function ($value, ExecutionContextInterface $context) {
|
$validatorFunction = static function ($value, ExecutionContextInterface $context) {
|
||||||
try {
|
try {
|
||||||
$date = new \DateTime((string) $value);
|
$date = new \DateTime($value);
|
||||||
} catch (\Exception) {
|
} catch (\Exception) {
|
||||||
$context->buildViolation('The expression "%expression%" is invalid', [
|
$context->buildViolation('The expression "%expression%" is invalid', [
|
||||||
'%expression%' => $value,
|
'%expression%' => $value,
|
||||||
@@ -125,7 +125,7 @@ class CustomFieldDate extends AbstractCustomField
|
|||||||
return $date->format('Y-m-d');
|
return $date->format('Y-m-d');
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$template = '@ChillCustomFields/CustomFieldsRendering/date.'
|
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:date.'
|
||||||
.$documentType.'.twig';
|
.$documentType.'.twig';
|
||||||
|
|
||||||
return $this->templating
|
return $this->templating
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class CustomFieldLongChoice extends AbstractCustomField
|
|||||||
public function render($value, CustomField $customField, $documentType = 'html')
|
public function render($value, CustomField $customField, $documentType = 'html')
|
||||||
{
|
{
|
||||||
$option = $this->deserialize($value, $customField);
|
$option = $this->deserialize($value, $customField);
|
||||||
$template = '@ChillCustomFields/CustomFieldsRendering/choice_long.'
|
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:choice_long.'
|
||||||
.$documentType.'.twig';
|
.$documentType.'.twig';
|
||||||
|
|
||||||
return $this->templating
|
return $this->templating
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class CustomFieldNumber extends AbstractCustomField
|
|||||||
|
|
||||||
public function render($value, CustomField $customField, $documentType = 'html')
|
public function render($value, CustomField $customField, $documentType = 'html')
|
||||||
{
|
{
|
||||||
$template = '@ChillCustomFields/CustomFieldsRendering/number.'
|
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:number.'
|
||||||
.$documentType.'.twig';
|
.$documentType.'.twig';
|
||||||
$options = $customField->getOptions();
|
$options = $customField->getOptions();
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class CustomFieldText extends AbstractCustomField
|
|||||||
$template = '@ChillCustomFields/CustomFieldsRendering/text.html.twig';
|
$template = '@ChillCustomFields/CustomFieldsRendering/text.html.twig';
|
||||||
|
|
||||||
if ('csv' === $documentType) {
|
if ('csv' === $documentType) {
|
||||||
$template = '@ChillCustomFields/CustomFieldsRendering/text.csv.twig';
|
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:text.csv.twig';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->templating
|
return $this->templating
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Form;
|
namespace Chill\CustomFieldsBundle\Form;
|
||||||
|
|
||||||
use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup;
|
|
||||||
use Chill\CustomFieldsBundle\Form\DataTransformer\CustomFieldsGroupToIdTransformer;
|
use Chill\CustomFieldsBundle\Form\DataTransformer\CustomFieldsGroupToIdTransformer;
|
||||||
use Chill\CustomFieldsBundle\Service\CustomFieldProvider;
|
use Chill\CustomFieldsBundle\Service\CustomFieldProvider;
|
||||||
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
||||||
@@ -46,7 +45,7 @@ class CustomFieldType extends AbstractType
|
|||||||
|
|
||||||
if ('entity' === $options['group_widget']) {
|
if ('entity' === $options['group_widget']) {
|
||||||
$builder->add('customFieldsGroup', EntityType::class, [
|
$builder->add('customFieldsGroup', EntityType::class, [
|
||||||
'class' => CustomFieldsGroup::class,
|
'class' => 'ChillCustomFieldsBundle:CustomFieldsGroup',
|
||||||
'choice_label' => fn ($g) => $this->translatableStringHelper->localize($g->getName()),
|
'choice_label' => fn ($g) => $this->translatableStringHelper->localize($g->getName()),
|
||||||
]);
|
]);
|
||||||
} elseif ('hidden' === $options['group_widget']) {
|
} elseif ('hidden' === $options['group_widget']) {
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
services:
|
services:
|
||||||
_defaults:
|
|
||||||
autowire: true
|
|
||||||
autoconfigure: true
|
|
||||||
|
|
||||||
Chill\CustomFieldsBundle\Controller\:
|
Chill\CustomFieldsBundle\Controller\:
|
||||||
resource: '../../Controller'
|
resource: '../../Controller'
|
||||||
tags: ['controller.service_arguments']
|
tags: ['controller.service_arguments']
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\DocGeneratorBundle\Serializer\Helper;
|
namespace Chill\DocGeneratorBundle\Serializer\Helper;
|
||||||
|
|
||||||
use Symfony\Component\Serializer\Mapping\ClassMetadataInterface;
|
use Symfony\Component\Serializer\Mapping\ClassMetadata;
|
||||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||||
|
|
||||||
class NormalizeNullValueHelper
|
class NormalizeNullValueHelper
|
||||||
{
|
{
|
||||||
public function __construct(private readonly NormalizerInterface $normalizer, private readonly ?string $discriminatorType = null, private readonly ?string $discriminatorValue = null) {}
|
public function __construct(private readonly NormalizerInterface $normalizer, private readonly ?string $discriminatorType = null, private readonly ?string $discriminatorValue = null) {}
|
||||||
|
|
||||||
public function normalize(array $attributes, string $format = 'docgen', ?array $context = [], ClassMetadataInterface $classMetadata = null)
|
public function normalize(array $attributes, string $format = 'docgen', ?array $context = [], ClassMetadata $classMetadata = null)
|
||||||
{
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
$data['isNull'] = true;
|
$data['isNull'] = true;
|
||||||
@@ -44,7 +44,7 @@ class NormalizeNullValueHelper
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getContextForAttribute(string $key, array $initialContext, ?ClassMetadataInterface $classMetadata): array
|
private function getContextForAttribute(string $key, array $initialContext, ?ClassMetadata $classMetadata): array
|
||||||
{
|
{
|
||||||
if (null === $classMetadata) {
|
if (null === $classMetadata) {
|
||||||
return $initialContext;
|
return $initialContext;
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ use Symfony\Component\PropertyAccess\PropertyAccessor;
|
|||||||
use Symfony\Component\Serializer\Exception\ExceptionInterface;
|
use Symfony\Component\Serializer\Exception\ExceptionInterface;
|
||||||
use Symfony\Component\Serializer\Exception\LogicException;
|
use Symfony\Component\Serializer\Exception\LogicException;
|
||||||
use Symfony\Component\Serializer\Mapping\AttributeMetadata;
|
use Symfony\Component\Serializer\Mapping\AttributeMetadata;
|
||||||
use Symfony\Component\Serializer\Mapping\AttributeMetadataInterface;
|
|
||||||
use Symfony\Component\Serializer\Mapping\ClassMetadata;
|
use Symfony\Component\Serializer\Mapping\ClassMetadata;
|
||||||
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
|
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||||
@@ -53,15 +52,12 @@ class DocGenObjectNormalizer implements NormalizerAwareInterface, NormalizerInte
|
|||||||
}
|
}
|
||||||
|
|
||||||
$metadata = $this->classMetadataFactory->getMetadataFor($classMetadataKey);
|
$metadata = $this->classMetadataFactory->getMetadataFor($classMetadataKey);
|
||||||
if (!$metadata instanceof ClassMetadata) {
|
|
||||||
throw new \LogicException('ClassMetadata should be the only one implementation for ClassMetadataInterface. See https://github.com/symfony/symfony/pull/17114');
|
|
||||||
}
|
|
||||||
$expectedGroups = \array_key_exists(AbstractNormalizer::GROUPS, $context) ?
|
$expectedGroups = \array_key_exists(AbstractNormalizer::GROUPS, $context) ?
|
||||||
\is_array($context[AbstractNormalizer::GROUPS]) ? $context[AbstractNormalizer::GROUPS] : [$context[AbstractNormalizer::GROUPS]]
|
\is_array($context[AbstractNormalizer::GROUPS]) ? $context[AbstractNormalizer::GROUPS] : [$context[AbstractNormalizer::GROUPS]]
|
||||||
: [];
|
: [];
|
||||||
$attributes = \array_filter(
|
$attributes = \array_filter(
|
||||||
$metadata->getAttributesMetadata(),
|
$metadata->getAttributesMetadata(),
|
||||||
static function (AttributeMetadataInterface $a) use ($expectedGroups) {
|
static function (AttributeMetadata $a) use ($expectedGroups) {
|
||||||
foreach ($a->getGroups() as $g) {
|
foreach ($a->getGroups() as $g) {
|
||||||
if (\in_array($g, $expectedGroups, true)) {
|
if (\in_array($g, $expectedGroups, true)) {
|
||||||
return true;
|
return true;
|
||||||
@@ -123,7 +119,7 @@ class DocGenObjectNormalizer implements NormalizerAwareInterface, NormalizerInte
|
|||||||
return $type->getName();
|
return $type->getName();
|
||||||
}
|
}
|
||||||
if ($type instanceof \ReflectionIntersectionType) {
|
if ($type instanceof \ReflectionIntersectionType) {
|
||||||
foreach (array_map(fn (\ReflectionType $t) => $t->getName(), $type->getTypes()) as $classString) {
|
foreach (array_map(fn (\ReflectionNamedType $t) => $t->getName(), $type->getTypes()) as $classString) {
|
||||||
if (ReadableCollection::class === $classString) {
|
if (ReadableCollection::class === $classString) {
|
||||||
return ReadableCollection::class;
|
return ReadableCollection::class;
|
||||||
}
|
}
|
||||||
@@ -215,7 +211,7 @@ class DocGenObjectNormalizer implements NormalizerAwareInterface, NormalizerInte
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array<AttributeMetadata> $attributes
|
* @param array|AttributeMetadata[] $attributes
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
<?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\MainBundle\Controller;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Form\UserPhonenumberType;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|
||||||
use Symfony\Component\Form\FormInterface;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
|
||||||
|
|
||||||
class UserProfileController extends AbstractController
|
|
||||||
{
|
|
||||||
public function __construct(
|
|
||||||
private readonly TranslatorInterface $translator,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* User profile that allows editing of phonenumber and visualization of certain data.
|
|
||||||
*
|
|
||||||
* @Route("/{_locale}/main/user/my-profile", name="chill_main_user_profile")
|
|
||||||
*/
|
|
||||||
public function __invoke(Request $request)
|
|
||||||
{
|
|
||||||
$user = $this->getUser();
|
|
||||||
$editForm = $this->createPhonenumberEditForm($user);
|
|
||||||
$editForm->handleRequest($request);
|
|
||||||
|
|
||||||
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
|
||||||
$phonenumber = $editForm->get('phonenumber')->getData();
|
|
||||||
|
|
||||||
$user->setPhonenumber($phonenumber);
|
|
||||||
|
|
||||||
$this->getDoctrine()->getManager()->flush();
|
|
||||||
$this->addFlash('success', $this->translator->trans('user.profile.Phonenumber successfully updated!'));
|
|
||||||
|
|
||||||
return $this->redirectToRoute('chill_main_user_profile');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('@ChillMain/User/profile.html.twig', [
|
|
||||||
'user' => $user,
|
|
||||||
'form' => $editForm->createView(),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function createPhonenumberEditForm(UserInterface $user): FormInterface
|
|
||||||
{
|
|
||||||
return $this->createForm(
|
|
||||||
UserPhonenumberType::class,
|
|
||||||
$user,
|
|
||||||
)
|
|
||||||
->add('submit', SubmitType::class, ['label' => $this->translator->trans('Save')]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -18,11 +18,9 @@ use Doctrine\Common\Collections\Collection;
|
|||||||
use Doctrine\Common\Collections\Criteria;
|
use Doctrine\Common\Collections\Criteria;
|
||||||
use Doctrine\Common\Collections\Selectable;
|
use Doctrine\Common\Collections\Selectable;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use libphonenumber\PhoneNumber;
|
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||||
use Chill\MainBundle\Validation\Constraint\PhonenumberConstraint;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User.
|
* User.
|
||||||
@@ -163,15 +161,6 @@ class User implements UserInterface, \Stringable
|
|||||||
*/
|
*/
|
||||||
private ?string $usernameCanonical = null;
|
private ?string $usernameCanonical = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* The user's mobile phone number.
|
|
||||||
*
|
|
||||||
* @ORM\Column(type="phone_number", nullable=true)
|
|
||||||
*
|
|
||||||
* @PhonenumberConstraint()
|
|
||||||
*/
|
|
||||||
private ?PhoneNumber $phonenumber = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User constructor.
|
* User constructor.
|
||||||
*/
|
*/
|
||||||
@@ -430,11 +419,6 @@ class User implements UserInterface, \Stringable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPhonenumber(): ?PhoneNumber
|
|
||||||
{
|
|
||||||
return $this->phonenumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws \RuntimeException if the groupCenter is not in the collection
|
* @throws \RuntimeException if the groupCenter is not in the collection
|
||||||
*/
|
*/
|
||||||
@@ -655,11 +639,4 @@ class User implements UserInterface, \Stringable
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setPhonenumber(?PhoneNumber $phonenumber): self
|
|
||||||
{
|
|
||||||
$this->phonenumber = $phonenumber;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,11 +92,6 @@ class UserHelper
|
|||||||
}
|
}
|
||||||
$asStrings = [];
|
$asStrings = [];
|
||||||
|
|
||||||
if (array_key_exists('uid', $decoded) || is_numeric($decoded)) {
|
|
||||||
// this is a single value. We have to wrap it into an array
|
|
||||||
$decoded = [$decoded];
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($decoded as $userId) {
|
foreach ($decoded as $userId) {
|
||||||
if (is_array($userId)) {
|
if (is_array($userId)) {
|
||||||
$uid = $userId['uid'];
|
$uid = $userId['uid'];
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
<?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\MainBundle\Form;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\User;
|
|
||||||
use Chill\MainBundle\Form\Type\ChillPhoneNumberType;
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
||||||
|
|
||||||
class UserPhonenumberType extends AbstractType
|
|
||||||
{
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
||||||
{
|
|
||||||
$builder
|
|
||||||
->add('phonenumber', ChillPhoneNumberType::class, [
|
|
||||||
'required' => false,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
|
||||||
{
|
|
||||||
$resolver->setDefaults([
|
|
||||||
'data_class' => User::class,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -16,7 +16,6 @@ use Chill\MainBundle\Entity\Location;
|
|||||||
use Chill\MainBundle\Entity\Scope;
|
use Chill\MainBundle\Entity\Scope;
|
||||||
use Chill\MainBundle\Entity\UserJob;
|
use Chill\MainBundle\Entity\UserJob;
|
||||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||||
use Chill\MainBundle\Form\Type\ChillPhoneNumberType;
|
|
||||||
use Chill\MainBundle\Form\Type\PickCivilityType;
|
use Chill\MainBundle\Form\Type\PickCivilityType;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
@@ -45,9 +44,6 @@ class UserType extends AbstractType
|
|||||||
->add('email', EmailType::class, [
|
->add('email', EmailType::class, [
|
||||||
'required' => true,
|
'required' => true,
|
||||||
])
|
])
|
||||||
->add('phonenumber', ChillPhoneNumberType::class, [
|
|
||||||
'required' => false,
|
|
||||||
])
|
|
||||||
->add('label', TextType::class)
|
->add('label', TextType::class)
|
||||||
->add('civility', PickCivilityType::class, [
|
->add('civility', PickCivilityType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
{#
|
|
||||||
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
|
|
||||||
<info@champs-libres.coop> / <http://www.champs-libres.coop>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#}
|
|
||||||
|
|
||||||
|
|
||||||
{% extends "@ChillMain/layout.html.twig" %}
|
|
||||||
|
|
||||||
|
|
||||||
{% block title %}{{"My profile"|trans}}{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<div class="justify-content-center col-10">
|
|
||||||
<h1>{{ 'user.profile.title'|trans }}</h1>
|
|
||||||
|
|
||||||
|
|
||||||
<dl>
|
|
||||||
<dt>{{ 'Job'|trans }}</dt>
|
|
||||||
{% if user.getUserJob is not null %}
|
|
||||||
<dd>{{ user.getUserJob.label|localize_translatable_string }}</dd>
|
|
||||||
{% else %}
|
|
||||||
<dd class="chill-no-data-statement">{{ 'user.profile.no job'|trans }}</dd>
|
|
||||||
{% endif %}
|
|
||||||
<dt>{{ 'Scope'|trans }}</dt>
|
|
||||||
{% if user.getMainScope is not null %}
|
|
||||||
<dd>{{ user.getMainScope.name|localize_translatable_string }}</dd>
|
|
||||||
{% else %}
|
|
||||||
<dd class="chill-no-data-statement">{{ 'user.profile.no scope'|trans }}</dd>
|
|
||||||
{% endif %}
|
|
||||||
</dl>
|
|
||||||
<div>
|
|
||||||
{{ form_start(form) }}
|
|
||||||
{{ form_row(form.phonenumber) }}
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
{{ form_widget(form.submit, { 'attr': { 'class': 'btn btn-save' } } ) }}
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
{{ form_end(form) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
@@ -29,14 +29,6 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
$user = $this->security->getUser();
|
$user = $this->security->getUser();
|
||||||
|
|
||||||
if ($user instanceof User) {
|
if ($user instanceof User) {
|
||||||
$menu->addChild($this->translator->trans('user.profile.title'), [
|
|
||||||
'route' => 'chill_main_user_profile',
|
|
||||||
])
|
|
||||||
->setExtras([
|
|
||||||
'order' => -11_111_111,
|
|
||||||
'icon' => 'user',
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (null !== $user->getCurrentLocation()) {
|
if (null !== $user->getCurrentLocation()) {
|
||||||
$locationTextMenu = $user->getCurrentLocation()->getName();
|
$locationTextMenu = $user->getCurrentLocation()->getName();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ use Chill\MainBundle\Entity\Scope;
|
|||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\MainBundle\Entity\UserJob;
|
use Chill\MainBundle\Entity\UserJob;
|
||||||
use Chill\MainBundle\Templating\Entity\UserRender;
|
use Chill\MainBundle\Templating\Entity\UserRender;
|
||||||
use libphonenumber\PhoneNumber;
|
|
||||||
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
|
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
|
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
|
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
|
||||||
@@ -35,7 +34,6 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware
|
|||||||
'text_without_absent' => '',
|
'text_without_absent' => '',
|
||||||
'label' => '',
|
'label' => '',
|
||||||
'email' => '',
|
'email' => '',
|
||||||
'isAbsent' => false,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct(private readonly UserRender $userRender) {}
|
public function __construct(private readonly UserRender $userRender) {}
|
||||||
@@ -63,13 +61,9 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware
|
|||||||
$context,
|
$context,
|
||||||
['docgen:expects' => Civility::class, 'groups' => 'docgen:read']
|
['docgen:expects' => Civility::class, 'groups' => 'docgen:read']
|
||||||
);
|
);
|
||||||
$phonenumberContext = array_merge(
|
|
||||||
$context,
|
|
||||||
['docgen:expects' => PhoneNumber::class, 'groups' => 'docgen:read']
|
|
||||||
);
|
|
||||||
|
|
||||||
if (null === $object && 'docgen' === $format) {
|
if (null === $object && 'docgen' === $format) {
|
||||||
return [...self::NULL_USER, 'phonenumber' => $this->normalizer->normalize(null, $format, $phonenumberContext), 'civility' => $this->normalizer->normalize(null, $format, $civilityContext), 'user_job' => $this->normalizer->normalize(null, $format, $userJobContext), 'main_center' => $this->normalizer->normalize(null, $format, $centerContext), 'main_scope' => $this->normalizer->normalize(null, $format, $scopeContext), 'current_location' => $this->normalizer->normalize(null, $format, $locationContext), 'main_location' => $this->normalizer->normalize(null, $format, $locationContext)];
|
return [...self::NULL_USER, 'civility' => $this->normalizer->normalize(null, $format, $civilityContext), 'user_job' => $this->normalizer->normalize(null, $format, $userJobContext), 'main_center' => $this->normalizer->normalize(null, $format, $centerContext), 'main_scope' => $this->normalizer->normalize(null, $format, $scopeContext), 'current_location' => $this->normalizer->normalize(null, $format, $locationContext), 'main_location' => $this->normalizer->normalize(null, $format, $locationContext)];
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
@@ -80,7 +74,6 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware
|
|||||||
'text_without_absent' => $this->userRender->renderString($object, ['absence' => false]),
|
'text_without_absent' => $this->userRender->renderString($object, ['absence' => false]),
|
||||||
'label' => $object->getLabel(),
|
'label' => $object->getLabel(),
|
||||||
'email' => (string) $object->getEmail(),
|
'email' => (string) $object->getEmail(),
|
||||||
'phonenumber' => $this->normalizer->normalize($object->getPhonenumber(), $format, $phonenumberContext),
|
|
||||||
'user_job' => $this->normalizer->normalize($object->getUserJob(), $format, $userJobContext),
|
'user_job' => $this->normalizer->normalize($object->getUserJob(), $format, $userJobContext),
|
||||||
'main_center' => $this->normalizer->normalize($object->getMainCenter(), $format, $centerContext),
|
'main_center' => $this->normalizer->normalize($object->getMainCenter(), $format, $centerContext),
|
||||||
'main_scope' => $this->normalizer->normalize($object->getMainScope(), $format, $scopeContext),
|
'main_scope' => $this->normalizer->normalize($object->getMainScope(), $format, $scopeContext),
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class AddressReferenceFromBano
|
|||||||
foreach ($stmt as $record) {
|
foreach ($stmt as $record) {
|
||||||
$this->baseImporter->importAddress(
|
$this->baseImporter->importAddress(
|
||||||
$record['refId'],
|
$record['refId'],
|
||||||
substr((string) $record['refId'], 0, 5), // extract insee from reference
|
substr($record['refId'], 0, 5), // extract insee from reference
|
||||||
$record['postcode'],
|
$record['postcode'],
|
||||||
$record['street'],
|
$record['street'],
|
||||||
$record['streetNumber'],
|
$record['streetNumber'],
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
|
|||||||
*/
|
*/
|
||||||
class PostalCodeFRFromOpenData
|
class PostalCodeFRFromOpenData
|
||||||
{
|
{
|
||||||
private const CSV = 'https://datanova.laposte.fr/data-fair/api/v1/datasets/laposte-hexasmal/data-files/019HexaSmal.csv';
|
private const CSV = 'https://datanova.legroupe.laposte.fr/explore/dataset/laposte_hexasmal/download/?format=csv&timezone=Europe/Berlin&lang=fr&use_labels_for_header=true&csv_separator=%3B';
|
||||||
|
|
||||||
public function __construct(private readonly PostalCodeBaseImporter $baseImporter, private readonly HttpClientInterface $client, private readonly LoggerInterface $logger) {}
|
public function __construct(private readonly PostalCodeBaseImporter $baseImporter, private readonly HttpClientInterface $client, private readonly LoggerInterface $logger) {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
<?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\MainBundle\Tests\Controller;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*
|
|
||||||
* @coversNothing
|
|
||||||
*/
|
|
||||||
final class UserProfileControllerTest extends WebTestCase
|
|
||||||
{
|
|
||||||
use PrepareClientTrait;
|
|
||||||
|
|
||||||
public function testPage()
|
|
||||||
{
|
|
||||||
$client = $this->getClientAuthenticated();
|
|
||||||
|
|
||||||
$client->request('GET', '/fr/main/user/my-profile');
|
|
||||||
$this->assertResponseIsSuccessful('Request GET /main/user/my-profile was successful');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,140 +0,0 @@
|
|||||||
<?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 Serializer\Normalizer;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\Center;
|
|
||||||
use Chill\MainBundle\Entity\Civility;
|
|
||||||
use Chill\MainBundle\Entity\Location;
|
|
||||||
use Chill\MainBundle\Entity\Scope;
|
|
||||||
use Chill\MainBundle\Entity\User;
|
|
||||||
use Chill\MainBundle\Entity\UserJob;
|
|
||||||
use Chill\MainBundle\Serializer\Normalizer\UserNormalizer;
|
|
||||||
use Chill\MainBundle\Templating\Entity\UserRender;
|
|
||||||
use libphonenumber\NumberParseException;
|
|
||||||
use libphonenumber\PhoneNumber;
|
|
||||||
use libphonenumber\PhoneNumberUtil;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
use Prophecy\Argument;
|
|
||||||
use Prophecy\PhpUnit\ProphecyTrait;
|
|
||||||
use Symfony\Component\Serializer\Exception\ExceptionInterface;
|
|
||||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*
|
|
||||||
* @coversNothing
|
|
||||||
*/
|
|
||||||
final class UserNormalizerTest extends TestCase
|
|
||||||
{
|
|
||||||
use ProphecyTrait;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws NumberParseException
|
|
||||||
*/
|
|
||||||
public function dataProviderUserNormalizer()
|
|
||||||
{
|
|
||||||
$user = new User();
|
|
||||||
$userNoPhone = new User();
|
|
||||||
|
|
||||||
$user
|
|
||||||
->setUsername('SomeUser')
|
|
||||||
->setLabel('SomeUser')
|
|
||||||
->setPhonenumber(PhoneNumberUtil::getInstance()->parse('+32475928635'))
|
|
||||||
->setEmail('some.user@chill.com');
|
|
||||||
|
|
||||||
$userNoPhone
|
|
||||||
->setUsername('AnotherUser')
|
|
||||||
->setLabel('AnotherUser');
|
|
||||||
|
|
||||||
yield [$user, 'docgen', ['docgen:expects' => User::class],
|
|
||||||
[
|
|
||||||
'id' => $user->getId(), // id
|
|
||||||
'type' => 'user', // type
|
|
||||||
'username' => 'SomeUser', // username
|
|
||||||
'email' => 'some.user@chill.com', // email
|
|
||||||
'text' => 'SomeUser', // text
|
|
||||||
'label' => 'SomeUser', // label
|
|
||||||
'phonenumber' => ['context' => PhoneNumber::class], // phonenumber
|
|
||||||
'main_scope' => ['context' => Scope::class], // scope
|
|
||||||
'user_job' => ['context' => UserJob::class], // user job
|
|
||||||
'current_location' => ['context' => Location::class], // curent location
|
|
||||||
'main_location' => ['context' => Location::class], // main location
|
|
||||||
'civility' => ['context' => Civility::class], // civility
|
|
||||||
'text_without_absent' => 'SomeUser',
|
|
||||||
'isAbsent' => false,
|
|
||||||
'main_center' => ['context' => Center::class],
|
|
||||||
]];
|
|
||||||
|
|
||||||
yield [$userNoPhone, 'docgen', ['docgen:expects' => User::class],
|
|
||||||
[
|
|
||||||
'id' => $user->getId(), // id
|
|
||||||
'type' => 'user', // type
|
|
||||||
'username' => 'AnotherUser', // username
|
|
||||||
'email' => '', // email
|
|
||||||
'text' => 'AnotherUser', // text
|
|
||||||
'label' => 'AnotherUser', // label
|
|
||||||
'phonenumber' => ['context' => PhoneNumber::class], // phonenumber
|
|
||||||
'main_scope' => ['context' => Scope::class], // scope
|
|
||||||
'user_job' => ['context' => UserJob::class], // user job
|
|
||||||
'current_location' => ['context' => Location::class], // curent location
|
|
||||||
'main_location' => ['context' => Location::class], // main location
|
|
||||||
'civility' => ['context' => Civility::class], // civility
|
|
||||||
'text_without_absent' => 'AnotherUser',
|
|
||||||
'isAbsent' => false,
|
|
||||||
'main_center' => ['context' => Center::class],
|
|
||||||
]];
|
|
||||||
|
|
||||||
yield [null, 'docgen', ['docgen:expects' => User::class], [
|
|
||||||
'id' => '', // id
|
|
||||||
'type' => 'user', // type
|
|
||||||
'username' => '', // username
|
|
||||||
'email' => '', // email
|
|
||||||
'text' => '', // text
|
|
||||||
'label' => '', // label
|
|
||||||
'phonenumber' => ['context' => PhoneNumber::class], // phonenumber
|
|
||||||
'main_scope' => ['context' => Scope::class], // scope
|
|
||||||
'user_job' => ['context' => UserJob::class], // user job
|
|
||||||
'current_location' => ['context' => Location::class], // curent location
|
|
||||||
'main_location' => ['context' => Location::class], // main location
|
|
||||||
'civility' => ['context' => Civility::class], // civility
|
|
||||||
'text_without_absent' => '',
|
|
||||||
'isAbsent' => false,
|
|
||||||
'main_center' => ['context' => Center::class],
|
|
||||||
]];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dataProvider dataProviderUserNormalizer
|
|
||||||
*
|
|
||||||
* @throws ExceptionInterface
|
|
||||||
*/
|
|
||||||
public function testNormalize(null|User $user, mixed $format, mixed $context, mixed $expected)
|
|
||||||
{
|
|
||||||
$userRender = $this->prophesize(UserRender::class);
|
|
||||||
$userRender->renderString(Argument::type(User::class), Argument::type('array'))->willReturn($user ? $user->getLabel() : '');
|
|
||||||
|
|
||||||
$normalizer = new UserNormalizer($userRender->reveal());
|
|
||||||
$normalizer->setNormalizer(new class () implements NormalizerInterface {
|
|
||||||
public function normalize($object, string $format = null, array $context = [])
|
|
||||||
{
|
|
||||||
return ['context' => $context['docgen:expects'] ?? null];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function supportsNormalization($data, string $format = null)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->assertEquals($expected, $normalizer->normalize($user, $format, $context));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
<?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\Migrations\Main;
|
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add phonenumber to user profile.
|
|
||||||
*/
|
|
||||||
final class Version20231020075524 extends AbstractMigration
|
|
||||||
{
|
|
||||||
public function getDescription(): string
|
|
||||||
{
|
|
||||||
return 'Add phonenumber to user profile';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function up(Schema $schema): void
|
|
||||||
{
|
|
||||||
$this->addSql('ALTER TABLE users ADD phonenumber VARCHAR(35) DEFAULT NULL');
|
|
||||||
$this->addSql('COMMENT ON COLUMN users.phonenumber IS \'(DC2Type:phone_number)\'');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down(Schema $schema): void
|
|
||||||
{
|
|
||||||
$this->addSql('ALTER TABLE users DROP phonenumber');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -44,13 +44,6 @@ address_fields: Données liées à l'adresse
|
|||||||
Datas: Données
|
Datas: Données
|
||||||
No title: Aucun titre
|
No title: Aucun titre
|
||||||
|
|
||||||
user:
|
|
||||||
profile:
|
|
||||||
title: Mon profil
|
|
||||||
Phonenumber successfully updated!: Numéro de téléphone mis à jour!
|
|
||||||
no job: Pas de métier assigné
|
|
||||||
no scope: Pas de cercle assigné
|
|
||||||
|
|
||||||
inactive: inactif
|
inactive: inactif
|
||||||
|
|
||||||
Edit: Modifier
|
Edit: Modifier
|
||||||
|
|||||||
@@ -39,13 +39,6 @@ Last updated by: Laatste update door
|
|||||||
on: "op "
|
on: "op "
|
||||||
Last updated on: Laatste update op
|
Last updated on: Laatste update op
|
||||||
by_user: "door "
|
by_user: "door "
|
||||||
lifecycleUpdate: Updates en creatie gebeurtenissen
|
|
||||||
address_fields: Gegevens gelinked aan het adres
|
|
||||||
Datas: Gegevens
|
|
||||||
No title: Geen titel
|
|
||||||
User profile: Mijn gebruikersprofiel
|
|
||||||
Phonenumber successfully updated!: Telefoonnummer bijgewerkt!
|
|
||||||
|
|
||||||
|
|
||||||
Edit: Bewerken
|
Edit: Bewerken
|
||||||
Update: Updaten
|
Update: Updaten
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
private ?AccompanyingPeriod $accompanyingPeriod = null;
|
private ?AccompanyingPeriod $accompanyingPeriod = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="text", nullable=false, options={"default":""})
|
* @ORM\Column(type="text")
|
||||||
*
|
*
|
||||||
* @Groups({"read", "write", "docgen:read"})
|
* @Groups({"read", "write", "docgen:read"})
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class ChildrenNumberAggregator implements AggregatorInterface
|
|||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
return static function (null|int|string $value): string {
|
return static function ($value): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'Number of children';
|
return 'Number of children';
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ class ChildrenNumberAggregator implements AggregatorInterface
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return (string) $value;
|
return $value;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ use Chill\MainBundle\Export\GroupedExportInterface;
|
|||||||
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
|
||||||
use Chill\PersonBundle\Entity\Household\Household;
|
use Chill\PersonBundle\Entity\Household\Household;
|
||||||
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
@@ -122,9 +121,7 @@ class CountHouseholdInPeriod implements ExportInterface, GroupedExportInterface
|
|||||||
->join('acppart.accompanyingPeriod', 'acp')
|
->join('acppart.accompanyingPeriod', 'acp')
|
||||||
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
|
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
|
||||||
->andWhere('hmember.startDate <= :count_household_at_date AND (hmember.endDate IS NULL OR hmember.endDate > :count_household_at_date)')
|
->andWhere('hmember.startDate <= :count_household_at_date AND (hmember.endDate IS NULL OR hmember.endDate > :count_household_at_date)')
|
||||||
->andWhere('acp.step != :count_acp_step')
|
->setParameter('count_household_at_date', $this->rollingDateConverter->convert($data['calc_date']));
|
||||||
->setParameter('count_household_at_date', $this->rollingDateConverter->convert($data['calc_date']))
|
|
||||||
->setParameter('count_acp_step', AccompanyingPeriod::STEP_DRAFT);
|
|
||||||
|
|
||||||
$qb
|
$qb
|
||||||
->select('COUNT(DISTINCT household.id) AS household_export_result')
|
->select('COUNT(DISTINCT household.id) AS household_export_result')
|
||||||
|
|||||||
@@ -19,22 +19,28 @@ use Chill\MainBundle\Form\Type\PickRollingDateType;
|
|||||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||||
|
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Chill\PersonBundle\Export\Helper\FilterListAccompanyingPeriodHelperInterface;
|
|
||||||
use Chill\PersonBundle\Export\Helper\ListAccompanyingPeriodHelper;
|
use Chill\PersonBundle\Export\Helper\ListAccompanyingPeriodHelper;
|
||||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||||
use Doctrine\ORM\AbstractQuery;
|
use Doctrine\ORM\AbstractQuery;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
final readonly class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface
|
final readonly class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
|
private bool $filterStatsByCenters;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private EntityManagerInterface $entityManager,
|
private EntityManagerInterface $entityManager,
|
||||||
private RollingDateConverterInterface $rollingDateConverter,
|
private RollingDateConverterInterface $rollingDateConverter,
|
||||||
private ListAccompanyingPeriodHelper $listAccompanyingPeriodHelper,
|
private ListAccompanyingPeriodHelper $listAccompanyingPeriodHelper,
|
||||||
private FilterListAccompanyingPeriodHelperInterface $filterListAccompanyingPeriodHelper,
|
ParameterBagInterface $parameterBag,
|
||||||
) {}
|
) {
|
||||||
|
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
||||||
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
{
|
{
|
||||||
@@ -95,6 +101,8 @@ final readonly class ListAccompanyingPeriod implements ListInterface, GroupedExp
|
|||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||||
{
|
{
|
||||||
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
|
||||||
$qb = $this->entityManager->createQueryBuilder();
|
$qb = $this->entityManager->createQueryBuilder();
|
||||||
|
|
||||||
$qb
|
$qb
|
||||||
@@ -102,7 +110,18 @@ final readonly class ListAccompanyingPeriod implements ListInterface, GroupedExp
|
|||||||
->andWhere('acp.step != :list_acp_step')
|
->andWhere('acp.step != :list_acp_step')
|
||||||
->setParameter('list_acp_step', AccompanyingPeriod::STEP_DRAFT);
|
->setParameter('list_acp_step', AccompanyingPeriod::STEP_DRAFT);
|
||||||
|
|
||||||
$this->filterListAccompanyingPeriodHelper->addFilterAccompanyingPeriods($qb, $requiredModifiers, $acl, $data);
|
if ($this->filterStatsByCenters) {
|
||||||
|
$qb
|
||||||
|
->andWhere(
|
||||||
|
$qb->expr()->exists(
|
||||||
|
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
||||||
|
JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
||||||
|
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||||
|
'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
->setParameter('authorized_centers', $centers);
|
||||||
|
}
|
||||||
|
|
||||||
$this->listAccompanyingPeriodHelper->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date']));
|
$this->listAccompanyingPeriodHelper->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date']));
|
||||||
|
|
||||||
|
|||||||
@@ -28,11 +28,11 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkGoal;
|
|||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkReferrerHistory;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkReferrerHistory;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\UserHistory;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\UserHistory;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\Evaluation;
|
use Chill\PersonBundle\Entity\SocialWork\Evaluation;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\Goal;
|
use Chill\PersonBundle\Entity\SocialWork\Goal;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\Result;
|
use Chill\PersonBundle\Entity\SocialWork\Result;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Chill\PersonBundle\Export\Helper\FilterListAccompanyingPeriodHelperInterface;
|
|
||||||
use Chill\PersonBundle\Export\Helper\LabelPersonHelper;
|
use Chill\PersonBundle\Export\Helper\LabelPersonHelper;
|
||||||
use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository;
|
use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository;
|
||||||
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
|
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
|
||||||
@@ -44,9 +44,10 @@ use Chill\ThirdPartyBundle\Export\Helper\LabelThirdPartyHelper;
|
|||||||
use Doctrine\ORM\AbstractQuery;
|
use Doctrine\ORM\AbstractQuery;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
final readonly class ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod implements ListInterface, GroupedExportInterface
|
class ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod implements ListInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
private const FIELDS = [
|
private const FIELDS = [
|
||||||
'id',
|
'id',
|
||||||
@@ -78,6 +79,8 @@ final readonly class ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeri
|
|||||||
'updatedBy',
|
'updatedBy',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
private readonly bool $filterStatsByCenters;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly EntityManagerInterface $entityManager,
|
private readonly EntityManagerInterface $entityManager,
|
||||||
private readonly DateTimeHelper $dateTimeHelper,
|
private readonly DateTimeHelper $dateTimeHelper,
|
||||||
@@ -91,8 +94,10 @@ final readonly class ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeri
|
|||||||
private readonly RollingDateConverterInterface $rollingDateConverter,
|
private readonly RollingDateConverterInterface $rollingDateConverter,
|
||||||
private readonly AggregateStringHelper $aggregateStringHelper,
|
private readonly AggregateStringHelper $aggregateStringHelper,
|
||||||
private readonly SocialActionRepository $socialActionRepository,
|
private readonly SocialActionRepository $socialActionRepository,
|
||||||
private readonly FilterListAccompanyingPeriodHelperInterface $filterListAccompanyingPeriodHelper,
|
ParameterBagInterface $parameterBag,
|
||||||
) {}
|
) {
|
||||||
|
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
||||||
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
{
|
{
|
||||||
@@ -201,7 +206,6 @@ final readonly class ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeri
|
|||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||||
{
|
{
|
||||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
$calcDate = $data['calc_date'] ?? new RollingDate(RollingDate::T_TODAY);
|
|
||||||
|
|
||||||
$qb = $this->entityManager->createQueryBuilder();
|
$qb = $this->entityManager->createQueryBuilder();
|
||||||
|
|
||||||
@@ -216,13 +220,23 @@ final readonly class ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeri
|
|||||||
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
|
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
|
||||||
// get participants at the given date
|
// get participants at the given date
|
||||||
->andWhere('acppart.startDate <= :calc_date AND (acppart.endDate > :calc_date OR acppart.endDate IS NULL)')
|
->andWhere('acppart.startDate <= :calc_date AND (acppart.endDate > :calc_date OR acppart.endDate IS NULL)')
|
||||||
->setParameter('calc_date', $this->rollingDateConverter->convert($calcDate));
|
->setParameter('calc_date', $this->rollingDateConverter->convert($data['calc_date']));
|
||||||
|
|
||||||
$this->filterListAccompanyingPeriodHelper->addFilterAccompanyingPeriods($qb, $requiredModifiers, $acl, $data);
|
if ($this->filterStatsByCenters) {
|
||||||
|
$qb
|
||||||
|
->andWhere(
|
||||||
|
$qb->expr()->exists(
|
||||||
|
'SELECT 1 FROM '.PersonCenterHistory::class.' acl_count_person_history WHERE acl_count_person_history.person = person
|
||||||
|
AND acl_count_person_history.center IN (:authorized_centers)
|
||||||
|
'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
->setParameter('authorized_centers', $centers);
|
||||||
|
}
|
||||||
|
|
||||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||||
|
|
||||||
$this->addSelectClauses($qb, $this->rollingDateConverter->convert($calcDate));
|
$this->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date']));
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,11 +28,11 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkGoal;
|
|||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkReferrerHistory;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkReferrerHistory;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\UserHistory;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\UserHistory;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\Evaluation;
|
use Chill\PersonBundle\Entity\SocialWork\Evaluation;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\Goal;
|
use Chill\PersonBundle\Entity\SocialWork\Goal;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\Result;
|
use Chill\PersonBundle\Entity\SocialWork\Result;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Chill\PersonBundle\Export\Helper\FilterListAccompanyingPeriodHelperInterface;
|
|
||||||
use Chill\PersonBundle\Export\Helper\LabelPersonHelper;
|
use Chill\PersonBundle\Export\Helper\LabelPersonHelper;
|
||||||
use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository;
|
use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository;
|
||||||
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
|
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
|
||||||
@@ -44,9 +44,10 @@ use Chill\ThirdPartyBundle\Export\Helper\LabelThirdPartyHelper;
|
|||||||
use Doctrine\ORM\AbstractQuery;
|
use Doctrine\ORM\AbstractQuery;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
final readonly class ListAccompanyingPeriodWorkAssociatePersonOnWork implements ListInterface, GroupedExportInterface
|
class ListAccompanyingPeriodWorkAssociatePersonOnWork implements ListInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
private const FIELDS = [
|
private const FIELDS = [
|
||||||
'id',
|
'id',
|
||||||
@@ -78,6 +79,8 @@ final readonly class ListAccompanyingPeriodWorkAssociatePersonOnWork implements
|
|||||||
'updatedBy',
|
'updatedBy',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
private readonly bool $filterStatsByCenters;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly EntityManagerInterface $entityManager,
|
private readonly EntityManagerInterface $entityManager,
|
||||||
private readonly DateTimeHelper $dateTimeHelper,
|
private readonly DateTimeHelper $dateTimeHelper,
|
||||||
@@ -91,8 +94,10 @@ final readonly class ListAccompanyingPeriodWorkAssociatePersonOnWork implements
|
|||||||
private readonly RollingDateConverterInterface $rollingDateConverter,
|
private readonly RollingDateConverterInterface $rollingDateConverter,
|
||||||
private readonly AggregateStringHelper $aggregateStringHelper,
|
private readonly AggregateStringHelper $aggregateStringHelper,
|
||||||
private readonly SocialActionRepository $socialActionRepository,
|
private readonly SocialActionRepository $socialActionRepository,
|
||||||
private FilterListAccompanyingPeriodHelperInterface $filterListAccompanyingPeriodHelper,
|
ParameterBagInterface $parameterBag,
|
||||||
) {}
|
) {
|
||||||
|
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
||||||
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
{
|
{
|
||||||
@@ -201,7 +206,6 @@ final readonly class ListAccompanyingPeriodWorkAssociatePersonOnWork implements
|
|||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||||
{
|
{
|
||||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
$calcDate = $data['calc_date'] ?? new RollingDate(RollingDate::T_TODAY);
|
|
||||||
|
|
||||||
$qb = $this->entityManager->createQueryBuilder();
|
$qb = $this->entityManager->createQueryBuilder();
|
||||||
|
|
||||||
@@ -213,11 +217,21 @@ final readonly class ListAccompanyingPeriodWorkAssociatePersonOnWork implements
|
|||||||
->join('acpw.persons', 'person')
|
->join('acpw.persons', 'person')
|
||||||
;
|
;
|
||||||
|
|
||||||
$this->filterListAccompanyingPeriodHelper->addFilterAccompanyingPeriods($qb, $requiredModifiers, $acl, $data);
|
if ($this->filterStatsByCenters) {
|
||||||
|
$qb
|
||||||
|
->andWhere(
|
||||||
|
$qb->expr()->exists(
|
||||||
|
'SELECT 1 FROM '.PersonCenterHistory::class.' acl_count_person_history WHERE acl_count_person_history.person = person
|
||||||
|
AND acl_count_person_history.center IN (:authorized_centers)
|
||||||
|
'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
->setParameter('authorized_centers', $centers);
|
||||||
|
}
|
||||||
|
|
||||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||||
|
|
||||||
$this->addSelectClauses($qb, $this->rollingDateConverter->convert($calcDate));
|
$this->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date']));
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
|||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\UserHistory;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\UserHistory;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Chill\PersonBundle\Export\Helper\FilterListAccompanyingPeriodHelperInterface;
|
|
||||||
use Chill\PersonBundle\Export\Helper\LabelPersonHelper;
|
use Chill\PersonBundle\Export\Helper\LabelPersonHelper;
|
||||||
use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository;
|
use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository;
|
||||||
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
|
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
|
||||||
@@ -37,9 +37,10 @@ use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
|
|||||||
use Doctrine\ORM\AbstractQuery;
|
use Doctrine\ORM\AbstractQuery;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
final readonly class ListEvaluation implements ListInterface, GroupedExportInterface
|
class ListEvaluation implements ListInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
private const FIELDS = [
|
private const FIELDS = [
|
||||||
'id',
|
'id',
|
||||||
@@ -68,6 +69,8 @@ final readonly class ListEvaluation implements ListInterface, GroupedExportInter
|
|||||||
'updatedBy',
|
'updatedBy',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
private readonly bool $filterStatsByCenters;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly EntityManagerInterface $entityManager,
|
private readonly EntityManagerInterface $entityManager,
|
||||||
private readonly SocialIssueRender $socialIssueRender,
|
private readonly SocialIssueRender $socialIssueRender,
|
||||||
@@ -80,8 +83,10 @@ final readonly class ListEvaluation implements ListInterface, GroupedExportInter
|
|||||||
private readonly TranslatableStringExportLabelHelper $translatableStringExportLabelHelper,
|
private readonly TranslatableStringExportLabelHelper $translatableStringExportLabelHelper,
|
||||||
private readonly AggregateStringHelper $aggregateStringHelper,
|
private readonly AggregateStringHelper $aggregateStringHelper,
|
||||||
private readonly RollingDateConverterInterface $rollingDateConverter,
|
private readonly RollingDateConverterInterface $rollingDateConverter,
|
||||||
private FilterListAccompanyingPeriodHelperInterface $filterListAccompanyingPeriodHelper,
|
ParameterBagInterface $parameterBag,
|
||||||
) {}
|
) {
|
||||||
|
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
||||||
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
{
|
{
|
||||||
@@ -188,7 +193,6 @@ final readonly class ListEvaluation implements ListInterface, GroupedExportInter
|
|||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||||
{
|
{
|
||||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
$calcDate = $data['calc_date'] ?? new RollingDate(RollingDate::T_TODAY);
|
|
||||||
|
|
||||||
$qb = $this->entityManager->createQueryBuilder();
|
$qb = $this->entityManager->createQueryBuilder();
|
||||||
|
|
||||||
@@ -204,13 +208,23 @@ final readonly class ListEvaluation implements ListInterface, GroupedExportInter
|
|||||||
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
|
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
|
||||||
// get participants at the given date
|
// get participants at the given date
|
||||||
->andWhere('acppart.startDate <= :calc_date AND (acppart.endDate > :calc_date OR acppart.endDate IS NULL)')
|
->andWhere('acppart.startDate <= :calc_date AND (acppart.endDate > :calc_date OR acppart.endDate IS NULL)')
|
||||||
->setParameter('calc_date', $this->rollingDateConverter->convert($calcDate));
|
->setParameter('calc_date', $this->rollingDateConverter->convert($data['calc_date']));
|
||||||
|
|
||||||
$this->filterListAccompanyingPeriodHelper->addFilterAccompanyingPeriods($qb, $requiredModifiers, $acl, $data);
|
if ($this->filterStatsByCenters) {
|
||||||
|
$qb
|
||||||
|
->andWhere(
|
||||||
|
$qb->expr()->exists(
|
||||||
|
'SELECT 1 FROM '.PersonCenterHistory::class.' acl_count_person_history WHERE acl_count_person_history.person = person
|
||||||
|
AND acl_count_person_history.center IN (:authorized_centers)
|
||||||
|
'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
->setParameter('authorized_centers', $centers);
|
||||||
|
}
|
||||||
|
|
||||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||||
|
|
||||||
$this->addSelectClauses($qb, $this->rollingDateConverter->convert($calcDate));
|
$this->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date']));
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
}
|
}
|
||||||
@@ -264,7 +278,7 @@ final readonly class ListEvaluation implements ListInterface, GroupedExportInter
|
|||||||
// referrers => at date XXXX
|
// referrers => at date XXXX
|
||||||
$qb
|
$qb
|
||||||
->addSelect('(SELECT JSON_BUILD_OBJECT(\'uid\', IDENTITY(history.user), \'d\', history.startDate) 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
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ use Chill\MainBundle\Export\ListInterface;
|
|||||||
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
|
||||||
use Chill\PersonBundle\Entity\Household\Household;
|
use Chill\PersonBundle\Entity\Household\Household;
|
||||||
use Chill\PersonBundle\Entity\Household\HouseholdComposition;
|
use Chill\PersonBundle\Entity\Household\HouseholdComposition;
|
||||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||||
@@ -145,9 +144,7 @@ class ListHouseholdInPeriod implements ListInterface, GroupedExportInterface
|
|||||||
->join('acppart.accompanyingPeriod', 'acp')
|
->join('acppart.accompanyingPeriod', 'acp')
|
||||||
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
|
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
|
||||||
->andWhere('hmember.startDate <= :count_household_at_date AND (hmember.endDate IS NULL OR hmember.endDate > :count_household_at_date)')
|
->andWhere('hmember.startDate <= :count_household_at_date AND (hmember.endDate IS NULL OR hmember.endDate > :count_household_at_date)')
|
||||||
->andWhere('acp.step != :list_acp_step')
|
->setParameter('count_household_at_date', $this->rollingDateConverter->convert($data['calc_date']));
|
||||||
->setParameter('count_household_at_date', $this->rollingDateConverter->convert($data['calc_date']))
|
|
||||||
->setParameter('list_acp_step', AccompanyingPeriod::STEP_DRAFT);
|
|
||||||
|
|
||||||
if ($this->filterStatsByCenters) {
|
if ($this->filterStatsByCenters) {
|
||||||
$qb
|
$qb
|
||||||
|
|||||||
@@ -332,18 +332,13 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou
|
|||||||
if (null === $value) {
|
if (null === $value) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
$decoded = json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR);
|
||||||
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
$label = $cfType->getChoices($cf)[$slugChoice];
|
$label = $cfType->getChoices($cf)[$slugChoice];
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize($cf->getName())
|
return $this->translatableStringHelper->localize($cf->getName())
|
||||||
.' | '.$label;
|
.' | '.$label;
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
$decoded = json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR);
|
|
||||||
} catch (\JsonException $e) {
|
|
||||||
throw new \RuntimeException(sprintf('unable to decode json: %s, %s', json_last_error(), json_last_error_msg()), $e->getCode(), $e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('_other' === $slugChoice && $cfType->isChecked($cf, $slugChoice, $decoded)) {
|
if ('_other' === $slugChoice && $cfType->isChecked($cf, $slugChoice, $decoded)) {
|
||||||
|
|||||||
@@ -20,14 +20,15 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
|
|||||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Chill\PersonBundle\Export\Helper\FilterListAccompanyingPeriodHelperInterface;
|
|
||||||
use Chill\PersonBundle\Export\Helper\ListAccompanyingPeriodHelper;
|
use Chill\PersonBundle\Export\Helper\ListAccompanyingPeriodHelper;
|
||||||
use Chill\PersonBundle\Export\Helper\ListPersonHelper;
|
use Chill\PersonBundle\Export\Helper\ListPersonHelper;
|
||||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||||
use DateTimeImmutable;
|
use DateTimeImmutable;
|
||||||
use Doctrine\ORM\AbstractQuery;
|
use Doctrine\ORM\AbstractQuery;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,13 +36,17 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
*/
|
*/
|
||||||
final readonly class ListPersonWithAccompanyingPeriodDetails implements ListInterface, GroupedExportInterface
|
final readonly class ListPersonWithAccompanyingPeriodDetails implements ListInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
|
private bool $filterStatsByCenters;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private ListPersonHelper $listPersonHelper,
|
private ListPersonHelper $listPersonHelper,
|
||||||
private ListAccompanyingPeriodHelper $listAccompanyingPeriodHelper,
|
private ListAccompanyingPeriodHelper $listAccompanyingPeriodHelper,
|
||||||
private EntityManagerInterface $entityManager,
|
private EntityManagerInterface $entityManager,
|
||||||
private RollingDateConverterInterface $rollingDateConverter,
|
private RollingDateConverterInterface $rollingDateConverter,
|
||||||
private FilterListAccompanyingPeriodHelperInterface $filterListAccompanyingPeriodHelper,
|
ParameterBagInterface $parameterBag,
|
||||||
) {}
|
) {
|
||||||
|
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
||||||
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
{
|
{
|
||||||
@@ -117,7 +122,14 @@ final readonly class ListPersonWithAccompanyingPeriodDetails implements ListInte
|
|||||||
->join('acppart.accompanyingPeriod', 'acp')
|
->join('acppart.accompanyingPeriod', 'acp')
|
||||||
->andWhere($qb->expr()->neq('acp.step', "'".AccompanyingPeriod::STEP_DRAFT."'"));
|
->andWhere($qb->expr()->neq('acp.step', "'".AccompanyingPeriod::STEP_DRAFT."'"));
|
||||||
|
|
||||||
$this->filterListAccompanyingPeriodHelper->addFilterAccompanyingPeriods($qb, $requiredModifiers, $acl, $data);
|
if ($this->filterStatsByCenters) {
|
||||||
|
$qb
|
||||||
|
->andWhere(
|
||||||
|
$qb->expr()->exists(
|
||||||
|
'SELECT 1 FROM '.PersonCenterHistory::class.' pch WHERE pch.person = person.id AND pch.center IN (:authorized_centers)'
|
||||||
|
)
|
||||||
|
)->setParameter('authorized_centers', $centers);
|
||||||
|
}
|
||||||
|
|
||||||
$this->listPersonHelper->addSelect($qb, ListPersonHelper::FIELDS, $this->rollingDateConverter->convert($data['address_date']));
|
$this->listPersonHelper->addSelect($qb, ListPersonHelper::FIELDS, $this->rollingDateConverter->convert($data['address_date']));
|
||||||
$this->listAccompanyingPeriodHelper->addSelectClauses($qb, $this->rollingDateConverter->convert($data['address_date']));
|
$this->listAccompanyingPeriodHelper->addSelectClauses($qb, $this->rollingDateConverter->convert($data['address_date']));
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ use Chill\MainBundle\Entity\User;
|
|||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Form\Type\PickUserDynamicType;
|
use Chill\MainBundle\Form\Type\PickUserDynamicType;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
@@ -60,13 +59,7 @@ class CreatorFilter implements FilterInterface
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'Filtered by creator: only %creators%', [
|
'Filtered by creator: only %creators%', [
|
||||||
'%creators%' => implode(
|
'%creators%' => implode(', ', array_map(static fn (User $u) => $u->getLabel(), $data['accepted_creators'])),
|
||||||
', ',
|
|
||||||
array_map(
|
|
||||||
static fn (User $u) => $u->getLabel(),
|
|
||||||
$data['accepted_creators'] instanceof Collection ? $data['accepted_creators']->toArray() : $data['accepted_creators']
|
|
||||||
)
|
|
||||||
),
|
|
||||||
], ];
|
], ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ 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;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
@@ -69,10 +68,7 @@ class GeographicalUnitStatFilter implements FilterInterface
|
|||||||
'acp_geog_filter_date',
|
'acp_geog_filter_date',
|
||||||
$this->rollingDateConverter->convert($data['date_calc'])
|
$this->rollingDateConverter->convert($data['date_calc'])
|
||||||
)
|
)
|
||||||
->setParameter('acp_geog_filter_units', array_map(
|
->setParameter('acp_geog_filter_units', array_map(static fn (SimpleGeographicalUnitDTO $unitDTO) => $unitDTO->id, $data['units']));
|
||||||
static fn (SimpleGeographicalUnitDTO $unitDTO) => $unitDTO->id,
|
|
||||||
$data['units'] instanceof Collection ? $data['units']->toArray() : $data['units']
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ use Chill\PersonBundle\Export\Declarations;
|
|||||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||||
use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType;
|
use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType;
|
||||||
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
|
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
@@ -53,10 +52,7 @@ final readonly class HandlingThirdPartyFilter implements FilterInterface
|
|||||||
[
|
[
|
||||||
'%3parties%' => implode(
|
'%3parties%' => implode(
|
||||||
', ',
|
', ',
|
||||||
array_map(
|
array_map(fn (ThirdParty $thirdParty) => $this->thirdPartyRender->renderString($thirdParty, []), $data['handling_3parties'])
|
||||||
fn (ThirdParty $thirdParty) => $this->thirdPartyRender->renderString($thirdParty, []),
|
|
||||||
$data['handling_3parties'] instanceof Collection ? $data['handling_3parties']->toArray() : $data['handling_3parties']
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
|||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodInfo;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodInfo;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
@@ -116,7 +115,7 @@ readonly class JobWorkingOnCourseFilter implements FilterInterface
|
|||||||
', ',
|
', ',
|
||||||
array_map(
|
array_map(
|
||||||
fn (UserJob $userJob) => $this->translatableStringHelper->localize($userJob->getLabel()),
|
fn (UserJob $userJob) => $this->translatableStringHelper->localize($userJob->getLabel()),
|
||||||
$data['jobs'] instanceof Collection ? $data['jobs']->toArray() : $data['jobs']
|
$data['jobs']
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'%start_date%' => $this->rollingDateConverter->convert($data['start_date'])?->format('d-m-Y'),
|
'%start_date%' => $this->rollingDateConverter->convert($data['start_date'])?->format('d-m-Y'),
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
|||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodInfo;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodInfo;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
@@ -111,7 +110,7 @@ readonly class ScopeWorkingOnCourseFilter implements FilterInterface
|
|||||||
', ',
|
', ',
|
||||||
array_map(
|
array_map(
|
||||||
fn (Scope $scope) => $this->translatableStringHelper->localize($scope->getName()),
|
fn (Scope $scope) => $this->translatableStringHelper->localize($scope->getName()),
|
||||||
$data['scopes'] instanceof Collection ? $data['scopes']->toArray() : $data['scopes']
|
$data['scopes']
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'%start_date%' => $this->rollingDateConverter->convert($data['start_date'])?->format('d-m-Y'),
|
'%start_date%' => $this->rollingDateConverter->convert($data['start_date'])?->format('d-m-Y'),
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
|
|||||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
@@ -99,10 +98,7 @@ class StepFilterBetweenDates implements FilterInterface
|
|||||||
|
|
||||||
public function describeAction($data, $format = 'string')
|
public function describeAction($data, $format = 'string')
|
||||||
{
|
{
|
||||||
$steps = array_map(
|
$steps = array_map(fn (string $step) => $this->translator->trans(array_flip(self::STEPS)[$step]), $data['accepted_steps_multi']);
|
||||||
fn (string $step) => $this->translator->trans(array_flip(self::STEPS)[$step]),
|
|
||||||
$data['accepted_steps_multi'] instanceof Collection ? $data['accepted_steps_multi']->toArray() : $data['accepted_steps_multi']
|
|
||||||
);
|
|
||||||
|
|
||||||
return ['export.filter.course.by_step.Filtered by steps: only %step% and between %date_from% and %date_to%', [
|
return ['export.filter.course.by_step.Filtered by steps: only %step% and between %date_from% and %date_to%', [
|
||||||
'%step%' => implode(', ', $steps),
|
'%step%' => implode(', ', $steps),
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
|
|||||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
@@ -102,10 +101,7 @@ class StepFilterOnDate implements FilterInterface
|
|||||||
|
|
||||||
public function describeAction($data, $format = 'string')
|
public function describeAction($data, $format = 'string')
|
||||||
{
|
{
|
||||||
$steps = array_map(
|
$steps = array_map(fn (string $step) => $this->translator->trans(array_flip(self::STEPS)[$step]), $data['accepted_steps_multi']);
|
||||||
fn (string $step) => $this->translator->trans(array_flip(self::STEPS)[$step]),
|
|
||||||
$data['accepted_steps_multi'] instanceof Collection ? $data['accepted_steps_multi']->toArray() : $data['accepted_steps_multi']
|
|
||||||
);
|
|
||||||
|
|
||||||
return ['Filtered by steps: only %step%', [
|
return ['Filtered by steps: only %step%', [
|
||||||
'%step%' => implode(', ', $steps),
|
'%step%' => implode(', ', $steps),
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
|||||||
use Chill\MainBundle\Templating\Entity\UserRender;
|
use Chill\MainBundle\Templating\Entity\UserRender;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
@@ -73,7 +72,7 @@ final readonly class UserWorkingOnCourseFilter implements FilterInterface
|
|||||||
', ',
|
', ',
|
||||||
array_map(
|
array_map(
|
||||||
fn (User $u) => $this->userRender->renderString($u, []),
|
fn (User $u) => $this->userRender->renderString($u, []),
|
||||||
$data['users'] instanceof Collection ? $data['users']->toArray() : $data['users']
|
$data['users']
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'%start_date%' => $this->rollingDateConverter->convert($data['start_date'])?->format('d-m-Y'),
|
'%start_date%' => $this->rollingDateConverter->convert($data['start_date'])?->format('d-m-Y'),
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ use Chill\MainBundle\Export\FilterInterface;
|
|||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\Evaluation;
|
use Chill\PersonBundle\Entity\SocialWork\Evaluation;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Chill\PersonBundle\Repository\SocialWork\EvaluationRepositoryInterface;
|
use Doctrine\ORM\Query\Expr\Andx;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
final readonly class EvaluationTypeFilter implements FilterInterface
|
final readonly class EvaluationTypeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
public function __construct(private TranslatableStringHelper $translatableStringHelper, private EvaluationRepositoryInterface $evaluationRepository) {}
|
public function __construct(private TranslatableStringHelper $translatableStringHelper) {}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
{
|
{
|
||||||
@@ -31,9 +31,16 @@ final readonly class EvaluationTypeFilter implements FilterInterface
|
|||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
$qb->andWhere(
|
$where = $qb->getDQLPart('where');
|
||||||
$qb->expr()->in('workeval.evaluation', ':evaluationtype')
|
$clause = $qb->expr()->in('eval.evaluation', ':evaluationtype');
|
||||||
);
|
|
||||||
|
if ($where instanceof Andx) {
|
||||||
|
$where->add($clause);
|
||||||
|
} else {
|
||||||
|
$where = $qb->expr()->andX($clause);
|
||||||
|
}
|
||||||
|
|
||||||
|
$qb->add('where', $where);
|
||||||
$qb->setParameter('evaluationtype', $data['accepted_evaluationtype']);
|
$qb->setParameter('evaluationtype', $data['accepted_evaluationtype']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,17 +51,11 @@ final readonly class EvaluationTypeFilter implements FilterInterface
|
|||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
{
|
{
|
||||||
$evaluations = $this->evaluationRepository->findAllActive();
|
|
||||||
|
|
||||||
usort($evaluations, fn (Evaluation $a, Evaluation $b) => $this->translatableStringHelper->localize($a->getTitle()) <=> $this->translatableStringHelper->localize($b->getTitle()));
|
|
||||||
|
|
||||||
$builder->add('accepted_evaluationtype', EntityType::class, [
|
$builder->add('accepted_evaluationtype', EntityType::class, [
|
||||||
'class' => Evaluation::class,
|
'class' => Evaluation::class,
|
||||||
'choices' => $evaluations,
|
|
||||||
'choice_label' => fn (Evaluation $ev): string => $this->translatableStringHelper->localize($ev->getTitle()),
|
'choice_label' => fn (Evaluation $ev): string => $this->translatableStringHelper->localize($ev->getTitle()),
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
'expanded' => false,
|
'expanded' => true,
|
||||||
'attr' => ['class' => 'select2'],
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ use Chill\PersonBundle\Entity\Household\HouseholdCompositionType;
|
|||||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Chill\PersonBundle\Repository\Household\HouseholdCompositionTypeRepositoryInterface;
|
use Chill\PersonBundle\Repository\Household\HouseholdCompositionTypeRepositoryInterface;
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
@@ -85,7 +84,7 @@ class ByHouseholdCompositionFilter implements FilterInterface
|
|||||||
{
|
{
|
||||||
$compos = array_map(
|
$compos = array_map(
|
||||||
fn (HouseholdCompositionType $compositionType) => $this->translatableStringHelper->localize($compositionType->getLabel()),
|
fn (HouseholdCompositionType $compositionType) => $this->translatableStringHelper->localize($compositionType->getLabel()),
|
||||||
$data['compositions'] instanceof Collection ? $data['compositions']->toArray() : $data['compositions']
|
$data['compositions']->toArray()
|
||||||
);
|
);
|
||||||
|
|
||||||
return ['export.filter.person.by_composition.Filtered by composition at %date%: only %compositions%', [
|
return ['export.filter.person.by_composition.Filtered by composition at %date%: only %compositions%', [
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ class GenderFilter implements
|
|||||||
'Woman' => Person::FEMALE_GENDER,
|
'Woman' => Person::FEMALE_GENDER,
|
||||||
'Man' => Person::MALE_GENDER,
|
'Man' => Person::MALE_GENDER,
|
||||||
'Both' => Person::BOTH_GENDER,
|
'Both' => Person::BOTH_GENDER,
|
||||||
'Unknown' => Person::NO_INFORMATION,
|
|
||||||
'Not given' => 'null',
|
'Not given' => 'null',
|
||||||
],
|
],
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
|||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress;
|
use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
@@ -103,7 +102,7 @@ class GeographicalUnitFilter implements \Chill\MainBundle\Export\FilterInterface
|
|||||||
', ',
|
', ',
|
||||||
array_map(
|
array_map(
|
||||||
fn (SimpleGeographicalUnitDTO $item) => $this->translatableStringHelper->localize($this->geographicalUnitLayerRepository->find($item->layerId)->getName()).' > '.$item->unitName,
|
fn (SimpleGeographicalUnitDTO $item) => $this->translatableStringHelper->localize($this->geographicalUnitLayerRepository->find($item->layerId)->getName()).' > '.$item->unitName,
|
||||||
$data['units'] instanceof Collection ? $data['units']->toArray() : $data['units']
|
$data['units']
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ use Chill\MainBundle\Entity\User;
|
|||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Form\Type\PickUserDynamicType;
|
use Chill\MainBundle\Form\Type\PickUserDynamicType;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
@@ -56,13 +55,7 @@ class CreatorFilter implements FilterInterface
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'export.filter.work.by_creator.Filtered by creator: only %creators%', [
|
'export.filter.work.by_creator.Filtered by creator: only %creators%', [
|
||||||
'%creators%' => implode(
|
'%creators%' => implode(', ', array_map(static fn (User $u) => $u->getLabel(), $data['creators'])),
|
||||||
', ',
|
|
||||||
array_map(
|
|
||||||
static fn (User $u) => $u->getLabel(),
|
|
||||||
$data['creators'] instanceof Collection ? $data['creators']->toArray() : $data['creators']
|
|
||||||
)
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,9 +144,6 @@ class SocialWorkTypeFilter implements FilterInterface
|
|||||||
$ids = [];
|
$ids = [];
|
||||||
|
|
||||||
foreach ($asIterable as $value) {
|
foreach ($asIterable as $value) {
|
||||||
if (null === $value) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$ids[] = $value->getId();
|
$ids[] = $value->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,105 +0,0 @@
|
|||||||
<?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\Export\Helper;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\User;
|
|
||||||
use Chill\MainBundle\Repository\CenterRepositoryInterface;
|
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperForCurrentUserInterface;
|
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
|
||||||
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
|
||||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
|
||||||
use Symfony\Component\Security\Core\Security;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter accompanying period list and related, removing confidential ones
|
|
||||||
* based on ACL rules.
|
|
||||||
*/
|
|
||||||
final readonly class FilterListAccompanyingPeriodHelper implements FilterListAccompanyingPeriodHelperInterface
|
|
||||||
{
|
|
||||||
private bool $filterStatsByCenters;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
private Security $security,
|
|
||||||
private CenterRepositoryInterface $centerRepository,
|
|
||||||
private AuthorizationHelperForCurrentUserInterface $authorizationHelperForCurrentUser,
|
|
||||||
ParameterBagInterface $parameterBag,
|
|
||||||
) {
|
|
||||||
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addFilterAccompanyingPeriods(QueryBuilder &$qb, array $requiredModifiers, array $acl, array $data = []): void
|
|
||||||
{
|
|
||||||
$centers = match ($this->filterStatsByCenters) {
|
|
||||||
true => array_map(static fn ($el) => $el['center'], $acl),
|
|
||||||
false => $this->centerRepository->findAll(),
|
|
||||||
};
|
|
||||||
|
|
||||||
$user = $this->security->getUser();
|
|
||||||
|
|
||||||
if (!$user instanceof User) {
|
|
||||||
throw new \RuntimeException('only a regular user can run this export');
|
|
||||||
}
|
|
||||||
|
|
||||||
// add filtering on confidential accompanying period. The confidential is applyed on the current status of
|
|
||||||
// the accompanying period (we do not use the 'calc_date' here
|
|
||||||
$aclConditionsOrX = $qb->expr()->orX(
|
|
||||||
// either the current user is the refferer for the course
|
|
||||||
'acp.user = :list_acp_current_user',
|
|
||||||
);
|
|
||||||
$qb->setParameter('list_acp_current_user', $user);
|
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
foreach ($centers as $center) {
|
|
||||||
$scopes = $this->authorizationHelperForCurrentUser->getReachableScopes(AccompanyingPeriodVoter::SEE_DETAILS, $center);
|
|
||||||
$scopesConfidential =
|
|
||||||
$this->authorizationHelperForCurrentUser->getReachableScopes(AccompanyingPeriodVoter::SEE_CONFIDENTIAL_ALL, $center);
|
|
||||||
$orScopes = $qb->expr()->orX();
|
|
||||||
|
|
||||||
foreach ($scopes as $scope) {
|
|
||||||
$scopeCondition = match (in_array($scope, $scopesConfidential, true)) {
|
|
||||||
true => ":scope_{$i} MEMBER OF acp.scopes",
|
|
||||||
false => $qb->expr()->andX(
|
|
||||||
'acp.confidential = FALSE',
|
|
||||||
":scope_{$i} MEMBER OF acp.scopes",
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
$orScopes->add($scopeCondition);
|
|
||||||
$qb->setParameter("scope_{$i}", $scope);
|
|
||||||
++$i;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->filterStatsByCenters) {
|
|
||||||
$andX = $qb->expr()->andX(
|
|
||||||
$qb->expr()->exists(
|
|
||||||
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class." acl_count_part_{$i}
|
|
||||||
JOIN ".PersonCenterHistory::class." acl_count_person_history_{$i} WITH IDENTITY(acl_count_person_history_{$i}.person) = IDENTITY(acl_count_part_{$i}.person)
|
|
||||||
WHERE acl_count_part_{$i}.accompanyingPeriod = acp.id AND acl_count_person_history_{$i}.center IN (:authorized_center_{$i})
|
|
||||||
AND acl_count_person_history_{$i}.startDate <= CURRENT_DATE() AND (acl_count_person_history_{$i}.endDate IS NULL or acl_count_person_history_{$i}.endDate > CURRENT_DATE())
|
|
||||||
"
|
|
||||||
),
|
|
||||||
$orScopes,
|
|
||||||
);
|
|
||||||
$qb->setParameter('authorized_center_'.$i, $center);
|
|
||||||
$aclConditionsOrX->add($andX);
|
|
||||||
} else {
|
|
||||||
$aclConditionsOrX->add($orScopes);
|
|
||||||
}
|
|
||||||
|
|
||||||
++$i;
|
|
||||||
}
|
|
||||||
|
|
||||||
$qb->andWhere($aclConditionsOrX);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
<?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\Export\Helper;
|
|
||||||
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter accompanying period list and related, removing confidential ones
|
|
||||||
* based on ACL rules.
|
|
||||||
*/
|
|
||||||
interface FilterListAccompanyingPeriodHelperInterface
|
|
||||||
{
|
|
||||||
public function addFilterAccompanyingPeriods(QueryBuilder &$qb, array $requiredModifiers, array $acl, array $data = []): void;
|
|
||||||
}
|
|
||||||
@@ -26,7 +26,6 @@ class AccompanyingCourseCommentType extends AbstractType
|
|||||||
{
|
{
|
||||||
$builder->add('content', ChillTextareaType::class, [
|
$builder->add('content', ChillTextareaType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'empty_data' => '',
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<teleport to="#export_filters_social_work_type_filter_form">
|
||||||
|
|
||||||
<fieldset class="mb-3" id="actionType">
|
<fieldset class="mb-3" id="actionType">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -13,7 +14,7 @@
|
|||||||
:multiple="true"
|
:multiple="true"
|
||||||
:close-on-select="false"
|
:close-on-select="false"
|
||||||
:placeholder="$t('action.placeholder')"
|
:placeholder="$t('action.placeholder')"
|
||||||
:custom-label="formatSocialAction"
|
label="text"
|
||||||
track-by="id"
|
track-by="id"
|
||||||
:searchable="true"
|
:searchable="true"
|
||||||
></VueMultiselect>
|
></VueMultiselect>
|
||||||
@@ -67,6 +68,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
</teleport>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -147,118 +150,72 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
async mounted() {
|
mounted() {
|
||||||
await this.getSocialActionsList();
|
this.getSocialActionsList();
|
||||||
|
|
||||||
if ('' !== this.actions.hiddenField.value) {
|
this.actions.hiddenField.value = '';
|
||||||
const actionIds = this.actions.hiddenField.value.split(',');
|
this.goals.hiddenField.value = '';
|
||||||
for (const aid of actionIds) {
|
this.results.hiddenField.value = '';
|
||||||
let action = this.actions.options.find(a => Number.parseInt(aid) === a.id);
|
|
||||||
if (undefined !== action) {
|
|
||||||
this.action.push(action);
|
|
||||||
await this.selectAction(action);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('' !== this.goals.hiddenField.value) {
|
//console.log(this.actions.hiddenField, this.goals.hiddenField, this.results.hiddenField);
|
||||||
const goalsIds = this.goals.hiddenField.value.split(',').map(s => Number.parseInt(s));
|
|
||||||
for (const gid of goalsIds) {
|
|
||||||
let goal = this.goals.options.find(g => gid === g.id);
|
|
||||||
if (undefined !== goal) {
|
|
||||||
this.goal.push(goal);
|
|
||||||
await this.selectGoal(goal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('' !== this.results.hiddenField.value) {
|
|
||||||
const resultsIds = this.results.hiddenField.value.split(',').map(s => Number.parseInt(s));
|
|
||||||
for (const rid of resultsIds) {
|
|
||||||
let result = this.results.options.find(r => rid === r.id);
|
|
||||||
if (undefined !== result) {
|
|
||||||
this.result.push(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async getSocialActionsList() {
|
async getSocialActionsList() {
|
||||||
let actions = await getSocialActions();
|
this.actions.options = await getSocialActions();
|
||||||
this.actions.options = actions.toSorted(function (a, b) {
|
|
||||||
if (a.issue.ordering === b.issue.ordering) {
|
|
||||||
if (a.ordering === b.ordering) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (a.ordering < b.ordering) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a.issue.ordering < b.issue.ordering) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
})
|
|
||||||
|
|
||||||
return Promise.resolve();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
formatSocialAction({text, issue}) {
|
|
||||||
return text + ' (' + issue.text + ')';
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select/unselect in Action Multiselect
|
* Select/unselect in Action Multiselect
|
||||||
* @param value
|
* @param value
|
||||||
*/
|
*/
|
||||||
async selectAction(value) {
|
selectAction(value) {
|
||||||
//console.log('----'); console.log('select action', value.id);
|
//console.log('----'); console.log('select action', value.id);
|
||||||
let children = this.getChildrensFromParent(value);
|
let children = this.getChildrensFromParent(value);
|
||||||
this.addSelectedElement('actions', children);
|
this.addSelectedElement('actions', children);
|
||||||
|
|
||||||
let parentAndChildren = [...[value], ...children];
|
let parentAndChildren = [...[value], ...children];
|
||||||
const promises = [];
|
|
||||||
parentAndChildren.forEach(elem => {
|
parentAndChildren.forEach(elem => {
|
||||||
promises.push(getGoalByAction(elem.id).then(goals => {
|
getGoalByAction(elem.id).then(response => new Promise((resolve, reject) => {
|
||||||
this.addElementInData('goals', goals);
|
this.addElementInData('goals', response.results);
|
||||||
return Promise.resolve();
|
resolve();
|
||||||
}));
|
})).catch;
|
||||||
promises.push(getResultByAction(elem.id).then(results => {
|
getResultByAction(elem.id).then(response => new Promise((resolve, reject) => {
|
||||||
this.addElementInData('results', results);
|
this.addElementInData('results', response.results);
|
||||||
return Promise.resolve();
|
resolve();
|
||||||
}));
|
})).catch;
|
||||||
});
|
});
|
||||||
|
|
||||||
await Promise.all(promises);
|
|
||||||
return Promise.resolve();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
unselectAction(value) {
|
unselectAction(value) {
|
||||||
getGoalByAction(value.id).then(goals => {
|
//console.log('----'); console.log('unselect action', value.id);
|
||||||
[this.results.options, this.results.value ] = this.removeElementInData('goals', goals);
|
getGoalByAction(value.id).then(response => new Promise((resolve, reject) => {
|
||||||
});
|
[ this.goals.options, this.goals.value ] = this.removeElementInData('goals', response.results);
|
||||||
getResultByAction(value.id).then(results => {
|
resolve();
|
||||||
[this.results.options, this.results.value ] = this.removeElementInData('results', results);
|
})).catch;
|
||||||
});
|
getResultByAction(value.id).then(response => new Promise((resolve, reject) => {
|
||||||
|
[ this.results.options, this.results.value ] = this.removeElementInData('results', response.results);
|
||||||
|
resolve();
|
||||||
|
})).catch;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select/unselect in Goal Multiselect
|
* Select/unselect in Goal Multiselect
|
||||||
* @param value
|
* @param value
|
||||||
*/
|
*/
|
||||||
async selectGoal(value) {
|
selectGoal(value) {
|
||||||
return getResultByGoal(value.id).then(results => {
|
//console.log('----'); console.log('select goal', value.id);
|
||||||
this.addElementInData('results', results);
|
getResultByGoal(value.id).then(response => new Promise((resolve, reject) => {
|
||||||
})
|
this.addElementInData('results', response.results);
|
||||||
|
resolve();
|
||||||
|
})).catch;
|
||||||
},
|
},
|
||||||
|
|
||||||
unselectGoal(value) {
|
unselectGoal(value) {
|
||||||
getResultByGoal(value.id).then(results => {
|
//console.log('----'); console.log('unselect goal', value.id);
|
||||||
[ this.results.options, this.results.value ] = this.removeElementInData('results', results);
|
getResultByGoal(value.id).then(response => new Promise((resolve, reject) => {
|
||||||
}).catch;
|
[ this.results.options, this.results.value ] = this.removeElementInData('results', response.results);
|
||||||
|
resolve();
|
||||||
|
})).catch;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -306,7 +263,6 @@ export default {
|
|||||||
if (dump.length > 0) {
|
if (dump.length > 0) {
|
||||||
//console.log('push ' + dump.length + ' elems in', target, dump);
|
//console.log('push ' + dump.length + ' elems in', target, dump);
|
||||||
}
|
}
|
||||||
data.options.sort();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,17 +8,29 @@ const getSocialActions = () => fetchResults(
|
|||||||
|
|
||||||
const getGoalByAction = (id) => {
|
const getGoalByAction = (id) => {
|
||||||
let url = `/api/1.0/person/social-work/goal/by-social-action/${id}.json`;
|
let url = `/api/1.0/person/social-work/goal/by-social-action/${id}.json`;
|
||||||
return fetchResults(url);
|
return fetch(url)
|
||||||
|
.then(response => {
|
||||||
|
if (response.ok) { return response.json(); }
|
||||||
|
throw Error('Error with request resource response');
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const getResultByAction = (id) => {
|
const getResultByAction = (id) => {
|
||||||
let url = `/api/1.0/person/social-work/result/by-social-action/${id}.json`;
|
let url = `/api/1.0/person/social-work/result/by-social-action/${id}.json`;
|
||||||
return fetchResults(url);
|
return fetch(url)
|
||||||
|
.then(response => {
|
||||||
|
if (response.ok) { return response.json(); }
|
||||||
|
throw Error('Error with request resource response');
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const getResultByGoal = (id) => {
|
const getResultByGoal = (id) => {
|
||||||
let url = `/api/1.0/person/social-work/result/by-goal/${id}.json`;
|
let url = `/api/1.0/person/social-work/result/by-goal/${id}.json`;
|
||||||
return fetchResults(url);
|
return fetch(url)
|
||||||
|
.then(response => {
|
||||||
|
if (response.ok) { return response.json(); }
|
||||||
|
throw Error('Error with request resource response');
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export {
|
export {
|
||||||
@@ -26,4 +38,4 @@ export {
|
|||||||
getGoalByAction,
|
getGoalByAction,
|
||||||
getResultByAction,
|
getResultByAction,
|
||||||
getResultByGoal,
|
getResultByGoal,
|
||||||
}
|
}
|
||||||
@@ -4,13 +4,11 @@ import App from './App.vue';
|
|||||||
|
|
||||||
if (null !== document.getElementById('export_filters_social_work_type_filter_enabled')) {
|
if (null !== document.getElementById('export_filters_social_work_type_filter_enabled')) {
|
||||||
const i18n = _createI18n({});
|
const i18n = _createI18n({});
|
||||||
const form = document.getElementById('export_filters_social_work_type_filter_form');
|
|
||||||
const after = form.appendChild(document.createElement('div'));
|
|
||||||
|
|
||||||
const app = createApp({
|
const app = createApp({
|
||||||
template: `<app></app>`,
|
template: `<app></app>`,
|
||||||
})
|
})
|
||||||
.use(i18n)
|
.use(i18n)
|
||||||
.component('app', App)
|
.component('app', App)
|
||||||
.mount(after);
|
.mount('#export_export');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ const visMessages = {
|
|||||||
Holder: 'Titulaire',
|
Holder: 'Titulaire',
|
||||||
Legend: 'Calques',
|
Legend: 'Calques',
|
||||||
concerned: 'concerné',
|
concerned: 'concerné',
|
||||||
// both: 'neutre, non binaire',
|
both: 'neutre, non binaire',
|
||||||
woman: 'féminin',
|
woman: 'féminin',
|
||||||
man: 'masculin',
|
man: 'masculin',
|
||||||
undefined: "genre non précisé",
|
undefined: "genre non précisé",
|
||||||
@@ -64,9 +64,8 @@ const visMessages = {
|
|||||||
placeholder: "Choisissez le genre de l'usager",
|
placeholder: "Choisissez le genre de l'usager",
|
||||||
woman: "Féminin",
|
woman: "Féminin",
|
||||||
man: "Masculin",
|
man: "Masculin",
|
||||||
both: "Neutre, non binaire",
|
neuter: "Neutre, non binaire",
|
||||||
undefined: "Non renseigné",
|
undefined: "Non renseigné"
|
||||||
unknown: "Non renseigné"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error_only_one_person: "Une seule personne peut être sélectionnée !",
|
error_only_one_person: "Une seule personne peut être sélectionnée !",
|
||||||
|
|||||||
@@ -153,8 +153,6 @@ const getGender = (gender) => {
|
|||||||
return visMessages.fr.visgraph.woman
|
return visMessages.fr.visgraph.woman
|
||||||
case 'man':
|
case 'man':
|
||||||
return visMessages.fr.visgraph.man
|
return visMessages.fr.visgraph.man
|
||||||
case 'unknown':
|
|
||||||
return visMessages.fr.visgraph.unknown
|
|
||||||
default:
|
default:
|
||||||
return visMessages.fr.visgraph.undefined
|
return visMessages.fr.visgraph.undefined
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
<li v-else-if="options.addNoData">
|
<li v-else-if="options.addNoData">
|
||||||
<i class="fa fa-li fa-map-marker"></i><p class="chill-no-data-statement">{{ $t('renderbox.no_data') }}</p>
|
<i class="fa fa-li fa-map-marker"></i><p class="chill-no-data-statement">{{ $t('renderbox.no_data') }}</p>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<template v-if="this.showResidentialAddresses && (person.current_residential_addresses || []).length > 0">
|
<template v-if="this.showResidentialAddresses && (person.current_residential_addresses || []).length > 0">
|
||||||
<li v-for="(addr, i) in person.current_residential_addresses" :key="i">
|
<li v-for="(addr, i) in person.current_residential_addresses" :key="i">
|
||||||
<i class="fa fa-li fa-map-marker"></i>
|
<i class="fa fa-li fa-map-marker"></i>
|
||||||
@@ -223,13 +223,13 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
getGenderIcon: function () {
|
getGenderIcon: function () {
|
||||||
return this.person.gender === 'woman' ? 'fa-venus' : this.person.gender === 'man' ? 'fa-mars' : this.person.gender === 'both' ? 'fa-neuter' : 'fa-genderless';
|
return this.person.gender === 'woman' ? 'fa-venus' : this.person.gender === 'man' ? 'fa-mars' : this.person.gender === 'neuter' ? 'fa-neuter' : 'fa-genderless';
|
||||||
},
|
},
|
||||||
getGenderTranslation: function () {
|
getGenderTranslation: function () {
|
||||||
return this.person.gender === 'woman' ? 'renderbox.birthday.woman' : 'renderbox.birthday.man';
|
return this.person.gender === 'woman' ? 'renderbox.birthday.woman' : 'renderbox.birthday.man';
|
||||||
},
|
},
|
||||||
getGender() {
|
getGender() {
|
||||||
return this.person.gender === 'woman' ? 'person.gender.woman' : this.person.gender === 'man' ? 'person.gender.man' : this.person.gender === 'both' ? 'person.gender.both' : 'person.gender.undefined';
|
return this.person.gender === 'woman' ? 'person.gender.woman' : this.person.gender === 'man' ? 'person.gender.man' : this.person.gender === 'neuter' ? 'person.gender.neuter' : 'person.gender.undefined';
|
||||||
},
|
},
|
||||||
birthdate: function () {
|
birthdate: function () {
|
||||||
if (this.person.birthdate !== null || this.person.birthdate === "undefined") {
|
if (this.person.birthdate !== null || this.person.birthdate === "undefined") {
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
<option selected disabled >{{ $t('person.gender.placeholder') }}</option>
|
<option selected disabled >{{ $t('person.gender.placeholder') }}</option>
|
||||||
<option value="woman">{{ $t('person.gender.woman') }}</option>
|
<option value="woman">{{ $t('person.gender.woman') }}</option>
|
||||||
<option value="man">{{ $t('person.gender.man') }}</option>
|
<option value="man">{{ $t('person.gender.man') }}</option>
|
||||||
<option value="both">{{ $t('person.gender.both') }}</option>
|
<option value="neuter">{{ $t('person.gender.neuter') }}</option>
|
||||||
</select>
|
</select>
|
||||||
<label>{{ $t('person.gender.title') }}</label>
|
<label>{{ $t('person.gender.title') }}</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -291,12 +291,8 @@ export default {
|
|||||||
return 'fa-venus';
|
return 'fa-venus';
|
||||||
case 'man':
|
case 'man':
|
||||||
return 'fa-mars';
|
return 'fa-mars';
|
||||||
case 'both':
|
case 'neuter':
|
||||||
return 'fa-neuter';
|
return 'fa-neuter';
|
||||||
case 'unknown':
|
|
||||||
return 'fa-genderless';
|
|
||||||
default:
|
|
||||||
return 'fa-genderless';
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
genderTranslation() {
|
genderTranslation() {
|
||||||
@@ -305,12 +301,8 @@ export default {
|
|||||||
return 'person.gender.woman';
|
return 'person.gender.woman';
|
||||||
case 'man':
|
case 'man':
|
||||||
return 'person.gender.man';
|
return 'person.gender.man';
|
||||||
case 'both':
|
case 'neuter':
|
||||||
return 'person.gender.both';
|
return 'person.gender.neuter';
|
||||||
case 'unknown':
|
|
||||||
return 'person.gender.unknown';
|
|
||||||
default:
|
|
||||||
return 'person.gender.unknown';
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
feminized() {
|
feminized() {
|
||||||
|
|||||||
@@ -36,8 +36,7 @@ const personMessages = {
|
|||||||
placeholder: "Choisissez le genre de l'usager",
|
placeholder: "Choisissez le genre de l'usager",
|
||||||
woman: "Féminin",
|
woman: "Féminin",
|
||||||
man: "Masculin",
|
man: "Masculin",
|
||||||
both: "Neutre, non binaire",
|
neuter: "Neutre, non binaire",
|
||||||
unknown: "Non renseigné",
|
|
||||||
undefined: "Non renseigné"
|
undefined: "Non renseigné"
|
||||||
},
|
},
|
||||||
civility: {
|
civility: {
|
||||||
|
|||||||
@@ -86,9 +86,9 @@
|
|||||||
</div>
|
</div>
|
||||||
{%- if options['addInfo'] -%}
|
{%- if options['addInfo'] -%}
|
||||||
{% set gender = (person.gender == 'woman') ? 'fa-venus' :
|
{% set gender = (person.gender == 'woman') ? 'fa-venus' :
|
||||||
(person.gender == 'man') ? 'fa-mars' : (person.gender == 'both') ? 'fa-neuter' : 'fa-genderless' %}
|
(person.gender == 'man') ? 'fa-mars' : (person.gender == 'neuter') ? 'fa-neuter' : 'fa-genderless' %}
|
||||||
{% set genderTitle = (person.gender == 'woman') ? 'woman' :
|
{% set genderTitle = (person.gender == 'woman') ? 'woman' :
|
||||||
(person.gender == 'man') ? 'man' : (person.gender == 'both') ? 'both' : 'Not given'|trans %}
|
(person.gender == 'man') ? 'man' : (person.gender == 'neuter') ? 'neuter' : 'Not given'|trans %}
|
||||||
<p class="moreinfo">
|
<p class="moreinfo">
|
||||||
<i class="fa fa-fw {{ gender }}" title="{{ genderTitle|trans }}"></i>
|
<i class="fa fa-fw {{ gender }}" title="{{ genderTitle|trans }}"></i>
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ class SocialIssueNormalizer implements ContextAwareNormalizerInterface, Normaliz
|
|||||||
'children_ids' => $socialIssue->getChildren()->map(static fn (SocialIssue $si) => $si->getId()),
|
'children_ids' => $socialIssue->getChildren()->map(static fn (SocialIssue $si) => $si->getId()),
|
||||||
'title' => $socialIssue->getTitle(),
|
'title' => $socialIssue->getTitle(),
|
||||||
'text' => $this->render->renderString($socialIssue, []),
|
'text' => $this->render->renderString($socialIssue, []),
|
||||||
'ordering' => $socialIssue->getOrdering(),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
case 'docgen':
|
case 'docgen':
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ namespace Chill\PersonBundle\Tests\Controller;
|
|||||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Chill\PersonBundle\Entity\Relationships\Relation;
|
use Chill\PersonBundle\Entity\Relationships\Relation;
|
||||||
use Chill\PersonBundle\Entity\Relationships\Relationship;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
@@ -44,34 +43,31 @@ final class RelationshipApiControllerTest extends WebTestCase
|
|||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
$em = self::$container->get(EntityManagerInterface::class);
|
||||||
$personIdHavingRelation = $em->createQueryBuilder()
|
$countPersons = $em->createQueryBuilder()
|
||||||
->select('p.id')
|
->select('count(p)')
|
||||||
->from(Person::class, 'p')
|
->from(Person::class, 'p')
|
||||||
->join('p.centerCurrent', 'center_current')
|
->join('p.centerCurrent', 'center_current')
|
||||||
->join('center_current.center', 'c')
|
->join('center_current.center', 'c')
|
||||||
->where('c.name LIKE :name')
|
->where('c.name LIKE :name')
|
||||||
->andWhere('EXISTS (SELECT 1 FROM '.Relationship::class.' r WHERE r.fromPerson = p OR r.toPerson = p)')
|
|
||||||
->setParameter('name', 'Center A')
|
->setParameter('name', 'Center A')
|
||||||
->getQuery()
|
->getQuery()
|
||||||
->setMaxResults(1)
|
|
||||||
->getSingleScalarResult();
|
->getSingleScalarResult();
|
||||||
|
$person = $em->createQueryBuilder()
|
||||||
$personIdWithoutRelation = $em->createQueryBuilder()
|
->select('p')
|
||||||
->select('p.id')
|
|
||||||
->from(Person::class, 'p')
|
->from(Person::class, 'p')
|
||||||
->join('p.centerCurrent', 'center_current')
|
->join('p.centerCurrent', 'center_current')
|
||||||
->join('center_current.center', 'c')
|
->join('center_current.center', 'c')
|
||||||
->where('c.name LIKE :name')
|
->where('c.name LIKE :name')
|
||||||
->andWhere('NOT EXISTS (SELECT 1 FROM '.Relationship::class.' r WHERE r.fromPerson = p OR r.toPerson = p)')
|
|
||||||
->setParameter('name', 'Center A')
|
->setParameter('name', 'Center A')
|
||||||
->getQuery()
|
->getQuery()
|
||||||
->setMaxResults(1)
|
->setMaxResults(1)
|
||||||
->getSingleScalarResult();
|
->setFirstResult(\random_int(0, $countPersons - 1))
|
||||||
|
->getSingleResult();
|
||||||
|
|
||||||
self::ensureKernelShutdown();
|
self::ensureKernelShutdown();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
[$personIdHavingRelation, $personIdWithoutRelation],
|
[$person->getId()],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,29 +75,39 @@ final class RelationshipApiControllerTest extends WebTestCase
|
|||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
$em = self::$container->get(EntityManagerInterface::class);
|
||||||
$personIdWithoutRelations = $em->createQueryBuilder()
|
$countPersons = $em->createQueryBuilder()
|
||||||
->select('p.id')
|
->select('count(DISTINCT p)')
|
||||||
|
->from(Person::class, 'p')
|
||||||
|
->join('p.centerCurrent', 'center_current')
|
||||||
|
->join('center_current.center', 'c')
|
||||||
|
->where('c.name LIKE :name')
|
||||||
|
->setParameter('name', 'Center A')
|
||||||
|
->getQuery()
|
||||||
|
->getSingleScalarResult();
|
||||||
|
|
||||||
|
$persons = $em->createQueryBuilder()
|
||||||
|
->select('p')
|
||||||
->from(Person::class, 'p')
|
->from(Person::class, 'p')
|
||||||
->join('p.centerCurrent', 'center_current')
|
->join('p.centerCurrent', 'center_current')
|
||||||
->join('center_current.center', 'c')
|
->join('center_current.center', 'c')
|
||||||
->where('c.name LIKE :name')
|
->where('c.name LIKE :name')
|
||||||
->andWhere('NOT EXISTS (SELECT 1 FROM '.Relationship::class.' r WHERE r.fromPerson = p OR r.toPerson = p)')
|
|
||||||
->setParameter('name', 'Center A')
|
->setParameter('name', 'Center A')
|
||||||
->getQuery()
|
->getQuery()
|
||||||
->setMaxResults(2)
|
->setMaxResults(2)
|
||||||
|
->setFirstResult(\random_int(0, $countPersons - 1))
|
||||||
->getResult();
|
->getResult();
|
||||||
|
|
||||||
self::ensureKernelShutdown();
|
self::ensureKernelShutdown();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
[$personIdWithoutRelations[0]['id'], $personIdWithoutRelations[1]['id'], $this->getRandomRelation($em)->getId(), true],
|
[$persons[0]->getId(), $persons[1]->getId(), $this->getRandomRelation($em)->getId(), true],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider personProvider
|
* @dataProvider personProvider
|
||||||
*/
|
*/
|
||||||
public function testGetRelationshipByPerson(int $personId)
|
public function testGetRelationshipByPerson(mixed $personId)
|
||||||
{
|
{
|
||||||
self::ensureKernelShutdown();
|
self::ensureKernelShutdown();
|
||||||
$client = $this->getClientAuthenticated();
|
$client = $this->getClientAuthenticated();
|
||||||
|
|||||||
@@ -11,23 +11,14 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\PersonBundle\Tests\Export\Export;
|
namespace Chill\PersonBundle\Tests\Export\Export;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\Center;
|
|
||||||
use Chill\MainBundle\Entity\User;
|
|
||||||
use Chill\MainBundle\Repository\CenterRepositoryInterface;
|
use Chill\MainBundle\Repository\CenterRepositoryInterface;
|
||||||
use Chill\MainBundle\Repository\ScopeRepositoryInterface;
|
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperForCurrentUserInterface;
|
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||||
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Chill\PersonBundle\Export\Export\ListAccompanyingPeriod;
|
use Chill\PersonBundle\Export\Export\ListAccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Export\Helper\FilterListAccompanyingPeriodHelper;
|
|
||||||
use Chill\PersonBundle\Export\Helper\ListAccompanyingPeriodHelper;
|
use Chill\PersonBundle\Export\Helper\ListAccompanyingPeriodHelper;
|
||||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Prophecy\Argument;
|
|
||||||
use Prophecy\PhpUnit\ProphecyTrait;
|
|
||||||
use Symfony\Component\Security\Core\Security;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@@ -36,8 +27,6 @@ use Symfony\Component\Security\Core\Security;
|
|||||||
*/
|
*/
|
||||||
class ListAccompanyingPeriodTest extends AbstractExportTest
|
class ListAccompanyingPeriodTest extends AbstractExportTest
|
||||||
{
|
{
|
||||||
use ProphecyTrait;
|
|
||||||
|
|
||||||
private readonly ListAccompanyingPeriod $listAccompanyingPeriod;
|
private readonly ListAccompanyingPeriod $listAccompanyingPeriod;
|
||||||
|
|
||||||
private readonly CenterRepositoryInterface $centerRepository;
|
private readonly CenterRepositoryInterface $centerRepository;
|
||||||
@@ -50,54 +39,12 @@ class ListAccompanyingPeriodTest extends AbstractExportTest
|
|||||||
|
|
||||||
public function getExport()
|
public function getExport()
|
||||||
{
|
{
|
||||||
/** @var EntityManagerInterface::class $em */
|
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
$em = self::$container->get(EntityManagerInterface::class);
|
||||||
$rollingDateConverter = self::$container->get(RollingDateConverterInterface::class);
|
$rollingDateConverter = self::$container->get(RollingDateConverterInterface::class);
|
||||||
$listAccompanyingPeriodHelper = self::$container->get(ListAccompanyingPeriodHelper::class);
|
$listAccompanyingPeriodHelper = self::$container->get(ListAccompanyingPeriodHelper::class);
|
||||||
$centerRepository = self::$container->get(CenterRepositoryInterface::class);
|
|
||||||
$scopeRepository = self::$container->get(ScopeRepositoryInterface::class);
|
|
||||||
|
|
||||||
// mock security
|
yield new ListAccompanyingPeriod($em, $rollingDateConverter, $listAccompanyingPeriodHelper, $this->getParameters(true));
|
||||||
$user = $em->createQuery('SELECT u FROM '.User::class.' u')
|
yield new ListAccompanyingPeriod($em, $rollingDateConverter, $listAccompanyingPeriodHelper, $this->getParameters(false));
|
||||||
->setMaxResults(1)->getSingleResult();
|
|
||||||
if (null === $user) {
|
|
||||||
throw new \RuntimeException('no user found');
|
|
||||||
}
|
|
||||||
$security = $this->prophesize(Security::class);
|
|
||||||
$security->getUser()->willReturn($user);
|
|
||||||
|
|
||||||
// mock authorization helper
|
|
||||||
$scopes = $scopeRepository->findAll();
|
|
||||||
$scopesConfidentials = [] !== $scopes ? [$scopes[0]] : [];
|
|
||||||
$authorizationHelper = $this->prophesize(AuthorizationHelperForCurrentUserInterface::class);
|
|
||||||
$authorizationHelper->getReachableScopes(AccompanyingPeriodVoter::SEE_DETAILS, Argument::type(Center::class))
|
|
||||||
->willReturn($scopes);
|
|
||||||
$authorizationHelper->getReachableScopes(AccompanyingPeriodVoter::SEE_CONFIDENTIAL_ALL, Argument::type(Center::class))
|
|
||||||
->willReturn($scopesConfidentials);
|
|
||||||
|
|
||||||
yield new ListAccompanyingPeriod(
|
|
||||||
$em,
|
|
||||||
$rollingDateConverter,
|
|
||||||
$listAccompanyingPeriodHelper,
|
|
||||||
new FilterListAccompanyingPeriodHelper(
|
|
||||||
$security->reveal(),
|
|
||||||
$centerRepository,
|
|
||||||
$authorizationHelper->reveal(),
|
|
||||||
$this->getParameters(true)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
yield new ListAccompanyingPeriod(
|
|
||||||
$em,
|
|
||||||
$rollingDateConverter,
|
|
||||||
$listAccompanyingPeriodHelper,
|
|
||||||
new FilterListAccompanyingPeriodHelper(
|
|
||||||
$security->reveal(),
|
|
||||||
$centerRepository,
|
|
||||||
$authorizationHelper->reveal(),
|
|
||||||
$this->getParameters(false)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormData()
|
public function getFormData()
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user