Compare commits

..

1 Commits

Author SHA1 Message Date
2721872da8 fix bug of user filter not being combined with other filters 2023-09-12 15:40:17 +02:00
789 changed files with 9892 additions and 4696 deletions

View File

@@ -0,0 +1,5 @@
kind: DX
body: '[FilterOrderHelper] add entity choice and singleCheckbox'
time: 2023-06-23T12:24:08.133491895+02:00
custom:
Issue: ""

View File

@@ -0,0 +1,5 @@
kind: Feature
body: '[activity list] add filtering for activities list'
time: 2023-06-23T12:25:30.49643551+02:00
custom:
Issue: ""

View File

@@ -0,0 +1,6 @@
kind: Feature
body: '[activity list] in person context, show also the activities from the accompanying
periods where the person participates'
time: 2023-06-23T12:27:02.159041095+02:00
custom:
Issue: ""

View File

@@ -0,0 +1,5 @@
kind: Feature
body: '[activity list] add pagination to the list of activities'
time: 2023-06-23T12:44:38.879098862+02:00
custom:
Issue: ""

View File

@@ -0,0 +1,5 @@
kind: Feature
body: Allow filtering on the basis of a user within general tasks list
time: 2023-07-05T14:03:36.664880092+02:00
custom:
Issue: ""

View File

@@ -1,39 +0,0 @@
## 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

View File

@@ -1,3 +0,0 @@
## 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

View File

@@ -1,3 +0,0 @@
## 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)

View File

@@ -7,7 +7,7 @@ versionFormat: '## {{.Version}} - {{.Time.Format "2006-01-02"}}'
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.
changeFormat: >-
* {{ 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 "")) }}
* {{ if not (eq .Custom.Issue "") }}([#{{ .Custom.Issue }}](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/{{ .Custom.Issue }})) {{ end }}{{.Body}} {{ if not (eq .Custom.Long "") }}
{{ .Custom.Long }}{{ end }}
custom:
@@ -30,8 +30,6 @@ kinds:
auto: patch
- label: DX
auto: patch
- label: UX
auto: patch
newlines:
afterChangelogHeader: 1
beforeChangelogVersion: 1

View File

@@ -6,54 +6,6 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
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
### Feature

View File

@@ -54,9 +54,18 @@ class CountPerson implements ExportInterface
public function getLabels($key, array $values, $data)
{
// the Closure which will be executed by the formatter.
return fn($value) => match ($value) {
'_header' => $this->getTitle(),
default => $value,
return function ($value) {
switch ($value) {
case '_header':
// 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;
}
};
}

View File

@@ -1,84 +0,0 @@
.. 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`.

View File

@@ -1,155 +0,0 @@
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.

View File

@@ -36,7 +36,6 @@ As Chill rely on the `symfony <http://symfony.com>`_ framework, reading the fram
Assets <assets.rst>
Cron Jobs <cronjob.rst>
Info about entities <entity-info.rst>
Info about database (in French) <database-principles.rst>
Layout and UI
**************

View File

@@ -23,12 +23,19 @@ class ChillMainConfiguration implements ConfigurationInterface
{
use AddWidgetConfigurationTrait;
/**
* @var ContainerBuilder
*/
private $containerBuilder;
public function __construct(
array $widgetFactories,
private ContainerBuilder $containerBuilder
ContainerBuilder $containerBuilder
) {
// we register here widget factories (see below)
$this->setWidgetFactories($widgetFactories);
// we will need the container builder later...
$this->containerBuilder = $containerBuilder;
}
public function getConfigTreeBuilder()

View File

@@ -21,7 +21,7 @@ return static function (RectorConfig $rectorConfig): void {
//define sets of rules
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_80
LevelSetList::UP_TO_PHP_74
]);
// chill rules
@@ -37,5 +37,27 @@ return static function (RectorConfig $rectorConfig): void {
// must merge MR500 and review a typing of "ArrayCollection" in entities
\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
]);
};

View File

@@ -77,8 +77,10 @@ final class ActivityController extends AbstractController
/**
* Deletes a Activity entity.
*
* @param mixed $id
*/
public function deleteAction(Request $request, mixed $id)
public function deleteAction(Request $request, $id)
{
$view = null;
@@ -257,8 +259,8 @@ final class ActivityController extends AbstractController
$filterArgs = [
'my_activities' => $filter->getSingleCheckboxData('my_activities'),
'types' => $filter->hasEntityChoice('activity_types') ? $filter->getEntityChoiceData('activity_types') : [],
'jobs' => $filter->hasEntityChoice('jobs') ? $filter->getEntityChoiceData('jobs') : [],
'types' => $filter->getEntityChoiceData('activity_types'),
'jobs' => $filter->getEntityChoiceData('jobs'),
'before' => $filter->getDateRangeData('activity_date')['to'],
'after' => $filter->getDateRangeData('activity_date')['from'],
];
@@ -325,28 +327,21 @@ final class ActivityController extends AbstractController
$filterBuilder
->addDateRange('activity_date', 'activity.date')
->addSingleCheckbox('my_activities', 'activity_filter.My activities');
->addSingleCheckbox('my_activities', 'activity_filter.My activities')
->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 => '',
};
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 $text . $this->translatableStringHelper->localize($activityType->getName());
}
])
->addEntityChoice('jobs', 'activity_filter.Jobs', UserJob::class, $jobs, [
'choice_label' => fn (UserJob $u) => $this->translatableStringHelper->localize($u->getLabel())
])
;
return $filterBuilder->build();
}
@@ -677,8 +672,8 @@ final class ActivityController extends AbstractController
throw $this->createNotFoundException('Accompanying Period not found');
}
// TODO Add permission
// $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
// TODO Add permission
// $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
} else {
throw $this->createNotFoundException('Person or Accompanying Period not found');
}

View File

@@ -47,8 +47,10 @@ class ActivityReasonCategoryController extends AbstractController
/**
* Displays a form to edit an existing ActivityReasonCategory entity.
*
* @param mixed $id
*/
public function editAction(mixed $id)
public function editAction($id)
{
$em = $this->getDoctrine()->getManager();
@@ -96,8 +98,10 @@ class ActivityReasonCategoryController extends AbstractController
/**
* Finds and displays a ActivityReasonCategory entity.
*
* @param mixed $id
*/
public function showAction(mixed $id)
public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
@@ -114,8 +118,10 @@ class ActivityReasonCategoryController extends AbstractController
/**
* Edits an existing ActivityReasonCategory entity.
*
* @param mixed $id
*/
public function updateAction(Request $request, mixed $id)
public function updateAction(Request $request, $id)
{
$em = $this->getDoctrine()->getManager();

View File

@@ -24,8 +24,11 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
*/
class ActivityReasonController extends AbstractController
{
public function __construct(private ActivityReasonRepository $activityReasonRepository)
private ActivityReasonRepository $activityReasonRepository;
public function __construct(ActivityReasonRepository $activityReasonRepository)
{
$this->activityReasonRepository = $activityReasonRepository;
}
/**
@@ -53,8 +56,10 @@ class ActivityReasonController extends AbstractController
/**
* Displays a form to edit an existing ActivityReason entity.
*
* @param mixed $id
*/
public function editAction(mixed $id)
public function editAction($id)
{
$em = $this->getDoctrine()->getManager();
@@ -102,8 +107,10 @@ class ActivityReasonController extends AbstractController
/**
* Finds and displays a ActivityReason entity.
*
* @param mixed $id
*/
public function showAction(mixed $id)
public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
@@ -120,8 +127,10 @@ class ActivityReasonController extends AbstractController
/**
* Edits an existing ActivityReason entity.
*
* @param mixed $id
*/
public function updateAction(Request $request, mixed $id)
public function updateAction(Request $request, $id)
{
$em = $this->getDoctrine()->getManager();

View File

@@ -25,14 +25,17 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface
{
use \Symfony\Component\DependencyInjection\ContainerAwareTrait;
private EntityManagerInterface $em;
/**
* @var \Faker\Generator
*/
private $faker;
public function __construct(private EntityManagerInterface $em)
public function __construct(EntityManagerInterface $em)
{
$this->faker = FakerFactory::create('fr_FR');
$this->em = $em;
}
public function getOrder()

View File

@@ -104,7 +104,6 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
/**
* @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject", cascade={"persist"})
* @Assert\Valid(traverse=true)
* @var Collection<StoredObject>
*/
private Collection $documents;
@@ -141,9 +140,8 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
/**
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
* @Groups({"read", "docgen:read"})
* @var Collection<Person>
*/
private Collection $persons;
private ?Collection $persons = null;
/**
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_")
@@ -153,7 +151,6 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
/**
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
* @Groups({"docgen:read"})
* @var Collection<ActivityReason>
*/
private Collection $reasons;
@@ -173,7 +170,6 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction")
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction")
* @Groups({"read", "docgen:read"})
* @var Collection<SocialAction>
*/
private Collection $socialActions;
@@ -181,16 +177,14 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialIssue")
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue")
* @Groups({"read", "docgen:read"})
* @var Collection<SocialIssue>
*/
private Collection $socialIssues;
/**
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
* @Groups({"read", "docgen:read"})
* @var Collection<ThirdParty>
*/
private Collection $thirdParties;
private ?Collection $thirdParties = null;
/**
* @ORM\Column(type="time", nullable=true)
@@ -206,9 +200,8 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
/**
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User")
* @Groups({"read", "docgen:read"})
* @var Collection<User>
*/
private Collection $users;
private ?Collection $users = null;
public function __construct()
{

View File

@@ -23,9 +23,10 @@ use Doctrine\ORM\Mapping as ORM;
class ActivityReason
{
/**
* @var bool
* @ORM\Column(type="boolean")
*/
private bool $active = true;
private $active = true;
/**
* @var ActivityReasonCategory
@@ -33,7 +34,7 @@ class ActivityReason
* targetEntity="Chill\ActivityBundle\Entity\ActivityReasonCategory",
* inversedBy="reasons")
*/
private ?ActivityReasonCategory $category = null;
private $category;
/**
* @var int
@@ -42,13 +43,13 @@ class ActivityReason
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null;
private $id;
/**
* @var array
* @ORM\Column(type="json")
*/
private array $name;
private $name;
/**
* Get active.
@@ -80,9 +81,27 @@ class ActivityReason
/**
* Get name.
*
* @param mixed|null $locale
*
* @return array | string
*/
public function getName(): array
public function getName($locale = null)
{
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;
}

View File

@@ -12,7 +12,6 @@ declare(strict_types=1);
namespace Chill\ActivityBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
@@ -22,7 +21,7 @@ use Doctrine\ORM\Mapping as ORM;
* @ORM\Table(name="activityreasoncategory")
* @ORM\HasLifecycleCallbacks
*/
class ActivityReasonCategory implements \Stringable
class ActivityReasonCategory
{
/**
* @var bool
@@ -48,12 +47,12 @@ class ActivityReasonCategory implements \Stringable
/**
* Array of ActivityReason.
*
* @var Collection<ActivityReason>
* @var ArrayCollection
* @ORM\OneToMany(
* targetEntity="Chill\ActivityBundle\Entity\ActivityReason",
* mappedBy="category")
*/
private Collection $reasons;
private $reasons;
/**
* ActivityReasonCategory constructor.
@@ -66,7 +65,7 @@ class ActivityReasonCategory implements \Stringable
/**
* @return string
*/
public function __toString(): string
public function __toString()
{
return 'ActivityReasonCategory(' . $this->getName('x') . ')';
}

View File

@@ -275,8 +275,10 @@ class ActivityType
/**
* @Assert\Callback
*
* @param mixed $payload
*/
public function checkSocialActionsVisibility(ExecutionContextInterface $context, mixed $payload)
public function checkSocialActionsVisibility(ExecutionContextInterface $context, $payload)
{
if ($this->socialIssuesVisible !== $this->socialActionsVisible) {
if (!(2 === $this->socialIssuesVisible && 1 === $this->socialActionsVisible)) {

View File

@@ -22,8 +22,14 @@ use function in_array;
class ActivityEntityListener
{
public function __construct(private EntityManagerInterface $em, private AccompanyingPeriodWorkRepository $workRepository)
private EntityManagerInterface $em;
private AccompanyingPeriodWorkRepository $workRepository;
public function __construct(EntityManagerInterface $em, AccompanyingPeriodWorkRepository $workRepository)
{
$this->em = $em;
$this->workRepository = $workRepository;
}
public function persistActionToCourse(Activity $activity)

View File

@@ -20,8 +20,16 @@ use Symfony\Component\Form\FormBuilderInterface;
class ByCreatorAggregator implements AggregatorInterface
{
public function __construct(private UserRepositoryInterface $userRepository, private UserRender $userRender)
{
private UserRender $userRender;
private UserRepositoryInterface $userRepository;
public function __construct(
UserRepositoryInterface $userRepository,
UserRender $userRender
) {
$this->userRepository = $userRepository;
$this->userRender = $userRender;
}
public function addRole(): ?string

View File

@@ -21,8 +21,16 @@ use function in_array;
class BySocialActionAggregator implements AggregatorInterface
{
public function __construct(private SocialActionRender $actionRender, private SocialActionRepository $actionRepository)
{
private SocialActionRender $actionRender;
private SocialActionRepository $actionRepository;
public function __construct(
SocialActionRender $actionRender,
SocialActionRepository $actionRepository
) {
$this->actionRender = $actionRender;
$this->actionRepository = $actionRepository;
}
public function addRole(): ?string

View File

@@ -21,8 +21,16 @@ use function in_array;
class BySocialIssueAggregator implements AggregatorInterface
{
public function __construct(private SocialIssueRepository $issueRepository, private SocialIssueRender $issueRender)
{
private SocialIssueRender $issueRender;
private SocialIssueRepository $issueRepository;
public function __construct(
SocialIssueRepository $issueRepository,
SocialIssueRender $issueRender
) {
$this->issueRepository = $issueRepository;
$this->issueRender = $issueRender;
}
public function addRole(): ?string

View File

@@ -21,8 +21,16 @@ use function in_array;
class ByThirdpartyAggregator implements AggregatorInterface
{
public function __construct(private ThirdPartyRepository $thirdPartyRepository, private ThirdPartyRender $thirdPartyRender)
{
private ThirdPartyRender $thirdPartyRender;
private ThirdPartyRepository $thirdPartyRepository;
public function __construct(
ThirdPartyRepository $thirdPartyRepository,
ThirdPartyRender $thirdPartyRender
) {
$this->thirdPartyRepository = $thirdPartyRepository;
$this->thirdPartyRender = $thirdPartyRender;
}
public function addRole(): ?string

View File

@@ -21,8 +21,16 @@ use function in_array;
class CreatorScopeAggregator implements AggregatorInterface
{
public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper)
{
private ScopeRepository $scopeRepository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
ScopeRepository $scopeRepository,
TranslatableStringHelper $translatableStringHelper
) {
$this->scopeRepository = $scopeRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string

View File

@@ -94,9 +94,17 @@ class DateAggregator implements AggregatorInterface
return '';
}
return match ($data['frequency']) {
default => $value,
};
switch ($data['frequency']) {
case 'month':
case 'week':
//return $this->translator->trans('for week') .' '. $value ;
case 'year':
//return $this->translator->trans('in year') .' '. $value ;
default:
return $value;
}
};
}

View File

@@ -21,8 +21,16 @@ use function in_array;
class LocationTypeAggregator implements AggregatorInterface
{
public function __construct(private LocationTypeRepository $locationTypeRepository, private TranslatableStringHelper $translatableStringHelper)
{
private LocationTypeRepository $locationTypeRepository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
LocationTypeRepository $locationTypeRepository,
TranslatableStringHelper $translatableStringHelper
) {
$this->locationTypeRepository = $locationTypeRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string

View File

@@ -1,80 +0,0 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\ActivityBundle\Export\Aggregator;
use Chill\ActivityBundle\Export\Declarations;
use Chill\ActivityBundle\Repository\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';
}
}

View File

@@ -24,8 +24,16 @@ class ActivityTypeAggregator implements AggregatorInterface
{
public const KEY = 'activity_type_aggregator';
public function __construct(protected ActivityTypeRepositoryInterface $activityTypeRepository, protected TranslatableStringHelperInterface $translatableStringHelper)
{
protected ActivityTypeRepositoryInterface $activityTypeRepository;
protected TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
ActivityTypeRepositoryInterface $activityTypeRepository,
TranslatableStringHelperInterface $translatableStringHelper
) {
$this->activityTypeRepository = $activityTypeRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string

View File

@@ -23,8 +23,16 @@ class ActivityUserAggregator implements AggregatorInterface
{
public const KEY = 'activity_user_id';
public function __construct(private UserRepository $userRepository, private UserRender $userRender)
{
private UserRender $userRender;
private UserRepository $userRepository;
public function __construct(
UserRepository $userRepository,
UserRender $userRender
) {
$this->userRepository = $userRepository;
$this->userRender = $userRender;
}
public function addRole(): ?string

View File

@@ -21,8 +21,14 @@ use function in_array;
class ActivityUsersAggregator implements AggregatorInterface
{
public function __construct(private UserRepositoryInterface $userRepository, private UserRender $userRender)
private UserRender $userRender;
private UserRepositoryInterface $userRepository;
public function __construct(UserRepositoryInterface $userRepository, UserRender $userRender)
{
$this->userRepository = $userRepository;
$this->userRender = $userRender;
}
public function addRole(): ?string

View File

@@ -20,8 +20,14 @@ use function in_array;
class ActivityUsersJobAggregator implements \Chill\MainBundle\Export\AggregatorInterface
{
public function __construct(private UserJobRepositoryInterface $userJobRepository, private TranslatableStringHelperInterface $translatableStringHelper)
private TranslatableStringHelperInterface $translatableStringHelper;
private UserJobRepositoryInterface $userJobRepository;
public function __construct(UserJobRepositoryInterface $userJobRepository, TranslatableStringHelperInterface $translatableStringHelper)
{
$this->userJobRepository = $userJobRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string

View File

@@ -20,8 +20,14 @@ use function in_array;
class ActivityUsersScopeAggregator implements \Chill\MainBundle\Export\AggregatorInterface
{
public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
private ScopeRepositoryInterface $scopeRepository;
private TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(ScopeRepositoryInterface $scopeRepository, TranslatableStringHelperInterface $translatableStringHelper)
{
$this->scopeRepository = $scopeRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string

View File

@@ -30,8 +30,20 @@ use function in_array;
class ActivityReasonAggregator implements AggregatorInterface, ExportElementValidatedInterface
{
public function __construct(protected ActivityReasonCategoryRepository $activityReasonCategoryRepository, protected ActivityReasonRepository $activityReasonRepository, protected TranslatableStringHelper $translatableStringHelper)
{
protected ActivityReasonCategoryRepository $activityReasonCategoryRepository;
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
@@ -105,11 +117,21 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
public function getLabels($key, array $values, $data)
{
match ($data['level']) {
'reasons' => $this->activityReasonRepository->findBy(['id' => $values]),
'categories' => $this->activityReasonCategoryRepository->findBy(['id' => $values]),
default => throw new RuntimeException(sprintf("The level data '%s' is invalid.", $data['level'])),
};
// for performance reason, we load data from db only once
switch ($data['level']) {
case 'reasons':
$this->activityReasonRepository->findBy(['id' => $values]);
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) {
if ('_header' === $value) {

View File

@@ -20,8 +20,11 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class SentReceivedAggregator implements AggregatorInterface
{
public function __construct(private TranslatorInterface $translator)
private TranslatorInterface $translator;
public function __construct(TranslatorInterface $translator)
{
$this->translator = $translator;
}
public function addRole(): ?string

View File

@@ -24,8 +24,20 @@ use Symfony\Component\Form\FormBuilderInterface;
class ListActivity implements ListInterface, GroupedExportInterface
{
public function __construct(private ListActivityHelper $helper, private EntityManagerInterface $entityManager, private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper)
{
private EntityManagerInterface $entityManager;
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)
@@ -54,17 +66,22 @@ class ListActivity implements ListInterface, GroupedExportInterface
public function getLabels($key, array $values, $data)
{
return match ($key) {
'acpId' => static function ($value) {
if ('_header' === $value) {
return ListActivityHelper::MSG_KEY . 'accompanying course id';
}
switch ($key) {
case 'acpId':
return static function ($value) {
if ('_header' === $value) {
return ListActivityHelper::MSG_KEY . 'accompanying course id';
}
return $value ?? '';
},
'scopesNames' => $this->translatableStringExportLabelHelper->getLabelMulti($key, $values, ListActivityHelper::MSG_KEY . 'course circles'),
default => $this->helper->getLabels($key, $values, $data),
};
return $value ?? '';
};
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)

View File

@@ -24,8 +24,12 @@ use Symfony\Component\Form\FormBuilderInterface;
class CountActivity implements ExportInterface, GroupedExportInterface
{
public function __construct(protected ActivityRepository $activityRepository)
{
protected ActivityRepository $activityRepository;
public function __construct(
ActivityRepository $activityRepository
) {
$this->activityRepository = $activityRepository;
}
public function buildForm(FormBuilderInterface $builder)

View File

@@ -36,6 +36,8 @@ use function in_array;
class ListActivity implements ListInterface, GroupedExportInterface
{
protected EntityManagerInterface $entityManager;
protected array $fields = [
'id',
'date',
@@ -50,8 +52,22 @@ class ListActivity implements ListInterface, GroupedExportInterface
'person_id',
];
public function __construct(protected EntityManagerInterface $entityManager, protected TranslatorInterface $translator, protected TranslatableStringHelperInterface $translatableStringHelper, private ActivityRepository $activityRepository)
{
protected TranslatableStringHelperInterface $translatableStringHelper;
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)

View File

@@ -32,16 +32,22 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface
{
public const SUM = 'sum';
/**
* The action for this report.
*/
protected string $action;
private ActivityRepository $activityRepository;
/**
* @param string $action the stat to perform
*/
public function __construct(
private ActivityRepository $activityRepository,
/**
* The action for this report.
*/
protected string $action = 'sum'
ActivityRepository $activityRepository,
string $action = 'sum'
) {
$this->action = $action;
$this->activityRepository = $activityRepository;
}
public function buildForm(FormBuilderInterface $builder)

View File

@@ -32,8 +32,44 @@ class ListActivityHelper
{
public const MSG_KEY = 'export.list.activity.';
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 ActivityPresenceRepositoryInterface $activityPresenceRepository;
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
@@ -79,78 +115,113 @@ class ListActivityHelper
public function getLabels($key, array $values, $data)
{
return match ($key) {
'createdAt', 'updatedAt' => $this->dateTimeHelper->getLabel($key),
'createdBy', 'updatedBy' => $this->userHelper->getLabel($key, $values, $key),
'date' => $this->dateTimeHelper->getLabel(self::MSG_KEY . $key),
'attendeeName' => function ($value) {
if ('_header' === $value) {
return 'Attendee';
}
switch ($key) {
case 'createdAt':
case 'updatedAt':
return $this->dateTimeHelper->getLabel($key);
if (null === $value || null === $presence = $this->activityPresenceRepository->find($value)) {
return '';
}
case 'createdBy':
case 'updatedBy':
return $this->userHelper->getLabel($key, $values, $key);
return $this->translatableStringHelper->localize($presence->getName());
},
'listReasons' => $this->translatableStringLabelHelper->getLabelMulti($key, $values, 'Activity Reasons'),
'typeName' => function ($value) {
if ('_header' === $value) {
return 'Activity type';
}
case 'date':
return $this->dateTimeHelper->getLabel(self::MSG_KEY . $key);
if (null === $value || null === $type = $this->activityTypeRepository->find($value)) {
return '';
}
case 'attendeeName':
return function ($value) {
if ('_header' === $value) {
return 'Attendee';
}
return $this->translatableStringHelper->localize($type->getName());
},
'usersNames' => $this->userHelper->getLabelMulti($key, $values, self::MSG_KEY . 'users name'),
'usersIds', 'thirdPartiesIds', 'personsIds' => static function ($value) use ($key) {
if ('_header' === $value) {
return match ($key) {
'usersIds' => self::MSG_KEY . 'users ids',
'thirdPartiesIds' => self::MSG_KEY . 'third parties ids',
'personsIds' => self::MSG_KEY . 'persons ids',
};
}
if (null === $value || null === $presence = $this->activityPresenceRepository->find($value)) {
return '';
}
$decoded = json_decode($value, null, 512, JSON_THROW_ON_ERROR);
return $this->translatableStringHelper->localize($presence->getName());
};
return implode(
'|',
array_unique(
array_filter($decoded, static fn (?int $id) => null !== $id),
SORT_NUMERIC
)
);
},
'personsNames' => $this->labelPersonHelper->getLabelMulti($key, $values, self::MSG_KEY . 'persons name'),
'thirdPartiesNames' => $this->labelThirdPartyHelper->getLabelMulti($key, $values, self::MSG_KEY . 'thirds parties'),
'sentReceived' => function ($value) {
if ('_header' === $value) {
return self::MSG_KEY . 'sent received';
}
case 'listReasons':
return $this->translatableStringLabelHelper->getLabelMulti($key, $values, 'Activity Reasons');
if (null === $value) {
return '';
}
case 'typeName':
return function ($value) {
if ('_header' === $value) {
return 'Activity type';
}
return $this->translator->trans($value);
},
default => function ($value) use ($key) {
if ('_header' === $value) {
return self::MSG_KEY . $key;
}
if (null === $value || null === $type = $this->activityTypeRepository->find($value)) {
return '';
}
if (null === $value) {
return '';
}
return $this->translatableStringHelper->localize($type->getName());
};
return $this->translator->trans($value);
},
};
case 'usersNames':
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) {
switch ($key) {
case 'usersIds':
return self::MSG_KEY . 'users 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);
return implode(
'|',
array_unique(
array_filter($decoded, static fn (?int $id) => null !== $id),
SORT_NUMERIC
)
);
};
case 'personsNames':
return $this->labelPersonHelper->getLabelMulti($key, $values, self::MSG_KEY . 'persons name');
case 'thirdPartiesNames':
return $this->labelThirdPartyHelper->getLabelMulti($key, $values, self::MSG_KEY . 'thirds parties');
case 'sentReceived':
return function ($value) {
if ('_header' === $value) {
return self::MSG_KEY . 'sent received';
}
if (null === $value) {
return '';
}
return $this->translator->trans($value);
};
default:
return function ($value) use ($key) {
if ('_header' === $value) {
return self::MSG_KEY . $key;
}
if (null === $value) {
return '';
}
return $this->translator->trans($value);
};
}
}
public function getQueryKeys($data)

View File

@@ -23,8 +23,16 @@ use Symfony\Component\Form\FormBuilderInterface;
class ActivityTypeFilter implements FilterInterface
{
public function __construct(private ActivityTypeRepositoryInterface $activityTypeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
{
private ActivityTypeRepositoryInterface $activityTypeRepository;
private TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
ActivityTypeRepositoryInterface $activityTypeRepository,
TranslatableStringHelperInterface $translatableStringHelper
) {
$this->activityTypeRepository = $activityTypeRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string

View File

@@ -20,8 +20,11 @@ use Symfony\Component\Form\FormBuilderInterface;
class ByCreatorFilter implements FilterInterface
{
public function __construct(private UserRender $userRender)
private UserRender $userRender;
public function __construct(UserRender $userRender)
{
$this->userRender = $userRender;
}
public function addRole(): ?string

View File

@@ -22,8 +22,11 @@ use function in_array;
class BySocialActionFilter implements FilterInterface
{
public function __construct(private SocialActionRender $actionRender)
private SocialActionRender $actionRender;
public function __construct(SocialActionRender $actionRender)
{
$this->actionRender = $actionRender;
}
public function addRole(): ?string

View File

@@ -22,8 +22,11 @@ use function in_array;
class BySocialIssueFilter implements FilterInterface
{
public function __construct(private SocialIssueRender $issueRender)
private SocialIssueRender $issueRender;
public function __construct(SocialIssueRender $issueRender)
{
$this->issueRender = $issueRender;
}
public function addRole(): ?string

View File

@@ -28,8 +28,11 @@ class EmergencyFilter implements FilterInterface
private const DEFAULT_CHOICE = false;
public function __construct(private TranslatorInterface $translator)
private TranslatorInterface $translator;
public function __construct(TranslatorInterface $translator)
{
$this->translator = $translator;
}
public function addRole(): ?string

View File

@@ -22,8 +22,11 @@ use function in_array;
class LocationTypeFilter implements FilterInterface
{
public function __construct(private TranslatableStringHelper $translatableStringHelper)
private TranslatableStringHelper $translatableStringHelper;
public function __construct(TranslatableStringHelper $translatableStringHelper)
{
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string

View File

@@ -1,90 +0,0 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
use Chill\ActivityBundle\Entity\Activity;
use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Form\Type\PickRollingDateType;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
final readonly class PeriodHavingActivityBetweenDatesFilter implements FilterInterface
{
public function __construct(
private RollingDateConverterInterface $rollingDateConverter,
) {
}
public function getTitle()
{
return 'export.filter.activity.course_having_activity_between_date.Title';
}
public function buildForm(FormBuilderInterface $builder)
{
$builder
->add('start_date', PickRollingDateType::class, [
'label' => 'export.filter.activity.course_having_activity_between_date.Receiving an activity after'
])
->add('end_date', PickRollingDateType::class, [
'label' => 'export.filter.activity.course_having_activity_between_date.Receiving an activity before'
]);
}
public function getFormDefaultData(): array
{
return [
'start_date' => new RollingDate(RollingDate::T_YEAR_CURRENT_START),
'end_date' => new RollingDate(RollingDate::T_TODAY)
];
}
public function describeAction($data, $format = 'string')
{
return [
'export.filter.activity.course_having_activity_between_date.Only course having an activity between from and to',
[
'from' => $this->rollingDateConverter->convert($data['start_date']),
'to' => $this->rollingDateConverter->convert($data['end_date']),
]
];
}
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$alias = 'act_period_having_act_betw_date_alias';
$from = 'act_period_having_act_betw_date_start';
$to = 'act_period_having_act_betw_date_end';
$qb->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM ' . Activity::class . " {$alias} WHERE {$alias}.date >= :{$from} AND {$alias}.date < :{$to} AND {$alias}.accompanyingPeriod = acp"
)
);
$qb
->setParameter($from, $this->rollingDateConverter->convert($data['start_date']))
->setParameter($to, $this->rollingDateConverter->convert($data['end_date']));
}
public function applyOn()
{
return \Chill\PersonBundle\Export\Declarations::ACP_TYPE;
}
}

View File

@@ -29,8 +29,11 @@ class SentReceivedFilter implements FilterInterface
private const DEFAULT_CHOICE = Activity::SENTRECEIVED_SENT;
public function __construct(private TranslatorInterface $translator)
private TranslatorInterface $translator;
public function __construct(TranslatorInterface $translator)
{
$this->translator = $translator;
}
public function addRole(): ?string

View File

@@ -21,8 +21,11 @@ use Symfony\Component\Form\FormBuilderInterface;
class UserFilter implements FilterInterface
{
public function __construct(private UserRender $userRender)
private UserRender $userRender;
public function __construct(UserRender $userRender)
{
$this->userRender = $userRender;
}
public function addRole(): ?string

View File

@@ -23,8 +23,11 @@ use function in_array;
class UserScopeFilter implements FilterInterface
{
public function __construct(private TranslatableStringHelper $translatableStringHelper)
private TranslatableStringHelper $translatableStringHelper;
public function __construct(TranslatableStringHelper $translatableStringHelper)
{
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string

View File

@@ -27,8 +27,16 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class ActivityDateFilter implements FilterInterface
{
public function __construct(protected TranslatorInterface $translator, private RollingDateConverterInterface $rollingDateConverter)
{
protected TranslatorInterface $translator;
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(
TranslatorInterface $translator,
RollingDateConverterInterface $rollingDateConverter
) {
$this->translator = $translator;
$this->rollingDateConverter = $rollingDateConverter;
}
public function addRole(): ?string

View File

@@ -26,8 +26,16 @@ use function count;
class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInterface
{
public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, protected ActivityTypeRepositoryInterface $activityTypeRepository)
{
protected ActivityTypeRepositoryInterface $activityTypeRepository;
protected TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
TranslatableStringHelperInterface $translatableStringHelper,
ActivityTypeRepositoryInterface $activityTypeRepository
) {
$this->translatableStringHelper = $translatableStringHelper;
$this->activityTypeRepository = $activityTypeRepository;
}
public function addRole(): ?string

View File

@@ -20,8 +20,11 @@ use Symfony\Component\Form\FormBuilderInterface;
class ActivityUsersFilter implements FilterInterface
{
public function __construct(private UserRender $userRender)
private UserRender $userRender;
public function __construct(UserRender $userRender)
{
$this->userRender = $userRender;
}
public function addRole(): ?string

View File

@@ -29,8 +29,16 @@ use function in_array;
class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInterface
{
public function __construct(protected TranslatableStringHelper $translatableStringHelper, protected ActivityReasonRepository $activityReasonRepository)
{
protected ActivityReasonRepository $activityReasonRepository;
protected TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
TranslatableStringHelper $helper,
ActivityReasonRepository $activityReasonRepository
) {
$this->translatableStringHelper = $helper;
$this->activityReasonRepository = $activityReasonRepository;
}
public function addRole(): ?string

View File

@@ -37,8 +37,20 @@ use function count;
class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInterface, FilterInterface
{
public function __construct(protected TranslatableStringHelper $translatableStringHelper, protected ActivityReasonRepository $activityReasonRepository, protected TranslatorInterface $translator)
{
protected ActivityReasonRepository $activityReasonRepository;
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

View File

@@ -22,8 +22,11 @@ use Symfony\Component\Form\FormBuilderInterface;
class UsersJobFilter implements FilterInterface
{
public function __construct(private TranslatableStringHelperInterface $translatableStringHelper)
private TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(TranslatableStringHelperInterface $translatableStringHelper)
{
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string

View File

@@ -23,8 +23,16 @@ use Symfony\Component\Form\FormBuilderInterface;
class UsersScopeFilter implements FilterInterface
{
public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
{
private ScopeRepositoryInterface $scopeRepository;
private TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
ScopeRepositoryInterface $scopeRepository,
TranslatableStringHelperInterface $translatableStringHelper
) {
$this->scopeRepository = $scopeRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string

View File

@@ -58,22 +58,40 @@ use function in_array;
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;
public function __construct(
TokenStorageInterface $tokenStorage,
protected AuthorizationHelper $authorizationHelper,
protected ObjectManager $om,
protected TranslatableStringHelper $translatableStringHelper,
protected array $timeChoices,
protected SocialIssueRender $socialIssueRender,
protected SocialActionRender $socialActionRender
AuthorizationHelper $authorizationHelper,
ObjectManager $om,
TranslatableStringHelper $translatableStringHelper,
array $timeChoices,
SocialIssueRender $socialIssueRender,
SocialActionRender $socialActionRender
) {
if (!$tokenStorage->getToken()->getUser() instanceof User) {
throw new RuntimeException('you should have a valid user');
}
$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

View File

@@ -25,8 +25,11 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class ActivityTypeType extends AbstractType
{
public function __construct(private TranslatableStringHelper $translatableStringHelper)
private TranslatableStringHelper $translatableStringHelper;
public function __construct(TranslatableStringHelper $translatableStringHelper)
{
$this->translatableStringHelper = $translatableStringHelper;
}
public function buildForm(FormBuilderInterface $builder, array $options)

View File

@@ -24,8 +24,20 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
*/
class PickActivityReasonType extends AbstractType
{
public function __construct(private ActivityReasonRepository $activityReasonRepository, private ActivityReasonRender $reasonRender, private TranslatableStringHelperInterface $translatableStringHelper)
{
private ActivityReasonRepository $activityReasonRepository;
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)

View File

@@ -23,8 +23,14 @@ use Symfony\Contracts\Translation\TranslatorInterface;
*/
class TranslatableActivityReasonCategoryType extends AbstractType
{
public function __construct(private TranslatableStringHelperInterface $translatableStringHelper, private TranslatorInterface $translator)
private TranslatableStringHelperInterface $translatableStringHelper;
private TranslatorInterface $translator;
public function __construct(TranslatableStringHelperInterface $translatableStringHelper, TranslatorInterface $translator)
{
$this->translatableStringHelper = $translatableStringHelper;
$this->translator = $translator;
}
public function configureOptions(OptionsResolver $resolver)

View File

@@ -20,8 +20,16 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class TranslatableActivityType extends AbstractType
{
public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, protected ActivityTypeRepositoryInterface $activityTypeRepository)
{
protected ActivityTypeRepositoryInterface $activityTypeRepository;
protected TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
TranslatableStringHelperInterface $helper,
ActivityTypeRepositoryInterface $activityTypeRepository
) {
$this->translatableStringHelper = $helper;
$this->activityTypeRepository = $activityTypeRepository;
}
public function configureOptions(OptionsResolver $resolver)

View File

@@ -23,8 +23,16 @@ use Symfony\Contracts\Translation\TranslatorInterface;
*/
class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
{
public function __construct(protected Security $security, protected TranslatorInterface $translator)
{
protected Security $security;
protected TranslatorInterface $translator;
public function __construct(
Security $security,
TranslatorInterface $translator
) {
$this->security = $security;
$this->translator = $translator;
}
public function buildMenu($menuId, MenuItem $menu, array $parameters)

View File

@@ -20,8 +20,11 @@ use Symfony\Component\Security\Core\Security;
*/
final class AdminMenuBuilder implements LocalMenuBuilderInterface
{
public function __construct(private Security $security)
private Security $security;
public function __construct(Security $security)
{
$this->security = $security;
}
public function buildMenu($menuId, MenuItem $menu, array $parameters)

View File

@@ -23,8 +23,22 @@ use Symfony\Contracts\Translation\TranslatorInterface;
*/
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)

View File

@@ -18,8 +18,11 @@ use Chill\MainBundle\Notification\NotificationHandlerInterface;
final class ActivityNotificationHandler implements NotificationHandlerInterface
{
public function __construct(private ActivityRepository $activityRepository)
private ActivityRepository $activityRepository;
public function __construct(ActivityRepository $activityRepository)
{
$this->activityRepository = $activityRepository;
}
public function getTemplate(Notification $notification, array $options = []): string

View File

@@ -23,11 +23,15 @@ use Symfony\Component\HttpFoundation\RequestStack;
*/
class ActivityReasonRepository extends ServiceEntityRepository
{
private RequestStack $requestStack;
public function __construct(
ManagerRegistry $registry,
private RequestStack $requestStack
RequestStack $requestStack
) {
parent::__construct($registry, ActivityReason::class);
$this->requestStack = $requestStack;
}
/**

View File

@@ -74,12 +74,15 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
self::FULL,
];
protected Security $security;
protected VoterHelperInterface $voterHelper;
public function __construct(
protected Security $security,
Security $security,
VoterHelperFactoryInterface $voterHelperFactory
) {
$this->security = $security;
$this->voterHelper = $voterHelperFactory->generate(self::class)
->addCheckFor(Person::class, [self::SEE, self::CREATE])
->addCheckFor(AccompanyingPeriod::class, [self::SEE, self::CREATE])

View File

@@ -42,17 +42,48 @@ class ActivityContext implements
DocGeneratorContextWithAdminFormInterface,
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(
private NormalizerInterface $normalizer,
private TranslatableStringHelperInterface $translatableStringHelper,
private EntityManagerInterface $em,
private PersonRenderInterface $personRender,
private PersonRepository $personRepository,
private TranslatorInterface $translator,
private BaseContextData $baseContextData,
private ThirdPartyRender $thirdPartyRender,
private ThirdPartyRepository $thirdPartyRepository
DocumentCategoryRepository $documentCategoryRepository,
NormalizerInterface $normalizer,
TranslatableStringHelperInterface $translatableStringHelper,
EntityManagerInterface $em,
PersonRenderInterface $personRender,
PersonRepository $personRepository,
TranslatorInterface $translator,
BaseContextData $baseContextData,
ThirdPartyRender $thirdPartyRender,
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

View File

@@ -48,8 +48,44 @@ class ListActivitiesByAccompanyingPeriodContext implements
DocGeneratorContextWithAdminFormInterface,
DocGeneratorContextWithPublicFormInterface
{
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 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;
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

View File

@@ -21,8 +21,14 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod;
final class AccompanyingPeriodActivityGenericDocRenderer implements GenericDocRendererInterface
{
public function __construct(private StoredObjectRepository $objectRepository, private ActivityRepository $activityRepository)
private StoredObjectRepository $objectRepository;
private ActivityRepository $activityRepository;
public function __construct(StoredObjectRepository $storedObjectRepository, ActivityRepository $activityRepository)
{
$this->objectRepository = $storedObjectRepository;
$this->activityRepository = $activityRepository;
}
public function supports(GenericDocDTO $genericDocDTO, $options = []): bool

View File

@@ -76,8 +76,10 @@ final class ActivityControllerTest extends WebTestCase
/**
* @dataProvider getSecuredPagesUnauthenticated
*
* @param mixed $url
*/
public function testAccessIsDeniedForUnauthenticated(mixed $url)
public function testAccessIsDeniedForUnauthenticated($url)
{
$client = $this->createClient();
@@ -260,9 +262,11 @@ final class ActivityControllerTest extends WebTestCase
}
/**
* @param mixed $username
*
* @return \Symfony\Component\BrowserKit\Client
*/
private function getAuthenticatedClient(mixed $username = 'center a_social')
private function getAuthenticatedClient($username = 'center a_social')
{
return self::createClient([], [
'PHP_AUTH_USER' => $username,

View File

@@ -89,9 +89,11 @@ final class TranslatableActivityTypeTest extends KernelTestCase
}
/**
* @param mixed $active
*
* @return \Chill\ActivityBundle\Entity\ActivityType
*/
protected function getRandomType(mixed $active = true)
protected function getRandomType($active = true)
{
$types = $this->container->get('doctrine.orm.entity_manager')
->getRepository(ActivityType::class)

View File

@@ -33,14 +33,24 @@ class TimelineActivityProvider implements TimelineProviderInterface
{
private const SUPPORTED_CONTEXTS = ['center', 'person'];
protected ActivityACLAwareRepository $aclAwareRepository;
protected EntityManagerInterface $em;
protected AuthorizationHelperInterface $helper;
protected UserInterface $user;
public function __construct(
protected EntityManagerInterface $em,
protected AuthorizationHelperInterface $helper,
EntityManagerInterface $em,
AuthorizationHelperInterface $helper,
TokenStorageInterface $storage,
protected ActivityACLAwareRepository $aclAwareRepository
ActivityACLAwareRepository $aclAwareRepository
) {
$this->em = $em;
$this->helper = $helper;
$this->aclAwareRepository = $aclAwareRepository;
if (!$storage->getToken()->getUser() instanceof User) {
throw new RuntimeException('A user should be authenticated !');
}

View File

@@ -135,10 +135,6 @@ services:
tags:
- { name: chill.export_filter, alias: 'accompanyingcourse_has_no_activity_filter' }
Chill\ActivityBundle\Export\Filter\ACPFilters\PeriodHavingActivityBetweenDatesFilter:
tags:
- { name: chill.export_filter, alias: 'period_having_activity_betw_dates_filter' }
## Aggregators
Chill\ActivityBundle\Export\Aggregator\PersonAggregators\ActivityReasonAggregator:
tags:
@@ -148,10 +144,6 @@ services:
tags:
- { 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:
class: Chill\ActivityBundle\Export\Aggregator\ActivityUserAggregator
tags:

View File

@@ -1,5 +0,0 @@
export:
filter:
activity:
course_having_activity_between_date:
Only course having an activity between from and to: Seulement les parcours ayant reçu au moins un échange entre le {from, date, short} et le {to, date, short}

View File

@@ -96,6 +96,9 @@ activity_filter:
My activities: Mes échanges (où j'interviens)
Types: Par type d'échange
Jobs: Par métier impliqué
By: Filtrer par
Search: Chercher dans la liste
By date: Filtrer par date
#timeline
'%user% has done an %activity_type%': '%user% a effectué un échange de type "%activity_type%"'
@@ -373,12 +376,6 @@ export:
by_usersscope:
Filter by users scope: Filtrer les échanges par services d'au moins un utilisateur participant
'Filtered activity by users scope: only %scopes%': 'Filtré par service d''au moins un utilisateur participant: seulement %scopes%'
course_having_activity_between_date:
Title: Filtre les parcours ayant reçu un échange entre deux dates
Receiving an activity after: Ayant reçu un échange après le
Receiving an activity before: Ayant reçu un échange avant le
aggregator:
activity:
by_sent_received:
@@ -386,9 +383,6 @@ export:
is sent: envoyé
is received: 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:
filter:

View File

@@ -21,8 +21,11 @@ use Symfony\Component\HttpFoundation\Request;
final class AsideActivityController extends CRUDController
{
public function __construct(private AsideActivityCategoryRepository $categoryRepository)
private AsideActivityCategoryRepository $categoryRepository;
public function __construct(AsideActivityCategoryRepository $categoryRepository)
{
$this->categoryRepository = $categoryRepository;
}
public function createEntity(string $action, Request $request): object

View File

@@ -24,8 +24,11 @@ use function random_int;
class LoadAsideActivity extends Fixture implements DependentFixtureInterface
{
public function __construct(private UserRepository $userRepository)
private UserRepository $userRepository;
public function __construct(UserRepository $userRepository)
{
$this->userRepository = $userRepository;
}
public function getDependencies(): array

View File

@@ -25,9 +25,8 @@ class AsideActivityCategory
{
/**
* @ORM\OneToMany(targetEntity=AsideActivityCategory::class, mappedBy="parent")
* @var Collection<AsideActivityCategory>
*/
private Collection $children;
private $children;
/**
* @ORM\Id
@@ -37,6 +36,7 @@ class AsideActivityCategory
private int $id;
/**
* @ORM\OneToMany(targetEntity=AsideActivityCategory::class, mappedBy="parent")
* @ORM\Column(type="boolean")
*/
private bool $isActive = true;
@@ -114,8 +114,10 @@ class AsideActivityCategory
/**
* @Assert\Callback
*
* @param mixed $payload
*/
public function preventRecursiveParent(ExecutionContextInterface $context, mixed $payload)
public function preventRecursiveParent(ExecutionContextInterface $context, $payload)
{
if (!$this->hasParent()) {
return;

View File

@@ -20,8 +20,14 @@ use Symfony\Component\Form\FormBuilderInterface;
class ByActivityTypeAggregator implements AggregatorInterface
{
public function __construct(private AsideActivityCategoryRepository $asideActivityCategoryRepository, private TranslatableStringHelper $translatableStringHelper)
private AsideActivityCategoryRepository $asideActivityCategoryRepository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(AsideActivityCategoryRepository $asideActivityCategoryRepository, TranslatableStringHelper $translatableStringHelper)
{
$this->asideActivityCategoryRepository = $asideActivityCategoryRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string

View File

@@ -22,8 +22,14 @@ use function in_array;
class ByUserJobAggregator implements AggregatorInterface
{
public function __construct(private UserJobRepositoryInterface $userJobRepository, private TranslatableStringHelperInterface $translatableStringHelper)
private TranslatableStringHelperInterface $translatableStringHelper;
private UserJobRepositoryInterface $userJobRepository;
public function __construct(UserJobRepositoryInterface $userJobRepository, TranslatableStringHelperInterface $translatableStringHelper)
{
$this->userJobRepository = $userJobRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string

View File

@@ -22,8 +22,14 @@ use function in_array;
class ByUserScopeAggregator implements AggregatorInterface
{
public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
private ScopeRepositoryInterface $scopeRepository;
private TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(ScopeRepositoryInterface $scopeRepository, TranslatableStringHelperInterface $translatableStringHelper)
{
$this->scopeRepository = $scopeRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string

View File

@@ -23,8 +23,12 @@ use Symfony\Component\Form\FormBuilderInterface;
class AvgAsideActivityDuration implements ExportInterface, GroupedExportInterface
{
public function __construct(private AsideActivityRepository $repository)
{
private AsideActivityRepository $repository;
public function __construct(
AsideActivityRepository $repository
) {
$this->repository = $repository;
}
public function buildForm(FormBuilderInterface $builder)

View File

@@ -23,8 +23,12 @@ use Symfony\Component\Form\FormBuilderInterface;
class CountAsideActivity implements ExportInterface, GroupedExportInterface
{
public function __construct(private AsideActivityRepository $repository)
{
private AsideActivityRepository $repository;
public function __construct(
AsideActivityRepository $repository
) {
$this->repository = $repository;
}
public function buildForm(FormBuilderInterface $builder)

View File

@@ -34,8 +34,40 @@ use Symfony\Component\Form\FormBuilderInterface;
final class ListAsideActivity implements ListInterface, GroupedExportInterface
{
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 AsideActivityCategoryRepository $asideActivityCategoryRepository;
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)
@@ -63,67 +95,86 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
public function getLabels($key, array $values, $data)
{
return match ($key) {
'id', 'note' => static function ($value) use ($key) {
if ('_header' === $value) {
return 'export.aside_activity.' . $key;
}
switch ($key) {
case 'id':
case 'note':
return static function ($value) use ($key) {
if ('_header' === $value) {
return 'export.aside_activity.' . $key;
}
return $value ?? '';
},
'duration' => static function ($value) use ($key) {
if ('_header' === $value) {
return 'export.aside_activity.' . $key;
}
return $value ?? '';
};
if (null === $value) {
return '';
}
case 'duration':
return static function ($value) use ($key) {
if ('_header' === $value) {
return 'export.aside_activity.' . $key;
}
if ($value instanceof DateTimeInterface) {
return $value->format('H:i:s');
}
if (null === $value) {
return '';
}
return $value;
},
'createdAt', 'updatedAt', 'date' => $this->dateTimeHelper->getLabel('export.aside_activity.' . $key),
'agent_id', 'creator_id' => $this->userHelper->getLabel($key, $values, 'export.aside_activity.' . $key),
'aside_activity_type' => function ($value) {
if ('_header' === $value) {
return 'export.aside_activity.aside_activity_type';
}
if ($value instanceof DateTimeInterface) {
return $value->format('H:i:s');
}
if (null === $value || '' === $value || null === $c = $this->asideActivityCategoryRepository->find($value)) {
return '';
}
return $value;
};
return $this->categoryRender->renderString($c, []);
},
'main_scope' => function ($value) {
if ('_header' === $value) {
return 'export.aside_activity.main_scope';
}
case 'createdAt':
case 'updatedAt':
case 'date':
return $this->dateTimeHelper->getLabel('export.aside_activity.' . $key);
if (null === $value || '' === $value || null === $c = $this->scopeRepository->find($value)) {
return '';
}
case 'agent_id':
case 'creator_id':
return $this->userHelper->getLabel($key, $values, 'export.aside_activity.' . $key);
return $this->translatableStringHelper->localize($c->getName());
},
'main_center' => function ($value) {
if ('_header' === $value) {
return 'export.aside_activity.main_center';
}
case 'aside_activity_type':
return function ($value) {
if ('_header' === $value) {
return 'export.aside_activity.aside_activity_type';
}
if (null === $value || '' === $value || null === $c = $this->centerRepository->find($value)) {
/** @var Center $c */
return '';
}
if (null === $value || '' === $value || null === $c = $this->asideActivityCategoryRepository->find($value)) {
return '';
}
return $c->getName();
},
default => throw new LogicException('this key is not supported : ' . $key),
};
return $this->categoryRender->renderString($c, []);
};
case 'main_scope':
return function ($value) {
if ('_header' === $value) {
return 'export.aside_activity.main_scope';
}
if (null === $value || '' === $value || null === $c = $this->scopeRepository->find($value)) {
return '';
}
return $this->translatableStringHelper->localize($c->getName());
};
case 'main_center':
return function ($value) {
if ('_header' === $value) {
return 'export.aside_activity.main_center';
}
if (null === $value || '' === $value || null === $c = $this->centerRepository->find($value)) {
/** @var Center $c */
return '';
}
return $c->getName();
};
default:
throw new LogicException('this key is not supported : ' . $key);
}
}
public function getQueryKeys($data)

View File

@@ -23,8 +23,12 @@ use Symfony\Component\Form\FormBuilderInterface;
class SumAsideActivityDuration implements ExportInterface, GroupedExportInterface
{
public function __construct(private AsideActivityRepository $repository)
{
private AsideActivityRepository $repository;
public function __construct(
AsideActivityRepository $repository
) {
$this->repository = $repository;
}
public function buildForm(FormBuilderInterface $builder)

View File

@@ -23,8 +23,20 @@ use Symfony\Component\Form\FormBuilderInterface;
class ByActivityTypeFilter implements FilterInterface
{
public function __construct(private CategoryRender $categoryRender, private TranslatableStringHelperInterface $translatableStringHelper, private AsideActivityCategoryRepository $asideActivityTypeRepository)
{
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

View File

@@ -26,8 +26,16 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class ByDateFilter implements FilterInterface
{
public function __construct(private RollingDateConverterInterface $rollingDateConverter, protected TranslatorInterface $translator)
{
protected TranslatorInterface $translator;
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(
RollingDateConverterInterface $rollingDateConverter,
TranslatorInterface $translator
) {
$this->translator = $translator;
$this->rollingDateConverter = $rollingDateConverter;
}
public function addRole(): ?string

View File

@@ -20,8 +20,11 @@ use Symfony\Component\Form\FormBuilderInterface;
class ByUserFilter implements FilterInterface
{
public function __construct(private UserRender $userRender)
private UserRender $userRender;
public function __construct(UserRender $userRender)
{
$this->userRender = $userRender;
}
public function addRole(): ?string

View File

@@ -22,8 +22,11 @@ use Symfony\Component\Form\FormBuilderInterface;
class ByUserJobFilter implements FilterInterface
{
public function __construct(private TranslatableStringHelperInterface $translatableStringHelper)
private TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(TranslatableStringHelperInterface $translatableStringHelper)
{
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string

View File

@@ -23,8 +23,16 @@ use Symfony\Component\Form\FormBuilderInterface;
class ByUserScopeFilter implements FilterInterface
{
public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
{
private ScopeRepositoryInterface $scopeRepository;
private TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
ScopeRepositoryInterface $scopeRepository,
TranslatableStringHelperInterface $translatableStringHelper
) {
$this->scopeRepository = $scopeRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string

View File

@@ -22,8 +22,12 @@ use Symfony\Component\Form\FormBuilderInterface;
final class AsideActivityCategoryType extends AbstractType
{
public function __construct(private CategoryRender $categoryRender)
{
private CategoryRender $categoryRender;
public function __construct(
CategoryRender $categoryRender
) {
$this->categoryRender = $categoryRender;
}
public function buildForm(FormBuilderInterface $builder, array $options)

View File

@@ -20,8 +20,12 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
final class PickAsideActivityCategoryType extends AbstractType
{
public function __construct(private CategoryRender $categoryRender)
{
private CategoryRender $categoryRender;
public function __construct(
CategoryRender $categoryRender
) {
$this->categoryRender = $categoryRender;
}
public function configureOptions(OptionsResolver $resolver)

View File

@@ -16,8 +16,11 @@ use Symfony\Component\Security\Core\Security;
final class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
{
public function __construct(private Security $security)
private Security $security;
public function __construct(Security $security)
{
$this->security = $security;
}
public function buildMenu($menuId, MenuItem $menu, array $parameters)

Some files were not shown because too many files have changed in this diff Show More