mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-14 18:54:59 +00:00
Compare commits
15 Commits
issue178_1
...
68-feature
Author | SHA1 | Date | |
---|---|---|---|
2fc6e18d0f | |||
|
80ea4bbdd2 | ||
|
801c693ef9 | ||
|
c1c9562e67 | ||
|
b9e580af9a | ||
|
790c7f6724 | ||
|
1be91bb392 | ||
|
93f39ebe5b | ||
|
176c3c0e27 | ||
|
59cd8466be | ||
|
ef9e872394 | ||
|
51a46ab5d7 | ||
|
191b416c6c | ||
6028efdc7c | |||
|
60c9e037a6 |
@@ -1,20 +0,0 @@
|
|||||||
## v2.10.0 - 2023-10-24
|
|
||||||
### Feature
|
|
||||||
* ([#172](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/172)) [export] Add a filter "grouping accompanying period by opening date" and "grouping accompanying period by closing date"
|
|
||||||
* ([#172](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/172)) [export] add a filter and aggregator on accompanying period work: group/filter by handling third party
|
|
||||||
* ([#172](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/172)) [export] add a filter and aggregator on activites: group/filter activities by people participating to the activities
|
|
||||||
* ([#172](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/172)) [export] add a grouping on accompanying period export: group by activity type associated to at least one activity within the accompanying period
|
|
||||||
* [export] sort filters and aggregators by title
|
|
||||||
* ([#179](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/179)) [export] create a parameter that will force to skip the filtering by center (ACL) when generating an export
|
|
||||||
### Fixed
|
|
||||||
* ([#177](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/177)) [export] fix date range selection on filter and grouping "by status of the course at date", on accompanying periods
|
|
||||||
|
|
||||||
### Résumé francophone des changements
|
|
||||||
|
|
||||||
- Ajout d'un regroupement sur les parcours: par date de cloture et d'ouverture;
|
|
||||||
- Ajouter d'un filtre et regroupement par tiers traitant sur les actions d'accompagnement;
|
|
||||||
- ajout d'un filtre et regroupement par usager participant sur les échanges
|
|
||||||
- ajout d'un regroupement: par type d'activité associé au parcours;
|
|
||||||
- trie les filtre et regroupements par ordre alphabétique dans els exports
|
|
||||||
- ajout d'un paramètre qui permet de désactiver le filtre par centre dans les exports
|
|
||||||
- correction de l'interface de date dans les filtres et regroupements "par statut du parcours à la date"
|
|
@@ -1,3 +0,0 @@
|
|||||||
## v2.10.1 - 2023-10-24
|
|
||||||
### Fixed
|
|
||||||
* Fix export controller when generating an export without any data in session
|
|
@@ -1,3 +0,0 @@
|
|||||||
## v2.10.2 - 2023-10-26
|
|
||||||
### Fixed
|
|
||||||
* ([#175](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/175)) Use injection of translator instead of ->get().
|
|
@@ -1,3 +0,0 @@
|
|||||||
## v2.10.3 - 2023-10-26
|
|
||||||
### Fixed
|
|
||||||
* ([#175](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/175)) Replace old method of getting translator with injection of translatorInterface
|
|
@@ -1,3 +0,0 @@
|
|||||||
## v2.10.4 - 2023-10-26
|
|
||||||
### Fixed
|
|
||||||
* Fix null value constraint errors when merging relationships in doubles
|
|
@@ -1,4 +0,0 @@
|
|||||||
## v2.10.5 - 2023-11-05
|
|
||||||
### Fixed
|
|
||||||
* ([#183](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/183)) Fix "problem during download" on some filters, which used a wrong data type
|
|
||||||
* ([#184](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/184)) Fix filter "activity by date"
|
|
@@ -1,4 +0,0 @@
|
|||||||
## v2.10.6 - 2023-11-07
|
|
||||||
### Fixed
|
|
||||||
* ([#182](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/182)) Fix merging of double person files. Adjustement relationship sql statement
|
|
||||||
* ([#185](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/185)) Export: fix aggregator by geographical unit on person: avoid inconsistencies
|
|
@@ -1,6 +0,0 @@
|
|||||||
## v2.11.0 - 2023-11-07
|
|
||||||
### Feature
|
|
||||||
* ([#194](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/194)) Export: add a filter "filter activity by creator job"
|
|
||||||
### Fixed
|
|
||||||
* ([#185](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/185)) Export: fix "group accompanying period by geographical unit": take into account the accompanying periods when the period is not located within an unit
|
|
||||||
* Fix "group activity by creator job" aggregator
|
|
@@ -1,26 +0,0 @@
|
|||||||
## 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
|
|
@@ -1,3 +0,0 @@
|
|||||||
## 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"
|
|
@@ -11,10 +11,6 @@ cache:
|
|||||||
services:
|
services:
|
||||||
- name: postgis/postgis:14-3.3-alpine
|
- name: postgis/postgis:14-3.3-alpine
|
||||||
alias: db
|
alias: db
|
||||||
command:
|
|
||||||
- postgres
|
|
||||||
- "-c"
|
|
||||||
- max_connections=1000
|
|
||||||
- name: redis
|
- name: redis
|
||||||
alias: redis
|
alias: redis
|
||||||
|
|
||||||
@@ -32,8 +28,6 @@ variables:
|
|||||||
REDIS_PORT: 6379
|
REDIS_PORT: 6379
|
||||||
REDIS_URL: redis://redis:6379
|
REDIS_URL: redis://redis:6379
|
||||||
DEFAULT_CARRIER_CODE: BE
|
DEFAULT_CARRIER_CODE: BE
|
||||||
# force a timezone
|
|
||||||
TZ: Europe/Brussels
|
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- Composer install
|
- Composer install
|
||||||
|
54
CHANGELOG.md
54
CHANGELOG.md
@@ -6,60 +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.11.0 - 2023-11-07
|
|
||||||
### Feature
|
|
||||||
* ([#194](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/194)) Export: add a filter "filter activity by creator job"
|
|
||||||
### Fixed
|
|
||||||
* ([#185](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/185)) Export: fix "group accompanying period by geographical unit": take into account the accompanying periods when the period is not located within an unit
|
|
||||||
* Fix "group activity by creator job" aggregator
|
|
||||||
|
|
||||||
## v2.10.6 - 2023-11-07
|
|
||||||
### Fixed
|
|
||||||
* ([#182](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/182)) Fix merging of double person files. Adjustement relationship sql statement
|
|
||||||
* ([#185](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/185)) Export: fix aggregator by geographical unit on person: avoid inconsistencies
|
|
||||||
|
|
||||||
## v2.10.5 - 2023-11-05
|
|
||||||
### Fixed
|
|
||||||
* ([#183](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/183)) Fix "problem during download" on some filters, which used a wrong data type
|
|
||||||
* ([#184](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/184)) Fix filter "activity by date"
|
|
||||||
|
|
||||||
## v2.10.4 - 2023-10-26
|
|
||||||
### Fixed
|
|
||||||
* Fix null value constraint errors when merging relationships in doubles
|
|
||||||
|
|
||||||
## v2.10.3 - 2023-10-26
|
|
||||||
### Fixed
|
|
||||||
* ([#175](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/175)) Replace old method of getting translator with injection of translatorInterface
|
|
||||||
|
|
||||||
## v2.10.2 - 2023-10-26
|
|
||||||
### Fixed
|
|
||||||
* ([#175](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/175)) Use injection of translator instead of ->get().
|
|
||||||
|
|
||||||
## v2.10.1 - 2023-10-24
|
|
||||||
### Fixed
|
|
||||||
* Fix export controller when generating an export without any data in session
|
|
||||||
|
|
||||||
## v2.10.0 - 2023-10-24
|
|
||||||
### Feature
|
|
||||||
* ([#172](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/172)) [export] Add a filter "grouping accompanying period by opening date" and "grouping accompanying period by closing date"
|
|
||||||
* ([#172](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/172)) [export] add a filter and aggregator on accompanying period work: group/filter by handling third party
|
|
||||||
* ([#172](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/172)) [export] add a filter and aggregator on activites: group/filter activities by people participating to the activities
|
|
||||||
* ([#172](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/172)) [export] add a grouping on accompanying period export: group by activity type associated to at least one activity within the accompanying period
|
|
||||||
* [export] sort filters and aggregators by title
|
|
||||||
* ([#179](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/179)) [export] create a parameter that will force to skip the filtering by center (ACL) when generating an export
|
|
||||||
### Fixed
|
|
||||||
* ([#177](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/177)) [export] fix date range selection on filter and grouping "by status of the course at date", on accompanying periods
|
|
||||||
|
|
||||||
### Résumé francophone des changements
|
|
||||||
|
|
||||||
- Ajout d'un regroupement sur les parcours: par date de cloture et d'ouverture;
|
|
||||||
- Ajouter d'un filtre et regroupement par tiers traitant sur les actions d'accompagnement;
|
|
||||||
- ajout d'un filtre et regroupement par usager participant sur les échanges
|
|
||||||
- ajout d'un regroupement: par type d'activité associé au parcours;
|
|
||||||
- trie les filtre et regroupements par ordre alphabétique dans els exports
|
|
||||||
- ajout d'un paramètre qui permet de désactiver le filtre par centre dans les exports
|
|
||||||
- correction de l'interface de date dans les filtres et regroupements "par statut du parcours à la date"
|
|
||||||
|
|
||||||
## v2.9.2 - 2023-10-17
|
## v2.9.2 - 2023-10-17
|
||||||
### Fixed
|
### Fixed
|
||||||
* Fix possible null values in string's entities
|
* Fix possible null values in string's entities
|
||||||
|
@@ -1,15 +1,13 @@
|
|||||||
|
|
||||||
Configure Chill for calendar and absence synchronisation and SSO with Microsoft Graph (Outlook)
|
Configure Chill for calendar sync and SSO with Microsoft Graph (Outlook)
|
||||||
===============================================================================================
|
========================================================================
|
||||||
|
|
||||||
Chill offers the possibility to:
|
Chill offers the possibility to:
|
||||||
|
|
||||||
* authenticate users using Microsoft Graph, with relatively small adaptations;
|
* authenticate users using Microsoft Graph, with relatively small adaptations;
|
||||||
* synchronize calendar in both ways (`see the user manual for a large description of the feature <https://gitea.champs-libres.be/Chill-project/manuals>`_).
|
* synchronize calendar in both ways (`see the user manual for a large description of the feature <https://gitea.champs-libres.be/Chill-project/manuals>`_).
|
||||||
|
|
||||||
Both can be configured separately (synchronising calendars without SSO, or SSO without calendar).
|
Both can be configured separately (synchronising calendars without SSO, or SSO without calendar). When calendar sync is configured without SSL, the user's email address is the key to associate Chill's users with Microsoft's ones.
|
||||||
|
|
||||||
Please note that the user's email address is the key to associate Chill's users with Microsoft's ones.
|
|
||||||
|
|
||||||
Configure SSO
|
Configure SSO
|
||||||
-------------
|
-------------
|
||||||
@@ -48,7 +46,7 @@ Do not forget to provider user's accesses to your app, using the "Utilisateurs e
|
|||||||
|
|
||||||
You must know have gathered all the required variables for SSO:
|
You must know have gathered all the required variables for SSO:
|
||||||
|
|
||||||
.. code-block::
|
.. code-block::
|
||||||
|
|
||||||
SAML_BASE_URL=https://test.chill.be # must be
|
SAML_BASE_URL=https://test.chill.be # must be
|
||||||
SAML_ENTITY_ID=https://test.chill.be # must match the one entered
|
SAML_ENTITY_ID=https://test.chill.be # must match the one entered
|
||||||
@@ -188,27 +186,20 @@ Configure chill app
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Configure sync and calendar access
|
Configure sync
|
||||||
----------------------------------
|
--------------
|
||||||
|
|
||||||
The purpose of this configuration is the following:
|
The sync processe might be configured in the same app, or into a different app.
|
||||||
|
|
||||||
- let user read their calendar and shared calendar within Chill (with the same permissions as the one configured in Outlook / Azure);
|
The synchronization processes use Oauth2.0 for authentication and authorization.
|
||||||
- allow chill instance to write appointment ("Rendez-vous") into their calendar, and invite other users to their appointment;
|
|
||||||
- allow chill instance to be notified if an appoint is added or removed by the user within another interface than Chill: if the appointment match another one created in the Chill interface, the date and time are updated in Chill;
|
|
||||||
- allow chill instance to read the absence of the user and, if set, mark the user as absent in Chill;
|
|
||||||
|
|
||||||
The sync processe might be configured in the same app, or into a different app on the Azure side.
|
|
||||||
|
|
||||||
The synchronization processes use Oauth 2.0 / OpenID Connect for authentication and authorization.
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Two flows are in use:
|
Two flows are in use:
|
||||||
|
|
||||||
* we authenticate "on behalf of a user", to allow users to see their own calendar or other user's calendar into the web interface.
|
* we authenticate "on behalf of a user", to allow users to see their own calendar or other user's calendar into the web interface.
|
||||||
|
|
||||||
Typically, when the page is loaded, Chill first check that an authorization token exists. If not, the user is redirected to Microsoft Azure for authentification and a new token is grabbed (most of the times, this is transparent for users).
|
Typically, when the page is loaded, Chill first check that an authorization token exists. If not, the user is redirected to Microsoft Azure for authentification and a new token is grabbed (most of the times, this is transparent for users).
|
||||||
|
|
||||||
* Chill also acts "as a machine", to synchronize calendars with a daemon background.
|
* Chill also acts "as a machine", to synchronize calendars with a daemon background.
|
||||||
|
|
||||||
@@ -238,9 +229,8 @@ Some explanation:
|
|||||||
The sync daemon must have write access:
|
The sync daemon must have write access:
|
||||||
|
|
||||||
* the daemon must be allowed to read all users and their profile, to establish a link between them and the Chill's users: (:code:`Users.Read.All`);
|
* the daemon must be allowed to read all users and their profile, to establish a link between them and the Chill's users: (:code:`Users.Read.All`);
|
||||||
* it must also be allowed to read and write into the calendars (:code:`Calendars.ReadWrite.All`);
|
* it must also be allowed to read and write into the calendars (:code:`Calendars.ReadWrite.All`)
|
||||||
* for sending invitation to other users, the permission (:code:`Mail.Send`) must be granted;
|
* for sending invitation to other users, the permission (:code:`Mail.Send`) must be granted.
|
||||||
* and, for reading the absence status of the user and sync it with chill, it must be able to read the mailboxSettings (:code:`MailboxSettings.Read`).
|
|
||||||
|
|
||||||
At this step, you might choose to accept those permissions for all users, or let them do it by yourself.
|
At this step, you might choose to accept those permissions for all users, or let them do it by yourself.
|
||||||
|
|
||||||
@@ -311,7 +301,7 @@ The calendar synchronization is processed using symfony messenger. It seems to b
|
|||||||
|
|
||||||
The association between chill's users and Microsoft's users is done by this cli command:
|
The association between chill's users and Microsoft's users is done by this cli command:
|
||||||
|
|
||||||
.. code-block::
|
.. code-block::
|
||||||
|
|
||||||
bin/console chill:calendar:msgraph-user-map-subscribe
|
bin/console chill:calendar:msgraph-user-map-subscribe
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 166 KiB After Width: | Height: | Size: 149 KiB |
@@ -31,7 +31,9 @@
|
|||||||
"typescript": "^4.7.2",
|
"typescript": "^4.7.2",
|
||||||
"vue-loader": "^17.0.0",
|
"vue-loader": "^17.0.0",
|
||||||
"webpack": "^5.75.0",
|
"webpack": "^5.75.0",
|
||||||
"webpack-cli": "^5.0.1"
|
"webpack-cli": "^5.0.1",
|
||||||
|
"chart.js": "^4.2.1",
|
||||||
|
"vue-chartjs": "^5.2.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fullcalendar/core": "^6.1.4",
|
"@fullcalendar/core": "^6.1.4",
|
||||||
|
@@ -673,8 +673,8 @@ final class ActivityController extends AbstractController
|
|||||||
throw $this->createNotFoundException('Accompanying Period not found');
|
throw $this->createNotFoundException('Accompanying Period not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Add permission
|
// TODO Add permission
|
||||||
// $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
// $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||||
} else {
|
} else {
|
||||||
throw $this->createNotFoundException('Person or Accompanying Period not found');
|
throw $this->createNotFoundException('Person or Accompanying Period not found');
|
||||||
}
|
}
|
||||||
|
@@ -1,122 +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\Aggregator\ACPAggregators;
|
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
|
||||||
use Chill\ActivityBundle\Entity\ActivityType;
|
|
||||||
use Chill\ActivityBundle\Repository\ActivityTypeRepositoryInterface;
|
|
||||||
use Chill\MainBundle\Export\AggregatorInterface;
|
|
||||||
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
|
||||||
use Doctrine\ORM\Query\Expr\Join;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
|
|
||||||
final readonly class ByActivityTypeAggregator implements AggregatorInterface
|
|
||||||
{
|
|
||||||
private const PREFIX = 'acp_by_activity_type_agg';
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
private RollingDateConverterInterface $rollingDateConverter,
|
|
||||||
private ActivityTypeRepositoryInterface $activityTypeRepository,
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
|
||||||
{
|
|
||||||
$builder
|
|
||||||
->add('after_date', PickRollingDateType::class, [
|
|
||||||
'required' => false,
|
|
||||||
'label' => 'export.aggregator.acp.by_activity_type.after_date',
|
|
||||||
])
|
|
||||||
->add('before_date', PickRollingDateType::class, [
|
|
||||||
'required' => false,
|
|
||||||
'label' => 'export.aggregator.acp.by_activity_type.before_date',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'before_date' => null,
|
|
||||||
'after_date' => null,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getLabels($key, array $values, mixed $data)
|
|
||||||
{
|
|
||||||
return function (null|int|string $value): string {
|
|
||||||
if ('_header' === $value) {
|
|
||||||
return 'export.aggregator.acp.by_activity_type.activity_type';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('' === $value || null === $value || null === $activityType = $this->activityTypeRepository->find($value)) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize($activityType->getName());
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
|
||||||
{
|
|
||||||
return [self::PREFIX.'_actype_id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTitle()
|
|
||||||
{
|
|
||||||
return 'export.aggregator.acp.by_activity_type.title';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addRole(): ?string
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
|
||||||
{
|
|
||||||
$p = self::PREFIX;
|
|
||||||
|
|
||||||
// we make a left join, with acp having at least one activity of the given type
|
|
||||||
$exists = 'EXISTS (SELECT 1 FROM '.Activity::class." {$p}_activity WHERE {$p}_activity.accompanyingPeriod = acp AND {$p}_activity.activityType = {$p}_activity_type";
|
|
||||||
|
|
||||||
if (null !== $data['after_date']) {
|
|
||||||
$exists .= " AND {$p}_activity.date > :{$p}_after_date";
|
|
||||||
$qb->setParameter("{$p}_after_date", $this->rollingDateConverter->convert($data['after_date']));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null !== $data['before_date']) {
|
|
||||||
$exists .= " AND {$p}_activity.date < :{$p}_before_date";
|
|
||||||
$qb->setParameter("{$p}_before_date", $this->rollingDateConverter->convert($data['before_date']));
|
|
||||||
}
|
|
||||||
|
|
||||||
$exists .= ')';
|
|
||||||
|
|
||||||
$qb->leftJoin(
|
|
||||||
ActivityType::class,
|
|
||||||
"{$p}_activity_type",
|
|
||||||
Join::WITH,
|
|
||||||
$exists
|
|
||||||
);
|
|
||||||
|
|
||||||
$qb
|
|
||||||
->addSelect("{$p}_activity_type.id AS {$p}_actype_id")
|
|
||||||
->addGroupBy("{$p}_actype_id");
|
|
||||||
}
|
|
||||||
|
|
||||||
public function applyOn()
|
|
||||||
{
|
|
||||||
return Declarations::ACP_TYPE;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,72 +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\Aggregator;
|
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
|
||||||
use Chill\ActivityBundle\Repository\ActivityPresenceRepositoryInterface;
|
|
||||||
use Chill\MainBundle\Export\AggregatorInterface;
|
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
|
|
||||||
final readonly class ActivityPresenceAggregator implements AggregatorInterface
|
|
||||||
{
|
|
||||||
public function __construct(private ActivityPresenceRepositoryInterface $activityPresenceRepository, private TranslatableStringHelperInterface $translatableStringHelper) {}
|
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder) {}
|
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getLabels($key, array $values, mixed $data)
|
|
||||||
{
|
|
||||||
return function (null|int|string $value): string {
|
|
||||||
if ('_header' === $value) {
|
|
||||||
return 'export.aggregator.activity.by_activity_presence.header';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null === $value || '' === $value || null === $presence = $this->activityPresenceRepository->find($value)) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize($presence->getName());
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
|
||||||
{
|
|
||||||
return ['activity_presence_aggregator_attendee'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTitle(): string
|
|
||||||
{
|
|
||||||
return 'export.aggregator.activity.by_activity_presence.Group activity by presence';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addRole(): ?string
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data): void
|
|
||||||
{
|
|
||||||
$qb->addSelect('IDENTITY(activity.attendee) AS activity_presence_aggregator_attendee');
|
|
||||||
$qb->addGroupBy('activity_presence_aggregator_attendee');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function applyOn()
|
|
||||||
{
|
|
||||||
return Declarations::ACTIVITY;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -73,6 +73,7 @@ class DateAggregator implements AggregatorInterface
|
|||||||
'choices' => self::CHOICES,
|
'choices' => self::CHOICES,
|
||||||
'multiple' => false,
|
'multiple' => false,
|
||||||
'expanded' => true,
|
'expanded' => true,
|
||||||
|
'empty_data' => self::DEFAULT_CHOICE,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,18 +14,18 @@ namespace Chill\ActivityBundle\Export\Aggregator;
|
|||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
use Chill\MainBundle\Entity\User\UserJobHistory;
|
use Chill\MainBundle\Entity\User\UserJobHistory;
|
||||||
use Chill\MainBundle\Export\AggregatorInterface;
|
use Chill\MainBundle\Export\AggregatorInterface;
|
||||||
use Chill\MainBundle\Repository\UserJobRepositoryInterface;
|
use Chill\MainBundle\Repository\ScopeRepository;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
use Doctrine\ORM\Query\Expr\Join;
|
use Doctrine\ORM\Query\Expr\Join;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class CreatorJobAggregator implements AggregatorInterface
|
class JobScopeAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private const PREFIX = 'acp_agg_creator_job';
|
private const PREFIX = 'acp_agg_creator_job';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly UserJobRepositoryInterface $userJobRepository,
|
private readonly ScopeRepository $scopeRepository,
|
||||||
private readonly TranslatableStringHelper $translatableStringHelper
|
private readonly TranslatableStringHelper $translatableStringHelper
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@@ -76,15 +76,17 @@ class CreatorJobAggregator implements AggregatorInterface
|
|||||||
{
|
{
|
||||||
return function ($value): string {
|
return function ($value): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'Job';
|
return 'Scope';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $value || '' === $value || null === $s = $this->userJobRepository->find($value)) {
|
if (null === $value || '' === $value) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$s = $this->scopeRepository->find($value);
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize(
|
return $this->translatableStringHelper->localize(
|
||||||
$s->getLabel()
|
$s->getName()
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
@@ -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\ActivityBundle\Export\Aggregator\PersonAggregators;
|
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
|
||||||
use Chill\MainBundle\Export\AggregatorInterface;
|
|
||||||
use Chill\PersonBundle\Export\Helper\LabelPersonHelper;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
|
|
||||||
final readonly class PersonAggregator implements AggregatorInterface
|
|
||||||
{
|
|
||||||
public function __construct(private LabelPersonHelper $labelPersonHelper) {}
|
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
|
||||||
{
|
|
||||||
// nothing to add here
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getLabels($key, array $values, mixed $data)
|
|
||||||
{
|
|
||||||
return $this->labelPersonHelper->getLabel($key, $values, 'export.aggregator.person.by_person.person');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
|
||||||
{
|
|
||||||
return ['activity_by_person_agg'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTitle()
|
|
||||||
{
|
|
||||||
return 'export.aggregator.person.by_person.title';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addRole(): ?string
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
|
||||||
{
|
|
||||||
$qb
|
|
||||||
->addSelect('IDENTITY(activity.person) AS activity_by_person_agg')
|
|
||||||
->addGroupBy('activity_by_person_agg');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function applyOn()
|
|
||||||
{
|
|
||||||
return Declarations::ACTIVITY_PERSON;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,78 +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\Aggregator;
|
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
|
||||||
use Chill\ActivityBundle\Tests\Export\Aggregator\PersonsAggregatorTest;
|
|
||||||
use Chill\MainBundle\Export\AggregatorInterface;
|
|
||||||
use Chill\PersonBundle\Export\Helper\LabelPersonHelper;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see PersonsAggregatorTest
|
|
||||||
*/
|
|
||||||
final readonly class PersonsAggregator implements AggregatorInterface
|
|
||||||
{
|
|
||||||
private const PREFIX = 'act_persons_agg';
|
|
||||||
|
|
||||||
public function __construct(private LabelPersonHelper $labelPersonHelper) {}
|
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
|
||||||
{
|
|
||||||
// nothing to add here
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getLabels($key, array $values, mixed $data)
|
|
||||||
{
|
|
||||||
if ($key !== self::PREFIX.'_pid') {
|
|
||||||
throw new \UnexpectedValueException('this key should not be handled: '.$key);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->labelPersonHelper->getLabel($key, $values, 'export.aggregator.activity.by_persons.Persons');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
|
||||||
{
|
|
||||||
return [self::PREFIX.'_pid'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTitle()
|
|
||||||
{
|
|
||||||
return 'export.aggregator.activity.by_persons.Group activity by persons';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addRole(): ?string
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
|
||||||
{
|
|
||||||
$p = self::PREFIX;
|
|
||||||
|
|
||||||
$qb
|
|
||||||
->leftJoin('activity.persons', "{$p}_p")
|
|
||||||
->addSelect("{$p}_p.id AS {$p}_pid")
|
|
||||||
->addGroupBy("{$p}_pid");
|
|
||||||
}
|
|
||||||
|
|
||||||
public function applyOn()
|
|
||||||
{
|
|
||||||
return Declarations::ACTIVITY;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -11,8 +11,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\ActivityBundle\Export\Export\LinkedToACP;
|
namespace Chill\ActivityBundle\Export\Export\LinkedToACP;
|
||||||
|
|
||||||
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
use Chill\ActivityBundle\Repository\ActivityRepository;
|
|
||||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||||
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
|
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
|
||||||
use Chill\MainBundle\Export\ExportInterface;
|
use Chill\MainBundle\Export\ExportInterface;
|
||||||
@@ -21,19 +21,19 @@ use Chill\MainBundle\Export\GroupedExportInterface;
|
|||||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||||
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||||
use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class AvgActivityDuration implements ExportInterface, GroupedExportInterface
|
class AvgActivityDuration implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
private readonly bool $filterStatsByCenters;
|
protected EntityRepository $repository;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly ActivityRepository $activityRepository,
|
EntityManagerInterface $em,
|
||||||
ParameterBagInterface $parameterBag,
|
|
||||||
) {
|
) {
|
||||||
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
$this->repository = $em->getRepository(Activity::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder) {}
|
public function buildForm(FormBuilderInterface $builder) {}
|
||||||
@@ -91,25 +91,23 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface
|
|||||||
{
|
{
|
||||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
|
||||||
$qb = $this->activityRepository->createQueryBuilder('activity');
|
$qb = $this->repository->createQueryBuilder('activity');
|
||||||
|
|
||||||
$qb
|
$qb
|
||||||
->join('activity.accompanyingPeriod', 'acp')
|
->join('activity.accompanyingPeriod', 'acp')
|
||||||
->select('AVG(activity.durationTime) as export_avg_activity_duration')
|
->select('AVG(activity.durationTime) as export_avg_activity_duration')
|
||||||
->andWhere($qb->expr()->isNotNull('activity.durationTime'));
|
->andWhere($qb->expr()->isNotNull('activity.durationTime'));
|
||||||
|
|
||||||
if ($this->filterStatsByCenters) {
|
$qb
|
||||||
$qb
|
->andWhere(
|
||||||
->andWhere(
|
$qb->expr()->exists(
|
||||||
$qb->expr()->exists(
|
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
||||||
'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)
|
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)
|
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||||
'
|
'
|
||||||
)
|
|
||||||
)
|
)
|
||||||
->setParameter('authorized_centers', $centers);
|
)
|
||||||
}
|
->setParameter('authorized_centers', $centers);
|
||||||
|
|
||||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||||
|
|
||||||
|
@@ -24,21 +24,16 @@ use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
|||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterface
|
class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
protected EntityRepository $repository;
|
protected EntityRepository $repository;
|
||||||
|
|
||||||
private readonly bool $filterStatsByCenters;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
EntityManagerInterface $em,
|
EntityManagerInterface $em,
|
||||||
ParameterBagInterface $parameterBag,
|
|
||||||
) {
|
) {
|
||||||
$this->repository = $em->getRepository(Activity::class);
|
$this->repository = $em->getRepository(Activity::class);
|
||||||
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
@@ -106,18 +101,16 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
|||||||
->select('AVG(activity.travelTime) as export_avg_activity_visit_duration')
|
->select('AVG(activity.travelTime) as export_avg_activity_visit_duration')
|
||||||
->andWhere($qb->expr()->isNotNull('activity.travelTime'));
|
->andWhere($qb->expr()->isNotNull('activity.travelTime'));
|
||||||
|
|
||||||
if ($this->filterStatsByCenters) {
|
$qb
|
||||||
$qb
|
->andWhere(
|
||||||
->andWhere(
|
$qb->expr()->exists(
|
||||||
$qb->expr()->exists(
|
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
||||||
'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)
|
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)
|
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||||
'
|
'
|
||||||
)
|
|
||||||
)
|
)
|
||||||
->setParameter('authorized_centers', $centers);
|
)
|
||||||
}
|
->setParameter('authorized_centers', $centers);
|
||||||
|
|
||||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||||
|
|
||||||
|
@@ -24,21 +24,16 @@ use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
|||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class CountActivity implements ExportInterface, GroupedExportInterface
|
class CountActivity implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
protected EntityRepository $repository;
|
protected EntityRepository $repository;
|
||||||
|
|
||||||
private readonly bool $filterStatsByCenters;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
EntityManagerInterface $em,
|
EntityManagerInterface $em,
|
||||||
ParameterBagInterface $parameterBag,
|
|
||||||
) {
|
) {
|
||||||
$this->repository = $em->getRepository(Activity::class);
|
$this->repository = $em->getRepository(Activity::class);
|
||||||
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder) {}
|
public function buildForm(FormBuilderInterface $builder) {}
|
||||||
@@ -100,18 +95,16 @@ class CountActivity implements ExportInterface, GroupedExportInterface
|
|||||||
->createQueryBuilder('activity')
|
->createQueryBuilder('activity')
|
||||||
->join('activity.accompanyingPeriod', 'acp');
|
->join('activity.accompanyingPeriod', 'acp');
|
||||||
|
|
||||||
if ($this->filterStatsByCenters) {
|
$qb
|
||||||
$qb
|
->andWhere(
|
||||||
->andWhere(
|
$qb->expr()->exists(
|
||||||
$qb->expr()->exists(
|
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
||||||
'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)
|
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)
|
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||||
'
|
'
|
||||||
)
|
|
||||||
)
|
)
|
||||||
->setParameter('authorized_centers', $centers);
|
)
|
||||||
}
|
->setParameter('authorized_centers', $centers);
|
||||||
|
|
||||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||||
|
|
||||||
|
@@ -1,138 +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\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;
|
|
||||||
|
|
||||||
class CountPersonsOnActivity implements ExportInterface, GroupedExportInterface
|
|
||||||
{
|
|
||||||
protected EntityRepository $repository;
|
|
||||||
|
|
||||||
private readonly 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_person_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_person_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_person_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');
|
|
||||||
|
|
||||||
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 person.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,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
@@ -22,21 +22,11 @@ use Chill\MainBundle\Export\Helper\TranslatableStringExportLabelHelper;
|
|||||||
use Chill\MainBundle\Export\ListInterface;
|
use Chill\MainBundle\Export\ListInterface;
|
||||||
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
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;
|
||||||
|
|
||||||
class ListActivity implements ListInterface, GroupedExportInterface
|
class ListActivity implements ListInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
private readonly bool $filterStatsByCenters;
|
public function __construct(private readonly ListActivityHelper $helper, private readonly EntityManagerInterface $entityManager, private readonly TranslatableStringExportLabelHelper $translatableStringExportLabelHelper) {}
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
private readonly ListActivityHelper $helper,
|
|
||||||
private readonly EntityManagerInterface $entityManager,
|
|
||||||
private readonly TranslatableStringExportLabelHelper $translatableStringExportLabelHelper,
|
|
||||||
ParameterBagInterface $parameterBag,
|
|
||||||
) {
|
|
||||||
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
{
|
{
|
||||||
@@ -117,27 +107,21 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
|||||||
->join('activity.accompanyingPeriod', 'acp')
|
->join('activity.accompanyingPeriod', 'acp')
|
||||||
->leftJoin('acp.participations', 'acppart')
|
->leftJoin('acp.participations', 'acppart')
|
||||||
->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')
|
||||||
|
->andWhere(
|
||||||
if ($this->filterStatsByCenters) {
|
$qb->expr()->exists(
|
||||||
$qb
|
'SELECT 1
|
||||||
->andWhere(
|
|
||||||
$qb->expr()->exists(
|
|
||||||
'SELECT 1
|
|
||||||
FROM '.PersonCenterHistory::class.' acl_count_person_history
|
FROM '.PersonCenterHistory::class.' acl_count_person_history
|
||||||
WHERE acl_count_person_history.person = person
|
WHERE acl_count_person_history.person = person
|
||||||
AND acl_count_person_history.center IN (:authorized_centers)
|
AND acl_count_person_history.center IN (:authorized_centers)
|
||||||
'
|
'
|
||||||
)
|
|
||||||
)
|
)
|
||||||
->setParameter('authorized_centers', $centers);
|
)
|
||||||
}
|
|
||||||
|
|
||||||
$qb
|
|
||||||
// some grouping are necessary
|
// some grouping are necessary
|
||||||
->addGroupBy('acp.id')
|
->addGroupBy('acp.id')
|
||||||
->addOrderBy('activity.date')
|
->addOrderBy('activity.date')
|
||||||
->addOrderBy('activity.id');
|
->addOrderBy('activity.id')
|
||||||
|
->setParameter('authorized_centers', $centers);
|
||||||
|
|
||||||
$this->helper->addSelect($qb);
|
$this->helper->addSelect($qb);
|
||||||
|
|
||||||
|
@@ -24,20 +24,16 @@ use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
|||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class SumActivityDuration implements ExportInterface, GroupedExportInterface
|
class SumActivityDuration implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
protected EntityRepository $repository;
|
protected EntityRepository $repository;
|
||||||
private readonly bool $filterStatsByCenters;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
EntityManagerInterface $em,
|
EntityManagerInterface $em,
|
||||||
ParameterBagInterface $parameterBag,
|
|
||||||
) {
|
) {
|
||||||
$this->repository = $em->getRepository(Activity::class);
|
$this->repository = $em->getRepository(Activity::class);
|
||||||
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
@@ -105,18 +101,16 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface
|
|||||||
$qb->select('SUM(activity.durationTime) as export_sum_activity_duration')
|
$qb->select('SUM(activity.durationTime) as export_sum_activity_duration')
|
||||||
->andWhere($qb->expr()->isNotNull('activity.durationTime'));
|
->andWhere($qb->expr()->isNotNull('activity.durationTime'));
|
||||||
|
|
||||||
if ($this->filterStatsByCenters) {
|
$qb
|
||||||
$qb
|
->andWhere(
|
||||||
->andWhere(
|
$qb->expr()->exists(
|
||||||
$qb->expr()->exists(
|
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
||||||
'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)
|
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)
|
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||||
'
|
'
|
||||||
)
|
|
||||||
)
|
)
|
||||||
->setParameter('authorized_centers', $centers);
|
)
|
||||||
}
|
->setParameter('authorized_centers', $centers);
|
||||||
|
|
||||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||||
|
|
||||||
|
@@ -24,20 +24,16 @@ use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
|||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class SumActivityVisitDuration implements ExportInterface, GroupedExportInterface
|
class SumActivityVisitDuration implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
protected EntityRepository $repository;
|
protected EntityRepository $repository;
|
||||||
private readonly bool $filterStatsByCenters;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
EntityManagerInterface $em,
|
EntityManagerInterface $em,
|
||||||
ParameterBagInterface $parameterBag,
|
|
||||||
) {
|
) {
|
||||||
$this->repository = $em->getRepository(Activity::class);
|
$this->repository = $em->getRepository(Activity::class);
|
||||||
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
@@ -105,18 +101,16 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
|||||||
$qb->select('SUM(activity.travelTime) as export_sum_activity_visit_duration')
|
$qb->select('SUM(activity.travelTime) as export_sum_activity_visit_duration')
|
||||||
->andWhere($qb->expr()->isNotNull('activity.travelTime'));
|
->andWhere($qb->expr()->isNotNull('activity.travelTime'));
|
||||||
|
|
||||||
if ($this->filterStatsByCenters) {
|
$qb
|
||||||
$qb
|
->andWhere(
|
||||||
->andWhere(
|
$qb->expr()->exists(
|
||||||
$qb->expr()->exists(
|
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
||||||
'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)
|
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)
|
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||||
'
|
'
|
||||||
)
|
|
||||||
)
|
)
|
||||||
->setParameter('authorized_centers', $centers);
|
)
|
||||||
}
|
->setParameter('authorized_centers', $centers);
|
||||||
|
|
||||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||||
|
|
||||||
|
@@ -19,19 +19,11 @@ use Chill\MainBundle\Export\FormatterInterface;
|
|||||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||||
use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class CountActivity implements ExportInterface, GroupedExportInterface
|
class CountActivity implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
private readonly bool $filterStatsByCenters;
|
public function __construct(protected ActivityRepository $activityRepository) {}
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
private readonly ActivityRepository $activityRepository,
|
|
||||||
ParameterBagInterface $parameterBag,
|
|
||||||
) {
|
|
||||||
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder) {}
|
public function buildForm(FormBuilderInterface $builder) {}
|
||||||
|
|
||||||
@@ -90,25 +82,23 @@ class CountActivity implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
$qb = $this->activityRepository
|
$qb = $this->activityRepository
|
||||||
->createQueryBuilder('activity')
|
->createQueryBuilder('activity')
|
||||||
->join('activity.person', 'person');
|
->join('activity.person', 'person')
|
||||||
|
->join('person.centerHistory', 'centerHistory');
|
||||||
|
|
||||||
$qb->select('COUNT(activity.id) as export_count_activity');
|
$qb->select('COUNT(activity.id) as export_count_activity');
|
||||||
|
|
||||||
if ($this->filterStatsByCenters) {
|
$qb
|
||||||
$qb
|
->where(
|
||||||
->join('person.centerHistory', 'centerHistory')
|
$qb->expr()->andX(
|
||||||
->where(
|
$qb->expr()->lte('centerHistory.startDate', 'activity.date'),
|
||||||
$qb->expr()->andX(
|
$qb->expr()->orX(
|
||||||
$qb->expr()->lte('centerHistory.startDate', 'activity.date'),
|
$qb->expr()->isNull('centerHistory.endDate'),
|
||||||
$qb->expr()->orX(
|
$qb->expr()->gt('centerHistory.endDate', 'activity.date')
|
||||||
$qb->expr()->isNull('centerHistory.endDate'),
|
|
||||||
$qb->expr()->gt('centerHistory.endDate', 'activity.date')
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->andWhere($qb->expr()->in('centerHistory.center', ':centers'))
|
)
|
||||||
->setParameter('centers', $centers);
|
->andWhere($qb->expr()->in('centerHistory.center', ':centers'))
|
||||||
}
|
->setParameter('centers', $centers);
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,6 @@ use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
|||||||
use Doctrine\DBAL\Exception\InvalidArgumentException;
|
use Doctrine\DBAL\Exception\InvalidArgumentException;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
|
||||||
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;
|
||||||
use Symfony\Component\Validator\Constraints\Callback;
|
use Symfony\Component\Validator\Constraints\Callback;
|
||||||
@@ -45,17 +44,8 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
|||||||
'person_lastname',
|
'person_lastname',
|
||||||
'person_id',
|
'person_id',
|
||||||
];
|
];
|
||||||
private readonly bool $filterStatsByCenters;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(protected EntityManagerInterface $entityManager, protected TranslatorInterface $translator, protected TranslatableStringHelperInterface $translatableStringHelper, private readonly ActivityRepository $activityRepository) {}
|
||||||
protected EntityManagerInterface $entityManager,
|
|
||||||
protected TranslatorInterface $translator,
|
|
||||||
protected TranslatableStringHelperInterface $translatableStringHelper,
|
|
||||||
private readonly ActivityRepository $activityRepository,
|
|
||||||
ParameterBagInterface $parameterBag,
|
|
||||||
) {
|
|
||||||
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
{
|
{
|
||||||
@@ -198,22 +188,20 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
|||||||
|
|
||||||
$qb
|
$qb
|
||||||
->from('ChillActivityBundle:Activity', 'activity')
|
->from('ChillActivityBundle:Activity', 'activity')
|
||||||
->join('activity.person', 'actperson');
|
->join('activity.person', 'actperson')
|
||||||
|
->join('actperson.centerHistory', 'centerHistory');
|
||||||
|
|
||||||
if ($this->filterStatsByCenters) {
|
$qb->where(
|
||||||
$qb->join('actperson.centerHistory', 'centerHistory');
|
$qb->expr()->andX(
|
||||||
$qb->where(
|
$qb->expr()->lte('centerHistory.startDate', 'activity.date'),
|
||||||
$qb->expr()->andX(
|
$qb->expr()->orX(
|
||||||
$qb->expr()->lte('centerHistory.startDate', 'activity.date'),
|
$qb->expr()->isNull('centerHistory.endDate'),
|
||||||
$qb->expr()->orX(
|
$qb->expr()->gt('centerHistory.endDate', 'activity.date')
|
||||||
$qb->expr()->isNull('centerHistory.endDate'),
|
|
||||||
$qb->expr()->gt('centerHistory.endDate', 'activity.date')
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->andWhere($qb->expr()->in('centerHistory.center', ':centers'))
|
)
|
||||||
->setParameter('centers', $centers);
|
->andWhere($qb->expr()->in('centerHistory.center', ':centers'))
|
||||||
}
|
->setParameter('centers', $centers);
|
||||||
|
|
||||||
foreach ($this->fields as $f) {
|
foreach ($this->fields as $f) {
|
||||||
if (\in_array($f, $data['fields'], true)) {
|
if (\in_array($f, $data['fields'], true)) {
|
||||||
|
@@ -20,7 +20,6 @@ use Chill\MainBundle\Export\FormatterInterface;
|
|||||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||||
use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,21 +30,17 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
class StatActivityDuration implements ExportInterface, GroupedExportInterface
|
class StatActivityDuration implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
final public const SUM = 'sum';
|
final public const SUM = 'sum';
|
||||||
private readonly bool $filterStatsByCenters;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $action the stat to perform
|
* @param string $action the stat to perform
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly ActivityRepository $activityRepository,
|
private readonly ActivityRepository $activityRepository,
|
||||||
ParameterBagInterface $parameterBag,
|
|
||||||
/**
|
/**
|
||||||
* The action for this report.
|
* The action for this report.
|
||||||
*/
|
*/
|
||||||
protected string $action = 'sum'
|
protected string $action = 'sum'
|
||||||
) {
|
) {}
|
||||||
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder) {}
|
public function buildForm(FormBuilderInterface $builder) {}
|
||||||
|
|
||||||
@@ -124,23 +119,21 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$qb->select($select)
|
$qb->select($select)
|
||||||
->join('activity.person', 'person');
|
->join('activity.person', 'person')
|
||||||
|
->join('person.centerHistory', 'centerHistory');
|
||||||
|
|
||||||
if ($this->filterStatsByCenters) {
|
$qb
|
||||||
$qb
|
->where(
|
||||||
->join('person.centerHistory', 'centerHistory')
|
$qb->expr()->andX(
|
||||||
->where(
|
$qb->expr()->lte('centerHistory.startDate', 'activity.date'),
|
||||||
$qb->expr()->andX(
|
$qb->expr()->orX(
|
||||||
$qb->expr()->lte('centerHistory.startDate', 'activity.date'),
|
$qb->expr()->isNull('centerHistory.endDate'),
|
||||||
$qb->expr()->orX(
|
$qb->expr()->gt('centerHistory.endDate', 'activity.date')
|
||||||
$qb->expr()->isNull('centerHistory.endDate'),
|
|
||||||
$qb->expr()->gt('centerHistory.endDate', 'activity.date')
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->andWhere($qb->expr()->in('centerHistory.center', ':centers'))
|
)
|
||||||
->setParameter('centers', $centers);
|
->andWhere($qb->expr()->in('centerHistory.center', ':centers'))
|
||||||
}
|
->setParameter('centers', $centers);
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
}
|
}
|
||||||
|
@@ -13,12 +13,16 @@ namespace Chill\ActivityBundle\Export\Filter;
|
|||||||
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\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\Query\Expr;
|
use Doctrine\ORM\Query\Expr;
|
||||||
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 ActivityDateFilter implements FilterInterface
|
class ActivityDateFilter implements FilterInterface
|
||||||
@@ -70,6 +74,46 @@ class ActivityDateFilter implements FilterInterface
|
|||||||
->add('date_to', PickRollingDateType::class, [
|
->add('date_to', PickRollingDateType::class, [
|
||||||
'label' => 'Activities before this date',
|
'label' => '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('This date should be after '
|
||||||
|
.'the date given in "Implied in an activity after '
|
||||||
|
.'this date" field')
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
|
@@ -1,82 +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\Filter;
|
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\ActivityPresence;
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
final readonly class ActivityPresenceFilter implements FilterInterface
|
|
||||||
{
|
|
||||||
public function __construct(
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper,
|
|
||||||
private TranslatorInterface $translator
|
|
||||||
) {}
|
|
||||||
|
|
||||||
public function getTitle()
|
|
||||||
{
|
|
||||||
return 'export.filter.activity.by_presence.Filter activity by activity presence';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
|
||||||
{
|
|
||||||
$builder->add('presences', EntityType::class, [
|
|
||||||
'class' => ActivityPresence::class,
|
|
||||||
'choice_label' => fn (ActivityPresence $presence) => $this->translatableStringHelper->localize($presence->getName())
|
|
||||||
.($presence->isActive() ? '' : ' ('.$this->translator->trans('inactive').')'),
|
|
||||||
'multiple' => true,
|
|
||||||
'expanded' => true,
|
|
||||||
'label' => 'export.filter.activity.by_presence.presences',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string')
|
|
||||||
{
|
|
||||||
$presences = array_map(
|
|
||||||
fn (ActivityPresence $presence) => $this->translatableStringHelper->localize($presence->getName()),
|
|
||||||
$data['presences'] instanceof Collection ? $data['presences']->toArray() : $data['presences']
|
|
||||||
);
|
|
||||||
|
|
||||||
return [
|
|
||||||
'export.filter.activity.by_presence.Filtered by activity presence: only %presences%',
|
|
||||||
['%presences%' => implode(', ', $presences)],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addRole(): ?string
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
|
||||||
{
|
|
||||||
$qb
|
|
||||||
->andWhere('activity.attendee IN (:activity_presence_filter_presences)')
|
|
||||||
->setParameter('activity_presence_filter_presences', $data['presences']);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function applyOn()
|
|
||||||
{
|
|
||||||
return Declarations::ACTIVITY;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -80,7 +80,7 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter
|
|||||||
// collect all the reasons'name used in this filter in one array
|
// collect all the reasons'name used in this filter in one array
|
||||||
$reasonsNames = array_map(
|
$reasonsNames = array_map(
|
||||||
fn (ActivityType $t): string => $this->translatableStringHelper->localize($t->getName()),
|
fn (ActivityType $t): string => $this->translatableStringHelper->localize($t->getName()),
|
||||||
$this->activityTypeRepository->findBy(['id' => $data['types'] instanceof \Doctrine\Common\Collections\Collection ? $data['types']->toArray() : $data['types']])
|
$this->activityTypeRepository->findBy(['id' => $data['types']->toArray()])
|
||||||
);
|
);
|
||||||
|
|
||||||
return ['Filtered by activity type: only %list%', [
|
return ['Filtered by activity type: only %list%', [
|
||||||
|
@@ -1,116 +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\Filter;
|
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
|
||||||
use Chill\MainBundle\Entity\User\UserJobHistory;
|
|
||||||
use Chill\MainBundle\Entity\UserJob;
|
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
|
||||||
use Chill\MainBundle\Repository\UserJobRepositoryInterface;
|
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\ORM\Query\Expr\Join;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
final readonly class CreatorJobFilter implements FilterInterface
|
|
||||||
{
|
|
||||||
private const PREFIX = 'acp_act_filter_creator_job';
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
private TranslatableStringHelper $translatableStringHelper,
|
|
||||||
private TranslatorInterface $translator,
|
|
||||||
private UserJobRepositoryInterface $userJobRepository,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
public function addRole(): ?string
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
|
||||||
{
|
|
||||||
$p = self::PREFIX;
|
|
||||||
|
|
||||||
$qb
|
|
||||||
->leftJoin('activity.createdBy', "{$p}_user")
|
|
||||||
->leftJoin(
|
|
||||||
UserJobHistory::class,
|
|
||||||
"{$p}_history",
|
|
||||||
Join::WITH,
|
|
||||||
$qb->expr()->eq("{$p}_history.user", "{$p}_user")
|
|
||||||
)
|
|
||||||
// job_at based on activity.date
|
|
||||||
->andWhere(
|
|
||||||
$qb->expr()->andX(
|
|
||||||
$qb->expr()->lte("{$p}_history.startDate", 'activity.date'),
|
|
||||||
$qb->expr()->orX(
|
|
||||||
$qb->expr()->isNull("{$p}_history.endDate"),
|
|
||||||
$qb->expr()->gt("{$p}_history.endDate", 'activity.date')
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
->andWhere(
|
|
||||||
$qb->expr()->in("{$p}_history.job", ":{$p}_jobs")
|
|
||||||
)
|
|
||||||
->setParameter(
|
|
||||||
"{$p}_jobs",
|
|
||||||
$data['jobs'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function applyOn(): string
|
|
||||||
{
|
|
||||||
return Declarations::ACTIVITY;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
|
||||||
{
|
|
||||||
$builder
|
|
||||||
->add('jobs', EntityType::class, [
|
|
||||||
'choices' => $this->userJobRepository->findAllOrderedByName(),
|
|
||||||
'class' => UserJob::class,
|
|
||||||
'choice_label' => fn (UserJob $s) => $this->translatableStringHelper->localize(
|
|
||||||
$s->getLabel()
|
|
||||||
).($s->isActive() ? '' : '('.$this->translator->trans('inactive').')'),
|
|
||||||
'label' => 'export.filter.activity.by_creator_job.job_form_label',
|
|
||||||
'multiple' => true,
|
|
||||||
'expanded' => true,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string'): array
|
|
||||||
{
|
|
||||||
$jobs = array_map(
|
|
||||||
fn (UserJob $job) => $this->translatableStringHelper->localize($job->getLabel()),
|
|
||||||
$data['jobs'] instanceof Collection ? $data['jobs']->toArray() : $data['jobs']
|
|
||||||
);
|
|
||||||
|
|
||||||
return ['export.filter.activity.by_creator_job.Filtered activity by user job: only %jobs%', [
|
|
||||||
'%jobs%' => implode(', ', $jobs),
|
|
||||||
]];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'jobs' => [],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTitle(): string
|
|
||||||
{
|
|
||||||
return 'export.filter.activity.by_creator_job.Filter activity by user job';
|
|
||||||
}
|
|
||||||
}
|
|
@@ -17,7 +17,6 @@ use Chill\ActivityBundle\Repository\ActivityReasonRepository;
|
|||||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\ORM\Query\Expr;
|
use Doctrine\ORM\Query\Expr;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
@@ -80,7 +79,7 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt
|
|||||||
// collect all the reasons'name used in this filter in one array
|
// collect all the reasons'name used in this filter in one array
|
||||||
$reasonsNames = array_map(
|
$reasonsNames = array_map(
|
||||||
fn (ActivityReason $r): string => '"'.$this->translatableStringHelper->localize($r->getName()).'"',
|
fn (ActivityReason $r): string => '"'.$this->translatableStringHelper->localize($r->getName()).'"',
|
||||||
$this->activityReasonRepository->findBy(['id' => $data['reasons'] instanceof Collection ? $data['reasons']->toArray() : $data['reasons']])
|
$this->activityReasonRepository->findBy(['id' => $data['reasons']->toArray()])
|
||||||
);
|
);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@@ -1,87 +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\Filter;
|
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
|
||||||
use Chill\ActivityBundle\Tests\Export\Filter\PersonsFilterTest;
|
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
|
||||||
use Chill\PersonBundle\Form\Type\PickPersonDynamicType;
|
|
||||||
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see PersonsFilterTest
|
|
||||||
*/
|
|
||||||
final readonly class PersonsFilter implements FilterInterface
|
|
||||||
{
|
|
||||||
private const PREFIX = 'act_persons_filter';
|
|
||||||
|
|
||||||
public function __construct(private PersonRenderInterface $personRender) {}
|
|
||||||
|
|
||||||
public function addRole(): ?string
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
|
||||||
{
|
|
||||||
$p = self::PREFIX;
|
|
||||||
|
|
||||||
$orX = $qb->expr()->orX();
|
|
||||||
|
|
||||||
foreach (array_values($data['accepted_persons']) as $key => $person) {
|
|
||||||
$orX->add($qb->expr()->isMemberOf(":{$p}_p_{$key}", 'activity.persons'));
|
|
||||||
$qb->setParameter(":{$p}_p_{$key}", $person);
|
|
||||||
}
|
|
||||||
|
|
||||||
$qb->andWhere($orX);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function applyOn()
|
|
||||||
{
|
|
||||||
return Declarations::ACTIVITY;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
|
||||||
{
|
|
||||||
$builder->add('accepted_persons', PickPersonDynamicType::class, [
|
|
||||||
'multiple' => true,
|
|
||||||
'label' => 'export.filter.activity.by_persons.persons taking part on the activity',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'accepted_persons' => [],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string')
|
|
||||||
{
|
|
||||||
$users = [];
|
|
||||||
|
|
||||||
foreach ($data['accepted_persons'] as $u) {
|
|
||||||
$users[] = $this->personRender->renderString($u, []);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ['export.filter.activity.by_persons.Filtered activity by persons: only %persons%', [
|
|
||||||
'%persons%' => implode(', ', $users),
|
|
||||||
]];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTitle(): string
|
|
||||||
{
|
|
||||||
return 'export.filter.activity.by_persons.Filter activity by persons';
|
|
||||||
}
|
|
||||||
}
|
|
@@ -23,8 +23,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
class SentReceivedFilter implements FilterInterface
|
class SentReceivedFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private const CHOICES = [
|
private const CHOICES = [
|
||||||
'export.filter.activity.by_sent_received.is sent' => Activity::SENTRECEIVED_SENT,
|
'is sent' => Activity::SENTRECEIVED_SENT,
|
||||||
'export.filter.activity.by_sent_received.is received' => Activity::SENTRECEIVED_RECEIVED,
|
'is received' => Activity::SENTRECEIVED_RECEIVED,
|
||||||
];
|
];
|
||||||
|
|
||||||
private const DEFAULT_CHOICE = Activity::SENTRECEIVED_SENT;
|
private const DEFAULT_CHOICE = Activity::SENTRECEIVED_SENT;
|
||||||
@@ -64,7 +64,6 @@ class SentReceivedFilter implements FilterInterface
|
|||||||
'multiple' => false,
|
'multiple' => false,
|
||||||
'expanded' => true,
|
'expanded' => true,
|
||||||
'empty_data' => self::DEFAULT_CHOICE,
|
'empty_data' => self::DEFAULT_CHOICE,
|
||||||
'label' => 'export.filter.activity.by_sent_received.Sent or received',
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -21,9 +21,9 @@ 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;
|
||||||
|
|
||||||
class CreatorScopeFilter implements FilterInterface
|
class UserScopeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private const PREFIX = 'acp_act_filter_creator_scope';
|
private const PREFIX = 'acp_act_filter_user_scope'; // creator ? cfr translation
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly TranslatableStringHelper $translatableStringHelper
|
private readonly TranslatableStringHelper $translatableStringHelper
|
||||||
@@ -39,7 +39,7 @@ class CreatorScopeFilter implements FilterInterface
|
|||||||
$p = self::PREFIX;
|
$p = self::PREFIX;
|
||||||
|
|
||||||
$qb
|
$qb
|
||||||
->leftJoin('activity.createdBy', "{$p}_user")
|
->leftJoin('activity.user', "{$p}_user") // createdBy ? cfr translation
|
||||||
->leftJoin(
|
->leftJoin(
|
||||||
UserScopeHistory::class,
|
UserScopeHistory::class,
|
||||||
"{$p}_history",
|
"{$p}_history",
|
@@ -17,7 +17,6 @@ use Chill\MainBundle\Entity\User\UserJobHistory;
|
|||||||
use Chill\MainBundle\Entity\UserJob;
|
use Chill\MainBundle\Entity\UserJob;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
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;
|
||||||
@@ -81,7 +80,7 @@ class UsersJobFilter implements FilterInterface
|
|||||||
', ',
|
', ',
|
||||||
array_map(
|
array_map(
|
||||||
fn (UserJob $job) => $this->translatableStringHelper->localize($job->getLabel()),
|
fn (UserJob $job) => $this->translatableStringHelper->localize($job->getLabel()),
|
||||||
$data['jobs'] instanceof Collection ? $data['jobs']->toArray() : $data['jobs']
|
$data['jobs']->toArray()
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
]];
|
]];
|
||||||
|
@@ -18,7 +18,6 @@ use Chill\MainBundle\Entity\User\UserScopeHistory;
|
|||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Repository\ScopeRepositoryInterface;
|
use Chill\MainBundle\Repository\ScopeRepositoryInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
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;
|
||||||
@@ -84,7 +83,7 @@ class UsersScopeFilter implements FilterInterface
|
|||||||
', ',
|
', ',
|
||||||
array_map(
|
array_map(
|
||||||
fn (Scope $s) => $this->translatableStringHelper->localize($s->getName()),
|
fn (Scope $s) => $this->translatableStringHelper->localize($s->getName()),
|
||||||
$data['scopes'] instanceof Collection ? $data['scopes']->toArray() : $data['scopes']
|
$data['scopes']->toArray()
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
]];
|
]];
|
||||||
|
@@ -1,87 +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\Aggregator\ACPAggregators;
|
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Aggregator\ACPAggregators\ByActivityTypeAggregator;
|
|
||||||
use Chill\ActivityBundle\Repository\ActivityTypeRepositoryInterface;
|
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*
|
|
||||||
* @coversNothing
|
|
||||||
*/
|
|
||||||
class ByActivityTypeAggregatorTest extends AbstractAggregatorTest
|
|
||||||
{
|
|
||||||
private RollingDateConverterInterface $rollingDateConverter;
|
|
||||||
private ActivityTypeRepositoryInterface $activityTypeRepository;
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
self::bootKernel();
|
|
||||||
$this->rollingDateConverter = self::$container->get(RollingDateConverterInterface::class);
|
|
||||||
$this->activityTypeRepository = self::$container->get(ActivityTypeRepositoryInterface::class);
|
|
||||||
$this->translatableStringHelper = self::$container->get(TranslatableStringHelperInterface::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getAggregator()
|
|
||||||
{
|
|
||||||
return new ByActivityTypeAggregator(
|
|
||||||
$this->rollingDateConverter,
|
|
||||||
$this->activityTypeRepository,
|
|
||||||
$this->translatableStringHelper,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormData()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
[
|
|
||||||
'after_date' => null,
|
|
||||||
'before_date' => null,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'after_date' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START),
|
|
||||||
'before_date' => null,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'after_date' => null,
|
|
||||||
'before_date' => new RollingDate(RollingDate::T_TODAY),
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'after_date' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START),
|
|
||||||
'before_date' => new RollingDate(RollingDate::T_TODAY),
|
|
||||||
],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getQueryBuilders()
|
|
||||||
{
|
|
||||||
self::bootKernel();
|
|
||||||
|
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
|
||||||
|
|
||||||
return [
|
|
||||||
$em->createQueryBuilder()
|
|
||||||
->select('count(distinct acp.id)')
|
|
||||||
->from(AccompanyingPeriod::class, 'acp'),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,62 +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\Aggregator;
|
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
|
||||||
use Chill\ActivityBundle\Export\Aggregator\ActivityPresenceAggregator;
|
|
||||||
use Chill\ActivityBundle\Repository\ActivityPresenceRepositoryInterface;
|
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*
|
|
||||||
* @coversNothing
|
|
||||||
*/
|
|
||||||
class ActivityPresenceAggregatorTest extends AbstractAggregatorTest
|
|
||||||
{
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
private ActivityPresenceRepositoryInterface $activityPresenceRepository;
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
self::bootKernel();
|
|
||||||
$this->translatableStringHelper = self::$container->get(TranslatableStringHelperInterface::class);
|
|
||||||
$this->activityPresenceRepository = self::$container->get(ActivityPresenceRepositoryInterface::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getAggregator()
|
|
||||||
{
|
|
||||||
return new ActivityPresenceAggregator($this->activityPresenceRepository, $this->translatableStringHelper);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormData()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
[],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getQueryBuilders()
|
|
||||||
{
|
|
||||||
self::bootKernel();
|
|
||||||
|
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
|
||||||
|
|
||||||
return [
|
|
||||||
$em->createQueryBuilder()
|
|
||||||
->select('count(activity.id)')
|
|
||||||
->from(Activity::class, 'activity'),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
@@ -12,7 +12,7 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Tests\Export\Aggregator;
|
namespace Chill\ActivityBundle\Tests\Export\Aggregator;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
use Chill\ActivityBundle\Export\Aggregator\CreatorJobAggregator;
|
use Chill\ActivityBundle\Export\Aggregator\JobScopeAggregator;
|
||||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
@@ -21,15 +21,15 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||||||
*
|
*
|
||||||
* @coversNothing
|
* @coversNothing
|
||||||
*/
|
*/
|
||||||
final class CreatorJobAggregatorTest extends AbstractAggregatorTest
|
final class JobScopeAggregatorTest extends AbstractAggregatorTest
|
||||||
{
|
{
|
||||||
private CreatorJobAggregator $aggregator;
|
private JobScopeAggregator $aggregator;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
|
|
||||||
$this->aggregator = self::$container->get(CreatorJobAggregator::class);
|
$this->aggregator = self::$container->get(JobScopeAggregator::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAggregator()
|
public function getAggregator()
|
@@ -1,57 +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\Aggregator\PersonAggregators;
|
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
|
||||||
use Chill\ActivityBundle\Export\Aggregator\PersonAggregators\PersonAggregator;
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
|
||||||
use Chill\PersonBundle\Export\Helper\LabelPersonHelper;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*
|
|
||||||
* @coversNothing
|
|
||||||
*/
|
|
||||||
class PersonAggregatorTest extends AbstractAggregatorTest
|
|
||||||
{
|
|
||||||
private LabelPersonHelper $labelPersonHelper;
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
self::bootKernel();
|
|
||||||
$this->labelPersonHelper = self::$container->get(LabelPersonHelper::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getAggregator()
|
|
||||||
{
|
|
||||||
return new PersonAggregator($this->labelPersonHelper);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormData()
|
|
||||||
{
|
|
||||||
return [[]];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getQueryBuilders()
|
|
||||||
{
|
|
||||||
self::bootKernel();
|
|
||||||
|
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
|
||||||
|
|
||||||
return [
|
|
||||||
$em->createQueryBuilder()
|
|
||||||
->select('count(activity.id)')
|
|
||||||
->from(Activity::class, 'activity'),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
@@ -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\Aggregator;
|
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
|
||||||
use Chill\ActivityBundle\Export\Aggregator\PersonsAggregator;
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
|
||||||
use Chill\PersonBundle\Export\Helper\LabelPersonHelper;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*
|
|
||||||
* @coversNothing
|
|
||||||
*/
|
|
||||||
class PersonsAggregatorTest extends AbstractAggregatorTest
|
|
||||||
{
|
|
||||||
private LabelPersonHelper $labelPersonHelper;
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
self::bootKernel();
|
|
||||||
$this->labelPersonHelper = self::$container->get(LabelPersonHelper::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getAggregator()
|
|
||||||
{
|
|
||||||
return new PersonsAggregator($this->labelPersonHelper);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormData()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
[],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getQueryBuilders()
|
|
||||||
{
|
|
||||||
self::bootKernel();
|
|
||||||
|
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
|
||||||
|
|
||||||
return [
|
|
||||||
$em->createQueryBuilder()
|
|
||||||
->select('count(activity.id)')
|
|
||||||
->from(Activity::class, 'activity'),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
@@ -12,7 +12,6 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Tests\Export\Export\LinkedToACP;
|
namespace Chill\ActivityBundle\Tests\Export\Export\LinkedToACP;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Export\LinkedToACP\AvgActivityDuration;
|
use Chill\ActivityBundle\Export\Export\LinkedToACP\AvgActivityDuration;
|
||||||
use Chill\ActivityBundle\Repository\ActivityRepository;
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -22,17 +21,18 @@ use Chill\MainBundle\Test\Export\AbstractExportTest;
|
|||||||
*/
|
*/
|
||||||
final class AvgActivityDurationTest extends AbstractExportTest
|
final class AvgActivityDurationTest extends AbstractExportTest
|
||||||
{
|
{
|
||||||
|
private AvgActivityDuration $export;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
|
|
||||||
|
$this->export = self::$container->get('chill.activity.export.avg_activity_duration_linked_to_acp');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getExport()
|
public function getExport()
|
||||||
{
|
{
|
||||||
$activityRepository = self::$container->get(ActivityRepository::class);
|
return $this->export;
|
||||||
|
|
||||||
yield new AvgActivityDuration($activityRepository, $this->getParameters(true));
|
|
||||||
yield new AvgActivityDuration($activityRepository, $this->getParameters(false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormData(): array
|
public function getFormData(): array
|
||||||
|
@@ -13,7 +13,6 @@ namespace Chill\ActivityBundle\Tests\Export\Export\LinkedToACP;
|
|||||||
|
|
||||||
use Chill\ActivityBundle\Export\Export\LinkedToACP\AvgActivityVisitDuration;
|
use Chill\ActivityBundle\Export\Export\LinkedToACP\AvgActivityVisitDuration;
|
||||||
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@@ -22,17 +21,18 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||||||
*/
|
*/
|
||||||
final class AvgActivityVisitDurationTest extends AbstractExportTest
|
final class AvgActivityVisitDurationTest extends AbstractExportTest
|
||||||
{
|
{
|
||||||
|
private AvgActivityVisitDuration $export;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
|
|
||||||
|
$this->export = self::$container->get('chill.activity.export.avg_activity_visit_duration_linked_to_acp');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getExport()
|
public function getExport()
|
||||||
{
|
{
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
return $this->export;
|
||||||
|
|
||||||
yield new AvgActivityVisitDuration($em, $this->getParameters(true));
|
|
||||||
yield new AvgActivityVisitDuration($em, $this->getParameters(false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormData(): array
|
public function getFormData(): array
|
||||||
|
@@ -13,7 +13,6 @@ namespace Chill\ActivityBundle\Tests\Export\Export\LinkedToACP;
|
|||||||
|
|
||||||
use Chill\ActivityBundle\Export\Export\LinkedToACP\CountActivity;
|
use Chill\ActivityBundle\Export\Export\LinkedToACP\CountActivity;
|
||||||
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@@ -22,17 +21,18 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||||||
*/
|
*/
|
||||||
final class CountActivityTest extends AbstractExportTest
|
final class CountActivityTest extends AbstractExportTest
|
||||||
{
|
{
|
||||||
|
private CountActivity $export;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
|
|
||||||
|
$this->export = self::$container->get('chill.activity.export.count_activity_linked_to_acp');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getExport()
|
public function getExport()
|
||||||
{
|
{
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
return $this->export;
|
||||||
|
|
||||||
yield new CountActivity($em, $this->getParameters(true));
|
|
||||||
yield new CountActivity($em, $this->getParameters(false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormData(): array
|
public function getFormData(): array
|
||||||
|
@@ -1,54 +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\CountPersonsOnActivity;
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
|
||||||
use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*
|
|
||||||
* @coversNothing
|
|
||||||
*/
|
|
||||||
class CountPersonsOnActivityTest extends AbstractExportTest
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
self::bootKernel();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getExport()
|
|
||||||
{
|
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
|
||||||
|
|
||||||
yield new CountPersonsOnActivity($em, $this->getParameters(true));
|
|
||||||
yield new CountPersonsOnActivity($em, $this->getParameters(false));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormData()
|
|
||||||
{
|
|
||||||
return [[]];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getModifiersCombination()
|
|
||||||
{
|
|
||||||
return [[
|
|
||||||
Declarations::ACTIVITY,
|
|
||||||
Declarations::ACTIVITY_ACP,
|
|
||||||
PersonDeclarations::ACP_TYPE,
|
|
||||||
PersonDeclarations::PERSON_TYPE,
|
|
||||||
]];
|
|
||||||
}
|
|
||||||
}
|
|
@@ -13,7 +13,6 @@ namespace Chill\ActivityBundle\Tests\Export\Export\LinkedToACP;
|
|||||||
|
|
||||||
use Chill\ActivityBundle\Export\Export\LinkedToACP\SumActivityDuration;
|
use Chill\ActivityBundle\Export\Export\LinkedToACP\SumActivityDuration;
|
||||||
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@@ -22,17 +21,18 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||||||
*/
|
*/
|
||||||
final class SumActivityDurationTest extends AbstractExportTest
|
final class SumActivityDurationTest extends AbstractExportTest
|
||||||
{
|
{
|
||||||
|
private SumActivityDuration $export;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
|
|
||||||
|
$this->export = self::$container->get('chill.activity.export.sum_activity_duration_linked_to_acp');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getExport()
|
public function getExport()
|
||||||
{
|
{
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
return $this->export;
|
||||||
|
|
||||||
yield new SumActivityDuration($em, $this->getParameters(true));
|
|
||||||
yield new SumActivityDuration($em, $this->getParameters(false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormData(): array
|
public function getFormData(): array
|
||||||
|
@@ -13,7 +13,6 @@ namespace Chill\ActivityBundle\Tests\Export\Export\LinkedToACP;
|
|||||||
|
|
||||||
use Chill\ActivityBundle\Export\Export\LinkedToACP\SumActivityVisitDuration;
|
use Chill\ActivityBundle\Export\Export\LinkedToACP\SumActivityVisitDuration;
|
||||||
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@@ -33,10 +32,7 @@ final class SumActivityVisitDurationTest extends AbstractExportTest
|
|||||||
|
|
||||||
public function getExport()
|
public function getExport()
|
||||||
{
|
{
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
return $this->export;
|
||||||
|
|
||||||
yield new SumActivityVisitDuration($em, $this->getParameters(true));
|
|
||||||
yield new SumActivityVisitDuration($em, $this->getParameters(false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormData(): array
|
public function getFormData(): array
|
||||||
|
@@ -12,7 +12,6 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Tests\Export\Export\LinkedToPerson;
|
namespace Chill\ActivityBundle\Tests\Export\Export\LinkedToPerson;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Export\LinkedToPerson\CountActivity;
|
use Chill\ActivityBundle\Export\Export\LinkedToPerson\CountActivity;
|
||||||
use Chill\ActivityBundle\Repository\ActivityRepository;
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -22,17 +21,18 @@ use Chill\MainBundle\Test\Export\AbstractExportTest;
|
|||||||
*/
|
*/
|
||||||
final class CountActivityTest extends AbstractExportTest
|
final class CountActivityTest extends AbstractExportTest
|
||||||
{
|
{
|
||||||
|
private CountActivity $export;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
|
|
||||||
|
$this->export = self::$container->get('chill.activity.export.count_activity_linked_to_person');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getExport()
|
public function getExport()
|
||||||
{
|
{
|
||||||
$activityRepository = self::$container->get(ActivityRepository::class);
|
return $this->export;
|
||||||
|
|
||||||
yield new CountActivity($activityRepository, $this->getParameters(true));
|
|
||||||
yield new CountActivity($activityRepository, $this->getParameters(false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormData(): array
|
public function getFormData(): array
|
||||||
|
@@ -12,12 +12,8 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Tests\Export\Export\LinkedToPerson;
|
namespace Chill\ActivityBundle\Tests\Export\Export\LinkedToPerson;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Export\LinkedToPerson\ListActivity;
|
use Chill\ActivityBundle\Export\Export\LinkedToPerson\ListActivity;
|
||||||
use Chill\ActivityBundle\Repository\ActivityRepository;
|
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Prophecy\PhpUnit\ProphecyTrait;
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@@ -28,12 +24,14 @@ final class ListActivityTest extends AbstractExportTest
|
|||||||
{
|
{
|
||||||
use ProphecyTrait;
|
use ProphecyTrait;
|
||||||
|
|
||||||
private readonly ListActivity $export;
|
private ListActivity $export;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
|
|
||||||
|
$this->export = self::$container->get('chill.activity.export.list_activity_linked_to_person');
|
||||||
|
|
||||||
$request = $this->prophesize()
|
$request = $this->prophesize()
|
||||||
->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
||||||
|
|
||||||
@@ -45,26 +43,7 @@ final class ListActivityTest extends AbstractExportTest
|
|||||||
|
|
||||||
public function getExport()
|
public function getExport()
|
||||||
{
|
{
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
return $this->export;
|
||||||
$translator = self::$container->get(TranslatorInterface::class);
|
|
||||||
$translatableStringHelper = self::$container->get(TranslatableStringHelperInterface::class);
|
|
||||||
$activityRepository = self::$container->get(ActivityRepository::class);
|
|
||||||
|
|
||||||
yield new ListActivity(
|
|
||||||
$em,
|
|
||||||
$translator,
|
|
||||||
$translatableStringHelper,
|
|
||||||
$activityRepository,
|
|
||||||
$this->getParameters(true)
|
|
||||||
);
|
|
||||||
|
|
||||||
yield new ListActivity(
|
|
||||||
$em,
|
|
||||||
$translator,
|
|
||||||
$translatableStringHelper,
|
|
||||||
$activityRepository,
|
|
||||||
$this->getParameters(false)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormData()
|
public function getFormData()
|
||||||
|
@@ -12,7 +12,6 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Tests\Export\Export\LinkedToPerson;
|
namespace Chill\ActivityBundle\Tests\Export\Export\LinkedToPerson;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Export\LinkedToPerson\StatActivityDuration;
|
use Chill\ActivityBundle\Export\Export\LinkedToPerson\StatActivityDuration;
|
||||||
use Chill\ActivityBundle\Repository\ActivityRepository;
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,18 +23,18 @@ use Chill\MainBundle\Test\Export\AbstractExportTest;
|
|||||||
*/
|
*/
|
||||||
final class StatActivityDurationTest extends AbstractExportTest
|
final class StatActivityDurationTest extends AbstractExportTest
|
||||||
{
|
{
|
||||||
private readonly StatActivityDuration $export;
|
private StatActivityDuration $export;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
|
|
||||||
|
$this->export = self::$container->get('chill.activity.export.sum_activity_duration_linked_to_person');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getExport()
|
public function getExport()
|
||||||
{
|
{
|
||||||
$activityRepository = self::$container->get(ActivityRepository::class);
|
return $this->export;
|
||||||
yield new StatActivityDuration($activityRepository, $this->getParameters(true), 'sum');
|
|
||||||
yield new StatActivityDuration($activityRepository, $this->getParameters(false), 'sum');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormData(): array
|
public function getFormData(): array
|
||||||
|
@@ -1,76 +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\Filter;
|
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
|
||||||
use Chill\ActivityBundle\Export\Filter\ActivityPresenceFilter;
|
|
||||||
use Chill\ActivityBundle\Repository\ActivityPresenceRepositoryInterface;
|
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*
|
|
||||||
* @coversNothing
|
|
||||||
*/
|
|
||||||
class ActivityPresenceFilterTest extends AbstractFilterTest
|
|
||||||
{
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
private TranslatorInterface $translator;
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
self::bootKernel();
|
|
||||||
|
|
||||||
$this->translator = self::$container->get(TranslatorInterface::class);
|
|
||||||
$this->translatableStringHelper = self::$container->get(TranslatableStringHelperInterface::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFilter()
|
|
||||||
{
|
|
||||||
return new ActivityPresenceFilter($this->translatableStringHelper, $this->translator);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormData()
|
|
||||||
{
|
|
||||||
self::bootKernel();
|
|
||||||
|
|
||||||
$presences = self::$container->get(ActivityPresenceRepositoryInterface::class)
|
|
||||||
->findAll();
|
|
||||||
|
|
||||||
return [
|
|
||||||
[
|
|
||||||
'presences' => $presences,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'presences' => new ArrayCollection($presences),
|
|
||||||
],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getQueryBuilders()
|
|
||||||
{
|
|
||||||
self::bootKernel();
|
|
||||||
|
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
|
||||||
|
|
||||||
yield $em->createQueryBuilder()
|
|
||||||
->select('count(activity.id)')
|
|
||||||
->from(Activity::class, 'activity');
|
|
||||||
|
|
||||||
self::ensureKernelShutdown();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -52,7 +52,6 @@ final class ActivityReasonFilterTest extends AbstractFilterTest
|
|||||||
public function getFormData()
|
public function getFormData()
|
||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
$data = [];
|
|
||||||
|
|
||||||
$em = self::$container
|
$em = self::$container
|
||||||
->get(EntityManagerInterface::class);
|
->get(EntityManagerInterface::class);
|
||||||
@@ -63,13 +62,10 @@ final class ActivityReasonFilterTest extends AbstractFilterTest
|
|||||||
|
|
||||||
// generate an array of 5 different combination of results
|
// generate an array of 5 different combination of results
|
||||||
for ($i = 0; 5 > $i; ++$i) {
|
for ($i = 0; 5 > $i; ++$i) {
|
||||||
$data[] = ['reasons' => new ArrayCollection(array_splice($reasons, ($i + 1) * -1))];
|
yield ['reasons' => new ArrayCollection(array_splice($reasons, ($i + 1) * -1))];
|
||||||
$data[] = ['reasons' => array_splice($reasons, ($i + 1) * -1)];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self::ensureKernelShutdown();
|
self::ensureKernelShutdown();
|
||||||
|
|
||||||
return $data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryBuilders(): iterable
|
public function getQueryBuilders(): iterable
|
||||||
|
@@ -57,9 +57,6 @@ final class ActivityTypeFilterTest extends AbstractFilterTest
|
|||||||
$data[] = [
|
$data[] = [
|
||||||
'types' => new ArrayCollection([$a]),
|
'types' => new ArrayCollection([$a]),
|
||||||
];
|
];
|
||||||
/*$data[] = [
|
|
||||||
'types' => [$a],
|
|
||||||
];*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
@@ -1,75 +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\Filter;
|
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
|
||||||
use Chill\ActivityBundle\Export\Filter\CreatorJobFilter;
|
|
||||||
use Chill\MainBundle\Repository\UserJobRepositoryInterface;
|
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*
|
|
||||||
* @coversNothing
|
|
||||||
*/
|
|
||||||
class CreatorJobFilterTest extends AbstractFilterTest
|
|
||||||
{
|
|
||||||
private EntityManagerInterface $entityManager;
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
private TranslatorInterface $translator;
|
|
||||||
private UserJobRepositoryInterface $userJobRepository;
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
self::bootKernel();
|
|
||||||
|
|
||||||
$this->entityManager = self::$container->get(EntityManagerInterface::class);
|
|
||||||
$this->translatableStringHelper = self::$container->get(TranslatableStringHelperInterface::class);
|
|
||||||
$this->translator = self::$container->get(TranslatorInterface::class);
|
|
||||||
$this->userJobRepository = self::$container->get(UserJobRepositoryInterface::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFilter()
|
|
||||||
{
|
|
||||||
return new CreatorJobFilter(
|
|
||||||
$this->translatableStringHelper,
|
|
||||||
$this->translator,
|
|
||||||
$this->userJobRepository
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormData()
|
|
||||||
{
|
|
||||||
$this->setUp();
|
|
||||||
$jobs = $this->userJobRepository->findAll();
|
|
||||||
|
|
||||||
return [
|
|
||||||
['jobs' => $jobs],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getQueryBuilders()
|
|
||||||
{
|
|
||||||
self::setUp();
|
|
||||||
|
|
||||||
return [
|
|
||||||
$this->entityManager->createQueryBuilder()
|
|
||||||
->select('count(activity.id)')
|
|
||||||
->from(Activity::class, 'activity')
|
|
||||||
->join('activity.user', 'actuser'),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,72 +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\Filter;
|
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
|
||||||
use Chill\ActivityBundle\Export\Filter\PersonsFilter;
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
|
||||||
use Chill\PersonBundle\Entity\Person;
|
|
||||||
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*
|
|
||||||
* @coversNothing
|
|
||||||
*/
|
|
||||||
class PersonsFilterTest extends AbstractFilterTest
|
|
||||||
{
|
|
||||||
private PersonRenderInterface $personRender;
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
self::bootKernel();
|
|
||||||
$this->personRender = self::$container->get(PersonRenderInterface::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFilter()
|
|
||||||
{
|
|
||||||
return new PersonsFilter($this->personRender);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormData()
|
|
||||||
{
|
|
||||||
self::bootKernel();
|
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
|
||||||
|
|
||||||
$persons = $em->createQuery('SELECT p FROM '.Person::class.' p ')
|
|
||||||
->setMaxResults(2)
|
|
||||||
->getResult();
|
|
||||||
|
|
||||||
self::ensureKernelShutdown();
|
|
||||||
|
|
||||||
return [
|
|
||||||
[
|
|
||||||
'accepted_persons' => $persons,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getQueryBuilders()
|
|
||||||
{
|
|
||||||
self::bootKernel();
|
|
||||||
|
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
|
||||||
|
|
||||||
yield $em->createQueryBuilder()
|
|
||||||
->select('count(activity.id)')
|
|
||||||
->from(Activity::class, 'activity');
|
|
||||||
|
|
||||||
self::ensureKernelShutdown();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -12,7 +12,7 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Tests\Export\Filter;
|
namespace Chill\ActivityBundle\Tests\Export\Filter;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
use Chill\ActivityBundle\Export\Filter\CreatorScopeFilter;
|
use Chill\ActivityBundle\Export\Filter\UserScopeFilter;
|
||||||
use Chill\MainBundle\Entity\Scope;
|
use Chill\MainBundle\Entity\Scope;
|
||||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
@@ -22,15 +22,15 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||||||
*
|
*
|
||||||
* @coversNothing
|
* @coversNothing
|
||||||
*/
|
*/
|
||||||
final class CreatorScopeFilterTest extends AbstractFilterTest
|
final class UserScopeFilterTest extends AbstractFilterTest
|
||||||
{
|
{
|
||||||
private CreatorScopeFilter $filter;
|
private UserScopeFilter $filter;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
|
|
||||||
$this->filter = self::$container->get(CreatorScopeFilter::class);
|
$this->filter = self::$container->get(UserScopeFilter::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFilter()
|
public function getFilter()
|
@@ -16,10 +16,6 @@ services:
|
|||||||
tags:
|
tags:
|
||||||
- { name: chill.export, alias: 'list_activity_linked_to_person' }
|
- { name: chill.export, alias: 'list_activity_linked_to_person' }
|
||||||
|
|
||||||
Chill\ActivityBundle\Export\Export\LinkedToACP\CountPersonsOnActivity:
|
|
||||||
tags:
|
|
||||||
- { name: chill.export, alias: 'count_person_on_activity' }
|
|
||||||
|
|
||||||
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:
|
||||||
@@ -113,16 +109,10 @@ services:
|
|||||||
tags:
|
tags:
|
||||||
- { name: chill.export_filter, alias: 'activity_user_filter' }
|
- { name: chill.export_filter, alias: 'activity_user_filter' }
|
||||||
|
|
||||||
Chill\ActivityBundle\Export\Filter\CreatorScopeFilter:
|
Chill\ActivityBundle\Export\Filter\UserScopeFilter:
|
||||||
tags:
|
tags:
|
||||||
# WARNING: for backward compatibility reason, the alias is named with userscope. Changing this will
|
|
||||||
# affect all saved exports (unless we write a migration for that)
|
|
||||||
- { name: chill.export_filter, alias: 'activity_userscope_filter' }
|
- { name: chill.export_filter, alias: 'activity_userscope_filter' }
|
||||||
|
|
||||||
Chill\ActivityBundle\Export\Filter\CreatorJobFilter:
|
|
||||||
tags:
|
|
||||||
- { name: chill.export_filter, alias: 'activity_creatorjob_filter' }
|
|
||||||
|
|
||||||
Chill\ActivityBundle\Export\Filter\UsersJobFilter:
|
Chill\ActivityBundle\Export\Filter\UsersJobFilter:
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_filter, alias: 'activity_usersjob_filter' }
|
- { name: chill.export_filter, alias: 'activity_usersjob_filter' }
|
||||||
@@ -139,11 +129,6 @@ services:
|
|||||||
tags:
|
tags:
|
||||||
- { name: chill.export_filter, alias: 'period_having_activity_betw_dates_filter' }
|
- { name: chill.export_filter, alias: 'period_having_activity_betw_dates_filter' }
|
||||||
|
|
||||||
Chill\ActivityBundle\Export\Filter\ActivityPresenceFilter:
|
|
||||||
tags:
|
|
||||||
- { name: chill.export_filter, alias: 'activity_presence_filter' }
|
|
||||||
|
|
||||||
|
|
||||||
## Aggregators
|
## Aggregators
|
||||||
Chill\ActivityBundle\Export\Aggregator\PersonAggregators\ActivityReasonAggregator:
|
Chill\ActivityBundle\Export\Aggregator\PersonAggregators\ActivityReasonAggregator:
|
||||||
tags:
|
tags:
|
||||||
@@ -192,7 +177,7 @@ services:
|
|||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: activity_creator_scope_aggregator }
|
- { name: chill.export_aggregator, alias: activity_creator_scope_aggregator }
|
||||||
|
|
||||||
Chill\ActivityBundle\Export\Aggregator\CreatorJobAggregator:
|
Chill\ActivityBundle\Export\Aggregator\JobScopeAggregator:
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: activity_creator_job_aggregator }
|
- { name: chill.export_aggregator, alias: activity_creator_job_aggregator }
|
||||||
|
|
||||||
@@ -215,23 +200,3 @@ services:
|
|||||||
Chill\ActivityBundle\Export\Aggregator\SentReceivedAggregator:
|
Chill\ActivityBundle\Export\Aggregator\SentReceivedAggregator:
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: activity_sentreceived_aggregator }
|
- { name: chill.export_aggregator, alias: activity_sentreceived_aggregator }
|
||||||
|
|
||||||
Chill\ActivityBundle\Export\Filter\PersonsFilter:
|
|
||||||
tags:
|
|
||||||
- { name: chill.export_filter, alias: activity_by_persons_filter }
|
|
||||||
|
|
||||||
Chill\ActivityBundle\Export\Aggregator\PersonsAggregator:
|
|
||||||
tags:
|
|
||||||
- { name: chill.export_aggregator, alias: activity_by_persons_aggregator }
|
|
||||||
|
|
||||||
Chill\ActivityBundle\Export\Aggregator\ACPAggregators\ByActivityTypeAggregator:
|
|
||||||
tags:
|
|
||||||
- { name: chill.export_aggregator, alias: acp_by_activity_type_aggregator }
|
|
||||||
|
|
||||||
Chill\ActivityBundle\Export\Aggregator\ActivityPresenceAggregator:
|
|
||||||
tags:
|
|
||||||
- { name: chill.export_aggregator, alias: activity_presence_agg }
|
|
||||||
|
|
||||||
Chill\ActivityBundle\Export\Aggregator\PersonAggregators\PersonAggregator:
|
|
||||||
tags:
|
|
||||||
- { name: chill.export_aggregator, alias: activity_person_agg }
|
|
||||||
|
@@ -275,7 +275,7 @@ Filter activity by linked socialaction: Filtrer les échanges par action liée
|
|||||||
'Filtered activity by linked socialaction: only %actions%': "Filtré par action liée: uniquement %actions%"
|
'Filtered activity by linked socialaction: only %actions%': "Filtré par action liée: uniquement %actions%"
|
||||||
Filter activity by linked socialissue: Filtrer les échanges par problématique liée
|
Filter activity by linked socialissue: Filtrer les échanges par problématique liée
|
||||||
'Filtered activity by linked socialissue: only %issues%': "Filtré par problématique liée: uniquement %issues%"
|
'Filtered activity by linked socialissue: only %issues%': "Filtré par problématique liée: uniquement %issues%"
|
||||||
Filter activity by user: Filtrer les échanges par utilisateur principal
|
Filter activity by user: Filtrer les échanges par créateur
|
||||||
Filter activity by users: Filtrer les échanges par utilisateur participant
|
Filter activity by users: Filtrer les échanges par utilisateur participant
|
||||||
Filter activity by creator: Filtrer les échanges par créateur de l'échange
|
Filter activity by creator: Filtrer les échanges par créateur de l'échange
|
||||||
'Filtered activity by user: only %users%': "Filtré par référent: uniquement %users%"
|
'Filtered activity by user: only %users%': "Filtré par référent: uniquement %users%"
|
||||||
@@ -332,11 +332,6 @@ docgen:
|
|||||||
myWorksOnly: Prendre en compte uniquement les actions d'accompagnement dont je suis référent
|
myWorksOnly: Prendre en compte uniquement les actions d'accompagnement dont je suis référent
|
||||||
|
|
||||||
export:
|
export:
|
||||||
export:
|
|
||||||
count_person_on_activity:
|
|
||||||
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.
|
|
||||||
header: Nombre d'usagers concernés par des échanges
|
|
||||||
list:
|
list:
|
||||||
activity:
|
activity:
|
||||||
users name: Nom des utilisateurs
|
users name: Nom des utilisateurs
|
||||||
@@ -364,10 +359,10 @@ export:
|
|||||||
Filter by users job: Filtrer les échanges par métier d'au moins un utilisateur participant
|
Filter by users job: Filtrer les échanges par métier d'au moins un utilisateur participant
|
||||||
'Filtered activity by users job: only %jobs%': 'Filtré par métier d''au moins un utilisateur participant: seulement %jobs%'
|
'Filtered activity by users job: only %jobs%': 'Filtré par métier d''au moins un utilisateur participant: seulement %jobs%'
|
||||||
by_users_scope:
|
by_users_scope:
|
||||||
Filter by users scope: Filtrer les échanges par service d'au moins un utilisateur participant
|
Filter by users scope: Filtrer les échanges par services d'au moins un utilisateur participant
|
||||||
'Filtered activity by users scope: only %scopes%': 'Filtré par service d''au moins un utilisateur participant: seulement %scopes%'
|
'Filtered activity by users scope: only %scopes%': 'Filtré par service d''au moins un utilisateur participant: seulement %scopes%'
|
||||||
course_having_activity_between_date:
|
course_having_activity_between_date:
|
||||||
Title: Filtrer les parcours ayant reçu un échange entre deux dates
|
Title: Filtre les parcours ayant reçu un échange entre deux dates
|
||||||
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:
|
||||||
@@ -377,39 +372,13 @@ export:
|
|||||||
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
|
||||||
Activity reasons for those activities: Sujets de ces échanges
|
Activity reasons for those activities: Sujets de ces échanges
|
||||||
if no reasons: Si aucun sujet n'est coché, tous les sujets seront pris en compte
|
if no reasons: Si aucun sujet n'est coché, tous les sujets seront pris en compte
|
||||||
title: Filtrer les usagers ayant été associés à un échange au cours de la période
|
title: Filtrer les personnes ayant été associés à un échange au cours de la période
|
||||||
date mismatch: La date de fin de la période doit être supérieure à la date du début
|
date mismatch: La date de fin de la période doit être supérieure à la date du début
|
||||||
by_creator_scope:
|
by_creator_scope:
|
||||||
Filter activity by user scope: Filtrer les échanges par service du créateur de l'échange
|
Filter activity by user scope: Filtrer les échanges par service du créateur de l'échange
|
||||||
'Filtered activity by user scope: only %scopes%': "Filtré par service du créateur de l'échange: uniquement %scopes%"
|
'Filtered activity by user scope: only %scopes%': "Filtré par service du créateur: uniquement %scopes%"
|
||||||
by_creator_job:
|
|
||||||
job_form_label: Métiers
|
|
||||||
Filter activity by user job: Filtrer les échanges par métier du créateur de l'échange
|
|
||||||
'Filtered activity by user job: only %jobs%': "Filtré par service du créateur de l'échange: uniquement %jobs%"
|
|
||||||
by_persons:
|
|
||||||
Filter activity by persons: Filtrer les échanges par usager participant
|
|
||||||
'Filtered activity by persons: only %persons%': 'Échanges filtrés par usagers participants: seulement %persons%'
|
|
||||||
persons taking part on the activity: Usagers participants à l'échange
|
|
||||||
by_sent_received:
|
|
||||||
Sent or received: Envoyé ou reçu
|
|
||||||
is sent: envoyé
|
|
||||||
is received: reçu
|
|
||||||
by_presence:
|
|
||||||
Filter activity by activity presence: Filtrer les échanges par présence de l'usager
|
|
||||||
presences: Présences
|
|
||||||
'Filtered by activity presence: only %presences%': 'Filtré par présence de l''usager: seulement %presences%'
|
|
||||||
|
|
||||||
aggregator:
|
aggregator:
|
||||||
person:
|
|
||||||
by_person:
|
|
||||||
title: Grouper les échanges par usager (dossier d'usager dans lequel l'échange est enregistré)
|
|
||||||
person: Usager
|
|
||||||
acp:
|
|
||||||
by_activity_type:
|
|
||||||
title: Grouper les parcours par type d'échange
|
|
||||||
after_date: Uniquement échanges après cette date
|
|
||||||
before_date: Uniquement échanges avant cette date
|
|
||||||
activity_type: Types d'échange
|
|
||||||
activity:
|
activity:
|
||||||
by_sent_received:
|
by_sent_received:
|
||||||
Sent or received: Envoyé ou reçu
|
Sent or received: Envoyé ou reçu
|
||||||
@@ -429,14 +398,8 @@ export:
|
|||||||
Group activity by creator scope: Grouper les échanges par service du créateur de l'échange
|
Group activity by creator scope: Grouper les échanges par service du créateur de l'échange
|
||||||
Calc date: Date de calcul du service du créateur de l'échange
|
Calc date: Date de calcul du service du créateur de l'échange
|
||||||
by_creator_job:
|
by_creator_job:
|
||||||
Group activity by creator job: Grouper les échanges par métier du créateur de l'échange
|
Group activity by creator job: Grouper les échanges par service du créateur de l'échange
|
||||||
Calc date: Date de calcul du métier du créateur de l'échange
|
Calc date: Date de calcul du service du créateur de l'échange
|
||||||
by_persons:
|
|
||||||
Group activity by persons: Grouper les échanges par usager participant
|
|
||||||
Persons: Usagers participants
|
|
||||||
by_activity_presence:
|
|
||||||
Group activity by presence: Grouper les échanges par présence de l'usager
|
|
||||||
header: Présence de(s) usager(s)
|
|
||||||
|
|
||||||
generic_doc:
|
generic_doc:
|
||||||
filter:
|
filter:
|
||||||
|
@@ -17,7 +17,6 @@ use Chill\AsideActivityBundle\Repository\AsideActivityCategoryRepository;
|
|||||||
use Chill\AsideActivityBundle\Templating\Entity\CategoryRender;
|
use Chill\AsideActivityBundle\Templating\Entity\CategoryRender;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
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;
|
||||||
@@ -77,7 +76,7 @@ class ByActivityTypeFilter implements FilterInterface
|
|||||||
{
|
{
|
||||||
$types = array_map(
|
$types = array_map(
|
||||||
fn (AsideActivityCategory $t): string => $this->translatableStringHelper->localize($t->getTitle()),
|
fn (AsideActivityCategory $t): string => $this->translatableStringHelper->localize($t->getTitle()),
|
||||||
$data['types'] instanceof Collection ? $data['types']->toArray() : $data['types']
|
$data['types']->toArray()
|
||||||
);
|
);
|
||||||
|
|
||||||
return ['export.filter.Filtered by aside activity type: only %type%', [
|
return ['export.filter.Filtered by aside activity type: only %type%', [
|
||||||
|
@@ -16,7 +16,6 @@ use Chill\MainBundle\Entity\Location;
|
|||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Form\Type\PickUserLocationType;
|
use Chill\MainBundle\Form\Type\PickUserLocationType;
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
@@ -55,12 +54,7 @@ final readonly class ByLocationFilter implements FilterInterface
|
|||||||
|
|
||||||
public function describeAction($data, $format = 'string'): array
|
public function describeAction($data, $format = 'string'): array
|
||||||
{
|
{
|
||||||
$extractFunction = fn (Location $l): string => $l->getName();
|
$locations = $data['locations']->map(fn (Location $l): string => $l->getName());
|
||||||
if ($data['locations'] instanceof Collection) {
|
|
||||||
$locations = $data['locations']->map($extractFunction);
|
|
||||||
} else {
|
|
||||||
$locations = array_map($extractFunction, $data['locations']);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ['export.filter.Filtered by aside activity location: only %location%', [
|
return ['export.filter.Filtered by aside activity location: only %location%', [
|
||||||
'%location%' => implode(', ', $locations),
|
'%location%' => implode(', ', $locations),
|
||||||
|
@@ -17,7 +17,6 @@ use Chill\MainBundle\Entity\User\UserJobHistory;
|
|||||||
use Chill\MainBundle\Entity\UserJob;
|
use Chill\MainBundle\Entity\UserJob;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
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;
|
||||||
@@ -81,7 +80,7 @@ class ByUserJobFilter implements FilterInterface
|
|||||||
', ',
|
', ',
|
||||||
array_map(
|
array_map(
|
||||||
fn (UserJob $job) => $this->translatableStringHelper->localize($job->getLabel()),
|
fn (UserJob $job) => $this->translatableStringHelper->localize($job->getLabel()),
|
||||||
$data['jobs'] instanceof Collection ? $data['jobs']->toArray() : $data['jobs']
|
$data['jobs']->toArray()
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
]];
|
]];
|
||||||
|
@@ -18,7 +18,6 @@ use Chill\MainBundle\Entity\User\UserScopeHistory;
|
|||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Repository\ScopeRepositoryInterface;
|
use Chill\MainBundle\Repository\ScopeRepositoryInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
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;
|
||||||
@@ -84,7 +83,7 @@ class ByUserScopeFilter implements FilterInterface
|
|||||||
', ',
|
', ',
|
||||||
array_map(
|
array_map(
|
||||||
fn (Scope $s) => $this->translatableStringHelper->localize($s->getName()),
|
fn (Scope $s) => $this->translatableStringHelper->localize($s->getName()),
|
||||||
$data['scopes'] instanceof Collection ? $data['scopes']->toArray() : $data['scopes']
|
$data['scopes']->toArray()
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
]];
|
]];
|
||||||
|
@@ -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\LinkedToAcp;
|
namespace Chill\CalendarBundle\Export\Export;
|
||||||
|
|
||||||
use Chill\CalendarBundle\Export\Declarations;
|
use Chill\CalendarBundle\Export\Declarations;
|
||||||
use Chill\CalendarBundle\Repository\CalendarRepository;
|
use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||||
@@ -17,25 +17,15 @@ 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(private readonly CalendarRepository $calendarRepository) {}
|
||||||
|
|
||||||
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)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
{
|
{
|
||||||
@@ -54,12 +44,12 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function getDescription(): string
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
return 'export.export.count_calendar_linked_to_acp.description';
|
return 'Count calendars by various parameters.';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGroup(): string
|
public function getGroup(): string
|
||||||
{
|
{
|
||||||
return 'export.export.calendar_linked_to_acp.group';
|
return 'Exports of calendar';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
@@ -86,7 +76,7 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function getTitle(): string
|
public function getTitle(): string
|
||||||
{
|
{
|
||||||
return 'export.export.count_calendar_linked_to_acp.title';
|
return 'Count calendars';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getType(): string
|
public function getType(): string
|
||||||
@@ -106,19 +96,6 @@ 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;
|
@@ -1,137 +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\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,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,132 +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\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 StatCalendarAvgDuration 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_avg_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_avg_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('AVG(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,132 +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\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,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
@@ -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\LinkedToAcp;
|
namespace Chill\CalendarBundle\Export\Export;
|
||||||
|
|
||||||
use Chill\CalendarBundle\Export\Declarations;
|
use Chill\CalendarBundle\Export\Declarations;
|
||||||
use Chill\CalendarBundle\Repository\CalendarRepository;
|
use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||||
@@ -17,24 +17,14 @@ 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
|
||||||
{
|
{
|
||||||
private readonly bool $filterStatsByCenters;
|
public function __construct(private readonly CalendarRepository $calendarRepository) {}
|
||||||
|
|
||||||
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
|
||||||
{
|
{
|
||||||
@@ -53,12 +43,12 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function getDescription(): string
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
return 'export.export.avg_duration_calendar_linked_to_acp.description';
|
return 'Get the average of calendar duration according to various filters';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGroup(): string
|
public function getGroup(): string
|
||||||
{
|
{
|
||||||
return 'export.export.calendar_linked_to_acp.group';
|
return 'Exports of calendar';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
@@ -85,7 +75,7 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function getTitle(): string
|
public function getTitle(): string
|
||||||
{
|
{
|
||||||
return 'export.export.avg_duration_calendar_linked_to_acp.title';
|
return 'Average calendar duration';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getType(): string
|
public function getType(): string
|
||||||
@@ -95,26 +85,11 @@ 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\LinkedToAcp;
|
namespace Chill\CalendarBundle\Export\Export;
|
||||||
|
|
||||||
use Chill\CalendarBundle\Export\Declarations;
|
use Chill\CalendarBundle\Export\Declarations;
|
||||||
use Chill\CalendarBundle\Repository\CalendarRepository;
|
use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||||
@@ -17,24 +17,14 @@ 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
|
||||||
{
|
{
|
||||||
private readonly bool $filterStatsByCenters;
|
public function __construct(private readonly CalendarRepository $calendarRepository) {}
|
||||||
|
|
||||||
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
|
||||||
{
|
{
|
||||||
@@ -53,12 +43,12 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function getDescription(): string
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
return 'export.export.sum_duration_calendar_linked_to_acp.description';
|
return 'Get the sum of calendar durations according to various filters';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGroup(): string
|
public function getGroup(): string
|
||||||
{
|
{
|
||||||
return 'export.export.calendar_linked_to_acp.group';
|
return 'Exports of calendar';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
@@ -85,7 +75,7 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function getTitle(): string
|
public function getTitle(): string
|
||||||
{
|
{
|
||||||
return 'export.export.sum_duration_calendar_linked_to_acp.description';
|
return 'Sum of calendar durations';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getType(): string
|
public function getType(): string
|
||||||
@@ -95,26 +85,11 @@ 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;
|
@@ -1,139 +1,118 @@
|
|||||||
services:
|
services:
|
||||||
|
|
||||||
## Indicators
|
## Indicators
|
||||||
chill.calendar.export.count_calendars_linked_to_acp:
|
chill.calendar.export.count_calendars:
|
||||||
class: Chill\CalendarBundle\Export\Export\LinkedToAcp\CountCalendars
|
class: Chill\CalendarBundle\Export\Export\CountCalendars
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export, alias: count_calendars_linked_to_acp }
|
- { name: chill.export, alias: count_calendars }
|
||||||
|
|
||||||
chill.calendar.export.average_duration_calendars_linked_to_acp:
|
chill.calendar.export.average_duration_calendars:
|
||||||
class: Chill\CalendarBundle\Export\Export\LinkedToAcp\StatCalendarAvgDuration
|
class: Chill\CalendarBundle\Export\Export\StatCalendarAvgDuration
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export, alias: average_duration_calendars_linked_to_acp }
|
- { name: chill.export, alias: average_duration_calendars }
|
||||||
|
|
||||||
chill.calendar.export.sum_duration_calendars_linked_to_acp:
|
chill.calendar.export.sum_duration_calendars:
|
||||||
class: Chill\CalendarBundle\Export\Export\LinkedToAcp\StatCalendarSumDuration
|
class: Chill\CalendarBundle\Export\Export\StatCalendarSumDuration
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export, alias: sum_duration_calendars_linked_to_acp }
|
- { name: chill.export, alias: sum_duration_calendars }
|
||||||
|
|
||||||
chill.calendar.export.count_calendars_linked_to_person:
|
## Filters
|
||||||
class: Chill\CalendarBundle\Export\Export\LinkedToPerson\CountCalendars
|
|
||||||
autowire: true
|
|
||||||
autoconfigure: true
|
|
||||||
tags:
|
|
||||||
- { name: chill.export, alias: count_calendars_linked_to_person }
|
|
||||||
|
|
||||||
chill.calendar.export.average_duration_calendars_linked_to_person:
|
chill.calendar.export.agent_filter:
|
||||||
class: Chill\CalendarBundle\Export\Export\LinkedToPerson\StatCalendarAvgDuration
|
class: Chill\CalendarBundle\Export\Filter\AgentFilter
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export, alias: average_duration_calendars_linked_to_person }
|
- { name: chill.export_filter, alias: agent_filter }
|
||||||
|
|
||||||
chill.calendar.export.sum_duration_calendars_linked_to_person:
|
chill.calendar.export.job_filter:
|
||||||
class: Chill\CalendarBundle\Export\Export\LinkedToPerson\StatCalendarSumDuration
|
class: Chill\CalendarBundle\Export\Filter\JobFilter
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export, alias: sum_duration_calendars_linked_to_person }
|
- { name: chill.export_filter, alias: job_filter }
|
||||||
|
|
||||||
## Filters
|
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_filter:
|
chill.calendar.export.between_dates_filter:
|
||||||
class: Chill\CalendarBundle\Export\Filter\AgentFilter
|
class: Chill\CalendarBundle\Export\Filter\BetweenDatesFilter
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_filter, alias: agent_filter }
|
- { name: chill.export_filter, alias: between_dates_filter }
|
||||||
|
|
||||||
chill.calendar.export.job_filter:
|
chill.calendar.export.calendar_range_filter:
|
||||||
class: Chill\CalendarBundle\Export\Filter\JobFilter
|
class: Chill\CalendarBundle\Export\Filter\CalendarRangeFilter
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_filter, alias: job_filter }
|
- { name: chill.export_filter, alias: calendar_range_filter }
|
||||||
|
|
||||||
chill.calendar.export.scope_filter:
|
## Aggregator
|
||||||
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_aggregator:
|
||||||
class: Chill\CalendarBundle\Export\Filter\BetweenDatesFilter
|
class: Chill\CalendarBundle\Export\Aggregator\AgentAggregator
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_filter, alias: between_dates_filter }
|
- { name: chill.export_aggregator, alias: agent_aggregator }
|
||||||
|
|
||||||
chill.calendar.export.calendar_range_filter:
|
chill.calendar.export.job_aggregator:
|
||||||
class: Chill\CalendarBundle\Export\Filter\CalendarRangeFilter
|
class: Chill\CalendarBundle\Export\Aggregator\JobAggregator
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_filter, alias: calendar_range_filter }
|
- { name: chill.export_aggregator, alias: job_aggregator }
|
||||||
|
|
||||||
## Aggregator
|
chill.calendar.export.scope_aggregator:
|
||||||
|
class: Chill\CalendarBundle\Export\Aggregator\ScopeAggregator
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
tags:
|
||||||
|
- { name: chill.export_aggregator, alias: scope_aggregator }
|
||||||
|
|
||||||
chill.calendar.export.agent_aggregator:
|
chill.calendar.export.location_type_aggregator:
|
||||||
class: Chill\CalendarBundle\Export\Aggregator\AgentAggregator
|
class: Chill\CalendarBundle\Export\Aggregator\LocationTypeAggregator
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: agent_aggregator }
|
- { name: chill.export_aggregator, alias: location_type_aggregator }
|
||||||
|
|
||||||
chill.calendar.export.job_aggregator:
|
chill.calendar.export.location_aggregator:
|
||||||
class: Chill\CalendarBundle\Export\Aggregator\JobAggregator
|
class: Chill\CalendarBundle\Export\Aggregator\LocationAggregator
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: job_aggregator }
|
- { name: chill.export_aggregator, alias: location_aggregator }
|
||||||
|
|
||||||
chill.calendar.export.scope_aggregator:
|
chill.calendar.export.cancel_reason_aggregator:
|
||||||
class: Chill\CalendarBundle\Export\Aggregator\ScopeAggregator
|
class: Chill\CalendarBundle\Export\Aggregator\CancelReasonAggregator
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: scope_aggregator }
|
- { name: chill.export_aggregator, alias: cancel_reason_aggregator }
|
||||||
|
|
||||||
chill.calendar.export.location_type_aggregator:
|
chill.calendar.export.month_aggregator:
|
||||||
class: Chill\CalendarBundle\Export\Aggregator\LocationTypeAggregator
|
class: Chill\CalendarBundle\Export\Aggregator\MonthYearAggregator
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: location_type_aggregator }
|
- { name: chill.export_aggregator, alias: month_aggregator }
|
||||||
|
|
||||||
chill.calendar.export.location_aggregator:
|
chill.calendar.export.urgency_aggregator:
|
||||||
class: Chill\CalendarBundle\Export\Aggregator\LocationAggregator
|
class: Chill\CalendarBundle\Export\Aggregator\UrgencyAggregator
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: location_aggregator }
|
- { name: chill.export_aggregator, alias: urgency_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 }
|
|
||||||
|
@@ -1,55 +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\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,
|
|
||||||
]];
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,55 +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\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,
|
|
||||||
]];
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,55 +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\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,
|
|
||||||
]];
|
|
||||||
}
|
|
||||||
}
|
|
@@ -356,6 +356,20 @@ final class CalendarSyncerTest extends TestCase
|
|||||||
}
|
}
|
||||||
JSON;
|
JSON;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
// all tests should run when timezone = +02:00
|
||||||
|
$brussels = new \DateTimeZone('Europe/Brussels');
|
||||||
|
|
||||||
|
if (7200 === $brussels->getOffset(new \DateTimeImmutable())) {
|
||||||
|
date_default_timezone_set('Europe/Brussels');
|
||||||
|
} else {
|
||||||
|
date_default_timezone_set('Europe/Moscow');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function testHandleAttendeesConfirmingCalendar(): void
|
public function testHandleAttendeesConfirmingCalendar(): void
|
||||||
{
|
{
|
||||||
$machineHttpClient = new MockHttpClient([
|
$machineHttpClient = new MockHttpClient([
|
||||||
|
@@ -112,31 +112,6 @@ 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
|
||||||
|
@@ -18,15 +18,12 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|||||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CustomFieldController.
|
* Class CustomFieldController.
|
||||||
*/
|
*/
|
||||||
class CustomFieldController extends AbstractController
|
class CustomFieldController extends AbstractController
|
||||||
{
|
{
|
||||||
public function __construct(private readonly TranslatorInterface $translator) {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new CustomField entity.
|
* Creates a new CustomField entity.
|
||||||
*
|
*
|
||||||
@@ -43,13 +40,13 @@ class CustomFieldController extends AbstractController
|
|||||||
$em->persist($entity);
|
$em->persist($entity);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->translator
|
$this->addFlash('success', $this->get('translator')
|
||||||
->trans('The custom field has been created'));
|
->trans('The custom field has been created'));
|
||||||
|
|
||||||
return $this->redirectToRoute('customfieldsgroup_show', ['id' => $entity->getCustomFieldsGroup()->getId()]);
|
return $this->redirectToRoute('customfieldsgroup_show', ['id' => $entity->getCustomFieldsGroup()->getId()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->addFlash('error', $this->translator
|
$this->addFlash('error', $this->get('translator')
|
||||||
->trans('The custom field form contains errors'));
|
->trans('The custom field form contains errors'));
|
||||||
|
|
||||||
return $this->render('@ChillCustomFields/CustomField/new.html.twig', [
|
return $this->render('@ChillCustomFields/CustomField/new.html.twig', [
|
||||||
@@ -133,13 +130,13 @@ class CustomFieldController extends AbstractController
|
|||||||
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->translator
|
$this->addFlash('success', $this->get('translator')
|
||||||
->trans('The custom field has been updated'));
|
->trans('The custom field has been updated'));
|
||||||
|
|
||||||
return $this->redirectToRoute('customfield_edit', ['id' => $id]);
|
return $this->redirectToRoute('customfield_edit', ['id' => $id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->addFlash('error', $this->translator
|
$this->addFlash('error', $this->get('translator')
|
||||||
->trans('The custom field form contains errors'));
|
->trans('The custom field form contains errors'));
|
||||||
|
|
||||||
return $this->render('@ChillCustomFields/CustomField/edit.html.twig', [
|
return $this->render('@ChillCustomFields/CustomField/edit.html.twig', [
|
||||||
|
@@ -118,7 +118,7 @@ class EventController extends AbstractController
|
|||||||
|
|
||||||
$this->addFlash(
|
$this->addFlash(
|
||||||
'success',
|
'success',
|
||||||
$this->translator
|
$this->get('translator')
|
||||||
->trans('The event has been sucessfully removed')
|
->trans('The event has been sucessfully removed')
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -249,7 +249,7 @@ class EventController extends AbstractController
|
|||||||
$em->persist($entity);
|
$em->persist($entity);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->translator
|
$this->addFlash('success', $this->get('translator')
|
||||||
->trans('The event was created'));
|
->trans('The event was created'));
|
||||||
|
|
||||||
return $this->redirectToRoute('chill_event__event_show', ['event_id' => $entity->getId()]);
|
return $this->redirectToRoute('chill_event__event_show', ['event_id' => $entity->getId()]);
|
||||||
@@ -364,7 +364,7 @@ class EventController extends AbstractController
|
|||||||
if ($editForm->isValid()) {
|
if ($editForm->isValid()) {
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->translator
|
$this->addFlash('success', $this->get('translator')
|
||||||
->trans('The event was updated'));
|
->trans('The event was updated'));
|
||||||
|
|
||||||
return $this->redirectToRoute('chill_event__event_edit', ['event_id' => $event_id]);
|
return $this->redirectToRoute('chill_event__event_edit', ['event_id' => $event_id]);
|
||||||
|
@@ -23,7 +23,6 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ParticipationController.
|
* Class ParticipationController.
|
||||||
@@ -33,7 +32,7 @@ class ParticipationController extends AbstractController
|
|||||||
/**
|
/**
|
||||||
* ParticipationController constructor.
|
* ParticipationController constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator) {}
|
public function __construct(private readonly LoggerInterface $logger) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/create", name="chill_event_participation_create")
|
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/create", name="chill_event_participation_create")
|
||||||
@@ -178,7 +177,7 @@ class ParticipationController extends AbstractController
|
|||||||
|
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->translator->trans(
|
$this->addFlash('success', $this->get('translator')->trans(
|
||||||
'The participations were created'
|
'The participations were created'
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -212,7 +211,7 @@ class ParticipationController extends AbstractController
|
|||||||
$em->persist($participation);
|
$em->persist($participation);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->translator->trans(
|
$this->addFlash('success', $this->get('translator')->trans(
|
||||||
'The participation was created'
|
'The participation was created'
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -261,7 +260,7 @@ class ParticipationController extends AbstractController
|
|||||||
|
|
||||||
$this->addFlash(
|
$this->addFlash(
|
||||||
'success',
|
'success',
|
||||||
$this->translator
|
$this->get('translator')
|
||||||
->trans('The participation has been sucessfully removed')
|
->trans('The participation has been sucessfully removed')
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -341,7 +340,7 @@ class ParticipationController extends AbstractController
|
|||||||
switch ($event->getParticipations()->count()) {
|
switch ($event->getParticipations()->count()) {
|
||||||
case 0:
|
case 0:
|
||||||
// if there aren't any participation, redirect to the 'show' view with an add flash
|
// if there aren't any participation, redirect to the 'show' view with an add flash
|
||||||
$this->addFlash('warning', $this->translator
|
$this->addFlash('warning', $this->get('translator')
|
||||||
->trans('There are no participation to edit for this event'));
|
->trans('There are no participation to edit for this event'));
|
||||||
|
|
||||||
return $this->redirectToRoute(
|
return $this->redirectToRoute(
|
||||||
@@ -435,7 +434,7 @@ class ParticipationController extends AbstractController
|
|||||||
|
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->translator->trans(
|
$this->addFlash('success', $this->get('translator')->trans(
|
||||||
'The participation was updated'
|
'The participation was updated'
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -481,7 +480,7 @@ class ParticipationController extends AbstractController
|
|||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$this->getDoctrine()->getManager()->flush();
|
$this->getDoctrine()->getManager()->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->translator->trans('The participations '
|
$this->addFlash('success', $this->get('translator')->trans('The participations '
|
||||||
.'have been successfully updated.'));
|
.'have been successfully updated.'));
|
||||||
|
|
||||||
return $this->redirectToRoute(
|
return $this->redirectToRoute(
|
||||||
@@ -653,7 +652,7 @@ class ParticipationController extends AbstractController
|
|||||||
|
|
||||||
if ([] === $newParticipations) {
|
if ([] === $newParticipations) {
|
||||||
// if we do not have nay participants, redirect to event view
|
// if we do not have nay participants, redirect to event view
|
||||||
$this->addFlash('error', $this->translator->trans(
|
$this->addFlash('error', $this->get('translator')->trans(
|
||||||
'None of the requested people may participate '
|
'None of the requested people may participate '
|
||||||
.'the event: they are maybe already participating.'
|
.'the event: they are maybe already participating.'
|
||||||
));
|
));
|
||||||
|
@@ -32,6 +32,7 @@ use Chill\MainBundle\Security\Resolver\ScopeResolverInterface;
|
|||||||
use Chill\MainBundle\Service\EntityInfo\ViewEntityInfoProviderInterface;
|
use Chill\MainBundle\Service\EntityInfo\ViewEntityInfoProviderInterface;
|
||||||
use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
|
use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
|
||||||
use Chill\MainBundle\Templating\UI\NotificationCounterInterface;
|
use Chill\MainBundle\Templating\UI\NotificationCounterInterface;
|
||||||
|
use Chill\MainBundle\Widget\WidgetHandlerInterface;
|
||||||
use Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface;
|
use Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||||
@@ -62,9 +63,10 @@ class ChillMainBundle extends Bundle
|
|||||||
->addTag('chill_main.workflow_handler');
|
->addTag('chill_main.workflow_handler');
|
||||||
$container->registerForAutoconfiguration(CronJobInterface::class)
|
$container->registerForAutoconfiguration(CronJobInterface::class)
|
||||||
->addTag('chill_main.cron_job');
|
->addTag('chill_main.cron_job');
|
||||||
|
$container->registerForAutoconfiguration(WidgetHandlerInterface::class)
|
||||||
|
->addTag('chill_main.widget_handler');
|
||||||
$container->registerForAutoconfiguration(ViewEntityInfoProviderInterface::class)
|
$container->registerForAutoconfiguration(ViewEntityInfoProviderInterface::class)
|
||||||
->addTag('chill_main.entity_info_provider');
|
->addTag('chill_main.entity_info_provider');
|
||||||
|
|
||||||
$container->addCompilerPass(new SearchableServicesCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
|
$container->addCompilerPass(new SearchableServicesCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
|
||||||
$container->addCompilerPass(new ConfigConsistencyCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
|
$container->addCompilerPass(new ConfigConsistencyCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
|
||||||
$container->addCompilerPass(new TimelineCompilerClass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
|
$container->addCompilerPass(new TimelineCompilerClass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
|
||||||
|
@@ -0,0 +1,133 @@
|
|||||||
|
<?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\Entity\User;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
|
use Chill\MainBundle\Repository\UserRepository;
|
||||||
|
use Chill\MainBundle\Serializer\Model\Collection;
|
||||||
|
use Chill\MainBundle\Widget\WidgetHandlerManager;
|
||||||
|
use Chill\PersonBundle\Repository\AccompanyingPeriodRepository;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||||
|
use Symfony\Component\Security\Core\Security;
|
||||||
|
use PHPUnit\Util\Json;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||||
|
use Symfony\Component\Serializer\Serializer;
|
||||||
|
use Symfony\Component\Serializer\SerializerInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route("/{_locale}/dashboard")
|
||||||
|
*/
|
||||||
|
class DashboardHomepageController extends AbstractController{
|
||||||
|
|
||||||
|
private WidgetHandlerManager $widgetHandlerManager;
|
||||||
|
|
||||||
|
private Security $security;
|
||||||
|
|
||||||
|
private UserRepository $userRepository;
|
||||||
|
|
||||||
|
private EntityManagerInterface $em;
|
||||||
|
|
||||||
|
private LoggerInterface $logger;
|
||||||
|
|
||||||
|
private SerializerInterface $serializer;
|
||||||
|
|
||||||
|
private PaginatorFactory $paginatorFactory;
|
||||||
|
public function __construct(
|
||||||
|
//AccompanyingPeriodRepository $accompanyingPeriodRepository,
|
||||||
|
WidgetHandlerManager $widgetHandlerManager,
|
||||||
|
Security $security,
|
||||||
|
UserRepository $userRepository,
|
||||||
|
EntityManagerInterface $em,
|
||||||
|
LoggerInterface $logger,
|
||||||
|
SerializerInterface $serializer,
|
||||||
|
PaginatorFactory $paginatorFactory,
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//$this->accompanyingPeriodRepository = $accompanyingPeriodRepository;
|
||||||
|
$this->widgetHandlerManager = $widgetHandlerManager;
|
||||||
|
$this->security = $security;
|
||||||
|
$this->userRepository = $userRepository;
|
||||||
|
$this->em = $em;
|
||||||
|
$this->logger = $logger;
|
||||||
|
$this->serializer = $serializer;
|
||||||
|
$this->paginatorFactory = $paginatorFactory;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route("/raw_data", name="chill_main_widget_raw_data")
|
||||||
|
* @return JsonResponse
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function index(): JsonResponse
|
||||||
|
{
|
||||||
|
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
|
||||||
|
|
||||||
|
if (!$this->security->getUser() instanceof User) {
|
||||||
|
throw new AccessDeniedHttpException('You must be authenticated and a user to see the dashboard');
|
||||||
|
}
|
||||||
|
// --------------Bar---------------------
|
||||||
|
$config = [
|
||||||
|
'alias' => 'bar',
|
||||||
|
];
|
||||||
|
|
||||||
|
$context = [
|
||||||
|
//'user' => $this->security->getUser(),
|
||||||
|
//Hardcoder pour resultat
|
||||||
|
'user' => 19,
|
||||||
|
'what' => 'accompanying_period_by_month',
|
||||||
|
];
|
||||||
|
// --------------Number------------------
|
||||||
|
/*$config = [
|
||||||
|
'alias' => 'number',
|
||||||
|
];
|
||||||
|
|
||||||
|
$context = [
|
||||||
|
'user' => $this->security->getUser(),
|
||||||
|
//'what' => 'notification_unread',
|
||||||
|
'what' => 'notification_sender',
|
||||||
|
];*/
|
||||||
|
$data = $this->widgetHandlerManager->getDataForWidget($config, $context);
|
||||||
|
|
||||||
|
return new JsonResponse($data,Response::HTTP_OK,[]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route("/widget/{context}", name="chill_main_widget_get_data")
|
||||||
|
*/
|
||||||
|
public function getDataForWidget(Request $request, string $context): JsonResponse
|
||||||
|
{
|
||||||
|
//Retrieve data from request in vue component
|
||||||
|
$requestData = json_decode($request->getContent(), true);
|
||||||
|
dump($requestData);
|
||||||
|
// Process the widget data using the WidgetHandlerManager
|
||||||
|
//$handler = $this->widgetHandlerManager->getHandler($requestData);
|
||||||
|
//dump($handler);
|
||||||
|
|
||||||
|
// Return the widget data in JSON response
|
||||||
|
//return new JsonResponse($this->getData($requestData));
|
||||||
|
|
||||||
|
return new JsonResponse($requestData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@@ -27,7 +27,6 @@ use Chill\MainBundle\Security\Authorization\SavedExportVoter;
|
|||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
use Symfony\Component\Form\FormFactoryInterface;
|
use Symfony\Component\Form\FormFactoryInterface;
|
||||||
@@ -47,8 +46,6 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
*/
|
*/
|
||||||
class ExportController extends AbstractController
|
class ExportController extends AbstractController
|
||||||
{
|
{
|
||||||
private readonly bool $filterStatsByCenters;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly ChillRedis $redis,
|
private readonly ChillRedis $redis,
|
||||||
private readonly ExportManager $exportManager,
|
private readonly ExportManager $exportManager,
|
||||||
@@ -59,11 +56,8 @@ class ExportController extends AbstractController
|
|||||||
private readonly EntityManagerInterface $entityManager,
|
private readonly EntityManagerInterface $entityManager,
|
||||||
private readonly ExportFormHelper $exportFormHelper,
|
private readonly ExportFormHelper $exportFormHelper,
|
||||||
private readonly SavedExportRepositoryInterface $savedExportRepository,
|
private readonly SavedExportRepositoryInterface $savedExportRepository,
|
||||||
private readonly Security $security,
|
private readonly Security $security
|
||||||
ParameterBagInterface $parameterBag,
|
) {}
|
||||||
) {
|
|
||||||
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/download/{alias}", name="chill_main_export_download", methods={"GET"})
|
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/download/{alias}", name="chill_main_export_download", methods={"GET"})
|
||||||
@@ -281,7 +275,7 @@ class ExportController extends AbstractController
|
|||||||
$options = match ($step) {
|
$options = match ($step) {
|
||||||
'export', 'generate_export' => [
|
'export', 'generate_export' => [
|
||||||
'export_alias' => $alias,
|
'export_alias' => $alias,
|
||||||
'picked_centers' => $exportManager->getPickedCenters($data['centers'] ?? []),
|
'picked_centers' => $exportManager->getPickedCenters($data['centers']),
|
||||||
],
|
],
|
||||||
'formatter', 'generate_formatter' => [
|
'formatter', 'generate_formatter' => [
|
||||||
'export_alias' => $alias,
|
'export_alias' => $alias,
|
||||||
@@ -304,7 +298,7 @@ class ExportController extends AbstractController
|
|||||||
FormType::class,
|
FormType::class,
|
||||||
$defaultFormData,
|
$defaultFormData,
|
||||||
[
|
[
|
||||||
'method' => $isGenerate ? Request::METHOD_GET : Request::METHOD_POST,
|
'method' => $isGenerate ? 'GET' : 'POST',
|
||||||
'csrf_protection' => !$isGenerate,
|
'csrf_protection' => !$isGenerate,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
@@ -339,9 +333,9 @@ class ExportController extends AbstractController
|
|||||||
$exportManager = $this->exportManager;
|
$exportManager = $this->exportManager;
|
||||||
|
|
||||||
// check we have data from the previous step (export step)
|
// check we have data from the previous step (export step)
|
||||||
$data = $this->session->get('centers_step', []);
|
$data = $this->session->get('centers_step', null);
|
||||||
|
|
||||||
if (null === $data && true === $this->filterStatsByCenters) {
|
if (null === $data) {
|
||||||
return $this->redirectToRoute('chill_main_export_new', [
|
return $this->redirectToRoute('chill_main_export_new', [
|
||||||
'step' => $this->getNextStep('export', $export, true),
|
'step' => $this->getNextStep('export', $export, true),
|
||||||
'alias' => $alias,
|
'alias' => $alias,
|
||||||
@@ -352,7 +346,7 @@ class ExportController extends AbstractController
|
|||||||
|
|
||||||
$form = $this->createCreateFormExport($alias, 'export', $data, $savedExport);
|
$form = $this->createCreateFormExport($alias, 'export', $data, $savedExport);
|
||||||
|
|
||||||
if (Request::METHOD_POST === $request->getMethod()) {
|
if ('POST' === $request->getMethod()) {
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
if ($form->isValid()) {
|
if ($form->isValid()) {
|
||||||
@@ -406,7 +400,7 @@ class ExportController extends AbstractController
|
|||||||
|
|
||||||
$form = $this->createCreateFormExport($alias, 'formatter', $data, $savedExport);
|
$form = $this->createCreateFormExport($alias, 'formatter', $data, $savedExport);
|
||||||
|
|
||||||
if (Request::METHOD_POST === $request->getMethod()) {
|
if ('POST' === $request->getMethod()) {
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
if ($form->isValid()) {
|
if ($form->isValid()) {
|
||||||
@@ -490,13 +484,9 @@ class ExportController extends AbstractController
|
|||||||
|
|
||||||
$alias = $rawData['alias'];
|
$alias = $rawData['alias'];
|
||||||
|
|
||||||
if ($this->filterStatsByCenters) {
|
$formCenters = $this->createCreateFormExport($alias, 'generate_centers', [], $savedExport);
|
||||||
$formCenters = $this->createCreateFormExport($alias, 'generate_centers', [], $savedExport);
|
$formCenters->submit($rawData['centers']);
|
||||||
$formCenters->submit($rawData['centers']);
|
$dataCenters = $formCenters->getData();
|
||||||
$dataCenters = $formCenters->getData();
|
|
||||||
} else {
|
|
||||||
$dataCenters = ['centers' => []];
|
|
||||||
}
|
|
||||||
|
|
||||||
$formExport = $this->createCreateFormExport($alias, 'generate_export', $dataCenters, $savedExport);
|
$formExport = $this->createCreateFormExport($alias, 'generate_export', $dataCenters, $savedExport);
|
||||||
$formExport->submit($rawData['export']);
|
$formExport->submit($rawData['export']);
|
||||||
@@ -523,20 +513,12 @@ class ExportController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
private function selectCentersStep(Request $request, DirectExportInterface|ExportInterface $export, $alias, SavedExport $savedExport = null)
|
private function selectCentersStep(Request $request, DirectExportInterface|ExportInterface $export, $alias, SavedExport $savedExport = null)
|
||||||
{
|
{
|
||||||
if (!$this->filterStatsByCenters) {
|
|
||||||
return $this->redirectToRoute('chill_main_export_new', [
|
|
||||||
'step' => $this->getNextStep('centers', $export),
|
|
||||||
'alias' => $alias,
|
|
||||||
'from_saved' => $request->get('from_saved', ''),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @var \Chill\MainBundle\Export\ExportManager $exportManager */
|
/** @var \Chill\MainBundle\Export\ExportManager $exportManager */
|
||||||
$exportManager = $this->exportManager;
|
$exportManager = $this->exportManager;
|
||||||
|
|
||||||
$form = $this->createCreateFormExport($alias, 'centers', [], $savedExport);
|
$form = $this->createCreateFormExport($alias, 'centers', [], $savedExport);
|
||||||
|
|
||||||
if (Request::METHOD_POST === $request->getMethod()) {
|
if ('POST' === $request->getMethod()) {
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
if ($form->isValid()) {
|
if ($form->isValid()) {
|
||||||
|
@@ -9,11 +9,10 @@ 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\PersonBundle\Export\Enum;
|
namespace Chill\MainBundle\Controller;
|
||||||
|
|
||||||
enum DateGroupingChoiceEnum: string
|
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||||
|
|
||||||
|
class SavedExportApiController extends ApiController
|
||||||
{
|
{
|
||||||
case MONTH = 'YYYY-MM';
|
|
||||||
case WEEK = 'YYYY-IW';
|
|
||||||
case YEAR = 'YYYY';
|
|
||||||
}
|
}
|
@@ -32,13 +32,12 @@ use Symfony\Component\HttpFoundation\Response;
|
|||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
|
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
class UserController extends CRUDController
|
class UserController extends CRUDController
|
||||||
{
|
{
|
||||||
final public const FORM_GROUP_CENTER_COMPOSED = 'composed_groupcenter';
|
final public const FORM_GROUP_CENTER_COMPOSED = 'composed_groupcenter';
|
||||||
|
|
||||||
public function __construct(private readonly LoggerInterface $logger, private readonly ValidatorInterface $validator, private readonly UserPasswordEncoderInterface $passwordEncoder, private readonly UserRepository $userRepository, protected ParameterBagInterface $parameterBag, private readonly TranslatorInterface $translator) {}
|
public function __construct(private readonly LoggerInterface $logger, private readonly ValidatorInterface $validator, private readonly UserPasswordEncoderInterface $passwordEncoder, private readonly UserRepository $userRepository, protected ParameterBagInterface $parameterBag) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{_locale}/admin/main/user/{uid}/add_link_groupcenter",
|
* @Route("/{_locale}/admin/main/user/{uid}/add_link_groupcenter",
|
||||||
@@ -66,7 +65,7 @@ class UserController extends CRUDController
|
|||||||
if (0 === $this->validator->validate($user)->count()) {
|
if (0 === $this->validator->validate($user)->count()) {
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->translator->trans('The '
|
$this->addFlash('success', $this->get('translator')->trans('The '
|
||||||
.'permissions have been successfully added to the user'));
|
.'permissions have been successfully added to the user'));
|
||||||
|
|
||||||
$returnPathParams = $request->query->has('returnPath') ?
|
$returnPathParams = $request->query->has('returnPath') ?
|
||||||
@@ -116,14 +115,14 @@ class UserController extends CRUDController
|
|||||||
try {
|
try {
|
||||||
$user->removeGroupCenter($groupCenter);
|
$user->removeGroupCenter($groupCenter);
|
||||||
} catch (\RuntimeException $ex) {
|
} catch (\RuntimeException $ex) {
|
||||||
$this->addFlash('error', $this->translator->trans($ex->getMessage()));
|
$this->addFlash('error', $this->get('translator')->trans($ex->getMessage()));
|
||||||
|
|
||||||
return $this->redirectToRoute('chill_crud_admin_user_edit', ['id' => $uid]);
|
return $this->redirectToRoute('chill_crud_admin_user_edit', ['id' => $uid]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->translator
|
$this->addFlash('success', $this->get('translator')
|
||||||
->trans('The permissions where removed.'));
|
->trans('The permissions where removed.'));
|
||||||
|
|
||||||
return $this->redirectToRoute('chill_crud_admin_user_edit', ['id' => $uid]);
|
return $this->redirectToRoute('chill_crud_admin_user_edit', ['id' => $uid]);
|
||||||
@@ -208,7 +207,7 @@ class UserController extends CRUDController
|
|||||||
$user->setCurrentLocation($currentLocation);
|
$user->setCurrentLocation($currentLocation);
|
||||||
|
|
||||||
$this->getDoctrine()->getManager()->flush();
|
$this->getDoctrine()->getManager()->flush();
|
||||||
$this->addFlash('success', $this->translator->trans('Current location successfully updated'));
|
$this->addFlash('success', $this->get('translator')->trans('Current location successfully updated'));
|
||||||
|
|
||||||
return $this->redirect(
|
return $this->redirect(
|
||||||
$request->query->has('returnPath') ? $request->query->get('returnPath') :
|
$request->query->has('returnPath') ? $request->query->get('returnPath') :
|
||||||
@@ -244,7 +243,7 @@ class UserController extends CRUDController
|
|||||||
$user->setPassword($this->passwordEncoder->encodePassword($user, $password));
|
$user->setPassword($this->passwordEncoder->encodePassword($user, $password));
|
||||||
|
|
||||||
$this->getDoctrine()->getManager()->flush();
|
$this->getDoctrine()->getManager()->flush();
|
||||||
$this->addFlash('success', $this->translator->trans('Password successfully updated!'));
|
$this->addFlash('success', $this->get('translator')->trans('Password successfully updated!'));
|
||||||
|
|
||||||
return $this->redirect(
|
return $this->redirect(
|
||||||
$request->query->has('returnPath') ? $request->query->get('returnPath') :
|
$request->query->has('returnPath') ? $request->query->get('returnPath') :
|
||||||
|
@@ -20,6 +20,7 @@ use Chill\MainBundle\Controller\LanguageController;
|
|||||||
use Chill\MainBundle\Controller\LocationController;
|
use Chill\MainBundle\Controller\LocationController;
|
||||||
use Chill\MainBundle\Controller\LocationTypeController;
|
use Chill\MainBundle\Controller\LocationTypeController;
|
||||||
use Chill\MainBundle\Controller\RegroupmentController;
|
use Chill\MainBundle\Controller\RegroupmentController;
|
||||||
|
use Chill\MainBundle\Controller\SavedExportApiController;
|
||||||
use Chill\MainBundle\Controller\UserController;
|
use Chill\MainBundle\Controller\UserController;
|
||||||
use Chill\MainBundle\Controller\UserJobApiController;
|
use Chill\MainBundle\Controller\UserJobApiController;
|
||||||
use Chill\MainBundle\Controller\UserJobController;
|
use Chill\MainBundle\Controller\UserJobController;
|
||||||
@@ -54,6 +55,7 @@ use Chill\MainBundle\Entity\Language;
|
|||||||
use Chill\MainBundle\Entity\Location;
|
use Chill\MainBundle\Entity\Location;
|
||||||
use Chill\MainBundle\Entity\LocationType;
|
use Chill\MainBundle\Entity\LocationType;
|
||||||
use Chill\MainBundle\Entity\Regroupment;
|
use Chill\MainBundle\Entity\Regroupment;
|
||||||
|
use Chill\MainBundle\Entity\SavedExport;
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\MainBundle\Entity\UserJob;
|
use Chill\MainBundle\Entity\UserJob;
|
||||||
use Chill\MainBundle\Form\CenterType;
|
use Chill\MainBundle\Form\CenterType;
|
||||||
@@ -228,7 +230,7 @@ class ChillMainExtension extends Extension implements
|
|||||||
$twigConfig = [
|
$twigConfig = [
|
||||||
'globals' => [
|
'globals' => [
|
||||||
'installation' => [
|
'installation' => [
|
||||||
'name' => $config['installation_name'], ],
|
'name' => $config['installation_name'],],
|
||||||
'available_languages' => $config['available_languages'],
|
'available_languages' => $config['available_languages'],
|
||||||
'add_address' => $config['add_address'],
|
'add_address' => $config['add_address'],
|
||||||
],
|
],
|
||||||
@@ -327,9 +329,9 @@ class ChillMainExtension extends Extension implements
|
|||||||
* Load parameter for configuration and set parameters for api.
|
* Load parameter for configuration and set parameters for api.
|
||||||
*/
|
*/
|
||||||
protected function configureCruds(
|
protected function configureCruds(
|
||||||
ContainerBuilder $container,
|
ContainerBuilder $container,
|
||||||
array $crudConfig,
|
array $crudConfig,
|
||||||
array $apiConfig,
|
array $apiConfig,
|
||||||
Loader\YamlFileLoader $loader
|
Loader\YamlFileLoader $loader
|
||||||
): void {
|
): void {
|
||||||
if (0 === \count($crudConfig)) {
|
if (0 === \count($crudConfig)) {
|
||||||
@@ -767,7 +769,28 @@ class ChillMainExtension extends Extension implements
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
[
|
||||||
|
'class' => SavedExport::class,
|
||||||
|
'controller' => SavedExportApiController::class,
|
||||||
|
'name' => 'saved_export',
|
||||||
|
'base_path' => '/api/1.0/main/saved-export',
|
||||||
|
'base_role' => 'ROLE_USER',
|
||||||
|
'actions' => [
|
||||||
|
'_index' => [
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'_entity' => [
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]
|
||||||
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -116,12 +116,8 @@ class Configuration implements ConfigurationInterface
|
|||||||
->booleanNode('form_show_centers')
|
->booleanNode('form_show_centers')
|
||||||
->defaultTrue()
|
->defaultTrue()
|
||||||
->end()
|
->end()
|
||||||
->booleanNode('filter_stats_by_center')
|
|
||||||
->defaultTrue()
|
|
||||||
->info("if set to false, the exports won't take into account the center of the people")
|
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end() // end of 'acl'
|
|
||||||
->booleanNode('access_global_history')
|
->booleanNode('access_global_history')
|
||||||
->defaultTrue()
|
->defaultTrue()
|
||||||
->end()
|
->end()
|
||||||
|
@@ -19,6 +19,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
use Ramsey\Uuid\Uuid;
|
use Ramsey\Uuid\Uuid;
|
||||||
use Ramsey\Uuid\UuidInterface;
|
use Ramsey\Uuid\UuidInterface;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
use Symfony\Component\Serializer\Annotation\Groups;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
@@ -35,6 +36,7 @@ class SavedExport implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||||
*
|
*
|
||||||
* @Assert\NotBlank
|
* @Assert\NotBlank
|
||||||
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private string $description = '';
|
private string $description = '';
|
||||||
|
|
||||||
@@ -49,11 +51,13 @@ class SavedExport implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
* @ORM\Column(name="id", type="uuid", unique="true")
|
* @ORM\Column(name="id", type="uuid", unique="true")
|
||||||
*
|
*
|
||||||
* @ORM\GeneratedValue(strategy="NONE")
|
* @ORM\GeneratedValue(strategy="NONE")
|
||||||
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private UuidInterface $id;
|
private UuidInterface $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="json", nullable=false, options={"default": "[]"})
|
* @ORM\Column(type="json", nullable=false, options={"default": "[]"})
|
||||||
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private array $options = [];
|
private array $options = [];
|
||||||
|
|
||||||
@@ -61,11 +65,13 @@ class SavedExport implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||||
*
|
*
|
||||||
* @Assert\NotBlank
|
* @Assert\NotBlank
|
||||||
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private string $title = '';
|
private string $title = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=User::class)
|
* @ORM\ManyToOne(targetEntity=User::class)
|
||||||
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private User $user;
|
private User $user;
|
||||||
|
|
||||||
|
@@ -11,7 +11,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\MainBundle\Export;
|
namespace Chill\MainBundle\Export;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\User;
|
|
||||||
use Chill\MainBundle\Form\Type\Export\ExportType;
|
use Chill\MainBundle\Form\Type\Export\ExportType;
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
@@ -55,17 +54,20 @@ class ExportManager
|
|||||||
*/
|
*/
|
||||||
private array $formatters = [];
|
private array $formatters = [];
|
||||||
|
|
||||||
|
private readonly string|\Stringable|\Symfony\Component\Security\Core\User\UserInterface $user;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly LoggerInterface $logger,
|
private readonly LoggerInterface $logger,
|
||||||
private readonly AuthorizationCheckerInterface $authorizationChecker,
|
private readonly AuthorizationCheckerInterface $authorizationChecker,
|
||||||
private readonly AuthorizationHelperInterface $authorizationHelper,
|
private readonly AuthorizationHelperInterface $authorizationHelper,
|
||||||
private readonly TokenStorageInterface $tokenStorage,
|
TokenStorageInterface $tokenStorage,
|
||||||
iterable $exports,
|
iterable $exports,
|
||||||
iterable $aggregators,
|
iterable $aggregators,
|
||||||
iterable $filters
|
iterable $filters
|
||||||
// iterable $formatters,
|
// iterable $formatters,
|
||||||
// iterable $exportElementProvider
|
// iterable $exportElementProvider
|
||||||
) {
|
) {
|
||||||
|
$this->user = $tokenStorage->getToken()->getUser();
|
||||||
$this->exports = iterator_to_array($exports);
|
$this->exports = iterator_to_array($exports);
|
||||||
$this->aggregators = iterator_to_array($aggregators);
|
$this->aggregators = iterator_to_array($aggregators);
|
||||||
$this->filters = iterator_to_array($filters);
|
$this->filters = iterator_to_array($filters);
|
||||||
@@ -89,24 +91,20 @@ class ExportManager
|
|||||||
*
|
*
|
||||||
* @return FilterInterface[] a \Generator that contains filters. The key is the filter's alias
|
* @return FilterInterface[] a \Generator that contains filters. The key is the filter's alias
|
||||||
*/
|
*/
|
||||||
public function getFiltersApplyingOn(DirectExportInterface|ExportInterface $export, array $centers = null): array
|
public function &getFiltersApplyingOn(DirectExportInterface|ExportInterface $export, array $centers = null): iterable
|
||||||
{
|
{
|
||||||
if ($export instanceof DirectExportInterface) {
|
if ($export instanceof DirectExportInterface) {
|
||||||
return [];
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$filters = [];
|
|
||||||
|
|
||||||
foreach ($this->filters as $alias => $filter) {
|
foreach ($this->filters as $alias => $filter) {
|
||||||
if (
|
if (
|
||||||
\in_array($filter->applyOn(), $export->supportsModifiers(), true)
|
\in_array($filter->applyOn(), $export->supportsModifiers(), true)
|
||||||
&& $this->isGrantedForElement($filter, $export, $centers)
|
&& $this->isGrantedForElement($filter, $export, $centers)
|
||||||
) {
|
) {
|
||||||
$filters[$alias] = $filter;
|
yield $alias => $filter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $filters;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,26 +112,22 @@ class ExportManager
|
|||||||
*
|
*
|
||||||
* @internal This class check the interface implemented by export, and, if ´ListInterface´ is used, return an empty array
|
* @internal This class check the interface implemented by export, and, if ´ListInterface´ is used, return an empty array
|
||||||
*
|
*
|
||||||
* @return array<string, AggregatorInterface> an array that contains aggregators. The key is the filter's alias
|
* @return iterable<string, AggregatorInterface>|null a \Generator that contains aggretagors. The key is the filter's alias
|
||||||
*/
|
*/
|
||||||
public function getAggregatorsApplyingOn(DirectExportInterface|ExportInterface $export, array $centers = null): array
|
public function &getAggregatorsApplyingOn(DirectExportInterface|ExportInterface $export, array $centers = null): ?iterable
|
||||||
{
|
{
|
||||||
if ($export instanceof ListInterface || $export instanceof DirectExportInterface) {
|
if ($export instanceof ListInterface || $export instanceof DirectExportInterface) {
|
||||||
return [];
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$aggregators = [];
|
|
||||||
|
|
||||||
foreach ($this->aggregators as $alias => $aggregator) {
|
foreach ($this->aggregators as $alias => $aggregator) {
|
||||||
if (
|
if (
|
||||||
\in_array($aggregator->applyOn(), $export->supportsModifiers(), true)
|
\in_array($aggregator->applyOn(), $export->supportsModifiers(), true)
|
||||||
&& $this->isGrantedForElement($aggregator, $export, $centers)
|
&& $this->isGrantedForElement($aggregator, $export, $centers)
|
||||||
) {
|
) {
|
||||||
$aggregators[$alias] = $aggregator;
|
yield $alias => $aggregator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $aggregators;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addExportElementsProvider(ExportElementsProviderInterface $provider, string $prefix): void
|
public function addExportElementsProvider(ExportElementsProviderInterface $provider, string $prefix): void
|
||||||
@@ -353,17 +347,6 @@ class ExportManager
|
|||||||
return $this->filters[$alias];
|
return $this->filters[$alias];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAllFilters(): array
|
|
||||||
{
|
|
||||||
$filters = [];
|
|
||||||
|
|
||||||
foreach ($this->filters as $alias => $filter) {
|
|
||||||
$filters[$alias] = $filter;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $filters;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get all filters.
|
* get all filters.
|
||||||
*
|
*
|
||||||
@@ -469,7 +452,7 @@ class ExportManager
|
|||||||
if (null === $centers || [] === $centers) {
|
if (null === $centers || [] === $centers) {
|
||||||
// we want to try if at least one center is reachable
|
// we want to try if at least one center is reachable
|
||||||
return [] !== $this->authorizationHelper->getReachableCenters(
|
return [] !== $this->authorizationHelper->getReachableCenters(
|
||||||
$this->tokenStorage->getToken()->getUser(),
|
$this->user,
|
||||||
$role
|
$role
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -501,17 +484,11 @@ class ExportManager
|
|||||||
{
|
{
|
||||||
$r = [];
|
$r = [];
|
||||||
|
|
||||||
$user = $this->tokenStorage->getToken()->getUser();
|
|
||||||
|
|
||||||
if (!$user instanceof User) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($centers as $center) {
|
foreach ($centers as $center) {
|
||||||
$r[] = [
|
$r[] = [
|
||||||
'center' => $center,
|
'center' => $center,
|
||||||
'circles' => $this->authorizationHelper->getReachableScopes(
|
'circles' => $this->authorizationHelper->getReachableScopes(
|
||||||
$user,
|
$this->user,
|
||||||
$element->requiredRole(),
|
$element->requiredRole(),
|
||||||
$center
|
$center
|
||||||
),
|
),
|
||||||
|
@@ -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\MainBundle\Export;
|
|
||||||
|
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
final readonly class SortExportElement
|
|
||||||
{
|
|
||||||
public function __construct(
|
|
||||||
private TranslatorInterface $translator,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array<int|string, FilterInterface> $elements
|
|
||||||
*/
|
|
||||||
public function sortFilters(array &$elements): void
|
|
||||||
{
|
|
||||||
uasort($elements, fn (FilterInterface $a, FilterInterface $b) => $this->translator->trans($a->getTitle()) <=> $this->translator->trans($b->getTitle()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array<int|string, AggregatorInterface> $elements
|
|
||||||
*/
|
|
||||||
public function sortAggregators(array &$elements): void
|
|
||||||
{
|
|
||||||
uasort($elements, fn (AggregatorInterface $a, AggregatorInterface $b) => $this->translator->trans($a->getTitle()) <=> $this->translator->trans($b->getTitle()));
|
|
||||||
}
|
|
||||||
}
|
|
@@ -37,13 +37,9 @@ class RollingDateDataMapper implements DataMapperInterface
|
|||||||
{
|
{
|
||||||
$forms = iterator_to_array($forms);
|
$forms = iterator_to_array($forms);
|
||||||
|
|
||||||
if (null === $forms['roll']->getData()) {
|
$viewData = new RollingDate(
|
||||||
$viewData = null;
|
$forms['roll']->getData() ?? RollingDate::T_TODAY,
|
||||||
} else {
|
$forms['fixedDate']->getData()
|
||||||
$viewData = new RollingDate(
|
);
|
||||||
$forms['roll']->getData(),
|
|
||||||
$forms['fixedDate']->getData()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,6 @@ declare(strict_types=1);
|
|||||||
namespace Chill\MainBundle\Form\Type\Export;
|
namespace Chill\MainBundle\Form\Type\Export;
|
||||||
|
|
||||||
use Chill\MainBundle\Export\ExportManager;
|
use Chill\MainBundle\Export\ExportManager;
|
||||||
use Chill\MainBundle\Export\SortExportElement;
|
|
||||||
use Chill\MainBundle\Validator\Constraints\Export\ExportElementConstraint;
|
use Chill\MainBundle\Validator\Constraints\Export\ExportElementConstraint;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
||||||
@@ -29,7 +28,15 @@ class ExportType extends AbstractType
|
|||||||
|
|
||||||
final public const PICK_FORMATTER_KEY = 'pick_formatter';
|
final public const PICK_FORMATTER_KEY = 'pick_formatter';
|
||||||
|
|
||||||
public function __construct(private readonly ExportManager $exportManager, private readonly SortExportElement $sortExportElement) {}
|
/**
|
||||||
|
* @var ExportManager
|
||||||
|
*/
|
||||||
|
protected $exportManager;
|
||||||
|
|
||||||
|
public function __construct(ExportManager $exportManager)
|
||||||
|
{
|
||||||
|
$this->exportManager = $exportManager;
|
||||||
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
{
|
{
|
||||||
@@ -51,12 +58,12 @@ class ExportType extends AbstractType
|
|||||||
if ($export instanceof \Chill\MainBundle\Export\ExportInterface) {
|
if ($export instanceof \Chill\MainBundle\Export\ExportInterface) {
|
||||||
// add filters
|
// add filters
|
||||||
$filters = $this->exportManager->getFiltersApplyingOn($export, $options['picked_centers']);
|
$filters = $this->exportManager->getFiltersApplyingOn($export, $options['picked_centers']);
|
||||||
$this->sortExportElement->sortFilters($filters);
|
|
||||||
$filterBuilder = $builder->create(self::FILTER_KEY, FormType::class, ['compound' => true]);
|
$filterBuilder = $builder->create(self::FILTER_KEY, FormType::class, ['compound' => true]);
|
||||||
|
|
||||||
foreach ($filters as $alias => $filter) {
|
foreach ($filters as $alias => $filter) {
|
||||||
$filterBuilder->add($alias, FilterType::class, [
|
$filterBuilder->add($alias, FilterType::class, [
|
||||||
'filter' => $filter,
|
'filter_alias' => $alias,
|
||||||
|
'export_manager' => $this->exportManager,
|
||||||
'label' => $filter->getTitle(),
|
'label' => $filter->getTitle(),
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
new ExportElementConstraint(['element' => $filter]),
|
new ExportElementConstraint(['element' => $filter]),
|
||||||
@@ -69,7 +76,6 @@ class ExportType extends AbstractType
|
|||||||
// add aggregators
|
// add aggregators
|
||||||
$aggregators = $this->exportManager
|
$aggregators = $this->exportManager
|
||||||
->getAggregatorsApplyingOn($export, $options['picked_centers']);
|
->getAggregatorsApplyingOn($export, $options['picked_centers']);
|
||||||
$this->sortExportElement->sortAggregators($aggregators);
|
|
||||||
$aggregatorBuilder = $builder->create(
|
$aggregatorBuilder = $builder->create(
|
||||||
self::AGGREGATOR_KEY,
|
self::AGGREGATOR_KEY,
|
||||||
FormType::class,
|
FormType::class,
|
||||||
|
@@ -11,7 +11,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\MainBundle\Form\Type\Export;
|
namespace Chill\MainBundle\Form\Type\Export;
|
||||||
|
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
||||||
@@ -26,7 +25,8 @@ class FilterType extends AbstractType
|
|||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
{
|
{
|
||||||
$filter = $options['filter'];
|
$exportManager = $options['export_manager'];
|
||||||
|
$filter = $exportManager->getFilter($options['filter_alias']);
|
||||||
|
|
||||||
$builder
|
$builder
|
||||||
->add(self::ENABLED_FIELD, CheckboxType::class, [
|
->add(self::ENABLED_FIELD, CheckboxType::class, [
|
||||||
@@ -46,9 +46,8 @@ class FilterType extends AbstractType
|
|||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
{
|
{
|
||||||
$resolver
|
$resolver->setRequired('filter_alias')
|
||||||
->setRequired('filter')
|
->setRequired('export_manager')
|
||||||
->setAllowedTypes('filter', [FilterInterface::class])
|
|
||||||
->setDefault('compound', true)
|
->setDefault('compound', true)
|
||||||
->setDefault('error_bubbling', false);
|
->setDefault('error_bubbling', false);
|
||||||
}
|
}
|
||||||
|
@@ -34,7 +34,6 @@ class PickRollingDateType extends AbstractType
|
|||||||
),
|
),
|
||||||
'multiple' => false,
|
'multiple' => false,
|
||||||
'expanded' => false,
|
'expanded' => false,
|
||||||
'required' => $options['required'],
|
|
||||||
'label' => 'rolling_date.roll_movement',
|
'label' => 'rolling_date.roll_movement',
|
||||||
])
|
])
|
||||||
->add('fixedDate', ChillDateType::class, [
|
->add('fixedDate', ChillDateType::class, [
|
||||||
@@ -54,22 +53,15 @@ class PickRollingDateType extends AbstractType
|
|||||||
{
|
{
|
||||||
$resolver->setDefaults([
|
$resolver->setDefaults([
|
||||||
'class' => RollingDate::class,
|
'class' => RollingDate::class,
|
||||||
'empty_data' => null,
|
'empty_data' => new RollingDate(RollingDate::T_TODAY),
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
new Callback($this->validate(...)),
|
new Callback($this->validate(...)),
|
||||||
],
|
],
|
||||||
'required' => true,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$resolver->setAllowedTypes('required', 'bool');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validate($data, ExecutionContextInterface $context, $payload): void
|
public function validate($data, ExecutionContextInterface $context, $payload): void
|
||||||
{
|
{
|
||||||
if (null === $data) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @var RollingDate $data */
|
/** @var RollingDate $data */
|
||||||
if (RollingDate::T_FIXED_DATE === $data->getRoll() && null === $data->getFixedDate()) {
|
if (RollingDate::T_FIXED_DATE === $data->getRoll() && null === $data->getFixedDate()) {
|
||||||
$context
|
$context
|
||||||
|
@@ -12,15 +12,14 @@ declare(strict_types=1);
|
|||||||
namespace Chill\MainBundle\Repository;
|
namespace Chill\MainBundle\Repository;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\UserJob;
|
use Chill\MainBundle\Entity\UserJob;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
|
||||||
readonly class UserJobRepository implements UserJobRepositoryInterface
|
class UserJobRepository implements UserJobRepositoryInterface
|
||||||
{
|
{
|
||||||
private EntityRepository $repository;
|
private readonly EntityRepository $repository;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $em, private TranslatableStringHelperInterface $translatableStringHelper)
|
public function __construct(EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
$this->repository = $em->getRepository(UserJob::class);
|
$this->repository = $em->getRepository(UserJob::class);
|
||||||
}
|
}
|
||||||
@@ -43,15 +42,6 @@ readonly class UserJobRepository implements UserJobRepositoryInterface
|
|||||||
return $this->repository->findBy(['active' => true]);
|
return $this->repository->findBy(['active' => true]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findAllOrderedByName(): array
|
|
||||||
{
|
|
||||||
$jobs = $this->findAll();
|
|
||||||
|
|
||||||
usort($jobs, fn (UserJob $a, UserJob $b) => $this->translatableStringHelper->localize($a->getLabel()) <=> $this->translatableStringHelper->localize($b->getLabel()));
|
|
||||||
|
|
||||||
return $jobs;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed|null $limit
|
* @param mixed|null $limit
|
||||||
* @param mixed|null $offset
|
* @param mixed|null $offset
|
||||||
|
@@ -28,13 +28,6 @@ interface UserJobRepositoryInterface extends ObjectRepository
|
|||||||
*/
|
*/
|
||||||
public function findAllActive(): array;
|
public function findAllActive(): array;
|
||||||
|
|
||||||
/**
|
|
||||||
* a list of UserJob ordered by name.
|
|
||||||
*
|
|
||||||
* @return array<UserJob>
|
|
||||||
*/
|
|
||||||
public function findAllOrderedByName(): array;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed|null $limit
|
* @param mixed|null $limit
|
||||||
* @param mixed|null $offset
|
* @param mixed|null $offset
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import {ShowHide} from 'ChillMainAssets/lib/show_hide/index';
|
import {ShowHide} from 'ChillMainAssets/lib/show_hide/index';
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function(_e) {
|
document.addEventListener('DOMContentLoaded', function(_e) {
|
||||||
|
console.log('pick-rolling-date');
|
||||||
document.querySelectorAll('div[data-rolling-date]').forEach( (picker) => {
|
document.querySelectorAll('div[data-rolling-date]').forEach( (picker) => {
|
||||||
const
|
const
|
||||||
roll_wrapper = picker.querySelector('div.roll-wrapper'),
|
roll_wrapper = picker.querySelector('div.roll-wrapper'),
|
||||||
@@ -10,8 +11,12 @@ document.addEventListener('DOMContentLoaded', function(_e) {
|
|||||||
froms: [roll_wrapper],
|
froms: [roll_wrapper],
|
||||||
container: [fixed_wrapper],
|
container: [fixed_wrapper],
|
||||||
test: function (elems) {
|
test: function (elems) {
|
||||||
|
console.log('testing');
|
||||||
|
console.log('elems', elems);
|
||||||
for (let el of elems) {
|
for (let el of elems) {
|
||||||
for (let select_roll of el.querySelectorAll('select[data-roll-picker]')) {
|
for (let select_roll of el.querySelectorAll('select[data-roll-picker]')) {
|
||||||
|
console.log('select_roll', select_roll);
|
||||||
|
console.log('value', select_roll.value);
|
||||||
return select_roll.value === 'fixed_date';
|
return select_roll.value === 'fixed_date';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user