mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-12 09:44:58 +00:00
Compare commits
112 Commits
testing
...
rector/rul
Author | SHA1 | Date | |
---|---|---|---|
74ed34ba97
|
|||
6e6f19c499
|
|||
075aca493b
|
|||
224c2c74e8
|
|||
1ebf68683f
|
|||
98c2ee3ab2
|
|||
4d7b4500c1
|
|||
ca2ba9d8e4
|
|||
f34f8b1eaa | |||
2b96160200
|
|||
933c353357
|
|||
e6da727a11 | |||
0719a541a6 | |||
883147ed9c | |||
718de2fad0 | |||
643d8f99be
|
|||
3954d69c94 | |||
78a5e81e33
|
|||
b05e128b5e
|
|||
8f39d0320c | |||
1cc61cee36
|
|||
a21cefab31
|
|||
f2673d6c83
|
|||
18535ee85f
|
|||
aea6796ba1 | |||
872d5e8ebf
|
|||
c0901947ca
|
|||
ea0e5dfa14
|
|||
59da93fd75 | |||
1d9b8729ab | |||
22ded77bde | |||
995e2dac80 | |||
28c41aaf85
|
|||
ce2ce42530 | |||
1409a3b23a
|
|||
51e382760d | |||
b0fcffea2d
|
|||
66e1047752 | |||
7bee376718 | |||
6bc45bbca3 | |||
f3912e5544 | |||
0950074121 | |||
94e9b75e40 | |||
23c7a92546 | |||
8391dbe448 | |||
a7842b2597
|
|||
1552b3c9d7
|
|||
2259a31260 | |||
36eed4323c | |||
9bf8c9b0ed | |||
1930c48d28 | |||
29306d2b66 | |||
e0758215ba | |||
e82c7cdc6c | |||
3f66e1a862
|
|||
efee2d8b44 | |||
f3829d3390 | |||
a2e705bd92 | |||
e38b369149
|
|||
5a36a8660d | |||
f7d385eba1 | |||
edd66f6a6c | |||
ef1eb2031e | |||
6065680e1e
|
|||
88114e3ba6
|
|||
bf93c1ddb2 | |||
0d365e16e5
|
|||
802ff20b5c | |||
cdfe201574 | |||
43419f9f15
|
|||
39896ea6e2
|
|||
ca62c3fd0b
|
|||
b3b84c5dc0
|
|||
6bdb3e9695
|
|||
20e64e8768 | |||
63f9bd5548
|
|||
c8146ded17
|
|||
17d2b795b4 | |||
7f30742fc3
|
|||
56d9072abe
|
|||
7ccff61c25
|
|||
cc97199c5d | |||
20d5fabc18 | |||
c04fd66163
|
|||
61982634a6 | |||
6c58e7eb3e | |||
4b25970ce0 | |||
52d51264ba | |||
4e934653be | |||
1ee0e8e350 | |||
4da7040a49 | |||
a34b5f8588 | |||
0d626fb345 | |||
25d4b6acbb | |||
145c1df313 | |||
7f9738975c | |||
3e63b4abf3 | |||
1485d1ce7a | |||
0e5f1b4ab9
|
|||
f7c11d3567
|
|||
51544cfc48
|
|||
659dff3d2c
|
|||
ad72192e24
|
|||
737f5f9275
|
|||
07c681fcec
|
|||
1c7d90a6ef
|
|||
24c33b306b
|
|||
7e19419861
|
|||
c35994203d
|
|||
9027cbd196
|
|||
dde3002100
|
|||
d8870e906f
|
@@ -1,5 +0,0 @@
|
|||||||
kind: Feature
|
|
||||||
body: '[export] Add a filter "filter course having an activity between two dates"'
|
|
||||||
time: 2023-07-11T15:59:29.065329834+02:00
|
|
||||||
custom:
|
|
||||||
Issue: "129"
|
|
39
.changes/v2.5.0.md
Normal file
39
.changes/v2.5.0.md
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
## v2.5.0 - 2023-07-14
|
||||||
|
### Feature
|
||||||
|
* Allow filtering on the basis of a user within general tasks lists
|
||||||
|
* ([#120](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/120)) Adding OrderFilter to the list of social actions.
|
||||||
|
* ([#125](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/125)) [export] Add a list for people with their associated course
|
||||||
|
* [export] Add ordering by person's lastname or course opening date in list which concerns accompanying course or peoples
|
||||||
|
* ([#128](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/128)) [Export] allow to group activities by localisation
|
||||||
|
* ([#129](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/129)) [export] Add a filter "filter course having an activity between two dates"
|
||||||
|
* ([#112](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/112)) [addresses] Add a cronjob to re-associate addresses with addresses reference every 6 hours
|
||||||
|
* Improve filtering layout
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* reimplement the visualization of all calculator results
|
||||||
|
* ([#117](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/117)) Repair my unread notification list with actions and evaluations documents
|
||||||
|
* ([#126](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/126)) Correct bug in thirdparty API search query: simplify address joins clause for child and parent kind
|
||||||
|
|
||||||
|
### DX
|
||||||
|
* Documentation for database principles
|
||||||
|
* [cronjob] when a cronjob is executed, it may return an array of data that will be passed as argument on the next execution
|
||||||
|
|
||||||
|
### UX
|
||||||
|
* ([#93](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/93)) Better integration of address details button: look, position, title tag
|
||||||
|
* ([#93](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/93)) Show address detail button on person and household banners
|
||||||
|
* Improve residential address position on show onthefly modale
|
||||||
|
|
||||||
|
### Traduction francophone des principaux changements
|
||||||
|
|
||||||
|
* Ajout d'un filtre "par utilisateur" aux pages de tâche
|
||||||
|
* Filtre des actions d'accompagnement par date, type, intervenant
|
||||||
|
* export: liste des usagers concernés avec détail de leurs parcours
|
||||||
|
* export: ajout d'un regroupement des échanges par localisation
|
||||||
|
* export: ajout d'un filtre "parcours ayant reçu un échange entre deux dates"
|
||||||
|
* ajout d'une tâche cron pour associer les adresses à une adresse de référence
|
||||||
|
* correction: réparation de la liste des notifications sur la page d'accueil, dans le cas où une notification concerne une action ou un document dans une évaluation
|
||||||
|
* correction: réparation de la recherche des tiers ayant des codes postaux similaires entre les parents et enfants
|
||||||
|
* meilleure intégration du bouton "détail d'une adresse": améliration de la taille et de la position
|
||||||
|
* bouton permettant de visualiser les détails d'une adresse (modale avec carte) dans la bannière "Usager" et "Ménage"
|
||||||
|
* amélioration de la modale permettant de voir les détails d'un usager: les adresses de résidence sont dans la continuité des autres adresses, et non plus dans une colonne séparée
|
||||||
|
* améliore le design et l'expérience utilisateur des filtres
|
3
.changes/v2.5.1.md
Normal file
3
.changes/v2.5.1.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
## v2.5.1 - 2023-07-14
|
||||||
|
### Fixed
|
||||||
|
* [collate addresses] block collating addresses to another address reference where the address reference is already the best match
|
3
.changes/v2.5.2.md
Normal file
3
.changes/v2.5.2.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
## v2.5.2 - 2023-07-15
|
||||||
|
### Fixed
|
||||||
|
* [Collate Address] when updating address point, do not use the point's address reference if the similarity is below the requirement for associating the address reference and the address (it uses the postcode's center instead)
|
@@ -7,7 +7,7 @@ versionFormat: '## {{.Version}} - {{.Time.Format "2006-01-02"}}'
|
|||||||
kindFormat: '### {{.Kind}}'
|
kindFormat: '### {{.Kind}}'
|
||||||
# Note: it is possible to add a `.custom.Long` text manually into the yaml file produced by `changie new`. This will add a long description.
|
# Note: it is possible to add a `.custom.Long` text manually into the yaml file produced by `changie new`. This will add a long description.
|
||||||
changeFormat: >-
|
changeFormat: >-
|
||||||
* {{ if not (eq .Custom.Issue "") }}([#{{ .Custom.Issue }}](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/{{ .Custom.Issue }})) {{ end }}{{.Body}} {{ if not (eq .Custom.Long "") }}
|
* {{ if not (eq .Custom.Issue "") }}([#{{ .Custom.Issue }}](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/{{ .Custom.Issue }})) {{ end }}{{.Body}} {{ if and (.Custom.Long) (not (eq .Custom.Long "")) }}
|
||||||
|
|
||||||
{{ .Custom.Long }}{{ end }}
|
{{ .Custom.Long }}{{ end }}
|
||||||
custom:
|
custom:
|
||||||
@@ -30,6 +30,8 @@ kinds:
|
|||||||
auto: patch
|
auto: patch
|
||||||
- label: DX
|
- label: DX
|
||||||
auto: patch
|
auto: patch
|
||||||
|
- label: UX
|
||||||
|
auto: patch
|
||||||
newlines:
|
newlines:
|
||||||
afterChangelogHeader: 1
|
afterChangelogHeader: 1
|
||||||
beforeChangelogVersion: 1
|
beforeChangelogVersion: 1
|
||||||
|
48
CHANGELOG.md
48
CHANGELOG.md
@@ -6,6 +6,54 @@ 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.5.2 - 2023-07-15
|
||||||
|
### Fixed
|
||||||
|
* [Collate Address] when updating address point, do not use the point's address reference if the similarity is below the requirement for associating the address reference and the address (it uses the postcode's center instead)
|
||||||
|
|
||||||
|
## v2.5.1 - 2023-07-14
|
||||||
|
### Fixed
|
||||||
|
* [collate addresses] block collating addresses to another address reference where the address reference is already the best match
|
||||||
|
|
||||||
|
## v2.5.0 - 2023-07-14
|
||||||
|
### Feature
|
||||||
|
* Allow filtering on the basis of a user within general tasks lists
|
||||||
|
* ([#120](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/120)) Adding OrderFilter to the list of social actions.
|
||||||
|
* ([#125](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/125)) [export] Add a list for people with their associated course
|
||||||
|
* [export] Add ordering by person's lastname or course opening date in list which concerns accompanying course or peoples
|
||||||
|
* ([#128](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/128)) [Export] allow to group activities by localisation
|
||||||
|
* ([#129](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/129)) [export] Add a filter "filter course having an activity between two dates"
|
||||||
|
* ([#112](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/112)) [addresses] Add a cronjob to re-associate addresses with addresses reference every 6 hours
|
||||||
|
* Improve filtering layout
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* reimplement the visualization of all calculator results
|
||||||
|
* ([#117](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/117)) Repair my unread notification list with actions and evaluations documents
|
||||||
|
* ([#126](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/126)) Correct bug in thirdparty API search query: simplify address joins clause for child and parent kind
|
||||||
|
|
||||||
|
### DX
|
||||||
|
* Documentation for database principles
|
||||||
|
* [cronjob] when a cronjob is executed, it may return an array of data that will be passed as argument on the next execution
|
||||||
|
|
||||||
|
### UX
|
||||||
|
* ([#93](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/93)) Better integration of address details button: look, position, title tag
|
||||||
|
* ([#93](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/93)) Show address detail button on person and household banners
|
||||||
|
* Improve residential address position on show onthefly modale
|
||||||
|
|
||||||
|
### Traduction francophone des principaux changements
|
||||||
|
|
||||||
|
* Ajout d'un filtre "par utilisateur" aux pages de tâche
|
||||||
|
* Filtre des actions d'accompagnement par date, type, intervenant
|
||||||
|
* export: liste des usagers concernés avec détail de leurs parcours
|
||||||
|
* export: ajout d'un regroupement des échanges par localisation
|
||||||
|
* export: ajout d'un filtre "parcours ayant reçu un échange entre deux dates"
|
||||||
|
* ajout d'une tâche cron pour associer les adresses à une adresse de référence
|
||||||
|
* correction: réparation de la liste des notifications sur la page d'accueil, dans le cas où une notification concerne une action ou un document dans une évaluation
|
||||||
|
* correction: réparation de la recherche des tiers ayant des codes postaux similaires entre les parents et enfants
|
||||||
|
* meilleure intégration du bouton "détail d'une adresse": améliration de la taille et de la position
|
||||||
|
* bouton permettant de visualiser les détails d'une adresse (modale avec carte) dans la bannière "Usager" et "Ménage"
|
||||||
|
* amélioration de la modale permettant de voir les détails d'un usager: les adresses de résidence sont dans la continuité des autres adresses, et non plus dans une colonne séparée
|
||||||
|
* améliore le design et l'expérience utilisateur des filtres
|
||||||
|
|
||||||
## v2.4.0 - 2023-07-07
|
## v2.4.0 - 2023-07-07
|
||||||
|
|
||||||
### Feature
|
### Feature
|
||||||
|
@@ -54,18 +54,9 @@ class CountPerson implements ExportInterface
|
|||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
// the Closure which will be executed by the formatter.
|
// the Closure which will be executed by the formatter.
|
||||||
return function ($value) {
|
return fn($value) => match ($value) {
|
||||||
switch ($value) {
|
'_header' => $this->getTitle(),
|
||||||
case '_header':
|
default => $value,
|
||||||
// we have to process specifically the '_header' string,
|
|
||||||
// which will be used by the formatter to show a column title
|
|
||||||
return $this->getTitle();
|
|
||||||
|
|
||||||
default:
|
|
||||||
// for all value, we do not process them and return them
|
|
||||||
// immediatly
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
84
docs/source/development/database-principles.rst
Normal file
84
docs/source/development/database-principles.rst
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
|
||||||
|
.. database-principles:
|
||||||
|
|
||||||
|
Principes de la base de données
|
||||||
|
###############################
|
||||||
|
|
||||||
|
Cette page donne une compréhension globale de la base de donnée de Chill, et explique quelques détails d'implémentations qui permettent d'accélérer les traitements à partir de la base de donnée, ou de l'exploiter plus aisément.
|
||||||
|
|
||||||
|
Cette page est rédigée en français.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
La stabilité du schéma de la base de donnée n'est pas garantie.
|
||||||
|
|
||||||
|
Toutefois, ce dernier évolue relativement peu. Il est rare que des tables ou des colonnes soient supprimées ou renommées. Mais il n'est pas garanti que cela puisse arriver.
|
||||||
|
|
||||||
|
Généralités
|
||||||
|
===========
|
||||||
|
|
||||||
|
Une liste commentée de toutes les tables :download:`est disponible au format CSV <./database/table_list.csv`.
|
||||||
|
|
||||||
|
Schéma et conventions de nommage
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
Au début de l'histoire de Chill, les schémas postgresql n'étaient pas exploités. Les données étaient stockées dans le schéma :code:`public`.
|
||||||
|
|
||||||
|
Par la suite, des nouveaux bundles sont apparus, et les tables ont été classées dans des schémas dédiés.
|
||||||
|
|
||||||
|
A l'heure actuelle:
|
||||||
|
|
||||||
|
- pour les anciens bundle, ceux qui ont déjà des tables dans le schéma public, les nouvelles tables sont ajoutées à ce schéma. Elles sont préfixées par :code:`chill_<nom du bundle>_`;
|
||||||
|
- pour les bundles plus récents, les tables sont créées dans le schéma dédié
|
||||||
|
|
||||||
|
Données avec de l'historicité
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
Certaines données sont historisées:
|
||||||
|
|
||||||
|
- les référents d'un parcours;
|
||||||
|
- les statuts d'un parcours;
|
||||||
|
- la liaison entre les centres et les usagers;
|
||||||
|
- etc.
|
||||||
|
|
||||||
|
Dans ces cas-là, Chill crée généralement deux colonnes, qui sont habituellement nommées :code:`startDate` et :code:`endDate`. Lorsque la colonne :code:`endDate` est à :code:`NULL`, cela signifie que la période n'est pas "fermée". La colonne :code:`startDate` n'est pas nullable.
|
||||||
|
|
||||||
|
Dans certains cas, la donnée actuelle (référent d'un parcours, par exemple) est également répétée au niveau de la table en elle-même. Par exemple, la table des parcours :code:`chill_person_accompanying_period` comporte une colonne :code:`step` (le statut du parcours) et :code:`user_id` (id du référent) en plus de l'historique. Bien que redondant, cela simplifie les traitements.
|
||||||
|
|
||||||
|
Relations particulières
|
||||||
|
=======================
|
||||||
|
|
||||||
|
Usagers, ménages, adresses
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
Les usagers ont une adresse au travers des ménages: dans l'interface, l'adresse est inscrite dans le dossier du ménage, et elle est "donnée" aux usagers membres du ménage, **et** qui partagent l'adresse de ce ménage. En effet, il est possible que des usagers "appartiennent" à un ménage sans y être domicilié: c'est le cas, par exemple, des enfants en garde alternée.
|
||||||
|
|
||||||
|
L'historique de l'appartenance des usagers au ménage est conservée, de même que l'historique des adresses pour un même ménage.
|
||||||
|
|
||||||
|
Les tables en jeu sont les suivantes:
|
||||||
|
|
||||||
|
- la table :code:`chill_person_person` liste les usagers;
|
||||||
|
- la table :code:`chill_person_household_members` liste les appartenances au ménage: il s'agit de la jointure entre les usagers et les ménages:
|
||||||
|
- les colonnes :code:`startDate` et :code:`endDate` indiquent la date de début et la date de fin de l'appartenance;
|
||||||
|
- la colonne :code:`shareHousehold` indique si l'utilisateur partage l'adresse du ménage (si oui, sa valeur est :code:`TRUE`)
|
||||||
|
- la table :code:`chill_person_household` liste les ménages
|
||||||
|
- la table :code:`chill_person_household_to_addresses` associe les ménages aux adresses;
|
||||||
|
- la table :code:`chill_main_address` contient les adresses, en indiquant la date de début de validité (:code:`validFrom`) et la fin de validité (:code:`validTo`).
|
||||||
|
|
||||||
|
Pour simplifier la résolution des adresses et des usagers, deux vues ont été mises en œuvre:
|
||||||
|
|
||||||
|
- la vue :code:`view_chill_person_household_address` reprend, pour chaque usager, l'historique des appartenances au ménage découpée par l'historique des adresses d'un ménage.
|
||||||
|
Autrement dit, une ligne est créée à chaque fois qu'un usager change de ménage, ou qu'un ménage change d'adresse. Il est donc possible de retrouver l'historique complet des adresses pour un usager donné via cette table.
|
||||||
|
- la vue :code:`view_chill_person_current_address` reprend l'adresse actuelle des usagers.
|
||||||
|
|
||||||
|
Adresses et unités géographiques
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
Chill propose des statistiques sur la localisation des adresses par rapport à des zones géographiques (:code:`chill_main_geographical_unit`).
|
||||||
|
|
||||||
|
Comme la résolution géographique des adresses est coûteuse en CPU et en temps de traitement, une vue matérialisée a été créée: :code:`view_chill_main_address_geographical_unit`. Elle est rafraichie quotidiennement dans la base de donnée de production.
|
||||||
|
|
||||||
|
Liste des tables et commentaires
|
||||||
|
================================
|
||||||
|
|
||||||
|
Une liste commentée de toutes les tables :download:`est disponible au format CSV <./database/table_list.csv`.
|
155
docs/source/development/database/table_list.csv
Normal file
155
docs/source/development/database/table_list.csv
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
order,table_schema,table_name,commentaire
|
||||||
|
1,chill_3party,party_category,Catégorie de tiers
|
||||||
|
2,chill_3party,party_center,Association entre les tiers et les centres (déprécié)
|
||||||
|
3,chill_3party,party_profession,Profession du tiers (déprécié)
|
||||||
|
4,chill_3party,third_party,Tiers
|
||||||
|
5,chill_3party,thirdparty_category,association tiers - catégories
|
||||||
|
6,chill_asideactivity,asideactivity,Activités annexes
|
||||||
|
7,chill_asideactivity,asideactivitycategory,Catégories d'activités annexes
|
||||||
|
8,chill_budget,charge,Charges du budget
|
||||||
|
9,chill_budget,charge_type,Types de charges
|
||||||
|
10,chill_budget,resource,Ressources du budget
|
||||||
|
11,chill_budget,resource_type,Types de ressources
|
||||||
|
12,chill_calendar,calendar,Rendez-vous
|
||||||
|
13,chill_calendar,calendar_doc,Document du rendez-vous
|
||||||
|
14,chill_calendar,calendar_range,Plage de disponibilité
|
||||||
|
15,chill_calendar,calendar_to_persons,association rendez-vous - usagers
|
||||||
|
16,chill_calendar,calendar_to_thirdparties,association rendez-vous - tiers
|
||||||
|
17,chill_calendar,cancel_reason,Motifs d'annulations
|
||||||
|
18,chill_calendar,invite,Invitation aux rendez-vous
|
||||||
|
19,chill_doc,accompanyingcourse_document,Documents associés aux parcours
|
||||||
|
20,chill_doc,document_category,Catégories de documents
|
||||||
|
21,chill_doc,person_document,Documents associés à l'usagers
|
||||||
|
22,chill_doc,stored_object,Documents
|
||||||
|
23,chill_task,recurring_task,Tâches récurrentes (non utilisé)
|
||||||
|
24,chill_task,single_task,Tâches
|
||||||
|
25,chill_task,single_task_place_event,Historique des transitions des tâches
|
||||||
|
26,chill_vendee,adressederelais,
|
||||||
|
27,chill_vendee,center_polygon
|
||||||
|
28,chill_vendee,entourage,
|
||||||
|
29,chill_vendee,geographical_unit
|
||||||
|
30,chill_vendee,geographical_unit_association
|
||||||
|
31,chill_vendee,mobilite
|
||||||
|
32,chill_vendee,niveauetude
|
||||||
|
33,chill_vendee,security_profile
|
||||||
|
34,chill_vendee,security_profile_action
|
||||||
|
35,chill_vendee,security_profile_jobs
|
||||||
|
36,chill_vendee,situationprofessionelle
|
||||||
|
37,chill_vendee,statutlogement
|
||||||
|
38,chill_vendee,tempsdetravail
|
||||||
|
39,chill_vendee,titredesejour
|
||||||
|
40,chill_vendee,vendee_person
|
||||||
|
41,chill_vendee,vendee_person_mineur
|
||||||
|
42,chill_vendee,vendeeperson_entourage
|
||||||
|
43,chill_vendee,vendeepersonmineur_adressederelais
|
||||||
|
44,public,accompanying_periods_scopes,Services associés aux parcours
|
||||||
|
45,public,activity,Échanges
|
||||||
|
46,public,activity_activityreason,s
|
||||||
|
47,public,activity_person,
|
||||||
|
48,public,activity_storedobject,
|
||||||
|
49,public,activity_thirdparty,
|
||||||
|
50,public,activity_user,
|
||||||
|
51,public,activityreason,Sujets d'échange
|
||||||
|
52,public,activityreasoncategory,Catégories de sujets
|
||||||
|
53,public,activitytpresence,Présence aux échanges
|
||||||
|
54,public,activitytype,Types d'échanges
|
||||||
|
55,public,activitytypecategory,Catégories de types d'échanges
|
||||||
|
56,public,centers,"Centres (territoires, agences, etc.)"
|
||||||
|
57,public,chill_activity_activity_chill_person_socialaction,
|
||||||
|
58,public,chill_activity_activity_chill_person_socialissue
|
||||||
|
59,public,chill_docgen_template,Gabarits de documents
|
||||||
|
60,public,chill_main_address,Adresses
|
||||||
|
61,public,chill_main_address_legacy,Anciennes adresses (dépréciés)
|
||||||
|
62,public,chill_main_address_reference,Adresses de référence
|
||||||
|
63,public,chill_main_civility,Civilités
|
||||||
|
64,public,chill_main_cronjob_execution,Dernière exécution des tâche cron
|
||||||
|
65,public,chill_main_geographical_unit,Unités géographiques
|
||||||
|
66,public,chill_main_geographical_unit_layer,Couches d'unités géographiques
|
||||||
|
67,public,chill_main_location,Localisations
|
||||||
|
68,public,chill_main_location_type,Types de localisations
|
||||||
|
69,public,chill_main_notification,Notifications
|
||||||
|
70,public,chill_main_notification_addresses_unread
|
||||||
|
71,public,chill_main_notification_addresses_user
|
||||||
|
72,public,chill_main_notification_comment,
|
||||||
|
73,public,chill_main_postal_code,Code postaux
|
||||||
|
74,public,chill_main_saved_export,Exports enregistrés
|
||||||
|
75,public,chill_main_user_job,Métiers
|
||||||
|
76,public,chill_main_workflow_entity,Workflows
|
||||||
|
77,public,chill_main_workflow_entity_comment
|
||||||
|
78,public,chill_main_workflow_entity_step,Etapes du workflow
|
||||||
|
79,public,chill_main_workflow_entity_step_cc_user,
|
||||||
|
80,public,chill_main_workflow_entity_step_user
|
||||||
|
81,public,chill_main_workflow_entity_step_user_by_accesskey,
|
||||||
|
82,public,chill_main_workflow_entity_subscriber_to_final,
|
||||||
|
83,public,chill_main_workflow_entity_subscriber_to_step
|
||||||
|
84,public,chill_person_accompanying_period,Parcours d'accompagnement
|
||||||
|
85,public,chill_person_accompanying_period_closingmotive,Motifs de cloture des parcours
|
||||||
|
86,public,chill_person_accompanying_period_comment,Commentaires des parcours
|
||||||
|
87,public,chill_person_accompanying_period_location_history,Historique de la localisatio ndes parcours
|
||||||
|
88,public,chill_person_accompanying_period_origin,Origine des parcours
|
||||||
|
89,public,chill_person_accompanying_period_participation,Appartenance des usagers au parcours
|
||||||
|
90,public,chill_person_accompanying_period_resource,Personnes ressources d'un parcours
|
||||||
|
91,public,chill_person_accompanying_period_social_issues,
|
||||||
|
92,public,chill_person_accompanying_period_step_history
|
||||||
|
93,public,chill_person_accompanying_period_user_history
|
||||||
|
94,public,chill_person_accompanying_period_work,Actions d'accompagnements
|
||||||
|
95,public,chill_person_accompanying_period_work_evaluation,Évaluations (dans les actions d'accompagnements)
|
||||||
|
96,public,chill_person_accompanying_period_work_evaluation_document,Documents des évaluations
|
||||||
|
97,public,chill_person_accompanying_period_work_goal,Objectifs d'une actions
|
||||||
|
98,public,chill_person_accompanying_period_work_goal_result,Objectifs et résultats d'une action
|
||||||
|
99,public,chill_person_accompanying_period_work_person,Usagers associés à une actions
|
||||||
|
100,public,chill_person_accompanying_period_work_referrer,Référents d'une actions
|
||||||
|
101,public,chill_person_accompanying_period_work_result,Résultats d'une action
|
||||||
|
102,public,chill_person_accompanying_period_work_third_party,Tiers traitants d'une action
|
||||||
|
103,public,chill_person_alt_name,"Noms supplémentaires d'un usager (nom marital, etc.)"
|
||||||
|
104,public,chill_person_household,Ménages
|
||||||
|
105,public,chill_person_household_composition,
|
||||||
|
106,public,chill_person_household_composition_type,Types de composition de ménage
|
||||||
|
107,public,chill_person_household_members,Membres du ménages
|
||||||
|
108,public,chill_person_household_position,Positions dans le ménage
|
||||||
|
109,public,chill_person_household_to_addresses,Association adresses - ménages
|
||||||
|
110,public,chill_person_marital_status,Etats civils
|
||||||
|
111,public,chill_person_not_duplicate,
|
||||||
|
112,public,chill_person_person,Usagers
|
||||||
|
113,public,chill_person_person_center_history,Historique des centres d'un usagers
|
||||||
|
114,public,chill_person_persons_to_addresses,Déprécié
|
||||||
|
115,public,chill_person_phone,Numéros d etéléphone supplémentaires d'un usager
|
||||||
|
116,public,chill_person_relations,Types de relations de filiation
|
||||||
|
117,public,chill_person_relationships,Relations de filiations
|
||||||
|
118,public,chill_person_residential_address,Adresses de résidences
|
||||||
|
119,public,chill_person_resource,Personnes ressources (pour les personnes)
|
||||||
|
120,public,chill_person_resource_kind,Type de personnes ressources
|
||||||
|
121,public,chill_person_social_action,Liste des actions d'accompagnement
|
||||||
|
122,public,chill_person_social_action_goal,Objectifs associés à une action
|
||||||
|
123,public,chill_person_social_action_result,Résultats associés à une action
|
||||||
|
124,public,chill_person_social_issue,Problématiques sociales
|
||||||
|
125,public,chill_person_social_work_evaluation,Evaluations disponibles
|
||||||
|
126,public,chill_person_social_work_evaluation_action,Associations entre les évaluations et les actions
|
||||||
|
127,public,chill_person_social_work_goal,Objectifs disponibles pour une actions
|
||||||
|
128,public,chill_person_social_work_goal_result,Objectifs et résultats disponible pour une action
|
||||||
|
129,public,chill_person_social_work_result,Résultats disponibles pour une action
|
||||||
|
130,public,country,Pays
|
||||||
|
131,public,custom_field_long_choice_options,
|
||||||
|
132,public,customfield
|
||||||
|
133,public,customfieldsdefaultgroup
|
||||||
|
134,public,customfieldsgroup
|
||||||
|
135,public,geography_columns,Table liée à postgis
|
||||||
|
136,public,geometry_columns,Table liée à postgis
|
||||||
|
137,public,group_centers,
|
||||||
|
138,public,language,Langues
|
||||||
|
139,public,messenger_messages,Table système
|
||||||
|
140,public,migration_versions,Table système
|
||||||
|
141,public,permission_groups
|
||||||
|
142,public,permissionsgroup_rolescope
|
||||||
|
143,public,persons_spoken_languages
|
||||||
|
144,public,regroupment,Regroupement de centres
|
||||||
|
145,public,regroupment_center,
|
||||||
|
146,public,role_scopes,
|
||||||
|
147,public,scopes,Services
|
||||||
|
148,public,spatial_ref_sys,Table système (postgis)
|
||||||
|
149,public,user_groupcenter,
|
||||||
|
150,public,users,Utilisateurs
|
||||||
|
151,public,view_chill_person_accompanying_period_info,
|
||||||
|
152,public,view_chill_person_current_address
|
||||||
|
153,public,view_chill_person_household_address
|
||||||
|
154,public,view_chill_person_person_center_history_current
|
Can't render this file because it has a wrong number of fields in line 28.
|
@@ -36,6 +36,7 @@ As Chill rely on the `symfony <http://symfony.com>`_ framework, reading the fram
|
|||||||
Assets <assets.rst>
|
Assets <assets.rst>
|
||||||
Cron Jobs <cronjob.rst>
|
Cron Jobs <cronjob.rst>
|
||||||
Info about entities <entity-info.rst>
|
Info about entities <entity-info.rst>
|
||||||
|
Info about database (in French) <database-principles.rst>
|
||||||
|
|
||||||
Layout and UI
|
Layout and UI
|
||||||
**************
|
**************
|
||||||
|
@@ -23,19 +23,12 @@ class ChillMainConfiguration implements ConfigurationInterface
|
|||||||
{
|
{
|
||||||
use AddWidgetConfigurationTrait;
|
use AddWidgetConfigurationTrait;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var ContainerBuilder
|
|
||||||
*/
|
|
||||||
private $containerBuilder;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
array $widgetFactories,
|
array $widgetFactories,
|
||||||
ContainerBuilder $containerBuilder
|
private ContainerBuilder $containerBuilder
|
||||||
) {
|
) {
|
||||||
// we register here widget factories (see below)
|
// we register here widget factories (see below)
|
||||||
$this->setWidgetFactories($widgetFactories);
|
$this->setWidgetFactories($widgetFactories);
|
||||||
// we will need the container builder later...
|
|
||||||
$this->containerBuilder = $containerBuilder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getConfigTreeBuilder()
|
public function getConfigTreeBuilder()
|
||||||
|
24
rector.php
24
rector.php
@@ -21,7 +21,7 @@ return static function (RectorConfig $rectorConfig): void {
|
|||||||
|
|
||||||
//define sets of rules
|
//define sets of rules
|
||||||
$rectorConfig->sets([
|
$rectorConfig->sets([
|
||||||
LevelSetList::UP_TO_PHP_74
|
LevelSetList::UP_TO_PHP_80
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// chill rules
|
// chill rules
|
||||||
@@ -37,27 +37,5 @@ return static function (RectorConfig $rectorConfig): void {
|
|||||||
|
|
||||||
// must merge MR500 and review a typing of "ArrayCollection" in entities
|
// must merge MR500 and review a typing of "ArrayCollection" in entities
|
||||||
\Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector::class,
|
\Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector::class,
|
||||||
|
|
||||||
// remove all PHP80 rules, in order to activate them one by one
|
|
||||||
\Rector\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector::class,
|
|
||||||
\Rector\Php80\Rector\Class_\AnnotationToAttributeRector::class,
|
|
||||||
\Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector::class,
|
|
||||||
\Rector\Php80\Rector\FuncCall\ClassOnObjectRector::class,
|
|
||||||
\Rector\Php80\Rector\ClassConstFetch\ClassOnThisVariableObjectRector::class,
|
|
||||||
\Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector::class,
|
|
||||||
\Rector\Php80\Rector\Class_\DoctrineAnnotationClassToAttributeRector::class,
|
|
||||||
\Rector\Php80\Rector\ClassMethod\FinalPrivateToPrivateVisibilityRector::class,
|
|
||||||
\Rector\Php80\Rector\Ternary\GetDebugTypeRector::class,
|
|
||||||
\Rector\Php80\Rector\FunctionLike\MixedTypeRector::class,
|
|
||||||
\Rector\Php80\Rector\Property\NestedAnnotationToAttributeRector::class,
|
|
||||||
\Rector\Php80\Rector\FuncCall\Php8ResourceReturnToObjectRector::class,
|
|
||||||
\Rector\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector::class,
|
|
||||||
\Rector\Php80\Rector\ClassMethod\SetStateToStaticRector::class,
|
|
||||||
\Rector\Php80\Rector\NotIdentical\StrContainsRector::class,
|
|
||||||
\Rector\Php80\Rector\Identical\StrEndsWithRector::class,
|
|
||||||
\Rector\Php80\Rector\Identical\StrStartsWithRector::class,
|
|
||||||
\Rector\Php80\Rector\Class_\StringableForToStringRector::class,
|
|
||||||
\Rector\Php80\Rector\FuncCall\TokenGetAllToObjectRector::class,
|
|
||||||
\Rector\Php80\Rector\FunctionLike\UnionTypesRector::class
|
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
@@ -18,11 +18,17 @@ use Chill\ActivityBundle\Repository\ActivityACLAwareRepositoryInterface;
|
|||||||
use Chill\ActivityBundle\Repository\ActivityRepository;
|
use Chill\ActivityBundle\Repository\ActivityRepository;
|
||||||
use Chill\ActivityBundle\Repository\ActivityTypeCategoryRepository;
|
use Chill\ActivityBundle\Repository\ActivityTypeCategoryRepository;
|
||||||
use Chill\ActivityBundle\Repository\ActivityTypeRepositoryInterface;
|
use Chill\ActivityBundle\Repository\ActivityTypeRepositoryInterface;
|
||||||
|
use Chill\ActivityBundle\Repository\ActivityUserJobRepository;
|
||||||
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
|
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
|
||||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||||
|
use Chill\MainBundle\Entity\UserJob;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
use Chill\MainBundle\Repository\LocationRepository;
|
use Chill\MainBundle\Repository\LocationRepository;
|
||||||
use Chill\MainBundle\Repository\UserRepositoryInterface;
|
use Chill\MainBundle\Repository\UserRepositoryInterface;
|
||||||
use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
|
use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
|
||||||
|
use Chill\MainBundle\Templating\Listing\FilterOrderHelper;
|
||||||
|
use Chill\MainBundle\Templating\Listing\FilterOrderHelperFactoryInterface;
|
||||||
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||||
@@ -47,76 +53,32 @@ use function array_key_exists;
|
|||||||
|
|
||||||
final class ActivityController extends AbstractController
|
final class ActivityController extends AbstractController
|
||||||
{
|
{
|
||||||
private AccompanyingPeriodRepository $accompanyingPeriodRepository;
|
|
||||||
|
|
||||||
private ActivityACLAwareRepositoryInterface $activityACLAwareRepository;
|
|
||||||
|
|
||||||
private ActivityRepository $activityRepository;
|
|
||||||
|
|
||||||
private ActivityTypeCategoryRepository $activityTypeCategoryRepository;
|
|
||||||
|
|
||||||
private ActivityTypeRepositoryInterface $activityTypeRepository;
|
|
||||||
|
|
||||||
private CenterResolverManagerInterface $centerResolver;
|
|
||||||
|
|
||||||
private EntityManagerInterface $entityManager;
|
|
||||||
|
|
||||||
private EventDispatcherInterface $eventDispatcher;
|
|
||||||
|
|
||||||
private LocationRepository $locationRepository;
|
|
||||||
|
|
||||||
private LoggerInterface $logger;
|
|
||||||
|
|
||||||
private PersonRepository $personRepository;
|
|
||||||
|
|
||||||
private SerializerInterface $serializer;
|
|
||||||
|
|
||||||
private ThirdPartyRepository $thirdPartyRepository;
|
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
|
||||||
|
|
||||||
private UserRepositoryInterface $userRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ActivityACLAwareRepositoryInterface $activityACLAwareRepository,
|
private readonly ActivityACLAwareRepositoryInterface $activityACLAwareRepository,
|
||||||
ActivityTypeRepositoryInterface $activityTypeRepository,
|
private readonly ActivityTypeRepositoryInterface $activityTypeRepository,
|
||||||
ActivityTypeCategoryRepository $activityTypeCategoryRepository,
|
private readonly ActivityTypeCategoryRepository $activityTypeCategoryRepository,
|
||||||
PersonRepository $personRepository,
|
private readonly PersonRepository $personRepository,
|
||||||
ThirdPartyRepository $thirdPartyRepository,
|
private readonly ThirdPartyRepository $thirdPartyRepository,
|
||||||
LocationRepository $locationRepository,
|
private readonly LocationRepository $locationRepository,
|
||||||
ActivityRepository $activityRepository,
|
private readonly ActivityRepository $activityRepository,
|
||||||
AccompanyingPeriodRepository $accompanyingPeriodRepository,
|
private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository,
|
||||||
EntityManagerInterface $entityManager,
|
private readonly EntityManagerInterface $entityManager,
|
||||||
EventDispatcherInterface $eventDispatcher,
|
private readonly EventDispatcherInterface $eventDispatcher,
|
||||||
LoggerInterface $logger,
|
private readonly LoggerInterface $logger,
|
||||||
SerializerInterface $serializer,
|
private readonly SerializerInterface $serializer,
|
||||||
UserRepositoryInterface $userRepository,
|
private readonly UserRepositoryInterface $userRepository,
|
||||||
CenterResolverManagerInterface $centerResolver,
|
private readonly CenterResolverManagerInterface $centerResolver,
|
||||||
TranslatorInterface $translator
|
private readonly TranslatorInterface $translator,
|
||||||
|
private readonly FilterOrderHelperFactoryInterface $filterOrderHelperFactory,
|
||||||
|
private readonly TranslatableStringHelperInterface $translatableStringHelper,
|
||||||
|
private readonly PaginatorFactory $paginatorFactory,
|
||||||
) {
|
) {
|
||||||
$this->activityACLAwareRepository = $activityACLAwareRepository;
|
|
||||||
$this->activityTypeRepository = $activityTypeRepository;
|
|
||||||
$this->activityTypeCategoryRepository = $activityTypeCategoryRepository;
|
|
||||||
$this->personRepository = $personRepository;
|
|
||||||
$this->thirdPartyRepository = $thirdPartyRepository;
|
|
||||||
$this->locationRepository = $locationRepository;
|
|
||||||
$this->activityRepository = $activityRepository;
|
|
||||||
$this->accompanyingPeriodRepository = $accompanyingPeriodRepository;
|
|
||||||
$this->entityManager = $entityManager;
|
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
|
||||||
$this->logger = $logger;
|
|
||||||
$this->serializer = $serializer;
|
|
||||||
$this->userRepository = $userRepository;
|
|
||||||
$this->centerResolver = $centerResolver;
|
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a Activity entity.
|
* Deletes a Activity entity.
|
||||||
*
|
|
||||||
* @param mixed $id
|
|
||||||
*/
|
*/
|
||||||
public function deleteAction(Request $request, $id)
|
public function deleteAction(Request $request, mixed $id)
|
||||||
{
|
{
|
||||||
$view = null;
|
$view = null;
|
||||||
|
|
||||||
@@ -289,14 +251,31 @@ final class ActivityController extends AbstractController
|
|||||||
{
|
{
|
||||||
$view = null;
|
$view = null;
|
||||||
$activities = [];
|
$activities = [];
|
||||||
// TODO: add pagination
|
|
||||||
|
|
||||||
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
||||||
|
$filter = $this->buildFilterOrder($person ?? $accompanyingPeriod);
|
||||||
|
|
||||||
|
$filterArgs = [
|
||||||
|
'my_activities' => $filter->getSingleCheckboxData('my_activities'),
|
||||||
|
'types' => $filter->hasEntityChoice('activity_types') ? $filter->getEntityChoiceData('activity_types') : [],
|
||||||
|
'jobs' => $filter->hasEntityChoice('jobs') ? $filter->getEntityChoiceData('jobs') : [],
|
||||||
|
'before' => $filter->getDateRangeData('activity_date')['to'],
|
||||||
|
'after' => $filter->getDateRangeData('activity_date')['from'],
|
||||||
|
];
|
||||||
|
|
||||||
if ($person instanceof Person) {
|
if ($person instanceof Person) {
|
||||||
$this->denyAccessUnlessGranted(ActivityVoter::SEE, $person);
|
$this->denyAccessUnlessGranted(ActivityVoter::SEE, $person);
|
||||||
|
$count = $this->activityACLAwareRepository->countByPerson($person, ActivityVoter::SEE, $filterArgs);
|
||||||
|
$paginator = $this->paginatorFactory->create($count);
|
||||||
$activities = $this->activityACLAwareRepository
|
$activities = $this->activityACLAwareRepository
|
||||||
->findByPerson($person, ActivityVoter::SEE, 0, null, ['date' => 'DESC', 'id' => 'DESC']);
|
->findByPerson(
|
||||||
|
$person,
|
||||||
|
ActivityVoter::SEE,
|
||||||
|
$paginator->getCurrentPageFirstItemNumber(),
|
||||||
|
$paginator->getItemsPerPage(),
|
||||||
|
['date' => 'DESC', 'id' => 'DESC'],
|
||||||
|
$filterArgs
|
||||||
|
);
|
||||||
|
|
||||||
$event = new PrivacyEvent($person, [
|
$event = new PrivacyEvent($person, [
|
||||||
'element_class' => Activity::class,
|
'element_class' => Activity::class,
|
||||||
@@ -308,10 +287,21 @@ final class ActivityController extends AbstractController
|
|||||||
} elseif ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
} elseif ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
$this->denyAccessUnlessGranted(ActivityVoter::SEE, $accompanyingPeriod);
|
$this->denyAccessUnlessGranted(ActivityVoter::SEE, $accompanyingPeriod);
|
||||||
|
|
||||||
|
$count = $this->activityACLAwareRepository->countByAccompanyingPeriod($accompanyingPeriod, ActivityVoter::SEE, $filterArgs);
|
||||||
|
$paginator = $this->paginatorFactory->create($count);
|
||||||
$activities = $this->activityACLAwareRepository
|
$activities = $this->activityACLAwareRepository
|
||||||
->findByAccompanyingPeriod($accompanyingPeriod, ActivityVoter::SEE, 0, null, ['date' => 'DESC', 'id' => 'DESC']);
|
->findByAccompanyingPeriod(
|
||||||
|
$accompanyingPeriod,
|
||||||
|
ActivityVoter::SEE,
|
||||||
|
$paginator->getCurrentPageFirstItemNumber(),
|
||||||
|
$paginator->getItemsPerPage(),
|
||||||
|
['date' => 'DESC', 'id' => 'DESC'],
|
||||||
|
$filterArgs
|
||||||
|
);
|
||||||
|
|
||||||
$view = 'ChillActivityBundle:Activity:listAccompanyingCourse.html.twig';
|
$view = 'ChillActivityBundle:Activity:listAccompanyingCourse.html.twig';
|
||||||
|
} else {
|
||||||
|
throw new \LogicException("Unsupported");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render(
|
return $this->render(
|
||||||
@@ -320,10 +310,47 @@ final class ActivityController extends AbstractController
|
|||||||
'activities' => $activities,
|
'activities' => $activities,
|
||||||
'person' => $person,
|
'person' => $person,
|
||||||
'accompanyingCourse' => $accompanyingPeriod,
|
'accompanyingCourse' => $accompanyingPeriod,
|
||||||
|
'filter' => $filter,
|
||||||
|
'paginator' => $paginator,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function buildFilterOrder(AccompanyingPeriod|Person $associated): FilterOrderHelper
|
||||||
|
{
|
||||||
|
|
||||||
|
$filterBuilder = $this->filterOrderHelperFactory->create(self::class);
|
||||||
|
$types = $this->activityACLAwareRepository->findActivityTypeByAssociated($associated);
|
||||||
|
$jobs = $this->activityACLAwareRepository->findUserJobByAssociated($associated);
|
||||||
|
|
||||||
|
$filterBuilder
|
||||||
|
->addDateRange('activity_date', 'activity.date')
|
||||||
|
->addSingleCheckbox('my_activities', 'activity_filter.My activities');
|
||||||
|
|
||||||
|
if (1 < count($types)) {
|
||||||
|
$filterBuilder
|
||||||
|
->addEntityChoice('activity_types', 'activity_filter.Types', \Chill\ActivityBundle\Entity\ActivityType::class, $types, [
|
||||||
|
'choice_label' => function (\Chill\ActivityBundle\Entity\ActivityType $activityType) {
|
||||||
|
$text = match ($activityType->hasCategory()) {
|
||||||
|
true => $this->translatableStringHelper->localize($activityType->getCategory()->getName()) . ' > ',
|
||||||
|
false => '',
|
||||||
|
};
|
||||||
|
|
||||||
|
return $text . $this->translatableStringHelper->localize($activityType->getName());
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (1 < count($jobs)) {
|
||||||
|
$filterBuilder
|
||||||
|
->addEntityChoice('jobs', 'activity_filter.Jobs', UserJob::class, $jobs, [
|
||||||
|
'choice_label' => fn (UserJob $u) => $this->translatableStringHelper->localize($u->getLabel())
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $filterBuilder->build();
|
||||||
|
}
|
||||||
|
|
||||||
public function newAction(Request $request): Response
|
public function newAction(Request $request): Response
|
||||||
{
|
{
|
||||||
$view = null;
|
$view = null;
|
||||||
|
@@ -47,10 +47,8 @@ class ActivityReasonCategoryController extends AbstractController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a form to edit an existing ActivityReasonCategory entity.
|
* Displays a form to edit an existing ActivityReasonCategory entity.
|
||||||
*
|
|
||||||
* @param mixed $id
|
|
||||||
*/
|
*/
|
||||||
public function editAction($id)
|
public function editAction(mixed $id)
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
@@ -98,10 +96,8 @@ class ActivityReasonCategoryController extends AbstractController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds and displays a ActivityReasonCategory entity.
|
* Finds and displays a ActivityReasonCategory entity.
|
||||||
*
|
|
||||||
* @param mixed $id
|
|
||||||
*/
|
*/
|
||||||
public function showAction($id)
|
public function showAction(mixed $id)
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
@@ -118,10 +114,8 @@ class ActivityReasonCategoryController extends AbstractController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Edits an existing ActivityReasonCategory entity.
|
* Edits an existing ActivityReasonCategory entity.
|
||||||
*
|
|
||||||
* @param mixed $id
|
|
||||||
*/
|
*/
|
||||||
public function updateAction(Request $request, $id)
|
public function updateAction(Request $request, mixed $id)
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
@@ -24,11 +24,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
*/
|
*/
|
||||||
class ActivityReasonController extends AbstractController
|
class ActivityReasonController extends AbstractController
|
||||||
{
|
{
|
||||||
private ActivityReasonRepository $activityReasonRepository;
|
public function __construct(private ActivityReasonRepository $activityReasonRepository)
|
||||||
|
|
||||||
public function __construct(ActivityReasonRepository $activityReasonRepository)
|
|
||||||
{
|
{
|
||||||
$this->activityReasonRepository = $activityReasonRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,10 +53,8 @@ class ActivityReasonController extends AbstractController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a form to edit an existing ActivityReason entity.
|
* Displays a form to edit an existing ActivityReason entity.
|
||||||
*
|
|
||||||
* @param mixed $id
|
|
||||||
*/
|
*/
|
||||||
public function editAction($id)
|
public function editAction(mixed $id)
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
@@ -107,10 +102,8 @@ class ActivityReasonController extends AbstractController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds and displays a ActivityReason entity.
|
* Finds and displays a ActivityReason entity.
|
||||||
*
|
|
||||||
* @param mixed $id
|
|
||||||
*/
|
*/
|
||||||
public function showAction($id)
|
public function showAction(mixed $id)
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
@@ -127,10 +120,8 @@ class ActivityReasonController extends AbstractController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Edits an existing ActivityReason entity.
|
* Edits an existing ActivityReason entity.
|
||||||
*
|
|
||||||
* @param mixed $id
|
|
||||||
*/
|
*/
|
||||||
public function updateAction(Request $request, $id)
|
public function updateAction(Request $request, mixed $id)
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
@@ -25,17 +25,14 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface
|
|||||||
{
|
{
|
||||||
use \Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
use \Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
||||||
|
|
||||||
private EntityManagerInterface $em;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \Faker\Generator
|
* @var \Faker\Generator
|
||||||
*/
|
*/
|
||||||
private $faker;
|
private $faker;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $em)
|
public function __construct(private EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
$this->faker = FakerFactory::create('fr_FR');
|
$this->faker = FakerFactory::create('fr_FR');
|
||||||
$this->em = $em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOrder()
|
public function getOrder()
|
||||||
|
@@ -104,6 +104,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject", cascade={"persist"})
|
* @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject", cascade={"persist"})
|
||||||
* @Assert\Valid(traverse=true)
|
* @Assert\Valid(traverse=true)
|
||||||
|
* @var Collection<StoredObject>
|
||||||
*/
|
*/
|
||||||
private Collection $documents;
|
private Collection $documents;
|
||||||
|
|
||||||
@@ -140,8 +141,9 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
|
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
|
||||||
* @Groups({"read", "docgen:read"})
|
* @Groups({"read", "docgen:read"})
|
||||||
|
* @var Collection<Person>
|
||||||
*/
|
*/
|
||||||
private ?Collection $persons = null;
|
private Collection $persons;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_")
|
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_")
|
||||||
@@ -151,6 +153,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
|
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
|
||||||
* @Groups({"docgen:read"})
|
* @Groups({"docgen:read"})
|
||||||
|
* @var Collection<ActivityReason>
|
||||||
*/
|
*/
|
||||||
private Collection $reasons;
|
private Collection $reasons;
|
||||||
|
|
||||||
@@ -170,6 +173,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction")
|
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction")
|
||||||
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction")
|
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction")
|
||||||
* @Groups({"read", "docgen:read"})
|
* @Groups({"read", "docgen:read"})
|
||||||
|
* @var Collection<SocialAction>
|
||||||
*/
|
*/
|
||||||
private Collection $socialActions;
|
private Collection $socialActions;
|
||||||
|
|
||||||
@@ -177,14 +181,16 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialIssue")
|
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialIssue")
|
||||||
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue")
|
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue")
|
||||||
* @Groups({"read", "docgen:read"})
|
* @Groups({"read", "docgen:read"})
|
||||||
|
* @var Collection<SocialIssue>
|
||||||
*/
|
*/
|
||||||
private Collection $socialIssues;
|
private Collection $socialIssues;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
|
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
|
||||||
* @Groups({"read", "docgen:read"})
|
* @Groups({"read", "docgen:read"})
|
||||||
|
* @var Collection<ThirdParty>
|
||||||
*/
|
*/
|
||||||
private ?Collection $thirdParties = null;
|
private Collection $thirdParties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="time", nullable=true)
|
* @ORM\Column(type="time", nullable=true)
|
||||||
@@ -200,8 +206,9 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User")
|
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User")
|
||||||
* @Groups({"read", "docgen:read"})
|
* @Groups({"read", "docgen:read"})
|
||||||
|
* @var Collection<User>
|
||||||
*/
|
*/
|
||||||
private ?Collection $users = null;
|
private Collection $users;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
@@ -23,10 +23,9 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
class ActivityReason
|
class ActivityReason
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var bool
|
|
||||||
* @ORM\Column(type="boolean")
|
* @ORM\Column(type="boolean")
|
||||||
*/
|
*/
|
||||||
private $active = true;
|
private bool $active = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ActivityReasonCategory
|
* @var ActivityReasonCategory
|
||||||
@@ -34,7 +33,7 @@ class ActivityReason
|
|||||||
* targetEntity="Chill\ActivityBundle\Entity\ActivityReasonCategory",
|
* targetEntity="Chill\ActivityBundle\Entity\ActivityReasonCategory",
|
||||||
* inversedBy="reasons")
|
* inversedBy="reasons")
|
||||||
*/
|
*/
|
||||||
private $category;
|
private ?ActivityReasonCategory $category = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
@@ -43,13 +42,13 @@ class ActivityReason
|
|||||||
* @ORM\Column(name="id", type="integer")
|
* @ORM\Column(name="id", type="integer")
|
||||||
* @ORM\GeneratedValue(strategy="AUTO")
|
* @ORM\GeneratedValue(strategy="AUTO")
|
||||||
*/
|
*/
|
||||||
private $id;
|
private ?int $id = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
* @ORM\Column(type="json")
|
* @ORM\Column(type="json")
|
||||||
*/
|
*/
|
||||||
private $name;
|
private array $name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get active.
|
* Get active.
|
||||||
@@ -81,27 +80,9 @@ class ActivityReason
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get name.
|
* Get name.
|
||||||
*
|
|
||||||
* @param mixed|null $locale
|
|
||||||
*
|
|
||||||
* @return array | string
|
|
||||||
*/
|
*/
|
||||||
public function getName($locale = null)
|
public function getName(): array
|
||||||
{
|
{
|
||||||
if ($locale) {
|
|
||||||
if (isset($this->name[$locale])) {
|
|
||||||
return $this->name[$locale];
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($this->name as $name) {
|
|
||||||
if (!empty($name)) {
|
|
||||||
return $name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Entity;
|
namespace Chill\ActivityBundle\Entity;
|
||||||
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,7 +22,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
* @ORM\Table(name="activityreasoncategory")
|
* @ORM\Table(name="activityreasoncategory")
|
||||||
* @ORM\HasLifecycleCallbacks
|
* @ORM\HasLifecycleCallbacks
|
||||||
*/
|
*/
|
||||||
class ActivityReasonCategory
|
class ActivityReasonCategory implements \Stringable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
@@ -47,12 +48,12 @@ class ActivityReasonCategory
|
|||||||
/**
|
/**
|
||||||
* Array of ActivityReason.
|
* Array of ActivityReason.
|
||||||
*
|
*
|
||||||
* @var ArrayCollection
|
* @var Collection<ActivityReason>
|
||||||
* @ORM\OneToMany(
|
* @ORM\OneToMany(
|
||||||
* targetEntity="Chill\ActivityBundle\Entity\ActivityReason",
|
* targetEntity="Chill\ActivityBundle\Entity\ActivityReason",
|
||||||
* mappedBy="category")
|
* mappedBy="category")
|
||||||
*/
|
*/
|
||||||
private $reasons;
|
private Collection $reasons;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ActivityReasonCategory constructor.
|
* ActivityReasonCategory constructor.
|
||||||
@@ -65,7 +66,7 @@ class ActivityReasonCategory
|
|||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __toString()
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
return 'ActivityReasonCategory(' . $this->getName('x') . ')';
|
return 'ActivityReasonCategory(' . $this->getName('x') . ')';
|
||||||
}
|
}
|
||||||
|
@@ -275,10 +275,8 @@ class ActivityType
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @Assert\Callback
|
* @Assert\Callback
|
||||||
*
|
|
||||||
* @param mixed $payload
|
|
||||||
*/
|
*/
|
||||||
public function checkSocialActionsVisibility(ExecutionContextInterface $context, $payload)
|
public function checkSocialActionsVisibility(ExecutionContextInterface $context, mixed $payload)
|
||||||
{
|
{
|
||||||
if ($this->socialIssuesVisible !== $this->socialActionsVisible) {
|
if ($this->socialIssuesVisible !== $this->socialActionsVisible) {
|
||||||
if (!(2 === $this->socialIssuesVisible && 1 === $this->socialActionsVisible)) {
|
if (!(2 === $this->socialIssuesVisible && 1 === $this->socialActionsVisible)) {
|
||||||
|
@@ -22,14 +22,8 @@ use function in_array;
|
|||||||
|
|
||||||
class ActivityEntityListener
|
class ActivityEntityListener
|
||||||
{
|
{
|
||||||
private EntityManagerInterface $em;
|
public function __construct(private EntityManagerInterface $em, private AccompanyingPeriodWorkRepository $workRepository)
|
||||||
|
|
||||||
private AccompanyingPeriodWorkRepository $workRepository;
|
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $em, AccompanyingPeriodWorkRepository $workRepository)
|
|
||||||
{
|
{
|
||||||
$this->em = $em;
|
|
||||||
$this->workRepository = $workRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function persistActionToCourse(Activity $activity)
|
public function persistActionToCourse(Activity $activity)
|
||||||
|
@@ -20,16 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ByCreatorAggregator implements AggregatorInterface
|
class ByCreatorAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private UserRender $userRender;
|
public function __construct(private UserRepositoryInterface $userRepository, private UserRender $userRender)
|
||||||
|
{
|
||||||
private UserRepositoryInterface $userRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
UserRepositoryInterface $userRepository,
|
|
||||||
UserRender $userRender
|
|
||||||
) {
|
|
||||||
$this->userRepository = $userRepository;
|
|
||||||
$this->userRender = $userRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
|||||||
|
|
||||||
class BySocialActionAggregator implements AggregatorInterface
|
class BySocialActionAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private SocialActionRender $actionRender;
|
public function __construct(private SocialActionRender $actionRender, private SocialActionRepository $actionRepository)
|
||||||
|
{
|
||||||
private SocialActionRepository $actionRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
SocialActionRender $actionRender,
|
|
||||||
SocialActionRepository $actionRepository
|
|
||||||
) {
|
|
||||||
$this->actionRender = $actionRender;
|
|
||||||
$this->actionRepository = $actionRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
|||||||
|
|
||||||
class BySocialIssueAggregator implements AggregatorInterface
|
class BySocialIssueAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private SocialIssueRender $issueRender;
|
public function __construct(private SocialIssueRepository $issueRepository, private SocialIssueRender $issueRender)
|
||||||
|
{
|
||||||
private SocialIssueRepository $issueRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
SocialIssueRepository $issueRepository,
|
|
||||||
SocialIssueRender $issueRender
|
|
||||||
) {
|
|
||||||
$this->issueRepository = $issueRepository;
|
|
||||||
$this->issueRender = $issueRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
|||||||
|
|
||||||
class ByThirdpartyAggregator implements AggregatorInterface
|
class ByThirdpartyAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private ThirdPartyRender $thirdPartyRender;
|
public function __construct(private ThirdPartyRepository $thirdPartyRepository, private ThirdPartyRender $thirdPartyRender)
|
||||||
|
{
|
||||||
private ThirdPartyRepository $thirdPartyRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
ThirdPartyRepository $thirdPartyRepository,
|
|
||||||
ThirdPartyRender $thirdPartyRender
|
|
||||||
) {
|
|
||||||
$this->thirdPartyRepository = $thirdPartyRepository;
|
|
||||||
$this->thirdPartyRender = $thirdPartyRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
|||||||
|
|
||||||
class CreatorScopeAggregator implements AggregatorInterface
|
class CreatorScopeAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private ScopeRepository $scopeRepository;
|
public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||||
|
{
|
||||||
private TranslatableStringHelper $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
ScopeRepository $scopeRepository,
|
|
||||||
TranslatableStringHelper $translatableStringHelper
|
|
||||||
) {
|
|
||||||
$this->scopeRepository = $scopeRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -94,17 +94,9 @@ class DateAggregator implements AggregatorInterface
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($data['frequency']) {
|
return match ($data['frequency']) {
|
||||||
case 'month':
|
default => $value,
|
||||||
case 'week':
|
};
|
||||||
//return $this->translator->trans('for week') .' '. $value ;
|
|
||||||
|
|
||||||
case 'year':
|
|
||||||
//return $this->translator->trans('in year') .' '. $value ;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
|||||||
|
|
||||||
class LocationTypeAggregator implements AggregatorInterface
|
class LocationTypeAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private LocationTypeRepository $locationTypeRepository;
|
public function __construct(private LocationTypeRepository $locationTypeRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||||
|
{
|
||||||
private TranslatableStringHelper $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
LocationTypeRepository $locationTypeRepository,
|
|
||||||
TranslatableStringHelper $translatableStringHelper
|
|
||||||
) {
|
|
||||||
$this->locationTypeRepository = $locationTypeRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -0,0 +1,80 @@
|
|||||||
|
<?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\ActivityTypeRepositoryInterface;
|
||||||
|
use Chill\MainBundle\Export\AggregatorInterface;
|
||||||
|
use Chill\MainBundle\Repository\LocationRepository;
|
||||||
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
|
use Closure;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
|
final readonly class ActivityLocationAggregator implements AggregatorInterface
|
||||||
|
{
|
||||||
|
public const KEY = 'activity_location_aggregator';
|
||||||
|
|
||||||
|
public function addRole(): ?string
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
|
{
|
||||||
|
if (!in_array('actloc', $qb->getAllAliases(), true)) {
|
||||||
|
$qb->leftJoin('activity.location', 'actloc');
|
||||||
|
}
|
||||||
|
$qb->addSelect(sprintf('actloc.name AS %s', self::KEY));
|
||||||
|
$qb->addGroupBy(self::KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function applyOn(): string
|
||||||
|
{
|
||||||
|
return Declarations::ACTIVITY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
{
|
||||||
|
// no form required for this aggregator
|
||||||
|
}
|
||||||
|
public function getFormDefaultData(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLabels($key, array $values, $data): Closure
|
||||||
|
{
|
||||||
|
return function ($value): string {
|
||||||
|
if ('_header' === $value) {
|
||||||
|
return 'export.aggregator.activity.by_location.Activity Location';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null === $value || '' === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getQueryKeys($data): array
|
||||||
|
{
|
||||||
|
return [self::KEY];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitle()
|
||||||
|
{
|
||||||
|
return 'export.aggregator.activity.by_location.Title';
|
||||||
|
}
|
||||||
|
}
|
@@ -24,16 +24,8 @@ class ActivityTypeAggregator implements AggregatorInterface
|
|||||||
{
|
{
|
||||||
public const KEY = 'activity_type_aggregator';
|
public const KEY = 'activity_type_aggregator';
|
||||||
|
|
||||||
protected ActivityTypeRepositoryInterface $activityTypeRepository;
|
public function __construct(protected ActivityTypeRepositoryInterface $activityTypeRepository, protected TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
{
|
||||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
ActivityTypeRepositoryInterface $activityTypeRepository,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper
|
|
||||||
) {
|
|
||||||
$this->activityTypeRepository = $activityTypeRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -23,16 +23,8 @@ class ActivityUserAggregator implements AggregatorInterface
|
|||||||
{
|
{
|
||||||
public const KEY = 'activity_user_id';
|
public const KEY = 'activity_user_id';
|
||||||
|
|
||||||
private UserRender $userRender;
|
public function __construct(private UserRepository $userRepository, private UserRender $userRender)
|
||||||
|
{
|
||||||
private UserRepository $userRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
UserRepository $userRepository,
|
|
||||||
UserRender $userRender
|
|
||||||
) {
|
|
||||||
$this->userRepository = $userRepository;
|
|
||||||
$this->userRender = $userRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -21,14 +21,8 @@ use function in_array;
|
|||||||
|
|
||||||
class ActivityUsersAggregator implements AggregatorInterface
|
class ActivityUsersAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private UserRender $userRender;
|
public function __construct(private UserRepositoryInterface $userRepository, private UserRender $userRender)
|
||||||
|
|
||||||
private UserRepositoryInterface $userRepository;
|
|
||||||
|
|
||||||
public function __construct(UserRepositoryInterface $userRepository, UserRender $userRender)
|
|
||||||
{
|
{
|
||||||
$this->userRepository = $userRepository;
|
|
||||||
$this->userRender = $userRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -20,14 +20,8 @@ use function in_array;
|
|||||||
|
|
||||||
class ActivityUsersJobAggregator implements \Chill\MainBundle\Export\AggregatorInterface
|
class ActivityUsersJobAggregator implements \Chill\MainBundle\Export\AggregatorInterface
|
||||||
{
|
{
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
public function __construct(private UserJobRepositoryInterface $userJobRepository, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
|
||||||
private UserJobRepositoryInterface $userJobRepository;
|
|
||||||
|
|
||||||
public function __construct(UserJobRepositoryInterface $userJobRepository, TranslatableStringHelperInterface $translatableStringHelper)
|
|
||||||
{
|
{
|
||||||
$this->userJobRepository = $userJobRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -20,14 +20,8 @@ use function in_array;
|
|||||||
|
|
||||||
class ActivityUsersScopeAggregator implements \Chill\MainBundle\Export\AggregatorInterface
|
class ActivityUsersScopeAggregator implements \Chill\MainBundle\Export\AggregatorInterface
|
||||||
{
|
{
|
||||||
private ScopeRepositoryInterface $scopeRepository;
|
public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(ScopeRepositoryInterface $scopeRepository, TranslatableStringHelperInterface $translatableStringHelper)
|
|
||||||
{
|
{
|
||||||
$this->scopeRepository = $scopeRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -30,20 +30,8 @@ use function in_array;
|
|||||||
|
|
||||||
class ActivityReasonAggregator implements AggregatorInterface, ExportElementValidatedInterface
|
class ActivityReasonAggregator implements AggregatorInterface, ExportElementValidatedInterface
|
||||||
{
|
{
|
||||||
protected ActivityReasonCategoryRepository $activityReasonCategoryRepository;
|
public function __construct(protected ActivityReasonCategoryRepository $activityReasonCategoryRepository, protected ActivityReasonRepository $activityReasonRepository, protected TranslatableStringHelper $translatableStringHelper)
|
||||||
|
{
|
||||||
protected ActivityReasonRepository $activityReasonRepository;
|
|
||||||
|
|
||||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
ActivityReasonCategoryRepository $activityReasonCategoryRepository,
|
|
||||||
ActivityReasonRepository $activityReasonRepository,
|
|
||||||
TranslatableStringHelper $translatableStringHelper
|
|
||||||
) {
|
|
||||||
$this->activityReasonCategoryRepository = $activityReasonCategoryRepository;
|
|
||||||
$this->activityReasonRepository = $activityReasonRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
@@ -117,21 +105,11 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
|||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
// for performance reason, we load data from db only once
|
match ($data['level']) {
|
||||||
switch ($data['level']) {
|
'reasons' => $this->activityReasonRepository->findBy(['id' => $values]),
|
||||||
case 'reasons':
|
'categories' => $this->activityReasonCategoryRepository->findBy(['id' => $values]),
|
||||||
$this->activityReasonRepository->findBy(['id' => $values]);
|
default => throw new RuntimeException(sprintf("The level data '%s' is invalid.", $data['level'])),
|
||||||
|
};
|
||||||
break;
|
|
||||||
|
|
||||||
case 'categories':
|
|
||||||
$this->activityReasonCategoryRepository->findBy(['id' => $values]);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new RuntimeException(sprintf("The level data '%s' is invalid.", $data['level']));
|
|
||||||
}
|
|
||||||
|
|
||||||
return function ($value) use ($data) {
|
return function ($value) use ($data) {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
|
@@ -20,11 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
|
|
||||||
class SentReceivedAggregator implements AggregatorInterface
|
class SentReceivedAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private TranslatorInterface $translator;
|
public function __construct(private TranslatorInterface $translator)
|
||||||
|
|
||||||
public function __construct(TranslatorInterface $translator)
|
|
||||||
{
|
{
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -24,20 +24,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ListActivity implements ListInterface, GroupedExportInterface
|
class ListActivity implements ListInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
private EntityManagerInterface $entityManager;
|
public function __construct(private ListActivityHelper $helper, private EntityManagerInterface $entityManager, private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper)
|
||||||
|
{
|
||||||
private ListActivityHelper $helper;
|
|
||||||
|
|
||||||
private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
ListActivityHelper $helper,
|
|
||||||
EntityManagerInterface $entityManager,
|
|
||||||
TranslatableStringExportLabelHelper $translatableStringExportLabelHelper
|
|
||||||
) {
|
|
||||||
$this->helper = $helper;
|
|
||||||
$this->entityManager = $entityManager;
|
|
||||||
$this->translatableStringExportLabelHelper = $translatableStringExportLabelHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
@@ -66,22 +54,17 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
switch ($key) {
|
return match ($key) {
|
||||||
case 'acpId':
|
'acpId' => static function ($value) {
|
||||||
return static function ($value) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return ListActivityHelper::MSG_KEY . 'accompanying course id';
|
return ListActivityHelper::MSG_KEY . 'accompanying course id';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value ?? '';
|
return $value ?? '';
|
||||||
|
},
|
||||||
|
'scopesNames' => $this->translatableStringExportLabelHelper->getLabelMulti($key, $values, ListActivityHelper::MSG_KEY . 'course circles'),
|
||||||
|
default => $this->helper->getLabels($key, $values, $data),
|
||||||
};
|
};
|
||||||
|
|
||||||
case 'scopesNames':
|
|
||||||
return $this->translatableStringExportLabelHelper->getLabelMulti($key, $values, ListActivityHelper::MSG_KEY . 'course circles');
|
|
||||||
|
|
||||||
default:
|
|
||||||
return $this->helper->getLabels($key, $values, $data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data)
|
||||||
|
@@ -24,12 +24,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class CountActivity implements ExportInterface, GroupedExportInterface
|
class CountActivity implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
protected ActivityRepository $activityRepository;
|
public function __construct(protected ActivityRepository $activityRepository)
|
||||||
|
{
|
||||||
public function __construct(
|
|
||||||
ActivityRepository $activityRepository
|
|
||||||
) {
|
|
||||||
$this->activityRepository = $activityRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
@@ -36,8 +36,6 @@ use function in_array;
|
|||||||
|
|
||||||
class ListActivity implements ListInterface, GroupedExportInterface
|
class ListActivity implements ListInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
protected EntityManagerInterface $entityManager;
|
|
||||||
|
|
||||||
protected array $fields = [
|
protected array $fields = [
|
||||||
'id',
|
'id',
|
||||||
'date',
|
'date',
|
||||||
@@ -52,22 +50,8 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
|||||||
'person_id',
|
'person_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
public function __construct(protected EntityManagerInterface $entityManager, protected TranslatorInterface $translator, protected TranslatableStringHelperInterface $translatableStringHelper, private ActivityRepository $activityRepository)
|
||||||
|
{
|
||||||
protected TranslatorInterface $translator;
|
|
||||||
|
|
||||||
private ActivityRepository $activityRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
EntityManagerInterface $em,
|
|
||||||
TranslatorInterface $translator,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper,
|
|
||||||
ActivityRepository $activityRepository
|
|
||||||
) {
|
|
||||||
$this->entityManager = $em;
|
|
||||||
$this->translator = $translator;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->activityRepository = $activityRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
@@ -32,22 +32,16 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface
|
|||||||
{
|
{
|
||||||
public const SUM = 'sum';
|
public const SUM = 'sum';
|
||||||
|
|
||||||
/**
|
|
||||||
* The action for this report.
|
|
||||||
*/
|
|
||||||
protected string $action;
|
|
||||||
|
|
||||||
private ActivityRepository $activityRepository;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $action the stat to perform
|
* @param string $action the stat to perform
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ActivityRepository $activityRepository,
|
private ActivityRepository $activityRepository,
|
||||||
string $action = 'sum'
|
/**
|
||||||
|
* The action for this report.
|
||||||
|
*/
|
||||||
|
protected string $action = 'sum'
|
||||||
) {
|
) {
|
||||||
$this->action = $action;
|
|
||||||
$this->activityRepository = $activityRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
@@ -32,44 +32,8 @@ class ListActivityHelper
|
|||||||
{
|
{
|
||||||
public const MSG_KEY = 'export.list.activity.';
|
public const MSG_KEY = 'export.list.activity.';
|
||||||
|
|
||||||
private ActivityPresenceRepositoryInterface $activityPresenceRepository;
|
public function __construct(private ActivityPresenceRepositoryInterface $activityPresenceRepository, private ActivityTypeRepositoryInterface $activityTypeRepository, private DateTimeHelper $dateTimeHelper, private LabelPersonHelper $labelPersonHelper, private LabelThirdPartyHelper $labelThirdPartyHelper, private TranslatorInterface $translator, private TranslatableStringHelperInterface $translatableStringHelper, private TranslatableStringExportLabelHelper $translatableStringLabelHelper, private UserHelper $userHelper)
|
||||||
|
{
|
||||||
private ActivityTypeRepositoryInterface $activityTypeRepository;
|
|
||||||
|
|
||||||
private DateTimeHelper $dateTimeHelper;
|
|
||||||
|
|
||||||
private LabelPersonHelper $labelPersonHelper;
|
|
||||||
|
|
||||||
private LabelThirdPartyHelper $labelThirdPartyHelper;
|
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
private TranslatableStringExportLabelHelper $translatableStringLabelHelper;
|
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
|
||||||
|
|
||||||
private UserHelper $userHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
ActivityPresenceRepositoryInterface $activityPresenceRepository,
|
|
||||||
ActivityTypeRepositoryInterface $activityTypeRepository,
|
|
||||||
DateTimeHelper $dateTimeHelper,
|
|
||||||
LabelPersonHelper $labelPersonHelper,
|
|
||||||
LabelThirdPartyHelper $labelThirdPartyHelper,
|
|
||||||
TranslatorInterface $translator,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper,
|
|
||||||
TranslatableStringExportLabelHelper $translatableStringLabelHelper,
|
|
||||||
UserHelper $userHelper
|
|
||||||
) {
|
|
||||||
$this->activityPresenceRepository = $activityPresenceRepository;
|
|
||||||
$this->activityTypeRepository = $activityTypeRepository;
|
|
||||||
$this->dateTimeHelper = $dateTimeHelper;
|
|
||||||
$this->labelPersonHelper = $labelPersonHelper;
|
|
||||||
$this->labelThirdPartyHelper = $labelThirdPartyHelper;
|
|
||||||
$this->translator = $translator;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->translatableStringLabelHelper = $translatableStringLabelHelper;
|
|
||||||
$this->userHelper = $userHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addSelect(QueryBuilder $qb): void
|
public function addSelect(QueryBuilder $qb): void
|
||||||
@@ -115,20 +79,11 @@ class ListActivityHelper
|
|||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
switch ($key) {
|
return match ($key) {
|
||||||
case 'createdAt':
|
'createdAt', 'updatedAt' => $this->dateTimeHelper->getLabel($key),
|
||||||
case 'updatedAt':
|
'createdBy', 'updatedBy' => $this->userHelper->getLabel($key, $values, $key),
|
||||||
return $this->dateTimeHelper->getLabel($key);
|
'date' => $this->dateTimeHelper->getLabel(self::MSG_KEY . $key),
|
||||||
|
'attendeeName' => function ($value) {
|
||||||
case 'createdBy':
|
|
||||||
case 'updatedBy':
|
|
||||||
return $this->userHelper->getLabel($key, $values, $key);
|
|
||||||
|
|
||||||
case 'date':
|
|
||||||
return $this->dateTimeHelper->getLabel(self::MSG_KEY . $key);
|
|
||||||
|
|
||||||
case 'attendeeName':
|
|
||||||
return function ($value) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'Attendee';
|
return 'Attendee';
|
||||||
}
|
}
|
||||||
@@ -138,13 +93,9 @@ class ListActivityHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize($presence->getName());
|
return $this->translatableStringHelper->localize($presence->getName());
|
||||||
};
|
},
|
||||||
|
'listReasons' => $this->translatableStringLabelHelper->getLabelMulti($key, $values, 'Activity Reasons'),
|
||||||
case 'listReasons':
|
'typeName' => function ($value) {
|
||||||
return $this->translatableStringLabelHelper->getLabelMulti($key, $values, 'Activity Reasons');
|
|
||||||
|
|
||||||
case 'typeName':
|
|
||||||
return function ($value) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'Activity type';
|
return 'Activity type';
|
||||||
}
|
}
|
||||||
@@ -154,29 +105,15 @@ class ListActivityHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize($type->getName());
|
return $this->translatableStringHelper->localize($type->getName());
|
||||||
};
|
},
|
||||||
|
'usersNames' => $this->userHelper->getLabelMulti($key, $values, self::MSG_KEY . 'users name'),
|
||||||
case 'usersNames':
|
'usersIds', 'thirdPartiesIds', 'personsIds' => static function ($value) use ($key) {
|
||||||
return $this->userHelper->getLabelMulti($key, $values, self::MSG_KEY . 'users name');
|
|
||||||
|
|
||||||
case 'usersIds':
|
|
||||||
case 'thirdPartiesIds':
|
|
||||||
case 'personsIds':
|
|
||||||
return static function ($value) use ($key) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
switch ($key) {
|
return match ($key) {
|
||||||
case 'usersIds':
|
'usersIds' => self::MSG_KEY . 'users ids',
|
||||||
return self::MSG_KEY . 'users ids';
|
'thirdPartiesIds' => self::MSG_KEY . 'third parties ids',
|
||||||
|
'personsIds' => self::MSG_KEY . 'persons ids',
|
||||||
case 'thirdPartiesIds':
|
};
|
||||||
return self::MSG_KEY . 'third parties ids';
|
|
||||||
|
|
||||||
case 'personsIds':
|
|
||||||
return self::MSG_KEY . 'persons ids';
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new LogicException('key not supported');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$decoded = json_decode($value, null, 512, JSON_THROW_ON_ERROR);
|
$decoded = json_decode($value, null, 512, JSON_THROW_ON_ERROR);
|
||||||
@@ -188,16 +125,10 @@ class ListActivityHelper
|
|||||||
SORT_NUMERIC
|
SORT_NUMERIC
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
};
|
},
|
||||||
|
'personsNames' => $this->labelPersonHelper->getLabelMulti($key, $values, self::MSG_KEY . 'persons name'),
|
||||||
case 'personsNames':
|
'thirdPartiesNames' => $this->labelThirdPartyHelper->getLabelMulti($key, $values, self::MSG_KEY . 'thirds parties'),
|
||||||
return $this->labelPersonHelper->getLabelMulti($key, $values, self::MSG_KEY . 'persons name');
|
'sentReceived' => function ($value) {
|
||||||
|
|
||||||
case 'thirdPartiesNames':
|
|
||||||
return $this->labelThirdPartyHelper->getLabelMulti($key, $values, self::MSG_KEY . 'thirds parties');
|
|
||||||
|
|
||||||
case 'sentReceived':
|
|
||||||
return function ($value) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return self::MSG_KEY . 'sent received';
|
return self::MSG_KEY . 'sent received';
|
||||||
}
|
}
|
||||||
@@ -207,10 +138,8 @@ class ListActivityHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->translator->trans($value);
|
return $this->translator->trans($value);
|
||||||
};
|
},
|
||||||
|
default => function ($value) use ($key) {
|
||||||
default:
|
|
||||||
return function ($value) use ($key) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return self::MSG_KEY . $key;
|
return self::MSG_KEY . $key;
|
||||||
}
|
}
|
||||||
@@ -220,9 +149,9 @@ class ListActivityHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->translator->trans($value);
|
return $this->translator->trans($value);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data)
|
||||||
{
|
{
|
||||||
|
@@ -23,16 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ActivityTypeFilter implements FilterInterface
|
class ActivityTypeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private ActivityTypeRepositoryInterface $activityTypeRepository;
|
public function __construct(private ActivityTypeRepositoryInterface $activityTypeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
{
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
ActivityTypeRepositoryInterface $activityTypeRepository,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper
|
|
||||||
) {
|
|
||||||
$this->activityTypeRepository = $activityTypeRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -20,11 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ByCreatorFilter implements FilterInterface
|
class ByCreatorFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private UserRender $userRender;
|
public function __construct(private UserRender $userRender)
|
||||||
|
|
||||||
public function __construct(UserRender $userRender)
|
|
||||||
{
|
{
|
||||||
$this->userRender = $userRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -22,11 +22,8 @@ use function in_array;
|
|||||||
|
|
||||||
class BySocialActionFilter implements FilterInterface
|
class BySocialActionFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private SocialActionRender $actionRender;
|
public function __construct(private SocialActionRender $actionRender)
|
||||||
|
|
||||||
public function __construct(SocialActionRender $actionRender)
|
|
||||||
{
|
{
|
||||||
$this->actionRender = $actionRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -22,11 +22,8 @@ use function in_array;
|
|||||||
|
|
||||||
class BySocialIssueFilter implements FilterInterface
|
class BySocialIssueFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private SocialIssueRender $issueRender;
|
public function __construct(private SocialIssueRender $issueRender)
|
||||||
|
|
||||||
public function __construct(SocialIssueRender $issueRender)
|
|
||||||
{
|
{
|
||||||
$this->issueRender = $issueRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -28,11 +28,8 @@ class EmergencyFilter implements FilterInterface
|
|||||||
|
|
||||||
private const DEFAULT_CHOICE = false;
|
private const DEFAULT_CHOICE = false;
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
public function __construct(private TranslatorInterface $translator)
|
||||||
|
|
||||||
public function __construct(TranslatorInterface $translator)
|
|
||||||
{
|
{
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -22,11 +22,8 @@ use function in_array;
|
|||||||
|
|
||||||
class LocationTypeFilter implements FilterInterface
|
class LocationTypeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private TranslatableStringHelper $translatableStringHelper;
|
public function __construct(private TranslatableStringHelper $translatableStringHelper)
|
||||||
|
|
||||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
|
||||||
{
|
{
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -29,11 +29,8 @@ class SentReceivedFilter implements FilterInterface
|
|||||||
|
|
||||||
private const DEFAULT_CHOICE = Activity::SENTRECEIVED_SENT;
|
private const DEFAULT_CHOICE = Activity::SENTRECEIVED_SENT;
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
public function __construct(private TranslatorInterface $translator)
|
||||||
|
|
||||||
public function __construct(TranslatorInterface $translator)
|
|
||||||
{
|
{
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -21,11 +21,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class UserFilter implements FilterInterface
|
class UserFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private UserRender $userRender;
|
public function __construct(private UserRender $userRender)
|
||||||
|
|
||||||
public function __construct(UserRender $userRender)
|
|
||||||
{
|
{
|
||||||
$this->userRender = $userRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -23,11 +23,8 @@ use function in_array;
|
|||||||
|
|
||||||
class UserScopeFilter implements FilterInterface
|
class UserScopeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private TranslatableStringHelper $translatableStringHelper;
|
public function __construct(private TranslatableStringHelper $translatableStringHelper)
|
||||||
|
|
||||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
|
||||||
{
|
{
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -27,16 +27,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
|
|
||||||
class ActivityDateFilter implements FilterInterface
|
class ActivityDateFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
protected TranslatorInterface $translator;
|
public function __construct(protected TranslatorInterface $translator, private RollingDateConverterInterface $rollingDateConverter)
|
||||||
|
{
|
||||||
private RollingDateConverterInterface $rollingDateConverter;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
TranslatorInterface $translator,
|
|
||||||
RollingDateConverterInterface $rollingDateConverter
|
|
||||||
) {
|
|
||||||
$this->translator = $translator;
|
|
||||||
$this->rollingDateConverter = $rollingDateConverter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -26,16 +26,8 @@ use function count;
|
|||||||
|
|
||||||
class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInterface
|
class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInterface
|
||||||
{
|
{
|
||||||
protected ActivityTypeRepositoryInterface $activityTypeRepository;
|
public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, protected ActivityTypeRepositoryInterface $activityTypeRepository)
|
||||||
|
{
|
||||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper,
|
|
||||||
ActivityTypeRepositoryInterface $activityTypeRepository
|
|
||||||
) {
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->activityTypeRepository = $activityTypeRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -20,11 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ActivityUsersFilter implements FilterInterface
|
class ActivityUsersFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private UserRender $userRender;
|
public function __construct(private UserRender $userRender)
|
||||||
|
|
||||||
public function __construct(UserRender $userRender)
|
|
||||||
{
|
{
|
||||||
$this->userRender = $userRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -29,16 +29,8 @@ use function in_array;
|
|||||||
|
|
||||||
class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInterface
|
class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInterface
|
||||||
{
|
{
|
||||||
protected ActivityReasonRepository $activityReasonRepository;
|
public function __construct(protected TranslatableStringHelper $translatableStringHelper, protected ActivityReasonRepository $activityReasonRepository)
|
||||||
|
{
|
||||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
TranslatableStringHelper $helper,
|
|
||||||
ActivityReasonRepository $activityReasonRepository
|
|
||||||
) {
|
|
||||||
$this->translatableStringHelper = $helper;
|
|
||||||
$this->activityReasonRepository = $activityReasonRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -37,20 +37,8 @@ use function count;
|
|||||||
|
|
||||||
class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInterface, FilterInterface
|
class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInterface, FilterInterface
|
||||||
{
|
{
|
||||||
protected ActivityReasonRepository $activityReasonRepository;
|
public function __construct(protected TranslatableStringHelper $translatableStringHelper, protected ActivityReasonRepository $activityReasonRepository, protected TranslatorInterface $translator)
|
||||||
|
{
|
||||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
protected TranslatorInterface $translator;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
TranslatableStringHelper $translatableStringHelper,
|
|
||||||
ActivityReasonRepository $activityReasonRepository,
|
|
||||||
TranslatorInterface $translator
|
|
||||||
) {
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->activityReasonRepository = $activityReasonRepository;
|
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -22,11 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class UsersJobFilter implements FilterInterface
|
class UsersJobFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
public function __construct(private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
|
||||||
public function __construct(TranslatableStringHelperInterface $translatableStringHelper)
|
|
||||||
{
|
{
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -23,16 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class UsersScopeFilter implements FilterInterface
|
class UsersScopeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private ScopeRepositoryInterface $scopeRepository;
|
public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
{
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
ScopeRepositoryInterface $scopeRepository,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper
|
|
||||||
) {
|
|
||||||
$this->scopeRepository = $scopeRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -58,40 +58,22 @@ use function in_array;
|
|||||||
|
|
||||||
class ActivityType extends AbstractType
|
class ActivityType extends AbstractType
|
||||||
{
|
{
|
||||||
protected AuthorizationHelper $authorizationHelper;
|
|
||||||
|
|
||||||
protected ObjectManager $om;
|
|
||||||
|
|
||||||
protected SocialActionRender $socialActionRender;
|
|
||||||
|
|
||||||
protected SocialIssueRender $socialIssueRender;
|
|
||||||
|
|
||||||
protected array $timeChoices;
|
|
||||||
|
|
||||||
protected TranslatableStringHelper $translatableStringHelper;
|
|
||||||
|
|
||||||
protected User $user;
|
protected User $user;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
TokenStorageInterface $tokenStorage,
|
TokenStorageInterface $tokenStorage,
|
||||||
AuthorizationHelper $authorizationHelper,
|
protected AuthorizationHelper $authorizationHelper,
|
||||||
ObjectManager $om,
|
protected ObjectManager $om,
|
||||||
TranslatableStringHelper $translatableStringHelper,
|
protected TranslatableStringHelper $translatableStringHelper,
|
||||||
array $timeChoices,
|
protected array $timeChoices,
|
||||||
SocialIssueRender $socialIssueRender,
|
protected SocialIssueRender $socialIssueRender,
|
||||||
SocialActionRender $socialActionRender
|
protected SocialActionRender $socialActionRender
|
||||||
) {
|
) {
|
||||||
if (!$tokenStorage->getToken()->getUser() instanceof User) {
|
if (!$tokenStorage->getToken()->getUser() instanceof User) {
|
||||||
throw new RuntimeException('you should have a valid user');
|
throw new RuntimeException('you should have a valid user');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->user = $tokenStorage->getToken()->getUser();
|
$this->user = $tokenStorage->getToken()->getUser();
|
||||||
$this->authorizationHelper = $authorizationHelper;
|
|
||||||
$this->om = $om;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->timeChoices = $timeChoices;
|
|
||||||
$this->socialIssueRender = $socialIssueRender;
|
|
||||||
$this->socialActionRender = $socialActionRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
|
@@ -25,11 +25,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||||||
|
|
||||||
class ActivityTypeType extends AbstractType
|
class ActivityTypeType extends AbstractType
|
||||||
{
|
{
|
||||||
private TranslatableStringHelper $translatableStringHelper;
|
public function __construct(private TranslatableStringHelper $translatableStringHelper)
|
||||||
|
|
||||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
|
||||||
{
|
{
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
|
@@ -24,20 +24,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||||||
*/
|
*/
|
||||||
class PickActivityReasonType extends AbstractType
|
class PickActivityReasonType extends AbstractType
|
||||||
{
|
{
|
||||||
private ActivityReasonRepository $activityReasonRepository;
|
public function __construct(private ActivityReasonRepository $activityReasonRepository, private ActivityReasonRender $reasonRender, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
{
|
||||||
private ActivityReasonRender $reasonRender;
|
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
ActivityReasonRepository $activityReasonRepository,
|
|
||||||
ActivityReasonRender $reasonRender,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper
|
|
||||||
) {
|
|
||||||
$this->activityReasonRepository = $activityReasonRepository;
|
|
||||||
$this->reasonRender = $reasonRender;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
@@ -23,14 +23,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
*/
|
*/
|
||||||
class TranslatableActivityReasonCategoryType extends AbstractType
|
class TranslatableActivityReasonCategoryType extends AbstractType
|
||||||
{
|
{
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
public function __construct(private TranslatableStringHelperInterface $translatableStringHelper, private TranslatorInterface $translator)
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
|
||||||
|
|
||||||
public function __construct(TranslatableStringHelperInterface $translatableStringHelper, TranslatorInterface $translator)
|
|
||||||
{
|
{
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
@@ -20,16 +20,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||||||
|
|
||||||
class TranslatableActivityType extends AbstractType
|
class TranslatableActivityType extends AbstractType
|
||||||
{
|
{
|
||||||
protected ActivityTypeRepositoryInterface $activityTypeRepository;
|
public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, protected ActivityTypeRepositoryInterface $activityTypeRepository)
|
||||||
|
{
|
||||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
TranslatableStringHelperInterface $helper,
|
|
||||||
ActivityTypeRepositoryInterface $activityTypeRepository
|
|
||||||
) {
|
|
||||||
$this->translatableStringHelper = $helper;
|
|
||||||
$this->activityTypeRepository = $activityTypeRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
@@ -23,16 +23,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
*/
|
*/
|
||||||
class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
||||||
{
|
{
|
||||||
protected Security $security;
|
public function __construct(protected Security $security, protected TranslatorInterface $translator)
|
||||||
|
{
|
||||||
protected TranslatorInterface $translator;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
Security $security,
|
|
||||||
TranslatorInterface $translator
|
|
||||||
) {
|
|
||||||
$this->security = $security;
|
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
|
@@ -20,11 +20,8 @@ use Symfony\Component\Security\Core\Security;
|
|||||||
*/
|
*/
|
||||||
final class AdminMenuBuilder implements LocalMenuBuilderInterface
|
final class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||||
{
|
{
|
||||||
private Security $security;
|
public function __construct(private Security $security)
|
||||||
|
|
||||||
public function __construct(Security $security)
|
|
||||||
{
|
{
|
||||||
$this->security = $security;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
|
@@ -23,22 +23,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
*/
|
*/
|
||||||
final class PersonMenuBuilder implements LocalMenuBuilderInterface
|
final class PersonMenuBuilder implements LocalMenuBuilderInterface
|
||||||
{
|
{
|
||||||
/**
|
public function __construct(private AuthorizationCheckerInterface $authorizationChecker, private TranslatorInterface $translator)
|
||||||
* @var AuthorizationCheckerInterface
|
{
|
||||||
*/
|
|
||||||
private $authorizationChecker;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var TranslatorInterface
|
|
||||||
*/
|
|
||||||
private $translator;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
AuthorizationCheckerInterface $authorizationChecker,
|
|
||||||
TranslatorInterface $translator
|
|
||||||
) {
|
|
||||||
$this->translator = $translator;
|
|
||||||
$this->authorizationChecker = $authorizationChecker;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
|
@@ -18,11 +18,8 @@ use Chill\MainBundle\Notification\NotificationHandlerInterface;
|
|||||||
|
|
||||||
final class ActivityNotificationHandler implements NotificationHandlerInterface
|
final class ActivityNotificationHandler implements NotificationHandlerInterface
|
||||||
{
|
{
|
||||||
private ActivityRepository $activityRepository;
|
public function __construct(private ActivityRepository $activityRepository)
|
||||||
|
|
||||||
public function __construct(ActivityRepository $activityRepository)
|
|
||||||
{
|
{
|
||||||
$this->activityRepository = $activityRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTemplate(Notification $notification, array $options = []): string
|
public function getTemplate(Notification $notification, array $options = []): string
|
||||||
|
@@ -18,67 +18,193 @@ use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
|
|||||||
use Chill\MainBundle\Entity\Location;
|
use Chill\MainBundle\Entity\Location;
|
||||||
use Chill\MainBundle\Entity\LocationType;
|
use Chill\MainBundle\Entity\LocationType;
|
||||||
use Chill\MainBundle\Entity\Scope;
|
use Chill\MainBundle\Entity\Scope;
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface;
|
use Chill\MainBundle\Entity\UserJob;
|
||||||
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelperForCurrentUserInterface;
|
||||||
|
use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\AbstractQuery;
|
use Doctrine\ORM\AbstractQuery;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Doctrine\ORM\NonUniqueResultException;
|
||||||
|
use Doctrine\ORM\NoResultException;
|
||||||
|
use Doctrine\ORM\Query\Expr\Join;
|
||||||
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Security\Core\Role\Role;
|
use Symfony\Component\HttpFoundation\RequestStack;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
|
|
||||||
use function count;
|
use function count;
|
||||||
use function in_array;
|
use function in_array;
|
||||||
|
|
||||||
final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInterface
|
final readonly class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInterface
|
||||||
{
|
{
|
||||||
private AuthorizationHelper $authorizationHelper;
|
|
||||||
|
|
||||||
private CenterResolverDispatcherInterface $centerResolverDispatcher;
|
|
||||||
|
|
||||||
private EntityManagerInterface $em;
|
|
||||||
|
|
||||||
private ActivityRepository $repository;
|
|
||||||
|
|
||||||
private Security $security;
|
|
||||||
|
|
||||||
private TokenStorageInterface $tokenStorage;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
AuthorizationHelper $authorizationHelper,
|
private AuthorizationHelperForCurrentUserInterface $authorizationHelper,
|
||||||
CenterResolverDispatcherInterface $centerResolverDispatcher,
|
private CenterResolverManagerInterface $centerResolverManager,
|
||||||
TokenStorageInterface $tokenStorage,
|
private ActivityRepository $repository,
|
||||||
ActivityRepository $repository,
|
private EntityManagerInterface $em,
|
||||||
EntityManagerInterface $em,
|
private Security $security,
|
||||||
Security $security
|
private RequestStack $requestStack,
|
||||||
) {
|
) {
|
||||||
$this->authorizationHelper = $authorizationHelper;
|
|
||||||
$this->centerResolverDispatcher = $centerResolverDispatcher;
|
|
||||||
$this->tokenStorage = $tokenStorage;
|
|
||||||
$this->repository = $repository;
|
|
||||||
$this->em = $em;
|
|
||||||
$this->security = $security;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array
|
/**
|
||||||
|
* @throws NonUniqueResultException
|
||||||
|
* @throws NoResultException
|
||||||
|
*/
|
||||||
|
public function countByAccompanyingPeriod(AccompanyingPeriod $period, string $role, array $filters = []): int
|
||||||
{
|
{
|
||||||
$user = $this->security->getUser();
|
$qb = $this->buildBaseQuery($filters);
|
||||||
$center = $this->centerResolverDispatcher->resolveCenter($period);
|
|
||||||
|
|
||||||
if (0 === count($orderBy)) {
|
$qb
|
||||||
$orderBy = ['date' => 'DESC'];
|
->select('COUNT(a)')
|
||||||
|
->andWhere('a.accompanyingPeriod = :period')->setParameter('period', $period);
|
||||||
|
|
||||||
|
return $qb->getQuery()->getSingleScalarResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
$scopes = $this->authorizationHelper
|
public function countByPerson(Person $person, string $role, array $filters = []): int
|
||||||
->getReachableCircles($user, $role, $center);
|
{
|
||||||
|
$qb = $this->buildBaseQuery($filters);
|
||||||
|
|
||||||
return $this->em->getRepository(Activity::class)
|
$qb = $this->filterBaseQueryByPerson($qb, $person, $role);
|
||||||
->findByAccompanyingPeriod($period, $scopes, true, $limit, $start, $orderBy);
|
|
||||||
|
$qb->select('COUNT(a)');
|
||||||
|
|
||||||
|
return $qb->getQuery()->getSingleScalarResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, array $orderBy = ['date' => 'DESC'], array $filters = []): array
|
||||||
|
{
|
||||||
|
$qb = $this->buildBaseQuery($filters);
|
||||||
|
|
||||||
|
$qb->andWhere('a.accompanyingPeriod = :period')->setParameter('period', $period);
|
||||||
|
|
||||||
|
foreach ($orderBy as $field => $order) {
|
||||||
|
$qb->addOrderBy('a.' . $field, $order);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null !== $start) {
|
||||||
|
$qb->setFirstResult($start);
|
||||||
|
}
|
||||||
|
if (null !== $limit) {
|
||||||
|
$qb->setMaxResults($limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $qb->getQuery()->getResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildBaseQuery(array $filters): QueryBuilder
|
||||||
|
{
|
||||||
|
$qb = $this->repository
|
||||||
|
->createQueryBuilder('a')
|
||||||
|
;
|
||||||
|
|
||||||
|
if (($filters['my_activities'] ?? false) and ($user = $this->security->getUser()) instanceof User) {
|
||||||
|
$qb->andWhere(
|
||||||
|
$qb->expr()->orX(
|
||||||
|
'a.createdBy = :user',
|
||||||
|
'a.user = :user',
|
||||||
|
':user MEMBER OF a.users'
|
||||||
|
)
|
||||||
|
)->setParameter('user', $user);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([] !== ($types = $filters['types'] ?? [])) {
|
||||||
|
$qb->andWhere('a.activityType IN (:types)')->setParameter('types', $types);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([] !== ($jobs = $filters['jobs'] ?? [])) {
|
||||||
|
$qb
|
||||||
|
->leftJoin('a.createdBy', 'creator')
|
||||||
|
->leftJoin('a.user', 'activity_u')
|
||||||
|
->andWhere(
|
||||||
|
$qb->expr()->orX(
|
||||||
|
'creator.userJob IN (:jobs)',
|
||||||
|
'activity_u.userJob IN (:jobs)',
|
||||||
|
'EXISTS (SELECT 1 FROM ' . User::class . ' activity_user WHERE activity_user MEMBER OF a.users AND activity_user.userJob IN (:jobs))'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
->setParameter('jobs', $jobs);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null !== ($after = $filters['after'] ?? null)) {
|
||||||
|
$qb->andWhere('a.date >= :after')->setParameter('after', $after);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null !== ($before = $filters['before'] ?? null)) {
|
||||||
|
$qb->andWhere('a.date <= :before')->setParameter('before', $before);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $qb;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param AccompanyingPeriod|Person $associated
|
||||||
|
* @return array<ActivityType>
|
||||||
|
*/
|
||||||
|
public function findActivityTypeByAssociated(AccompanyingPeriod|Person $associated): array
|
||||||
|
{
|
||||||
|
$in = $this->em->createQueryBuilder();
|
||||||
|
$in
|
||||||
|
->select('1')
|
||||||
|
->from(Activity::class, 'a');
|
||||||
|
|
||||||
|
if ($associated instanceof Person) {
|
||||||
|
$in = $this->filterBaseQueryByPerson($in, $associated, ActivityVoter::SEE);
|
||||||
|
} else {
|
||||||
|
$in->andWhere('a.accompanyingPeriod = :period')->setParameter('period', $associated);
|
||||||
|
}
|
||||||
|
|
||||||
|
// join between the embedded exist query and the main query
|
||||||
|
$in->andWhere('a.activityType = t');
|
||||||
|
|
||||||
|
$qb = $this->em->createQueryBuilder()->setParameters($in->getParameters());
|
||||||
|
$qb
|
||||||
|
->select('t')
|
||||||
|
->from(ActivityType::class, 't')
|
||||||
|
->where(
|
||||||
|
$qb->expr()->exists($in->getDQL())
|
||||||
|
);
|
||||||
|
|
||||||
|
return $qb->getQuery()->getResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findUserJobByAssociated(Person|AccompanyingPeriod $associated): array
|
||||||
|
{
|
||||||
|
$in = $this->em->createQueryBuilder();
|
||||||
|
$in->select('IDENTITY(u.userJob)')
|
||||||
|
->from(User::class, 'u')
|
||||||
|
->join(
|
||||||
|
Activity::class,
|
||||||
|
'a',
|
||||||
|
Join::WITH,
|
||||||
|
'a.createdBy = u OR a.user = u OR u MEMBER OF a.users'
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($associated instanceof Person) {
|
||||||
|
$in = $this->filterBaseQueryByPerson($in, $associated, ActivityVoter::SEE);
|
||||||
|
} else {
|
||||||
|
$in->andWhere('a.accompanyingPeriod = :associated');
|
||||||
|
$in->setParameter('associated', $associated);
|
||||||
|
}
|
||||||
|
|
||||||
|
$qb = $this->em->createQueryBuilder()->setParameters($in->getParameters());
|
||||||
|
|
||||||
|
$qb->select('ub', 'JSON_EXTRACT(ub.label, :lang) AS HIDDEN lang')
|
||||||
|
->from(UserJob::class, 'ub')
|
||||||
|
->where($qb->expr()->in('ub.id', $in->getDQL()))
|
||||||
|
->setParameter('lang', $this->requestStack->getCurrentRequest()->getLocale())
|
||||||
|
->orderBy('lang')
|
||||||
|
;
|
||||||
|
|
||||||
|
return $qb->getQuery()->getResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function findByAccompanyingPeriodSimplified(AccompanyingPeriod $period, ?int $limit = 1000): array
|
public function findByAccompanyingPeriodSimplified(AccompanyingPeriod $period, ?int $limit = 1000): array
|
||||||
{
|
{
|
||||||
$rsm = new ResultSetMappingBuilder($this->em);
|
$rsm = new ResultSetMappingBuilder($this->em);
|
||||||
@@ -159,25 +285,73 @@ final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInte
|
|||||||
return $nq->getResult(AbstractQuery::HYDRATE_ARRAY);
|
return $nq->getResult(AbstractQuery::HYDRATE_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function findByPerson(Person $person, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = [], array $filters = []): array
|
||||||
* @param array $orderBy
|
|
||||||
*
|
|
||||||
* @return Activity[]|array
|
|
||||||
*/
|
|
||||||
public function findByPerson(Person $person, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array
|
|
||||||
{
|
{
|
||||||
$user = $this->security->getUser();
|
$qb = $this->buildBaseQuery($filters);
|
||||||
$center = $this->centerResolverDispatcher->resolveCenter($person);
|
|
||||||
|
|
||||||
if (0 === count($orderBy)) {
|
$qb = $this->filterBaseQueryByPerson($qb, $person, $role);
|
||||||
$orderBy = ['date' => 'DESC'];
|
|
||||||
|
foreach ($orderBy as $field => $direction) {
|
||||||
|
$qb->addOrderBy('a.' . $field, $direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
$reachableScopes = $this->authorizationHelper
|
if (null !== $start) {
|
||||||
->getReachableCircles($user, $role, $center);
|
$qb->setFirstResult($start);
|
||||||
|
}
|
||||||
|
if (null !== $limit) {
|
||||||
|
$qb->setMaxResults($limit);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->em->getRepository(Activity::class)
|
return $qb->getQuery()->getResult();
|
||||||
->findByPersonImplied($person, $reachableScopes, $orderBy, $limit, $start);
|
}
|
||||||
|
|
||||||
|
private function filterBaseQueryByPerson(QueryBuilder $qb, Person $person, string $role): QueryBuilder
|
||||||
|
{
|
||||||
|
$orX = $qb->expr()->orX();
|
||||||
|
$counter = 0;
|
||||||
|
foreach ($this->centerResolverManager->resolveCenters($person) as $center) {
|
||||||
|
$scopes = $this->authorizationHelper->getReachableScopes($role, $center);
|
||||||
|
|
||||||
|
if ([] === $scopes) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$orX->add(sprintf('a.person = :person AND a.scope IN (:scopes_%d)', $counter));
|
||||||
|
$qb->setParameter(sprintf('scopes_%d', $counter), $scopes);
|
||||||
|
$qb->setParameter('person', $person);
|
||||||
|
$counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($person->getAccompanyingPeriodParticipations() as $participation) {
|
||||||
|
if (!$this->security->isGranted(ActivityVoter::SEE, $participation->getAccompanyingPeriod())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$and = $qb->expr()->andX(
|
||||||
|
sprintf('a.accompanyingPeriod = :period_%d', $counter),
|
||||||
|
sprintf('a.date >= :participation_start_%d', $counter)
|
||||||
|
);
|
||||||
|
|
||||||
|
$qb
|
||||||
|
->setParameter(sprintf('period_%d', $counter), $participation->getAccompanyingPeriod())
|
||||||
|
->setParameter(sprintf('participation_start_%d', $counter), $participation->getStartDate());
|
||||||
|
|
||||||
|
if (null !== $participation->getEndDate()) {
|
||||||
|
$and->add(sprintf('a.date < :participation_end_%d', $counter));
|
||||||
|
$qb
|
||||||
|
->setParameter(sprintf('participation_end_%d', $counter), $participation->getEndDate());
|
||||||
|
}
|
||||||
|
$orX->add($and);
|
||||||
|
$counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 === $orX->count()) {
|
||||||
|
$qb->andWhere('FALSE = TRUE');
|
||||||
|
} else {
|
||||||
|
$qb->andWhere($orX);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $qb;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function queryTimelineIndexer(string $context, array $args = []): array
|
public function queryTimelineIndexer(string $context, array $args = []): array
|
||||||
@@ -226,7 +400,6 @@ final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInte
|
|||||||
|
|
||||||
// acls:
|
// acls:
|
||||||
$reachableCenters = $this->authorizationHelper->getReachableCenters(
|
$reachableCenters = $this->authorizationHelper->getReachableCenters(
|
||||||
$this->tokenStorage->getToken()->getUser(),
|
|
||||||
ActivityVoter::SEE
|
ActivityVoter::SEE
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -251,7 +424,7 @@ final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInte
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// we get all the reachable scopes for this center
|
// we get all the reachable scopes for this center
|
||||||
$reachableScopes = $this->authorizationHelper->getReachableScopes($this->tokenStorage->getToken()->getUser(), ActivityVoter::SEE, $center);
|
$reachableScopes = $this->authorizationHelper->getReachableScopes(ActivityVoter::SEE, $center);
|
||||||
// we get the ids for those scopes
|
// we get the ids for those scopes
|
||||||
$reachablesScopesId = array_map(
|
$reachablesScopesId = array_map(
|
||||||
static fn (Scope $scope) => $scope->getId(),
|
static fn (Scope $scope) => $scope->getId(),
|
||||||
|
@@ -11,15 +11,32 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\ActivityBundle\Repository;
|
namespace Chill\ActivityBundle\Repository;
|
||||||
|
|
||||||
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
|
use Chill\ActivityBundle\Entity\ActivityType;
|
||||||
|
use Chill\MainBundle\Entity\UserJob;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
|
||||||
interface ActivityACLAwareRepositoryInterface
|
interface ActivityACLAwareRepositoryInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return Activity[]|array
|
* Return all the activities associated to an accompanying period and that the user is allowed to apply the given role.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param array{my_activities?: bool, types?: array<ActivityType>, jobs?: array<UserJob>, after?: \DateTimeImmutable|null, before?: \DateTimeImmutable|null} $filters
|
||||||
|
* @return array<Activity>
|
||||||
*/
|
*/
|
||||||
public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array;
|
public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, array $orderBy = ['date' => 'DESC'], array $filters = []): array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array{my_activities?: bool, types?: array<ActivityType>, jobs?: array<UserJob>, after?: \DateTimeImmutable|null, before?: \DateTimeImmutable|null} $filters
|
||||||
|
*/
|
||||||
|
public function countByAccompanyingPeriod(AccompanyingPeriod $period, string $role, array $filters = []): int;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array{my_activities?: bool, types?: array<ActivityType>, jobs?: array<UserJob>, after?: \DateTimeImmutable|null, before?: \DateTimeImmutable|null} $filters
|
||||||
|
*/
|
||||||
|
public function countByPerson(Person $person, string $role, array $filters = []): int;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a list of activities, simplified as array (not object).
|
* Return a list of activities, simplified as array (not object).
|
||||||
@@ -31,7 +48,28 @@ interface ActivityACLAwareRepositoryInterface
|
|||||||
public function findByAccompanyingPeriodSimplified(AccompanyingPeriod $period, ?int $limit = 1000): array;
|
public function findByAccompanyingPeriodSimplified(AccompanyingPeriod $period, ?int $limit = 1000): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Activity[]|array
|
* @param array{my_activities?: bool, types?: array<ActivityType>, jobs?: array<UserJob>, after?: \DateTimeImmutable|null, before?: \DateTimeImmutable|null} $filters
|
||||||
|
* @return array<Activity>
|
||||||
*/
|
*/
|
||||||
public function findByPerson(Person $person, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array;
|
public function findByPerson(Person $person, string $role, ?int $start = 0, ?int $limit = 1000, array $orderBy = ['date' => 'DESC'], array $filters = []): array;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a list of the type for the activities associated to person or accompanying period
|
||||||
|
*
|
||||||
|
* @return array<ActivityType>
|
||||||
|
*/
|
||||||
|
public function findActivityTypeByAssociated(AccompanyingPeriod|Person $associated): array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a list of the user job for the activities associated to person or accompanying period
|
||||||
|
*
|
||||||
|
* Associated mean the job:
|
||||||
|
* - of the creator;
|
||||||
|
* - of the user (activity.user)
|
||||||
|
* - of all the users
|
||||||
|
*
|
||||||
|
* @return array<UserJob>
|
||||||
|
*/
|
||||||
|
public function findUserJobByAssociated(AccompanyingPeriod|Person $associated): array;
|
||||||
}
|
}
|
||||||
|
@@ -23,15 +23,11 @@ use Symfony\Component\HttpFoundation\RequestStack;
|
|||||||
*/
|
*/
|
||||||
class ActivityReasonRepository extends ServiceEntityRepository
|
class ActivityReasonRepository extends ServiceEntityRepository
|
||||||
{
|
{
|
||||||
private RequestStack $requestStack;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ManagerRegistry $registry,
|
ManagerRegistry $registry,
|
||||||
RequestStack $requestStack
|
private RequestStack $requestStack
|
||||||
) {
|
) {
|
||||||
parent::__construct($registry, ActivityReason::class);
|
parent::__construct($registry, ActivityReason::class);
|
||||||
|
|
||||||
$this->requestStack = $requestStack;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -11,9 +11,13 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\ActivityBundle\Repository;
|
namespace Chill\ActivityBundle\Repository;
|
||||||
|
|
||||||
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
use Chill\ActivityBundle\Entity\ActivityType;
|
use Chill\ActivityBundle\Entity\ActivityType;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
use Doctrine\ORM\Query\Expr\Join;
|
||||||
|
|
||||||
final class ActivityTypeRepository implements ActivityTypeRepositoryInterface
|
final class ActivityTypeRepository implements ActivityTypeRepositoryInterface
|
||||||
{
|
{
|
||||||
|
@@ -12,12 +12,14 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Repository;
|
namespace Chill\ActivityBundle\Repository;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\ActivityType;
|
use Chill\ActivityBundle\Entity\ActivityType;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Doctrine\Persistence\ObjectRepository;
|
use Doctrine\Persistence\ObjectRepository;
|
||||||
|
|
||||||
interface ActivityTypeRepositoryInterface extends ObjectRepository
|
interface ActivityTypeRepositoryInterface extends ObjectRepository
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return array|ActivityType[]
|
* @return array<ActivityType>
|
||||||
*/
|
*/
|
||||||
public function findAllActive(): array;
|
public function findAllActive(): array;
|
||||||
}
|
}
|
||||||
|
@@ -80,12 +80,15 @@
|
|||||||
|
|
||||||
<div class="context-{{ context }}">
|
<div class="context-{{ context }}">
|
||||||
|
|
||||||
|
{{ filter|chill_render_filter_order_helper }}
|
||||||
|
|
||||||
{% if activities|length == 0 %}
|
{% if activities|length == 0 %}
|
||||||
<p class="chill-no-data-statement">
|
<p class="chill-no-data-statement">
|
||||||
{{ "There isn't any activities."|trans }}
|
{{ "There isn't any activities."|trans }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
<div class="flex-table activity-list">
|
<div class="flex-table activity-list">
|
||||||
{% for activity in activities %}
|
{% for activity in activities %}
|
||||||
{% include 'ChillActivityBundle:Activity:_list_item.html.twig' with {
|
{% include 'ChillActivityBundle:Activity:_list_item.html.twig' with {
|
||||||
@@ -96,4 +99,6 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{{ chill_pagination(paginator) }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@@ -74,15 +74,12 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
|||||||
self::FULL,
|
self::FULL,
|
||||||
];
|
];
|
||||||
|
|
||||||
protected Security $security;
|
|
||||||
|
|
||||||
protected VoterHelperInterface $voterHelper;
|
protected VoterHelperInterface $voterHelper;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Security $security,
|
protected Security $security,
|
||||||
VoterHelperFactoryInterface $voterHelperFactory
|
VoterHelperFactoryInterface $voterHelperFactory
|
||||||
) {
|
) {
|
||||||
$this->security = $security;
|
|
||||||
$this->voterHelper = $voterHelperFactory->generate(self::class)
|
$this->voterHelper = $voterHelperFactory->generate(self::class)
|
||||||
->addCheckFor(Person::class, [self::SEE, self::CREATE])
|
->addCheckFor(Person::class, [self::SEE, self::CREATE])
|
||||||
->addCheckFor(AccompanyingPeriod::class, [self::SEE, self::CREATE])
|
->addCheckFor(AccompanyingPeriod::class, [self::SEE, self::CREATE])
|
||||||
|
@@ -42,48 +42,17 @@ class ActivityContext implements
|
|||||||
DocGeneratorContextWithAdminFormInterface,
|
DocGeneratorContextWithAdminFormInterface,
|
||||||
DocGeneratorContextWithPublicFormInterface
|
DocGeneratorContextWithPublicFormInterface
|
||||||
{
|
{
|
||||||
private BaseContextData $baseContextData;
|
|
||||||
|
|
||||||
private DocumentCategoryRepository $documentCategoryRepository;
|
|
||||||
|
|
||||||
private EntityManagerInterface $em;
|
|
||||||
|
|
||||||
private NormalizerInterface $normalizer;
|
|
||||||
|
|
||||||
private PersonRenderInterface $personRender;
|
|
||||||
|
|
||||||
private PersonRepository $personRepository;
|
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
|
||||||
|
|
||||||
private ThirdPartyRender $thirdPartyRender;
|
|
||||||
|
|
||||||
private ThirdPartyRepository $thirdPartyRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
DocumentCategoryRepository $documentCategoryRepository,
|
private NormalizerInterface $normalizer,
|
||||||
NormalizerInterface $normalizer,
|
private TranslatableStringHelperInterface $translatableStringHelper,
|
||||||
TranslatableStringHelperInterface $translatableStringHelper,
|
private EntityManagerInterface $em,
|
||||||
EntityManagerInterface $em,
|
private PersonRenderInterface $personRender,
|
||||||
PersonRenderInterface $personRender,
|
private PersonRepository $personRepository,
|
||||||
PersonRepository $personRepository,
|
private TranslatorInterface $translator,
|
||||||
TranslatorInterface $translator,
|
private BaseContextData $baseContextData,
|
||||||
BaseContextData $baseContextData,
|
private ThirdPartyRender $thirdPartyRender,
|
||||||
ThirdPartyRender $thirdPartyRender,
|
private ThirdPartyRepository $thirdPartyRepository
|
||||||
ThirdPartyRepository $thirdPartyRepository
|
|
||||||
) {
|
) {
|
||||||
$this->documentCategoryRepository = $documentCategoryRepository;
|
|
||||||
$this->normalizer = $normalizer;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->em = $em;
|
|
||||||
$this->personRender = $personRender;
|
|
||||||
$this->personRepository = $personRepository;
|
|
||||||
$this->translator = $translator;
|
|
||||||
$this->baseContextData = $baseContextData;
|
|
||||||
$this->thirdPartyRender = $thirdPartyRender;
|
|
||||||
$this->thirdPartyRepository = $thirdPartyRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function adminFormReverseTransform(array $data): array
|
public function adminFormReverseTransform(array $data): array
|
||||||
|
@@ -48,44 +48,8 @@ class ListActivitiesByAccompanyingPeriodContext implements
|
|||||||
DocGeneratorContextWithAdminFormInterface,
|
DocGeneratorContextWithAdminFormInterface,
|
||||||
DocGeneratorContextWithPublicFormInterface
|
DocGeneratorContextWithPublicFormInterface
|
||||||
{
|
{
|
||||||
private AccompanyingPeriodContext $accompanyingPeriodContext;
|
public function __construct(private AccompanyingPeriodContext $accompanyingPeriodContext, private ActivityACLAwareRepositoryInterface $activityACLAwareRepository, private NormalizerInterface $normalizer, private PersonRepository $personRepository, private SocialActionRepository $socialActionRepository, private SocialIssueRepository $socialIssueRepository, private ThirdPartyRepository $thirdPartyRepository, private TranslatableStringHelperInterface $translatableStringHelper, private UserRepository $userRepository)
|
||||||
|
{
|
||||||
private ActivityACLAwareRepositoryInterface $activityACLAwareRepository;
|
|
||||||
|
|
||||||
private NormalizerInterface $normalizer;
|
|
||||||
|
|
||||||
private PersonRepository $personRepository;
|
|
||||||
|
|
||||||
private SocialActionRepository $socialActionRepository;
|
|
||||||
|
|
||||||
private SocialIssueRepository $socialIssueRepository;
|
|
||||||
|
|
||||||
private ThirdPartyRepository $thirdPartyRepository;
|
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
private UserRepository $userRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
AccompanyingPeriodContext $accompanyingPeriodContext,
|
|
||||||
ActivityACLAwareRepositoryInterface $activityACLAwareRepository,
|
|
||||||
NormalizerInterface $normalizer,
|
|
||||||
PersonRepository $personRepository,
|
|
||||||
SocialActionRepository $socialActionRepository,
|
|
||||||
SocialIssueRepository $socialIssueRepository,
|
|
||||||
ThirdPartyRepository $thirdPartyRepository,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper,
|
|
||||||
UserRepository $userRepository,
|
|
||||||
) {
|
|
||||||
$this->accompanyingPeriodContext = $accompanyingPeriodContext;
|
|
||||||
$this->activityACLAwareRepository = $activityACLAwareRepository;
|
|
||||||
$this->normalizer = $normalizer;
|
|
||||||
$this->personRepository = $personRepository;
|
|
||||||
$this->socialActionRepository = $socialActionRepository;
|
|
||||||
$this->socialIssueRepository = $socialIssueRepository;
|
|
||||||
$this->thirdPartyRepository = $thirdPartyRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->userRepository = $userRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function adminFormReverseTransform(array $data): array
|
public function adminFormReverseTransform(array $data): array
|
||||||
|
@@ -21,14 +21,8 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
|||||||
|
|
||||||
final class AccompanyingPeriodActivityGenericDocRenderer implements GenericDocRendererInterface
|
final class AccompanyingPeriodActivityGenericDocRenderer implements GenericDocRendererInterface
|
||||||
{
|
{
|
||||||
private StoredObjectRepository $objectRepository;
|
public function __construct(private StoredObjectRepository $objectRepository, private ActivityRepository $activityRepository)
|
||||||
|
|
||||||
private ActivityRepository $activityRepository;
|
|
||||||
|
|
||||||
public function __construct(StoredObjectRepository $storedObjectRepository, ActivityRepository $activityRepository)
|
|
||||||
{
|
{
|
||||||
$this->objectRepository = $storedObjectRepository;
|
|
||||||
$this->activityRepository = $activityRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function supports(GenericDocDTO $genericDocDTO, $options = []): bool
|
public function supports(GenericDocDTO $genericDocDTO, $options = []): bool
|
||||||
|
@@ -76,10 +76,8 @@ final class ActivityControllerTest extends WebTestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider getSecuredPagesUnauthenticated
|
* @dataProvider getSecuredPagesUnauthenticated
|
||||||
*
|
|
||||||
* @param mixed $url
|
|
||||||
*/
|
*/
|
||||||
public function testAccessIsDeniedForUnauthenticated($url)
|
public function testAccessIsDeniedForUnauthenticated(mixed $url)
|
||||||
{
|
{
|
||||||
$client = $this->createClient();
|
$client = $this->createClient();
|
||||||
|
|
||||||
@@ -262,11 +260,9 @@ final class ActivityControllerTest extends WebTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $username
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\BrowserKit\Client
|
* @return \Symfony\Component\BrowserKit\Client
|
||||||
*/
|
*/
|
||||||
private function getAuthenticatedClient($username = 'center a_social')
|
private function getAuthenticatedClient(mixed $username = 'center a_social')
|
||||||
{
|
{
|
||||||
return self::createClient([], [
|
return self::createClient([], [
|
||||||
'PHP_AUTH_USER' => $username,
|
'PHP_AUTH_USER' => $username,
|
||||||
|
@@ -89,11 +89,9 @@ final class TranslatableActivityTypeTest extends KernelTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $active
|
|
||||||
*
|
|
||||||
* @return \Chill\ActivityBundle\Entity\ActivityType
|
* @return \Chill\ActivityBundle\Entity\ActivityType
|
||||||
*/
|
*/
|
||||||
protected function getRandomType($active = true)
|
protected function getRandomType(mixed $active = true)
|
||||||
{
|
{
|
||||||
$types = $this->container->get('doctrine.orm.entity_manager')
|
$types = $this->container->get('doctrine.orm.entity_manager')
|
||||||
->getRepository(ActivityType::class)
|
->getRepository(ActivityType::class)
|
||||||
|
@@ -0,0 +1,325 @@
|
|||||||
|
<?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\Repository;
|
||||||
|
|
||||||
|
use Chill\ActivityBundle\Entity\ActivityType;
|
||||||
|
use Chill\ActivityBundle\Repository\ActivityACLAwareRepository;
|
||||||
|
use Chill\ActivityBundle\Repository\ActivityRepository;
|
||||||
|
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
|
||||||
|
use Chill\MainBundle\Entity\Center;
|
||||||
|
use Chill\MainBundle\Entity\Scope;
|
||||||
|
use Chill\MainBundle\Entity\User;
|
||||||
|
use Chill\MainBundle\Entity\UserJob;
|
||||||
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelperForCurrentUserInterface;
|
||||||
|
use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Prophecy\Argument;
|
||||||
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\RequestStack;
|
||||||
|
use Symfony\Component\Security\Core\Security;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
class ActivityACLAwareRepositoryTest extends KernelTestCase
|
||||||
|
{
|
||||||
|
use ProphecyTrait;
|
||||||
|
private AuthorizationHelperForCurrentUserInterface $authorizationHelperForCurrentUser;
|
||||||
|
|
||||||
|
private CenterResolverManagerInterface $centerResolverManager;
|
||||||
|
|
||||||
|
private ActivityRepository $activityRepository;
|
||||||
|
|
||||||
|
private EntityManagerInterface $entityManager;
|
||||||
|
|
||||||
|
private Security $security;
|
||||||
|
|
||||||
|
private RequestStack $requestStack;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
|
||||||
|
$this->authorizationHelperForCurrentUser = self::$container->get(AuthorizationHelperForCurrentUserInterface::class);
|
||||||
|
$this->centerResolverManager = self::$container->get(CenterResolverManagerInterface::class);
|
||||||
|
$this->activityRepository = self::$container->get(ActivityRepository::class);
|
||||||
|
$this->entityManager = self::$container->get(EntityManagerInterface::class);
|
||||||
|
$this->security = self::$container->get(Security::class);
|
||||||
|
|
||||||
|
$this->requestStack = $requestStack = new RequestStack();
|
||||||
|
$request = $this->prophesize(Request::class);
|
||||||
|
$request->getLocale()->willReturn('fr');
|
||||||
|
$request->getDefaultLocale()->willReturn('fr');
|
||||||
|
$requestStack->push($request->reveal());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideDataFindByAccompanyingPeriod
|
||||||
|
*/
|
||||||
|
public function testFindByAccompanyingPeriod(AccompanyingPeriod $period, User $user, string $role, ?int $start = 0, ?int $limit = 1000, array $orderBy = ['date' => 'DESC'], array $filters = []): void
|
||||||
|
{
|
||||||
|
$security = $this->prophesize(Security::class);
|
||||||
|
$security->isGranted($role, $period)->willReturn(true);
|
||||||
|
$security->getUser()->willReturn($user);
|
||||||
|
|
||||||
|
$repository = new ActivityACLAwareRepository(
|
||||||
|
$this->authorizationHelperForCurrentUser,
|
||||||
|
$this->centerResolverManager,
|
||||||
|
$this->activityRepository,
|
||||||
|
$this->entityManager,
|
||||||
|
$security->reveal(),
|
||||||
|
$this->requestStack
|
||||||
|
);
|
||||||
|
|
||||||
|
$actual = $repository->findByAccompanyingPeriod($period, $role, $start, $limit, $orderBy, $filters);
|
||||||
|
|
||||||
|
self::assertIsArray($actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideDataFindByAccompanyingPeriod
|
||||||
|
*/
|
||||||
|
public function testFindActivityTypeByAccompanyingPeriod(AccompanyingPeriod $period, User $user, string $role, ?int $start = 0, ?int $limit = 1000, array $orderBy = ['date' => 'DESC'], array $filters = []): void
|
||||||
|
{
|
||||||
|
$security = $this->prophesize(Security::class);
|
||||||
|
$security->isGranted($role, $period)->willReturn(true);
|
||||||
|
$security->getUser()->willReturn($user);
|
||||||
|
|
||||||
|
$repository = new ActivityACLAwareRepository(
|
||||||
|
$this->authorizationHelperForCurrentUser,
|
||||||
|
$this->centerResolverManager,
|
||||||
|
$this->activityRepository,
|
||||||
|
$this->entityManager,
|
||||||
|
$security->reveal(),
|
||||||
|
$this->requestStack
|
||||||
|
);
|
||||||
|
|
||||||
|
$actual = $repository->findActivityTypeByAssociated($period);
|
||||||
|
|
||||||
|
self::assertIsArray($actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideDataFindByPerson
|
||||||
|
*/
|
||||||
|
public function testFindActivityTypeByPerson(Person $person, User $user, array $centers, array $scopes, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = [], array $filters = []): void
|
||||||
|
{
|
||||||
|
$role = ActivityVoter::SEE;
|
||||||
|
$centerResolver = $this->prophesize(CenterResolverManagerInterface::class);
|
||||||
|
$centerResolver->resolveCenters($person)->willReturn($centers);
|
||||||
|
|
||||||
|
$authorizationHelper = $this->prophesize(AuthorizationHelperForCurrentUserInterface::class);
|
||||||
|
$authorizationHelper->getReachableScopes($role, Argument::type(Center::class))
|
||||||
|
->willReturn($scopes);
|
||||||
|
|
||||||
|
$security = $this->prophesize(Security::class);
|
||||||
|
$security->isGranted($role, Argument::type(AccompanyingPeriod::class))->willReturn(true);
|
||||||
|
$security->getUser()->willReturn($user);
|
||||||
|
|
||||||
|
$repository = new ActivityACLAwareRepository(
|
||||||
|
$authorizationHelper->reveal(),
|
||||||
|
$centerResolver->reveal(),
|
||||||
|
$this->activityRepository,
|
||||||
|
$this->entityManager,
|
||||||
|
$security->reveal(),
|
||||||
|
$this->requestStack
|
||||||
|
);
|
||||||
|
|
||||||
|
$actual = $repository->findByPerson($person, $role, $start, $limit, $orderBy, $filters);
|
||||||
|
|
||||||
|
self::assertIsArray($actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideDataFindByPerson
|
||||||
|
*/
|
||||||
|
public function testFindByPerson(Person $person, User $user, array $centers, array $scopes, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = [], array $filters = []): void
|
||||||
|
{
|
||||||
|
$centerResolver = $this->prophesize(CenterResolverManagerInterface::class);
|
||||||
|
$centerResolver->resolveCenters($person)->willReturn($centers);
|
||||||
|
|
||||||
|
$authorizationHelper = $this->prophesize(AuthorizationHelperForCurrentUserInterface::class);
|
||||||
|
$authorizationHelper->getReachableScopes($role, Argument::type(Center::class))
|
||||||
|
->willReturn($scopes);
|
||||||
|
|
||||||
|
$security = $this->prophesize(Security::class);
|
||||||
|
$security->isGranted($role, Argument::type(AccompanyingPeriod::class))->willReturn(true);
|
||||||
|
$security->getUser()->willReturn($user);
|
||||||
|
|
||||||
|
$repository = new ActivityACLAwareRepository(
|
||||||
|
$authorizationHelper->reveal(),
|
||||||
|
$centerResolver->reveal(),
|
||||||
|
$this->activityRepository,
|
||||||
|
$this->entityManager,
|
||||||
|
$security->reveal(),
|
||||||
|
$this->requestStack
|
||||||
|
);
|
||||||
|
|
||||||
|
$actual = $repository->findByPerson($person, $role, $start, $limit, $orderBy, $filters);
|
||||||
|
|
||||||
|
self::assertIsArray($actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function provideDataFindByPerson(): iterable
|
||||||
|
{
|
||||||
|
$this->setUp();
|
||||||
|
|
||||||
|
/** @var Person $person */
|
||||||
|
if (null === $person = $this->entityManager->createQueryBuilder()
|
||||||
|
->select('p')->from(Person::class, 'p')->setMaxResults(1)
|
||||||
|
->getQuery()->getSingleResult()) {
|
||||||
|
throw new \RuntimeException("person not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var AccompanyingPeriod $period1 */
|
||||||
|
if (null === $period1 = $this->entityManager
|
||||||
|
->createQueryBuilder()
|
||||||
|
->select('a')
|
||||||
|
->from(AccompanyingPeriod::class, 'a')
|
||||||
|
->setMaxResults(1)
|
||||||
|
->getQuery()
|
||||||
|
->getSingleResult()) {
|
||||||
|
throw new \RuntimeException("no period found");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var AccompanyingPeriod $period2 */
|
||||||
|
if (null === $period2 = $this->entityManager
|
||||||
|
->createQueryBuilder()
|
||||||
|
->select('a')
|
||||||
|
->from(AccompanyingPeriod::class, 'a')
|
||||||
|
->where('a.id > :pid')
|
||||||
|
->setParameter('pid', $period1->getId())
|
||||||
|
->setMaxResults(1)
|
||||||
|
->getQuery()
|
||||||
|
->getSingleResult()) {
|
||||||
|
throw new \RuntimeException("no second period found");
|
||||||
|
}
|
||||||
|
// add a period
|
||||||
|
$period1->addPerson($person);
|
||||||
|
$period2->addPerson($person);
|
||||||
|
$period1->getParticipationsContainsPerson($person)->first()->setEndDate(
|
||||||
|
(new \DateTime('now'))->add(new \DateInterval('P1M'))
|
||||||
|
);
|
||||||
|
|
||||||
|
if ([] === $types = $this->entityManager
|
||||||
|
->createQueryBuilder()
|
||||||
|
->select('t')
|
||||||
|
->from(ActivityType::class, 't')
|
||||||
|
->setMaxResults(2)
|
||||||
|
->getQuery()
|
||||||
|
->getResult()) {
|
||||||
|
throw new \RuntimeException("no types");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([] === $jobs = $this->entityManager
|
||||||
|
->createQueryBuilder()
|
||||||
|
->select('j')
|
||||||
|
->from(UserJob::class, 'j')
|
||||||
|
->setMaxResults(2)
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
) {
|
||||||
|
throw new \RuntimeException("no jobs found");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null === $user = $this->entityManager
|
||||||
|
->createQueryBuilder()
|
||||||
|
->select('u')
|
||||||
|
->from(User::class, 'u')
|
||||||
|
->setMaxResults(1)
|
||||||
|
->getQuery()
|
||||||
|
->getSingleResult()
|
||||||
|
) {
|
||||||
|
throw new \RuntimeException("no user found");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([] === $centers = $this->entityManager->createQueryBuilder()
|
||||||
|
->select('c')->from(Center::class, 'c')->setMaxResults(2)->getQuery()
|
||||||
|
->getResult()) {
|
||||||
|
throw new \RuntimeException("no centers found");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([] === $scopes = $this->entityManager->createQueryBuilder()
|
||||||
|
->select('s')->from(Scope::class, 's')->setMaxResults(2)->getQuery()
|
||||||
|
->getResult()) {
|
||||||
|
throw new \RuntimeException("no scopes found");
|
||||||
|
}
|
||||||
|
|
||||||
|
yield [$person, $user, $centers, $scopes, ActivityVoter::SEE, 0, 5, ['date' => 'DESC'], []];
|
||||||
|
yield [$person, $user, $centers, $scopes, ActivityVoter::SEE, 0, 5, ['date' => 'DESC'], ['my_activities' => true]];
|
||||||
|
yield [$person, $user, $centers, $scopes, ActivityVoter::SEE, 0, 5, ['date' => 'DESC'], ['types' => $types]];
|
||||||
|
yield [$person, $user, $centers, $scopes, ActivityVoter::SEE, 0, 5, ['date' => 'DESC'], ['jobs' => $jobs]];
|
||||||
|
yield [$person, $user, $centers, $scopes, ActivityVoter::SEE, 0, 5, ['date' => 'DESC'], ['after' => new \DateTimeImmutable('1 year ago')]];
|
||||||
|
yield [$person, $user, $centers, $scopes, ActivityVoter::SEE, 0, 5, ['date' => 'DESC'], ['before' => new \DateTimeImmutable('1 year ago')]];
|
||||||
|
yield [$person, $user, $centers, $scopes, ActivityVoter::SEE, 0, 5, ['date' => 'DESC'], ['after' => new \DateTimeImmutable('1 year ago'), 'before' => new \DateTimeImmutable('1 month ago')]];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function provideDataFindByAccompanyingPeriod(): iterable
|
||||||
|
{
|
||||||
|
$this->setUp();
|
||||||
|
|
||||||
|
if (null === $period = $this->entityManager
|
||||||
|
->createQueryBuilder()
|
||||||
|
->select('a')
|
||||||
|
->from(AccompanyingPeriod::class, 'a')
|
||||||
|
->setMaxResults(1)
|
||||||
|
->getQuery()
|
||||||
|
->getSingleResult()) {
|
||||||
|
throw new \RuntimeException("no period found");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([] === $types = $this->entityManager
|
||||||
|
->createQueryBuilder()
|
||||||
|
->select('t')
|
||||||
|
->from(ActivityType::class, 't')
|
||||||
|
->setMaxResults(2)
|
||||||
|
->getQuery()
|
||||||
|
->getResult()) {
|
||||||
|
throw new \RuntimeException("no types");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([] === $jobs = $this->entityManager
|
||||||
|
->createQueryBuilder()
|
||||||
|
->select('j')
|
||||||
|
->from(UserJob::class, 'j')
|
||||||
|
->setMaxResults(2)
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
) {
|
||||||
|
throw new \RuntimeException("no jobs found");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null === $user = $this->entityManager
|
||||||
|
->createQueryBuilder()
|
||||||
|
->select('u')
|
||||||
|
->from(User::class, 'u')
|
||||||
|
->setMaxResults(1)
|
||||||
|
->getQuery()
|
||||||
|
->getSingleResult()
|
||||||
|
) {
|
||||||
|
throw new \RuntimeException("no user found");
|
||||||
|
}
|
||||||
|
|
||||||
|
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], []];
|
||||||
|
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['my_activities' => true]];
|
||||||
|
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['types' => $types]];
|
||||||
|
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['jobs' => $jobs]];
|
||||||
|
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['after' => new \DateTimeImmutable('1 year ago')]];
|
||||||
|
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['before' => new \DateTimeImmutable('1 year ago')]];
|
||||||
|
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['after' => new \DateTimeImmutable('1 year ago'), 'before' => new \DateTimeImmutable('1 month ago')]];
|
||||||
|
}
|
||||||
|
}
|
@@ -33,24 +33,14 @@ class TimelineActivityProvider implements TimelineProviderInterface
|
|||||||
{
|
{
|
||||||
private const SUPPORTED_CONTEXTS = ['center', 'person'];
|
private const SUPPORTED_CONTEXTS = ['center', 'person'];
|
||||||
|
|
||||||
protected ActivityACLAwareRepository $aclAwareRepository;
|
|
||||||
|
|
||||||
protected EntityManagerInterface $em;
|
|
||||||
|
|
||||||
protected AuthorizationHelperInterface $helper;
|
|
||||||
|
|
||||||
protected UserInterface $user;
|
protected UserInterface $user;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
EntityManagerInterface $em,
|
protected EntityManagerInterface $em,
|
||||||
AuthorizationHelperInterface $helper,
|
protected AuthorizationHelperInterface $helper,
|
||||||
TokenStorageInterface $storage,
|
TokenStorageInterface $storage,
|
||||||
ActivityACLAwareRepository $aclAwareRepository
|
protected ActivityACLAwareRepository $aclAwareRepository
|
||||||
) {
|
) {
|
||||||
$this->em = $em;
|
|
||||||
$this->helper = $helper;
|
|
||||||
$this->aclAwareRepository = $aclAwareRepository;
|
|
||||||
|
|
||||||
if (!$storage->getToken()->getUser() instanceof User) {
|
if (!$storage->getToken()->getUser() instanceof User) {
|
||||||
throw new RuntimeException('A user should be authenticated !');
|
throw new RuntimeException('A user should be authenticated !');
|
||||||
}
|
}
|
||||||
|
@@ -148,6 +148,10 @@ services:
|
|||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: activity_common_type_aggregator }
|
- { name: chill.export_aggregator, alias: activity_common_type_aggregator }
|
||||||
|
|
||||||
|
Chill\ActivityBundle\Export\Aggregator\ActivityLocationAggregator:
|
||||||
|
tags:
|
||||||
|
- { name: chill.export_aggregator, alias: activity_common_location_aggregator }
|
||||||
|
|
||||||
chill.activity.export.user_aggregator:
|
chill.activity.export.user_aggregator:
|
||||||
class: Chill\ActivityBundle\Export\Aggregator\ActivityUserAggregator
|
class: Chill\ActivityBundle\Export\Aggregator\ActivityUserAggregator
|
||||||
tags:
|
tags:
|
||||||
|
@@ -83,12 +83,20 @@ Third persons: Tiers non-pro.
|
|||||||
Others persons: Usagers
|
Others persons: Usagers
|
||||||
Third parties: Tiers professionnels
|
Third parties: Tiers professionnels
|
||||||
Users concerned: T(M)S
|
Users concerned: T(M)S
|
||||||
|
|
||||||
activity:
|
activity:
|
||||||
|
date: Date de l'échange
|
||||||
Insert a document: Insérer un document
|
Insert a document: Insérer un document
|
||||||
Remove a document: Supprimer le document
|
Remove a document: Supprimer le document
|
||||||
comment: Commentaire
|
comment: Commentaire
|
||||||
No documents: Aucun document
|
No documents: Aucun document
|
||||||
|
|
||||||
|
# activity filter in list page
|
||||||
|
activity_filter:
|
||||||
|
My activities: Mes échanges (où j'interviens)
|
||||||
|
Types: Par type d'échange
|
||||||
|
Jobs: Par métier impliqué
|
||||||
|
|
||||||
#timeline
|
#timeline
|
||||||
'%user% has done an %activity_type%': '%user% a effectué un échange de type "%activity_type%"'
|
'%user% has done an %activity_type%': '%user% a effectué un échange de type "%activity_type%"'
|
||||||
|
|
||||||
@@ -378,6 +386,9 @@ export:
|
|||||||
is sent: envoyé
|
is sent: envoyé
|
||||||
is received: reçu
|
is received: reçu
|
||||||
Group activity by sentreceived: Grouper les échanges par envoyé / reçu
|
Group activity by sentreceived: Grouper les échanges par envoyé / reçu
|
||||||
|
by_location:
|
||||||
|
Activity Location: Localisation de l'échange
|
||||||
|
Title: Grouper les échanges par localisation de l'échange
|
||||||
|
|
||||||
generic_doc:
|
generic_doc:
|
||||||
filter:
|
filter:
|
||||||
|
@@ -21,11 +21,8 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
|
|
||||||
final class AsideActivityController extends CRUDController
|
final class AsideActivityController extends CRUDController
|
||||||
{
|
{
|
||||||
private AsideActivityCategoryRepository $categoryRepository;
|
public function __construct(private AsideActivityCategoryRepository $categoryRepository)
|
||||||
|
|
||||||
public function __construct(AsideActivityCategoryRepository $categoryRepository)
|
|
||||||
{
|
{
|
||||||
$this->categoryRepository = $categoryRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createEntity(string $action, Request $request): object
|
public function createEntity(string $action, Request $request): object
|
||||||
|
@@ -24,11 +24,8 @@ use function random_int;
|
|||||||
|
|
||||||
class LoadAsideActivity extends Fixture implements DependentFixtureInterface
|
class LoadAsideActivity extends Fixture implements DependentFixtureInterface
|
||||||
{
|
{
|
||||||
private UserRepository $userRepository;
|
public function __construct(private UserRepository $userRepository)
|
||||||
|
|
||||||
public function __construct(UserRepository $userRepository)
|
|
||||||
{
|
{
|
||||||
$this->userRepository = $userRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDependencies(): array
|
public function getDependencies(): array
|
||||||
|
@@ -25,8 +25,9 @@ class AsideActivityCategory
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity=AsideActivityCategory::class, mappedBy="parent")
|
* @ORM\OneToMany(targetEntity=AsideActivityCategory::class, mappedBy="parent")
|
||||||
|
* @var Collection<AsideActivityCategory>
|
||||||
*/
|
*/
|
||||||
private $children;
|
private Collection $children;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
@@ -36,7 +37,6 @@ class AsideActivityCategory
|
|||||||
private int $id;
|
private int $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity=AsideActivityCategory::class, mappedBy="parent")
|
|
||||||
* @ORM\Column(type="boolean")
|
* @ORM\Column(type="boolean")
|
||||||
*/
|
*/
|
||||||
private bool $isActive = true;
|
private bool $isActive = true;
|
||||||
@@ -114,10 +114,8 @@ class AsideActivityCategory
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @Assert\Callback
|
* @Assert\Callback
|
||||||
*
|
|
||||||
* @param mixed $payload
|
|
||||||
*/
|
*/
|
||||||
public function preventRecursiveParent(ExecutionContextInterface $context, $payload)
|
public function preventRecursiveParent(ExecutionContextInterface $context, mixed $payload)
|
||||||
{
|
{
|
||||||
if (!$this->hasParent()) {
|
if (!$this->hasParent()) {
|
||||||
return;
|
return;
|
||||||
|
@@ -20,14 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ByActivityTypeAggregator implements AggregatorInterface
|
class ByActivityTypeAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private AsideActivityCategoryRepository $asideActivityCategoryRepository;
|
public function __construct(private AsideActivityCategoryRepository $asideActivityCategoryRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||||
|
|
||||||
private TranslatableStringHelper $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(AsideActivityCategoryRepository $asideActivityCategoryRepository, TranslatableStringHelper $translatableStringHelper)
|
|
||||||
{
|
{
|
||||||
$this->asideActivityCategoryRepository = $asideActivityCategoryRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -22,14 +22,8 @@ use function in_array;
|
|||||||
|
|
||||||
class ByUserJobAggregator implements AggregatorInterface
|
class ByUserJobAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
public function __construct(private UserJobRepositoryInterface $userJobRepository, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
|
||||||
private UserJobRepositoryInterface $userJobRepository;
|
|
||||||
|
|
||||||
public function __construct(UserJobRepositoryInterface $userJobRepository, TranslatableStringHelperInterface $translatableStringHelper)
|
|
||||||
{
|
{
|
||||||
$this->userJobRepository = $userJobRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -22,14 +22,8 @@ use function in_array;
|
|||||||
|
|
||||||
class ByUserScopeAggregator implements AggregatorInterface
|
class ByUserScopeAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private ScopeRepositoryInterface $scopeRepository;
|
public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(ScopeRepositoryInterface $scopeRepository, TranslatableStringHelperInterface $translatableStringHelper)
|
|
||||||
{
|
{
|
||||||
$this->scopeRepository = $scopeRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -23,12 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class AvgAsideActivityDuration implements ExportInterface, GroupedExportInterface
|
class AvgAsideActivityDuration implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
private AsideActivityRepository $repository;
|
public function __construct(private AsideActivityRepository $repository)
|
||||||
|
{
|
||||||
public function __construct(
|
|
||||||
AsideActivityRepository $repository
|
|
||||||
) {
|
|
||||||
$this->repository = $repository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
@@ -23,12 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class CountAsideActivity implements ExportInterface, GroupedExportInterface
|
class CountAsideActivity implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
private AsideActivityRepository $repository;
|
public function __construct(private AsideActivityRepository $repository)
|
||||||
|
{
|
||||||
public function __construct(
|
|
||||||
AsideActivityRepository $repository
|
|
||||||
) {
|
|
||||||
$this->repository = $repository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
@@ -34,40 +34,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
private AsideActivityCategoryRepository $asideActivityCategoryRepository;
|
public function __construct(private EntityManagerInterface $em, private DateTimeHelper $dateTimeHelper, private UserHelper $userHelper, private ScopeRepositoryInterface $scopeRepository, private CenterRepositoryInterface $centerRepository, private AsideActivityCategoryRepository $asideActivityCategoryRepository, private CategoryRender $categoryRender, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
{
|
||||||
private CategoryRender $categoryRender;
|
|
||||||
|
|
||||||
private CenterRepositoryInterface $centerRepository;
|
|
||||||
|
|
||||||
private DateTimeHelper $dateTimeHelper;
|
|
||||||
|
|
||||||
private EntityManagerInterface $em;
|
|
||||||
|
|
||||||
private ScopeRepositoryInterface $scopeRepository;
|
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
private UserHelper $userHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
EntityManagerInterface $em,
|
|
||||||
DateTimeHelper $dateTimeHelper,
|
|
||||||
UserHelper $userHelper,
|
|
||||||
ScopeRepositoryInterface $scopeRepository,
|
|
||||||
CenterRepositoryInterface $centerRepository,
|
|
||||||
AsideActivityCategoryRepository $asideActivityCategoryRepository,
|
|
||||||
CategoryRender $categoryRender,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper
|
|
||||||
) {
|
|
||||||
$this->em = $em;
|
|
||||||
$this->dateTimeHelper = $dateTimeHelper;
|
|
||||||
$this->userHelper = $userHelper;
|
|
||||||
$this->scopeRepository = $scopeRepository;
|
|
||||||
$this->centerRepository = $centerRepository;
|
|
||||||
$this->asideActivityCategoryRepository = $asideActivityCategoryRepository;
|
|
||||||
$this->categoryRender = $categoryRender;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
@@ -95,19 +63,15 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
switch ($key) {
|
return match ($key) {
|
||||||
case 'id':
|
'id', 'note' => static function ($value) use ($key) {
|
||||||
case 'note':
|
|
||||||
return static function ($value) use ($key) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'export.aside_activity.' . $key;
|
return 'export.aside_activity.' . $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value ?? '';
|
return $value ?? '';
|
||||||
};
|
},
|
||||||
|
'duration' => static function ($value) use ($key) {
|
||||||
case 'duration':
|
|
||||||
return static function ($value) use ($key) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'export.aside_activity.' . $key;
|
return 'export.aside_activity.' . $key;
|
||||||
}
|
}
|
||||||
@@ -121,19 +85,10 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
};
|
},
|
||||||
|
'createdAt', 'updatedAt', 'date' => $this->dateTimeHelper->getLabel('export.aside_activity.' . $key),
|
||||||
case 'createdAt':
|
'agent_id', 'creator_id' => $this->userHelper->getLabel($key, $values, 'export.aside_activity.' . $key),
|
||||||
case 'updatedAt':
|
'aside_activity_type' => function ($value) {
|
||||||
case 'date':
|
|
||||||
return $this->dateTimeHelper->getLabel('export.aside_activity.' . $key);
|
|
||||||
|
|
||||||
case 'agent_id':
|
|
||||||
case 'creator_id':
|
|
||||||
return $this->userHelper->getLabel($key, $values, 'export.aside_activity.' . $key);
|
|
||||||
|
|
||||||
case 'aside_activity_type':
|
|
||||||
return function ($value) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'export.aside_activity.aside_activity_type';
|
return 'export.aside_activity.aside_activity_type';
|
||||||
}
|
}
|
||||||
@@ -143,10 +98,8 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->categoryRender->renderString($c, []);
|
return $this->categoryRender->renderString($c, []);
|
||||||
};
|
},
|
||||||
|
'main_scope' => function ($value) {
|
||||||
case 'main_scope':
|
|
||||||
return function ($value) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'export.aside_activity.main_scope';
|
return 'export.aside_activity.main_scope';
|
||||||
}
|
}
|
||||||
@@ -156,10 +109,8 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize($c->getName());
|
return $this->translatableStringHelper->localize($c->getName());
|
||||||
};
|
},
|
||||||
|
'main_center' => function ($value) {
|
||||||
case 'main_center':
|
|
||||||
return function ($value) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'export.aside_activity.main_center';
|
return 'export.aside_activity.main_center';
|
||||||
}
|
}
|
||||||
@@ -170,11 +121,9 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $c->getName();
|
return $c->getName();
|
||||||
|
},
|
||||||
|
default => throw new LogicException('this key is not supported : ' . $key),
|
||||||
};
|
};
|
||||||
|
|
||||||
default:
|
|
||||||
throw new LogicException('this key is not supported : ' . $key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data)
|
||||||
|
@@ -23,12 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class SumAsideActivityDuration implements ExportInterface, GroupedExportInterface
|
class SumAsideActivityDuration implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
private AsideActivityRepository $repository;
|
public function __construct(private AsideActivityRepository $repository)
|
||||||
|
{
|
||||||
public function __construct(
|
|
||||||
AsideActivityRepository $repository
|
|
||||||
) {
|
|
||||||
$this->repository = $repository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
@@ -23,20 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ByActivityTypeFilter implements FilterInterface
|
class ByActivityTypeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private AsideActivityCategoryRepository $asideActivityTypeRepository;
|
public function __construct(private CategoryRender $categoryRender, private TranslatableStringHelperInterface $translatableStringHelper, private AsideActivityCategoryRepository $asideActivityTypeRepository)
|
||||||
|
{
|
||||||
private CategoryRender $categoryRender;
|
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
CategoryRender $categoryRender,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper,
|
|
||||||
AsideActivityCategoryRepository $asideActivityTypeRepository
|
|
||||||
) {
|
|
||||||
$this->categoryRender = $categoryRender;
|
|
||||||
$this->asideActivityTypeRepository = $asideActivityTypeRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -26,16 +26,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
|
|
||||||
class ByDateFilter implements FilterInterface
|
class ByDateFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
protected TranslatorInterface $translator;
|
public function __construct(private RollingDateConverterInterface $rollingDateConverter, protected TranslatorInterface $translator)
|
||||||
|
{
|
||||||
private RollingDateConverterInterface $rollingDateConverter;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
RollingDateConverterInterface $rollingDateConverter,
|
|
||||||
TranslatorInterface $translator
|
|
||||||
) {
|
|
||||||
$this->translator = $translator;
|
|
||||||
$this->rollingDateConverter = $rollingDateConverter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -20,11 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ByUserFilter implements FilterInterface
|
class ByUserFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private UserRender $userRender;
|
public function __construct(private UserRender $userRender)
|
||||||
|
|
||||||
public function __construct(UserRender $userRender)
|
|
||||||
{
|
{
|
||||||
$this->userRender = $userRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -22,11 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ByUserJobFilter implements FilterInterface
|
class ByUserJobFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
public function __construct(private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
|
||||||
public function __construct(TranslatableStringHelperInterface $translatableStringHelper)
|
|
||||||
{
|
{
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -23,16 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ByUserScopeFilter implements FilterInterface
|
class ByUserScopeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private ScopeRepositoryInterface $scopeRepository;
|
public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
{
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
ScopeRepositoryInterface $scopeRepository,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper
|
|
||||||
) {
|
|
||||||
$this->scopeRepository = $scopeRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -22,12 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
final class AsideActivityCategoryType extends AbstractType
|
final class AsideActivityCategoryType extends AbstractType
|
||||||
{
|
{
|
||||||
private CategoryRender $categoryRender;
|
public function __construct(private CategoryRender $categoryRender)
|
||||||
|
{
|
||||||
public function __construct(
|
|
||||||
CategoryRender $categoryRender
|
|
||||||
) {
|
|
||||||
$this->categoryRender = $categoryRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
|
@@ -20,12 +20,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||||||
|
|
||||||
final class PickAsideActivityCategoryType extends AbstractType
|
final class PickAsideActivityCategoryType extends AbstractType
|
||||||
{
|
{
|
||||||
private CategoryRender $categoryRender;
|
public function __construct(private CategoryRender $categoryRender)
|
||||||
|
{
|
||||||
public function __construct(
|
|
||||||
CategoryRender $categoryRender
|
|
||||||
) {
|
|
||||||
$this->categoryRender = $categoryRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
@@ -16,11 +16,8 @@ use Symfony\Component\Security\Core\Security;
|
|||||||
|
|
||||||
final class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
|
final class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
|
||||||
{
|
{
|
||||||
private Security $security;
|
public function __construct(private Security $security)
|
||||||
|
|
||||||
public function __construct(Security $security)
|
|
||||||
{
|
{
|
||||||
$this->security = $security;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user