Compare commits

...

603 Commits

Author SHA1 Message Date
8423c6c99c fix banners: resolve_center is always an iterable 2021-11-22 10:55:38 +01:00
03feb78037 fix down migration 2021-11-22 10:49:56 +01:00
98760bc5e8 Merge remote-tracking branch 'origin/master' into doc/authorizaton-documentation-update 2021-11-22 10:30:05 +01:00
1194aaecaf Merge branch 'master' into 295_resume_retouches 2021-11-22 10:08:06 +01:00
f69d6edba3 accourse banner carousel: slide2 control on right, + display when ready 2021-11-22 10:05:34 +01:00
009a093b9d Merge branch 'features/docgen-normalization' into 'master'
Bootstrap encoder for documents

See merge request Chill-Projet/chill-bundles!208
2021-11-22 09:05:15 +00:00
d0bf47e0d5 Bootstrap encoder for documents 2021-11-22 09:05:15 +00:00
7758e1358d better 2021-11-22 09:47:02 +01:00
46a4afe1b3 Merge branch 'features/person-search-improve' into 'master'
refactor search for using search by pertinence

See merge request Chill-Projet/chill-bundles!224

# Description of changes

* remplacer le classement par ordre alphabétique par un classement par ordre de pertinence, qui tient compte:
  * de la présence d'une string avec le nom de la ville;
  * de la similarité;
  * du fait que la recherche commence par une partie du mot recherché
* ajouter la recherche par numéro de téléphone directement dans la barre de recherche et dans le formulaire recherche avancée;
* ajouter la recherche par date de naissance directement dans la barre de recherche;
* ajouter la recherche par ville dans la recherche avancée
* ajouter un lien vers le ménage dans les résultats de recherche
* ajouter l'id du parcours dans les résultats de recherche
* ajouter le demandeur dans les résultats de recherche
* ajout d'un bouton "recherche avancée" sur la page d'accueil
* inclure les droits de vendée dans la recherche par l'api

# Issues related

* https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/300
* https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/182
* https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/193
* https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/212
* https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/169
* https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/149
* https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/156

# Tests

* add tests for extracting phonenumber
* add tests for extracting dates
* test for search still exists
2021-11-22 08:28:22 +00:00
9fb29ec110 refactor search for using search by pertinence 2021-11-22 08:28:22 +00:00
f06f9c10ad update changelog 2021-11-22 09:17:11 +01:00
a8dbf8b986 fix view person_current_address: address must exists 2021-11-19 23:33:13 +01:00
2d536b8b53 fix bounds for view current person address 2021-11-19 23:15:41 +01:00
76179d389d carousel: fix error 2021-11-19 19:48:56 +01:00
da686ab3b5 Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles 2021-11-19 18:25:58 +01:00
fec852b044 carousel: fix span household position 2021-11-19 18:25:07 +01:00
039483abf7 Merge branch 'issue304_validationOnOriginAccCourse' into 'master'
accompanying course: add client-side validation if no origin

See merge request Chill-Projet/chill-bundles!225
2021-11-19 17:09:05 +00:00
31ec155070 update changelog 2021-11-19 17:27:53 +01:00
89c2d74c33 Merge branch 'master' into 295_resume_retouches 2021-11-19 17:22:00 +01:00
af339aa7f0 accourse banner: use bootstrap carousel to display vue_accourse social-issues and associated-persons as slides 2021-11-19 17:16:16 +01:00
nobohan
264b902db5 upd CHANGELOG 2021-11-19 14:50:55 +01:00
nobohan
f1113ee448 accompanying course: add client-side validation if no origin 2021-11-19 14:48:31 +01:00
Pol Dellaiera
0a522b465f fix: Update typing information. 2021-11-19 12:32:21 +01:00
Pol Dellaiera
693b59c484 fix: Fix wrong repository. 2021-11-19 12:32:05 +01:00
Pol Dellaiera
5a6a15a351 fix: Add missing repository. 2021-11-19 12:31:48 +01:00
aba47600ff hop 2021-11-18 17:56:46 +01:00
a600196151 vue_accourse referrer: style for suggestions, add and remove items 2021-11-18 16:25:36 +01:00
193d0fb94a vue_activity: style for suggestions, add and remove items 2021-11-18 16:02:40 +01:00
c7ffb7062a improve resume course styles 2021-11-18 16:02:09 +01:00
Pol Dellaiera
d1935f96e7 fix: Add more typing informations. 2021-11-18 15:23:44 +01:00
Pol Dellaiera
17ef963924 fix: Fix wrong entity class and a few other fixes. 2021-11-18 15:15:51 +01:00
Pol Dellaiera
597a12b085 fix: Get rid of obsolete import. 2021-11-18 14:50:16 +01:00
Pol Dellaiera
56b15f26b2 fix: Get rid of a single PHPStan critical issue. 2021-11-18 14:47:58 +01:00
Pol Dellaiera
7a07b8bef7 fix: Autowire and autoconfigure the new service. 2021-11-18 14:45:32 +01:00
Pol Dellaiera
1509fcc2e9 fix: Fix tests. 2021-11-18 14:33:14 +01:00
Pol Dellaiera
7fd45d5735 fix: Remove deprecations. 2021-11-18 14:33:06 +01:00
Pol Dellaiera
ae79ebc299 fix: Strict type RoleScope. 2021-11-18 14:29:11 +01:00
Pol Dellaiera
162db60f59 fix: Fix FamilyMemberController and Repository. 2021-11-18 14:28:51 +01:00
Pol Dellaiera
dfc853a876 fix: Replace tabs with spaces. 2021-11-18 14:16:02 +01:00
Pol Dellaiera
674bf614dd fix: Add a deprecation and the new service that goes with it as replacement. 2021-11-18 14:15:51 +01:00
Pol Dellaiera
370a24d3f5 fix: Fix PHPStan issues. 2021-11-18 12:36:50 +01:00
Pol Dellaiera
1e05bd31d8 fix: Fix bug reported by the tests. 2021-11-18 12:18:16 +01:00
Pol Dellaiera
11ad94ee09 fix: Fix bug reported by the tests. 2021-11-18 12:17:04 +01:00
Pol Dellaiera
c1a4454a08 fix: Fix bug reported by the tests. 2021-11-18 12:10:54 +01:00
Pol Dellaiera
f9d36cc8a9 fix: Fix bug reported by the tests. 2021-11-18 12:03:49 +01:00
Pol Dellaiera
a32692c37a fix: RoleScope might or might not have a Scope. 2021-11-18 11:48:35 +01:00
Pol Dellaiera
6ccc8d4cb8 fix: Let Symfony inject dependencies automatically. 2021-11-18 11:46:30 +01:00
Pol Dellaiera
d9b862925f fix: Let Symfony inject dependencies automatically. 2021-11-18 11:41:41 +01:00
Pol Dellaiera
7dcf0f8dcf fix: Inject newly created repository instead of having to deal with the container definitions. 2021-11-18 11:41:41 +01:00
Pol Dellaiera
97ab71b63d fix: Add missing repositories, fix typing information, autoload Repository directory. 2021-11-18 11:41:40 +01:00
Pol Dellaiera
b722106616 fix: Use TranslatableStringHelperInterface. 2021-11-18 11:41:40 +01:00
Pol Dellaiera
cc9ce4167f fix: Upgrade TranslatableStringHelper service and create its interface. 2021-11-18 11:41:40 +01:00
Pol Dellaiera
9f06bc7126 fix: Autowire and autoconfigure services in chill_main.
This commit does not remove services that are not automatically PSR loaded.
2021-11-18 11:41:40 +01:00
78615519f4 select2 field added to task form 2021-11-18 09:34:52 +01:00
Pol Dellaiera
d1e1f7faa4 Revert "fix: Autowire and autoconfigure services in chill_main."
This reverts commit d7fbbbf92c.
2021-11-18 08:34:17 +01:00
Pol Dellaiera
d7fbbbf92c fix: Autowire and autoconfigure services in chill_main. 2021-11-17 20:31:35 +01:00
Pol Dellaiera
d830b19756 fix: Enforce (and document) the type of property. 2021-11-17 20:31:35 +01:00
2492a9281f improve household button in course participation 2021-11-17 16:06:55 +01:00
0e98010d0e #101 improve translations + hide title 2021-11-17 16:06:42 +01:00
1a04973072 visgraph: refresh after post/patch/delete request, fix missing key in POST body parameter 2021-11-17 12:20:43 +01:00
Pol Dellaiera
4f56bb2464 fix: Creation of entity in createEntity().
Issue introduced in 5432242376.
2021-11-17 11:58:15 +01:00
Pol Dellaiera
afa8d7cb72 fix: Creation of entity in createEntity().
Issue introduced in 5432242376.
2021-11-17 11:46:28 +01:00
5d74b3ab0a fix errors when clearing cache 2021-11-17 10:58:52 +01:00
Pol Dellaiera
7f02130ff2 fix: Return type of getAge().
Issue highlighted by c68bda5c9b.
2021-11-16 20:58:28 +01:00
Pol Dellaiera
5432242376 fix: SA: Fix many critical rules.
SA stands for Static Analysis.
2021-11-16 17:13:39 +01:00
Pol Dellaiera
db2010082a fix: SA: Fix "...Access to an undefined property..." rule.
SA stands for Static Analysis.
2021-11-16 16:37:45 +01:00
Pol Dellaiera
6cfcf91757 fix: Follow up f8aeb08594 and fix parameters type. 2021-11-16 16:28:20 +01:00
Pol Dellaiera
f11df95f59 fix: Follow up 8879734ea2 and fix service definition. 2021-11-16 15:46:33 +01:00
Pol Dellaiera
68a21fcc0a fix: SA: Fix "...Instantiated class not found..." rules.
SA stands for Static Analysis.
2021-11-16 15:34:12 +01:00
Pol Dellaiera
8879734ea2 fix: SA: Fix "...does not call parent constructor... and ...Access to an undefined property..." rules.
SA stands for Static Analysis.
2021-11-16 15:30:53 +01:00
Pol Dellaiera
a17c22c74f fix: SA: Fix "...does not call parent constructor...." rule.
SA stands for Static Analysis.
2021-11-16 15:27:46 +01:00
Pol Dellaiera
75d2d50dd2 fix: SA: Fix "...Variable in isset() is never defined...." rule.
SA stands for Static Analysis.
2021-11-16 15:25:48 +01:00
Pol Dellaiera
c94fb2efbf fix: SA: Fix "...variable always exists and is not falsy...." rule.
SA stands for Static Analysis.
2021-11-16 15:23:56 +01:00
Pol Dellaiera
11651fdb2a fix: SA: Fix "...does not call parent constructor...." rule.
SA stands for Static Analysis.
2021-11-16 15:21:26 +01:00
Pol Dellaiera
d382cf35ba fix: SA: Fix "...Variable in isset() is never defined...." rule.
SA stands for Static Analysis.
2021-11-16 15:18:59 +01:00
Pol Dellaiera
479f0ce9ed fix: SA: Fix "...does not match parent method..." rule.
SA stands for Static Analysis.
2021-11-16 15:17:29 +01:00
Pol Dellaiera
e2a8437807 fix: SA: Fix "...Short ternary operator..." rule.
SA stands for Static Analysis.
2021-11-16 15:14:43 +01:00
Pol Dellaiera
5a85d497ab fix: SA: Fix "...Switch condition type..." rule.
Also fix a critical bug in `ReportList.php`.

SA stands for Static Analysis.
2021-11-16 15:12:31 +01:00
Pol Dellaiera
7462babbeb fix: SA: Fix "...an unused use..." rule.
Also fix a critical bug in `ListPerson.php`.

SA stands for Static Analysis.
2021-11-16 15:06:43 +01:00
Pol Dellaiera
8bebe1f904 fix: SA: Split configurations across multiple files.
SA stands for Static Analysis.
2021-11-16 14:49:42 +01:00
Pol Dellaiera
8ede116cf5 fix: SA: Split critical issues in its own file.
SA stands for Static Analysis.
2021-11-16 14:06:24 +01:00
Pol Dellaiera
c68bda5c9b fix: SA: Fix "...invoked with..." rule.
SA stands for Static Analysis.
2021-11-16 12:16:02 +01:00
Pol Dellaiera
a3eb23478a fix: SA: Fix "Call to sprintf" rule.
SA stands for Static Analysis.
2021-11-16 11:52:52 +01:00
Pol Dellaiera
f8aeb08594 fix: SA: Fix "might not be defined" rule.
SA stands for Static Analysis.
2021-11-16 11:41:12 +01:00
Pol Dellaiera
a7b96f1756 fix: SA: Fix "incorrect case" rule.
SA stands for Static Analysis.
2021-11-16 10:29:41 +01:00
196cddab09 Merge remote-tracking branch 'origin/master' into issue185_ACCent_createdBy_updatedBy 2021-11-15 14:14:12 +01:00
4a15022375 update change log 2021-11-15 13:15:32 +01:00
5fb7a6d0ae take into account form_show_centers parameters into thirdparty form type 2021-11-15 13:15:32 +01:00
77add46a70 take parameter form_show_center into account: not to ask center on person creation 2021-11-15 13:15:32 +01:00
b217fb3c39 create option config for asking (or not) center in form 2021-11-15 13:15:31 +01:00
e2d4d9c831 remove use statement 2021-11-15 13:07:44 +01:00
93e75161fc Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles 2021-11-15 13:05:59 +01:00
5ee67f74d9 remove toast imports for vue 2021-11-15 13:05:27 +01:00
9b03f8130b Merge remote-tracking branch 'origin/issue289_person_extraPhoneNumbers' 2021-11-15 12:30:52 +01:00
6c51d6de51 remove unnecessary space (minor, [ci-skip]) 2021-11-15 12:28:48 +01:00
0aef40f23f Merge remote-tracking branch 'origin/issue267_filter_household_of_the_person' 2021-11-15 12:24:21 +01:00
a1125cfd3a Merge branch 'fix_add_multiple_pick_address_type_in_collection' into 'master'
fix when adding multiple pick address type form in a collection

See merge request Chill-Projet/chill-bundles!216
2021-11-15 11:23:05 +00:00
9816ac8ad7 Merge branch 'master' into 'issue289_person_extraPhoneNumbers'
# Conflicts:
#   CHANGELOG.md
2021-11-15 11:22:17 +00:00
87c83dd7a0 Merge branch 'features/search-person-acl-ordering' into 'master'
add base authorization to person search + improve search ordering + fix testes

See merge request Chill-Projet/chill-bundles!217
2021-11-15 11:17:03 +00:00
8296d60cb6 add base authorization to person search + improve search ordering 2021-11-15 11:17:03 +00:00
nobohan
bfc25c50b9 upd CHANGELOG 2021-11-15 12:03:31 +01:00
nobohan
3417aa8207 person: do not suggest the current household of the person 2021-11-15 12:00:42 +01:00
4ba93bb709 failed job personControllerUpdateTest fixed 2021-11-15 11:56:29 +01:00
bf0ad88cf0 Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles 2021-11-15 10:22:18 +01:00
b07188eaaf changelog updated 2021-11-15 10:21:57 +01:00
5651efe44d fix phpstan errors 2021-11-13 11:42:26 +01:00
52dc89c06f Merge branch 'master' into household_filiation 2021-11-12 17:20:46 +01:00
fa7409bdf8 visgraph: export canvas as image 2021-11-12 16:58:08 +01:00
nobohan
e413a09a0f upd CHANGELOG 2021-11-12 16:05:47 +01:00
nobohan
a04c499af0 fix when adding multiple pick address type form in a collection 2021-11-12 16:01:03 +01:00
dcf5f1ed66 Merge branch 'issue162_ACCent_display_addresses' into 'master'
Display of incomplete address

See merge request Chill-Projet/chill-bundles!210
2021-11-12 12:15:03 +00:00
6dd74287a8 Merge remote-tracking branch 'origin/master' into issue162_ACCent_display_addresses 2021-11-12 13:14:04 +01:00
2b0093a351 fix typo 2021-11-12 12:08:48 +00:00
e905465e1b Merge branch 'accourse_validation' into 'master'
add validation to accompanying periods

See merge request Chill-Projet/chill-bundles!183
2021-11-12 12:07:31 +00:00
c8135e0741 add validation to accompanying periods 2021-11-12 12:07:31 +00:00
831b4f354c Merge branch 'deleteAccompanyingPeriodWork_234' into 'master'
Delete AccompanyingPeriodWork

See merge request Chill-Projet/chill-bundles!199
2021-11-12 12:06:43 +00:00
7482c709b3 Merge branch 'master' into 'deleteAccompanyingPeriodWork_234'
# Conflicts:
#   CHANGELOG.md
2021-11-12 12:06:34 +00:00
22bdf35eb0 minor fixes 2021-11-12 12:05:16 +00:00
a2e9e4cf6a Merge branch 'userInAddPerson_278' into 'master'
person: user in the modal 'search person'

See merge request Chill-Projet/chill-bundles!198
2021-11-12 11:59:03 +00:00
nobohan
28afe5228a upd CHANGELOG 2021-11-12 12:14:55 +01:00
nobohan
fcbf1bd558 accompanying course work: missing translation in App.vue 2021-11-12 12:10:27 +01:00
nobohan
32c2d96ab6 accompanying course work: add cascade remove on delete Accompanying Period Work 2021-11-12 12:02:45 +01:00
nobohan
eedf5f25bd accompanying course work: translation 2021-11-12 12:00:39 +01:00
nobohan
a7dd15a411 upd CHANGELOG 2021-11-12 11:09:02 +01:00
nobohan
24be9dbe09 person: display other phone numbers in view + translations + add message in case no others phone numbers 2021-11-12 11:05:56 +01:00
39ab7057ce Update CHANGELOG.md 2021-11-12 09:29:37 +00:00
96b44ede3c information about creation and update displayed on person detail page. Vendee person and mineur still to do 2021-11-11 16:56:26 +01:00
5606b714cd changelog updated 2021-11-11 13:38:32 +01:00
f92c500657 Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles 2021-11-11 13:37:11 +01:00
1146bd666f unnecessary whitespace removed from person banner after person-id + double parentheses removed 2021-11-11 13:36:49 +01:00
95610ffd34 visgraph: improve update graph mechanism
adding an updateHack in store, and a watcher in component.
* updateHack increment a value in the lpop,
* the watcher detect when value changes
* and $forceUpdate

improve layer checkbox legend refresh and rebuild
2021-11-10 20:09:18 +01:00
7230fd9c07 minor changes, and cleaning code 2021-11-10 15:13:23 +01:00
7dc9021eca visgraph: no more need for tiny emitter. remove it 2021-11-10 11:35:19 +01:00
a63e1321b0 cleaning 2021-11-09 22:48:29 +01:00
bfca6d2afc cleaning 2021-11-09 20:06:54 +01:00
b392bc9e65 visgraph: post, patch and delete relationship link works! 2021-11-09 20:00:19 +01:00
d6da6a5d9d visgraph: trying to pass value to edit relationship form fields (wip) 2021-11-09 20:00:09 +01:00
e7fcebc99e add some method for resolving scope in twig 2021-11-09 17:04:49 +01:00
7574b5bfac doc for authorization 2021-11-09 17:04:32 +01:00
Pol Dellaiera
5e5dcaefe7 Fix implicit variable creation. 2021-11-09 16:22:16 +01:00
nobohan
e6a9701418 upd CHANGELOG 2021-11-09 16:14:25 +01:00
nobohan
66a2009aea person search: translation User + show User in concernedGroups 2021-11-09 16:07:11 +01:00
Pol Dellaiera
a1b381a3ea Fix bug and remove obsolete issue. 2021-11-09 15:20:25 +01:00
Pol Dellaiera
5615734123 Update baseline - remove obsolete errors. 2021-11-09 15:17:55 +01:00
Pol Dellaiera
2eb30d2ae8 Fix issues reported by PHPStan. 2021-11-09 15:17:24 +01:00
Pol Dellaiera
48ea67968e Update PHPStan configuration.
Update paths - add paths to ignore.
2021-11-09 15:16:06 +01:00
nobohan
c8b0d62d46 person: display user in the modal 'search person' 2021-11-09 14:21:39 +01:00
Pol Dellaiera
9fc397f048 Fix PHPStan un-ignorable issues. 2021-11-09 13:51:25 +01:00
Pol Dellaiera
a19a5803e8 Update baseline - add new errors. 2021-11-09 13:49:08 +01:00
Pol Dellaiera
bf155f6967 Update PHPStan configuration.
Update paths - simplify.
2021-11-09 13:48:15 +01:00
Pol Dellaiera
6a9e133256 Add phpstan/extension-installer. 2021-11-09 13:39:24 +01:00
Pol Dellaiera
fb4b586cf0 Update baseline - add new errors. 2021-11-09 13:37:01 +01:00
Pol Dellaiera
6b60c46ad3 Update baseline - remove ignored errors. 2021-11-09 13:36:09 +01:00
Pol Dellaiera
774b5b69d9 Enable phpstan/phpstan-strict-rules. 2021-11-09 13:35:44 +01:00
2382e7f44b Merge branch 'feat/add-phpstan-configuration-and-baseline' into 'master'
Add PHPStan project with level 1.

This PR: Add basic configuration files with basic baseline.


See merge request Chill-Projet/chill-bundles!191
2021-11-09 11:31:21 +00:00
Pol Dellaiera
e2ab3bfc6e Add PHPStan project with level 1. 2021-11-09 11:31:20 +00:00
16512a1ca1 changelog updated 2021-11-09 11:44:36 +01:00
a373142827 display of incomplete address changed 2021-11-09 11:38:20 +01:00
46e552d034 DELETE endpoint added 2021-11-09 10:58:08 +01:00
b2d6c82cbe update changelog with last release 2021-11-09 09:39:05 +01:00
nobohan
66c5c4c1d6 accompanying period work: translate flash message 2021-11-08 15:52:24 +01:00
9247cd3546 fix saving person 2021-11-08 15:31:19 +01:00
nobohan
70524c506d accompanying period work: add content to the delete page 2021-11-08 15:17:16 +01:00
nobohan
b4d21c23b2 accompanying period work: add logger interface 2021-11-08 14:50:15 +01:00
nobohan
d94c367e3d accompanying period work: can delete the work 2021-11-08 14:47:50 +01:00
nobohan
6afd8ae3cd accompanying period work: add delete twig 2021-11-08 13:52:23 +01:00
nobohan
e195434bf4 accompanyingPeriodWork: add action in controller 2021-11-08 13:52:23 +01:00
nobohan
0299500cad accompanyingPeriodWork: replace 'spinner' by a real spinner 2021-11-08 13:52:23 +01:00
nobohan
952435b36f Activity: correct accompanying_period_id param in twig 2021-11-08 13:52:22 +01:00
ec6828f128 Merge branch 'features/person-normalization-resolver-center-dynamically' into 'master'
Use centerResolverDispatcher to normalize a person's center


# Description of changes

There is a normalizer for a person, which include a property "center":

```json
{

    "type": "person",
    "id": 4362539,
    "text": "Diakite BAH",
    "firstName": "Diakite",
    "lastName": "BAH",
    "center": {
        "id": 475,
        "type": "center",
        "name": "Nord Vendée"
    },
    "phonenumber": "",
    "mobilenumber": "",
    "altNames": [ ],
    "gender": "woman",
    "gender_numeric": 1,
    // ...
}
```

Previously, the center was the center attached to the person in the database.

But since September, version 2.0 allow to resolve the center dynamically, for instance with the usage of address. This resolution is done through `CenterResolverDispatcher`.

This `CenterResolverDispatcher` is now used into person normalization.

As a consequence, the center may now be:

* null;
* a center;
* an array of center;

Thoses case are taken into account into `PersonRenderBox` in Vue.



# Issues related

Any issue related.

# Tests

Any new tests.

See merge request Chill-Projet/chill-bundles!205
2021-11-08 12:22:11 +00:00
7399d0aa9e Use centerResolverDispatcher to normalize a person's center 2021-11-08 12:22:11 +00:00
19b469259d Merge branch 'bugfix/acl-add-roles-misc-places' into 'master'
Add voter to various places

See merge request Chill-Projet/chill-bundles!207
2021-11-08 12:21:15 +00:00
5c037ca18f Merge branch 'master' into 'bugfix/acl-add-roles-misc-places' [ci-skip]
# Conflicts:
#   CHANGELOG.md
2021-11-08 12:20:26 +00:00
nobohan
c979de962e fix conflict in CHANGELOG 2021-11-08 12:41:11 +01:00
nobohan
061197e52e upd CHANGELOG 2021-11-08 12:21:06 +01:00
e786c40679 Merge branch 'issue124_ACCent_ménage_editForm' into 'master'
Household edit: end date field deleted


# Description of changes

End date field removed from household edit form.


# Issues related

* internal: https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/265
* ACCent: https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/124

# Tests

No tests

See merge request Chill-Projet/chill-bundles!202
2021-11-08 11:03:38 +00:00
e4f8ada236 Household edit: end date field deleted 2021-11-08 11:03:37 +00:00
21e419b338 Merge branch 'issue126_household_list' into 'master'
household list of accompanying periods + upgrade DBAL version to 3.1


# Description of changes

* Household: List of accompanying periods shows all periods linked to current household members for which viewing access is granted to current user.
* Upgrade DBAL to 3.1


# Issues related

* inernal: https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/274
* ACCent: https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/126

# Tests

Not yet written

See merge request Chill-Projet/chill-bundles!204
2021-11-08 10:57:14 +00:00
7fabe0214e household list of accompanying periods + upgrade DBAL version to 3.1 2021-11-08 10:57:14 +00:00
nobohan
fa05a6856a person: add civility: entity, migration, form, twig, config 2021-11-08 11:41:45 +01:00
nobohan
1dbf29beea person: avoid js error when personAcceptEmail is null 2021-11-08 11:04:20 +01:00
nobohan
bddcdd7de2 person: add preferrred_choices for countries and languages 2021-11-08 10:42:12 +01:00
2c0198ef78 listen on relationship nodes event (wip) 2021-11-05 20:34:59 +01:00
e55e8e072d visgraph: prepare UI for add relationship link 2021-11-05 19:37:59 +01:00
f92b4b0ea3 visgraph, fix details 2021-11-05 17:50:19 +01:00
b904e33d9b Merge branch 'household_filiation' of gitlab.com:Chill-Projet/chill-bundles into household_filiation 2021-11-05 17:18:55 +01:00
f064e8f307 method added to get current accompanying periods + api adjusted 2021-11-05 17:00:07 +01:00
e911dd30f5 cleaning store 2021-11-05 16:16:24 +01:00
092ea4d57f Merge branch 'bugfix/activity-fix-role-inheritance' into 'master'
Bugfix/activity fix role inheritance


# Description of changes

* fix the inheritance of the role "ACTIVITY_FULL"
* add missing ACL in menu


# Issues related

* https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/163

# Tests

Any new tests

See merge request Chill-Projet/chill-bundles!206
2021-11-05 14:13:00 +00:00
f16f45f3f3 Bugfix/activity fix role inheritance 2021-11-05 14:13:00 +00:00
bfcd420cdf visgraph: improve nodes that are hidden when uncheck layer
- a new getter count links by node. before exclude person, check first if node has others visible links
- links id are rewrote to serve count links getter
- unfold and expand only folded person
2021-11-05 14:41:45 +01:00
9494bdee2a visgraph: improve splitId(node_id,'id') : return always integer
node_id value examples:
* 'accompanying_period_124' --> 124
* '124' --> 124
* 124 --> 124
2021-11-05 14:41:45 +01:00
0f8ca77105 visgraph: refactor store excludedNode action 2021-11-05 14:41:45 +01:00
9a00e13532 visgraph: adding node whitelist 2021-11-05 14:41:45 +01:00
1a00798da0 visgraph: canvas options, maximize position 2021-11-05 14:41:45 +01:00
5e2b70249e cleaning 2021-11-05 14:41:45 +01:00
55c2aed613 visgraph: fix algo problems when expanding graph 2021-11-05 14:41:45 +01:00
19badc0062 visgraph: try to remove folded person nodes when layer is unchecked (wip) 2021-11-05 14:41:35 +01:00
5ce2fe3295 Merge branch 'feature/suivi-157-affiche-alt-names-list-with-periods' into 'master'
Show alt names in person search results


# Description of changes

* Ajoute l'adresse actuelle de la personne dans les résultats de recherche;
* affiche les altNames dansl es réslttats de recherche



# Issues related


* https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/157

# Tests

Some tests, which were related to the old way on person address was computed, where removed.

See merge request Chill-Projet/chill-bundles!195
2021-11-05 12:52:31 +00:00
5111a0ff6a Show alt names in person search results 2021-11-05 12:52:31 +00:00
74df496e38 Merge branch 'issue47_ACCent_householdAddress_ordering' into 'master'
Ordering household addresses


# Description of changes

Ordering by id added so that last created address displays first.


# Issues related

* internal: https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/275
* ACCent: https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/47

# Tests

No tests written.

See merge request Chill-Projet/chill-bundles!203
2021-11-05 12:34:35 +00:00
fd2d74c9f5 Ordering household addresses 2021-11-05 12:34:35 +00:00
b615f0c79f Merge branch 'issue73_ACCent_displayOf_problématiques' into 'master'
Display of social issues with parent issue and with badge


# Description of changes

For social work action: social issues are displayed with their parent issue.
Banner was fixed so that it contains all the context info.


# Issues related

* internal: https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/277
* ACCent: https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/73

# Tests

No tests.

See merge request Chill-Projet/chill-bundles!201
2021-11-05 12:33:10 +00:00
97859e9c1f Display of social issues with parent issue and with badge 2021-11-05 12:33:10 +00:00
6642b87168 Merge branch 'bugfixes/tasks-list' into 'master'
Bugfixes/tasks list


# Description of changes

<!--
  describe here the change of your MR. It can be either a text, or a bullet list
  for changes
-->

* different title for task list and my title
* fixes link to tasks in alert


# Issues related

<!--
  list the issues related to this MR.

  It may be client issues, or dev issues
-->

no issues related

# Tests

The tests for listing task does apply

See merge request Chill-Projet/chill-bundles!200
2021-11-05 12:31:41 +00:00
35d807cab0 Bugfixes/tasks list 2021-11-05 12:31:41 +00:00
e1677cd2b6 Merge branch 'feature/household-accept-members-without-position' into 'master'
An household can have members without position

See merge request Chill-Projet/chill-bundles!189
2021-11-05 09:26:16 +00:00
df0cb8596b update changelog [ci-skip] 2021-11-04 23:43:24 +01:00
250bd29ab3 add voter for documents 2021-11-04 23:40:30 +01:00
nobohan
8de78c7584 person: add prefered_choices for language (WIP) 2021-11-04 16:20:08 +01:00
nobohan
84ab4f8d1f person: add the possibility of form data is null on CommentType 2021-11-04 15:56:15 +01:00
261810374f Merge branch 'issue83_ACCent_addDocument_toAction' into 'master'
cascade persist added to Activity::documents

See merge request Chill-Projet/chill-bundles!197
2021-11-04 11:44:57 +00:00
8f541c8418 Merge branch 'master' into 'issue83_ACCent_addDocument_toAction'
# Conflicts:
#   CHANGELOG.md
2021-11-04 11:40:56 +00:00
b69cee84b6 Update CHANGELOG.md 2021-11-04 09:12:06 +00:00
b7e0753dbf changelog fixed 2021-11-04 10:09:08 +01:00
9c57d21e5a Merge branch 'issue153_ACCent_activity_admin' into 'master'
Issue153_accent_activity_admin

See merge request Chill-Projet/chill-bundles!193
2021-11-04 08:57:13 +00:00
c03b925bd9 Merge branch 'master' into 'issue153_ACCent_activity_admin'
# Conflicts:
#   CHANGELOG.md
#   src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php
2021-11-04 08:52:32 +00:00
6fdbefa4c8 changelog updated and comments removed 2021-11-04 09:50:25 +01:00
13b43ace39 update of changelog.md 2021-11-04 09:45:35 +01:00
5d7f4bde1d minor stuffs 2021-11-03 21:17:25 +01:00
40c5322cba visgraph: an event trigger unfoldPersonsByCourse (store) 2021-11-03 21:15:37 +01:00
8ab0fd59f8 visgraph: add basic graph event mechanism when clicking on nodes 2021-11-03 21:12:42 +01:00
aa9926aa29 translations 2021-11-03 16:56:11 +01:00
adac384279 visgraph: prepare PATCH relationship when submitting (wip) 2021-11-03 16:49:07 +01:00
2099edefc5 visgraph: fix error with GET relations response 2021-11-03 16:45:37 +01:00
12c3bfa578 Merge branch 'improve_localisation_271' 2021-11-03 16:18:53 +01:00
nobohan
52778a7051 upd CHANGELOG 2021-11-03 16:17:33 +01:00
nobohan
a768563cd0 location: display the error message in case of wrong phone number or email 2021-11-03 16:16:51 +01:00
nobohan
4011fc6e77 location: client side validation 2021-11-03 16:16:51 +01:00
nobohan
51938a99db location: allow null value for location in Calendar 2021-11-03 16:16:51 +01:00
nobohan
c1f4e77293 location: allow null value for location in Activity 2021-11-03 16:16:51 +01:00
nobohan
bfb219746a location: client-side form validation 2021-11-03 16:16:51 +01:00
nobohan
4e72bdead5 location: code refactoring: move saveNewLocation + order of fields 2021-11-03 16:16:51 +01:00
nobohan
e52880bb53 location: filter location-type by active and availableForUsers 2021-11-03 16:16:51 +01:00
nobohan
0439e6a821 location: filter location endpoint by NULL names 2021-11-03 16:16:51 +01:00
72337a8fba Merge branch 'issue74_ACCent_rename_evaluations' into 'master'
section title evaluations changed for accompanyingcoursework edit

See merge request Chill-Projet/chill-bundles!196
2021-11-03 15:16:01 +00:00
e2110691ff Merge branch 'household_filiation' of gitlab.com:Chill-Projet/chill-bundles into household_filiation 2021-11-03 16:11:05 +01:00
645603a98f Merge branch 'master' into improve_localisation_271 2021-11-03 16:09:53 +01:00
cab7cc4150 PATCH added to swagger 2021-11-03 16:04:35 +01:00
c6d7de3e58 Merge branch 'bugfix/authorization-helper-fix-constructor' into 'master'
authorization helper: fix consructor

See merge request Chill-Projet/chill-bundles!194
2021-11-03 14:59:08 +00:00
6c52233a5a visgraph: with reversed relationship, reverse arrow and not title 2021-11-03 15:56:25 +01:00
8c5bf6786b increase memory on gitlab-ci operations 2021-11-03 15:46:00 +01:00
58f7715643 visgraph: fix logic error with relationship direction 2021-11-03 15:43:44 +01:00
7c5d0fce51 update changelog 2021-11-03 15:36:06 +01:00
35154f5ae1 fix constructor into acl aware repository 2021-11-03 15:35:38 +01:00
6911ace412 Refactor authorization helper to separate some methods
Methods regarding to role hierarchi are now delegated to a parent role helper.
2021-11-03 15:35:38 +01:00
87e16ec24f authorization helper: fix consructor 2021-11-03 15:35:38 +01:00
765a450bb9 update changelog with issues into vendee changelog 2021-11-03 15:33:31 +01:00
nobohan
93880f7010 upd CHANGELOG 2021-11-03 14:55:33 +01:00
e7900b8b21 visgraph: fix POST response (create link) 2021-11-03 14:54:27 +01:00
nobohan
0231433a6c location: display the error message in case of wrong phone number or email 2021-11-03 14:45:15 +01:00
4d08f3583e Merge branch 'household_filiation' of gitlab.com:Chill-Projet/chill-bundles into household_filiation 2021-11-03 14:29:39 +01:00
b2fe024534 Code that causes error commented: UserMenuBuilder.php 2021-11-03 13:27:32 +00:00
39e0e01eb8 cascade persist added to Activity::documents 2021-11-03 14:15:48 +01:00
nobohan
2aa588037a location: client side validation 2021-11-03 13:51:15 +01:00
nobohan
addb362478 location: allow null value for location in Calendar 2021-11-03 13:43:34 +01:00
nobohan
819fc8af46 location: allow null value for location in Activity 2021-11-03 13:42:35 +01:00
4dbbc40473 Merge branch 'household_filiation' of gitlab.com:Chill-Projet/chill-bundles into household_filiation 2021-11-03 12:52:41 +01:00
577ed7b6be GET relations adapted, POST fixed 2021-11-03 12:52:21 +01:00
2d3549ee28 visgraph: give more space to graph in twig content 2021-11-03 12:39:47 +01:00
6e3cdb6f58 visgraph, disable action callback on nodes 2021-11-03 12:13:06 +01:00
e7ad96aaf7 Add a template for merge request [ci-skip] 2021-11-03 12:02:09 +01:00
nobohan
f4bd55262a location: client-side form validation 2021-11-03 11:59:06 +01:00
eebff23282 section title evaluations changed for accompanyingcoursework edit 2021-11-03 11:49:31 +01:00
2d33ae26d8 Merge branch '106_tasks_to_parcours' 2021-11-03 11:45:40 +01:00
7a384f9657 Separate cache:clear from doctrine:fixtures:load in ci
This is an attempt to fix the bug which replace references by NULL
values
2021-11-03 11:43:57 +01:00
nobohan
c8bc6ac495 location: code refactoring: move saveNewLocation + order of fields 2021-11-03 11:34:52 +01:00
7d91f3bef5 complete relations fixtures 2021-11-03 11:30:36 +01:00
b0471c4851 translation fixes for aside activities 2021-11-03 10:56:28 +01:00
6d248ab47b Activity link added to admin homepage 2021-11-03 10:55:51 +01:00
nobohan
999658e792 location: filter location-type by active and availableForUsers 2021-11-03 10:27:58 +01:00
nobohan
1646740382 location: filter location endpoint by NULL names 2021-11-03 09:59:40 +01:00
71695ed793 updating changelog 2021-11-03 09:31:49 +01:00
6d5f94ab45 Merge branch 'household_filiation' of gitlab.com:Chill-Projet/chill-bundles into household_filiation 2021-11-03 09:28:36 +01:00
9e61c417e5 visgraph: improve relationship form UI, change physics solver, disable node edition 2021-11-03 09:20:27 +01:00
e62d026339 visgraph form: other way to display relation 2021-11-02 18:58:25 +01:00
9cffe5161a visgraph: test form without vis-network 2021-11-02 18:45:15 +01:00
cbb3ad04f0 visgraph: right align text when reverse 2021-11-02 16:39:34 +01:00
6b31bf225a visgraph: fix body in POST relationship query 2021-11-02 16:34:01 +01:00
024531fbe1 visgraph: build modal form to create/edit relationship 2021-11-02 15:39:22 +01:00
bd2ee9ddc1 visgraph: adding endpoint to get list of relations 2021-11-02 10:21:06 +01:00
84dfcb2899 tests for GET and POST: attempt 2021-11-01 16:01:21 +01:00
1d774b19e8 datafixture relationship: attempt 2021-11-01 16:00:48 +01:00
d06a4b1ca9 import multiselect (wip) 2021-11-01 15:37:32 +01:00
9cce62c294 visgraph: pass context to modals 2021-11-01 15:36:57 +01:00
d3a08149f0 visgraph: open vue modal when adding/editing edge 2021-11-01 13:31:58 +01:00
5d995115ba visgraph: only addEdge for person to person 2021-11-01 12:59:02 +01:00
41f815bbb9 tiny-emitter package is used as "centralized event hub" between vis-network and vue3 2021-11-01 11:50:36 +01:00
a0940a0c85 visgraph: init window.eventHub as external emitter called in Vue. This implementation works with vue2, but is deprecated in vue3 !!
see https://vue3-fr.netlify.app/guide/migration/events-api.html#_2-x-syntax
2021-11-01 11:48:26 +01:00
c4ba78d076 minor 2021-11-01 10:50:13 +01:00
869e442c2c visgraph: add hover interaction 2021-11-01 09:49:55 +01:00
94e84fbdf0 Merge branch 'blur_confidential_info' into 'master'
Blur confidential info

See merge request Chill-Projet/chill-bundles!172
2021-10-30 00:22:41 +00:00
20cebfc517 Merge branch '129_ACCent_gender_display' into 'master'
129_accent_gender_display

See merge request Chill-Projet/chill-bundles!187
2021-10-30 00:22:05 +00:00
e9d20a56ff show members without position in list 2021-10-30 02:08:31 +02:00
a57a23dc49 visgraph options settings 2021-10-30 01:51:02 +02:00
576ee49da0 update changelog 2021-10-30 01:08:52 +02:00
8214fec217 Merge remote-tracking branch 'origin/master' into 106_tasks_to_parcours 2021-10-30 01:08:05 +02:00
e0cb5a88bd rewrite task list action 2021-10-30 00:41:28 +02:00
c63b1015e1 add indexes for searching task by end date 2021-10-30 00:40:15 +02:00
851a246257 visgraph: improve label with basic markdown 2021-10-30 00:27:10 +02:00
35a27de216 update jsonb exists method by using question mark escaping 2021-10-30 00:25:25 +02:00
09903c2f52 click node event (wip) 2021-10-29 19:08:52 +02:00
6719548504 Merge branch 'household_filiation' of gitlab.com:Chill-Projet/chill-bundles into household_filiation 2021-10-29 18:14:02 +02:00
8312955391 visgraph: hide somes persons nodes labels (folded) 2021-10-29 17:54:28 +02:00
8eedee5e91 visgraph: default uncheck layers when loading 2021-10-29 16:54:22 +02:00
4dc29435dc changelog entries removed... moved to changelog at root 2021-10-29 16:31:22 +02:00
db15a3d53c adapta list of tasks for a person 2021-10-29 16:26:19 +02:00
b60b1cb668 Merge branch 'household_filiation' of gitlab.com:Chill-Projet/chill-bundles into household_filiation 2021-10-29 15:57:06 +02:00
e6183f6646 migration fixed to insert default true value for isActive 2021-10-29 15:56:57 +02:00
a9d3d2027b minor 2021-10-29 15:32:12 +02:00
80594ed186 Merge branch 'household_filiation' of gitlab.com:Chill-Projet/chill-bundles into household_filiation 2021-10-29 15:05:51 +02:00
1c60a5b51e vue_visgraph: improve graph 2021-10-29 15:05:34 +02:00
039c74a1e4 route annotation removed 2021-10-29 13:20:56 +02:00
059a0b075c review processed 2021-10-29 12:50:01 +02:00
50fbc7fd15 processing of review. still ACL left to do 2021-10-29 11:30:01 +02:00
1155555bb3 backend: adapt deprecated getGenderNumeric 2021-10-29 10:37:51 +02:00
76d6a9b4df vue_visgraph: makeFetch (api), add validation exception 2021-10-29 10:01:14 +02:00
e1d28289f6 Merge branch 'household_filiation' of gitlab.com:Chill-Projet/chill-bundles into household_filiation 2021-10-29 09:39:25 +02:00
3a7af94058 GET and POST both working. 2021-10-29 09:29:27 +02:00
998295dc5f vue_visgraph improve (physics, corrections) 2021-10-28 15:47:40 +02:00
4017f8db48 refactor list by course: use acl aware repository 2021-10-28 14:41:19 +02:00
317ba0a095 vue_visgraph: store missing persons from courses, household and relationship 2021-10-28 12:11:51 +02:00
nobohan
046f65f5ff person: re-add accpet email and add possibility of hidding this field 2021-10-28 09:45:27 +02:00
27db6ddf0c Merge branch 'fix_double_search_button' into 'master'
Fix double search button

See merge request Chill-Projet/chill-bundles!188
2021-10-28 07:03:50 +00:00
nobohan
c90f9ee5bc add mod_input_address_index to collection event: better addition of the event listener to the DOM 2021-10-28 08:07:01 +02:00
nobohan
0bc8986aa7 upd CHANGELOG for fix_double_search_button 2021-10-28 07:42:08 +02:00
nobohan
56019cad99 delete double actions buttons on search person page 2021-10-28 07:40:03 +02:00
4da32dc5ca fix filtering of new tasks 2021-10-28 01:05:36 +02:00
e63d645f8a fix return path in tasks 2021-10-28 00:50:18 +02:00
97dbc4bc16 add more filtering possibilities with order helper 2021-10-28 00:11:05 +02:00
69e3a0a6cd Merge branch 'household_filiation' of gitlab.com:Chill-Projet/chill-bundles into household_filiation 2021-10-27 19:56:28 +02:00
92c1bf15cc vue_visgraph: add relationship links with relations 2021-10-27 19:55:24 +02:00
f834bb3bd6 backend normalizer: add id to relationship endpoint 2021-10-27 19:54:28 +02:00
2cb1ad6afc improve household position fixture 2021-10-27 18:11:14 +02:00
83e8b117db start of Relationship fixture 2021-10-27 18:10:35 +02:00
6752a2f6d3 fixture created for Relation entity 2021-10-27 17:40:15 +02:00
1d1a54f653 vue_visgraph: improve household links (edges) 2021-10-27 17:31:04 +02:00
2bbc6bd158 Merge remote-tracking branch 'origin/improve_location' 2021-10-27 16:50:17 +02:00
aea5e9b1d7 Merge remote-tracking branch 'origin/improve_location' into 106_tasks_to_parcours 2021-10-27 16:49:34 +02:00
8ff581d5fa vue_visgraph: add links array state in store 2021-10-27 16:40:01 +02:00
7ad0e2f2c8 rename fetch api method 2021-10-27 16:39:24 +02:00
a3b203c306 fix backend error with AccompanyingCourse endpoints 2021-10-27 16:39:16 +02:00
4287ca37ae changelog note added 2021-10-27 15:28:54 +02:00
07ed6b0fdf no gender defined -> no icon displayed 2021-10-27 15:26:27 +02:00
c200e9909e i18n minor changes 2021-10-27 15:16:13 +02:00
8e0a22974b Merge remote-tracking branch 'origin/master' into 106_tasks_to_parcours 2021-10-27 13:45:02 +02:00
b4b661882a remove dump 2021-10-27 13:40:55 +02:00
f4fb375fd1 add filtering in task list 2021-10-27 13:32:52 +02:00
691c5ffd21 improve filter order by adding checkboxes 2021-10-27 13:32:33 +02:00
a09c824726 changelogs: info added 2021-10-27 13:09:41 +02:00
59118c8eed Merge branch 'issue88_rename_field' into 'master'
field label for duration of activity

See merge request Chill-Projet/chill-bundles!178
2021-10-27 10:18:00 +00:00
c4c75199d6 Merge branch 'fix_display_dates' into 'master'
Correct formatting of birth- and deathdate

See merge request Chill-Projet/chill-bundles!185
2021-10-27 10:17:16 +00:00
333a4d94b2 layout task list 2021-10-27 11:57:51 +02:00
326fe5f50b vue_visgraph: cleaning + i18n 2021-10-27 11:53:34 +02:00
2a86fd12d7 vue_visgraph: add checkbox legend to enable/disable layers 2021-10-27 11:40:15 +02:00
3f869e9ca5 further implementation in vue elements 2021-10-27 11:14:27 +02:00
5cf94a5ed6 implementation of blur effect for list of thirdparties 2021-10-27 09:41:44 +02:00
ccf6c7ad91 Merge branch 'household_filiation' of gitlab.com:Chill-Projet/chill-bundles into household_filiation 2021-10-27 08:55:51 +02:00
965ea528e3 adaptations for acl with tasks 2021-10-26 18:05:06 +02:00
6921817853 Merge branch 'fix/accompanying_period-work-creation-date' into 'master'
accompanying course work: remove display of creation date

See merge request Chill-Projet/chill-bundles!186
2021-10-26 15:56:53 +00:00
nobohan
532efb1787 accompanying course work: changelog 2021-10-26 17:17:04 +02:00
nobohan
0fa3ff4c16 accompanying course work: handle case end date is null 2021-10-26 17:13:41 +02:00
nobohan
d2eb7b471e accompanying course work: remove display of creation date 2021-10-26 16:24:45 +02:00
a20eeb6a34 vue_visgraph: add a mechanism to force update component
cfr. https://medium.com/emblatech/ways-to-force-vue-to-re-render-a-component-df866fbacf47
2021-10-26 15:18:53 +02:00
9609fcb5d3 visgraph: edit interface fr translations 2021-10-26 14:53:42 +02:00
b6dd5e92fc Merge branch 'household_filiation' of gitlab.com:Chill-Projet/chill-bundles into household_filiation 2021-10-26 14:49:33 +02:00
b7466c7e85 GET for relationship fixed: associated relation displayed 2021-10-26 14:49:12 +02:00
2ef70b301f visgraph: basic styles by groups, initialize legend, etc. 2021-10-26 14:44:49 +02:00
nobohan
816855e6f8 mod input address: add an event listener to add this component for collections 2021-10-26 14:12:53 +02:00
nobohan
f6806f7743 person: new translation for accept SMS 2021-10-26 14:11:10 +02:00
nobohan
69ae252da6 person: delete accept Email 2021-10-26 14:11:10 +02:00
nobohan
b800b62e88 person: capitalise place of birth (frontend + backend) 2021-10-26 14:11:10 +02:00
nobohan
6a1cf4eb92 person: capitalize entry in person form 2021-10-26 14:11:10 +02:00
nobohan
f44566037c person: fix showHide import/export 2021-10-26 14:11:10 +02:00
c1a845e3e1 display of eye-icon fixed 2021-10-26 11:35:26 +02:00
4096e0d4df undefined condition added 2021-10-26 11:05:13 +02:00
00ad7a74d6 correct formatting of birth- and deathdate 2021-10-26 10:59:19 +02:00
136c6f19de vue_visgraph: basically display persons, household, courses and edges between them 2021-10-25 18:47:15 +02:00
18ca01b0dc migration changed, further attempts to fix bug 2021-10-25 17:03:45 +02:00
e7f555077e vis need each edge has an id, and vuex don't like vis create it by itself ! 2021-10-25 16:42:38 +02:00
b7f3700928 loop on household members to add edges to graph 2021-10-25 15:00:01 +02:00
f4b9942f3c Merge branch 'household_filiation' of gitlab.com:Chill-Projet/chill-bundles into household_filiation 2021-10-25 14:59:12 +02:00
97f6110be3 prepare course and relationship dispatch 2021-10-25 14:56:23 +02:00
nobohan
1b7cc2be7a add about improve_location MR in changelog 2021-10-25 11:36:18 +02:00
nobohan
526ec52c8d location admin: translations 2021-10-25 11:22:56 +02:00
nobohan
82a679c233 improve location: admin menu 2021-10-25 11:16:17 +02:00
nobohan
21f463ccb9 improve location: correct migration 2021-10-25 10:50:14 +02:00
nobohan
911e709a74 improve location: customizeQuery 2021-10-25 09:34:05 +02:00
nobohan
c46065d9c5 Merge remote-tracking branch 'origin/improve_location-fix-crud' into improve_location
merge...
2021-10-25 09:30:17 +02:00
nobohan
625c43c0b9 improve location: form config 2021-10-25 09:27:50 +02:00
3196a8f785 Merge branch 'household_filiation' of gitlab.com:Chill-Projet/chill-bundles into household_filiation 2021-10-22 19:21:55 +02:00
05d16ec9ab relation and relationship entities created + endpoints. Still something wrong with link between Relation and Relationship 2021-10-22 19:21:32 +02:00
bae06fcc9c Merge remote-tracking branch 'origin/master' into 106_tasks_to_parcours 2021-10-22 17:58:26 +02:00
2f053d3b5f Merge branch 'features/list-possible-user-referral-period' into 'master'
Features/list possible user referral period

See merge request Chill-Projet/chill-bundles!180
2021-10-22 15:54:06 +00:00
c4da6a436b Merge remote-tracking branch 'origin/master' into 106_tasks_to_parcours 2021-10-22 17:52:57 +02:00
4d55b0582c change visibility of methods in LocationCotnroller 2021-10-22 17:25:54 +02:00
693a2889bc fix query customization in crud controller 2021-10-22 17:24:05 +02:00
nobohan
913eb5f229 admin location: filter items in twig 2021-10-22 14:13:54 +02:00
83d91e61cb vue_visgraph: manage vis objects with window variables to avoid conflict between vis and vue 2021-10-22 12:58:32 +02:00
d009d09215 some adjustments to the application of blur effect...incomplete 2021-10-22 12:35:27 +02:00
nobohan
8c96aae988 location admin: menu for location admin 2021-10-22 12:30:52 +02:00
nobohan
ece7ec032d location admin: correct missing dep 2021-10-22 12:21:23 +02:00
nobohan
154416cddf location admin: add active field on Location and LocationType 2021-10-22 12:14:32 +02:00
6ff80be88d vue_visgraph: add vis manipulation actions and vis styles 2021-10-22 11:59:55 +02:00
5869236af1 merge remote into local branch issue fixed 2021-10-22 11:53:13 +02:00
nobohan
7dc4590580 location admin: show/ hide fields based on location type 2021-10-22 11:27:52 +02:00
nobohan
e24fd8aff0 location admin: improve admin crud for location 2021-10-22 10:01:24 +02:00
nobohan
e9322e61d4 location admin: admin crud for location 2021-10-21 21:39:32 +02:00
c38196006c confidential component created and added to personRenderBox on resourceItem and participationItem as demo. bug: eye icon only appears when clicking on the vue devtools extension in firefox? 2021-10-21 16:52:27 +02:00
a754bc0abe blur added to requestor in twig template 2021-10-21 16:52:27 +02:00
f09329daee blur logic implemented on view.html.twig of Person by means of example 2021-10-21 16:52:27 +02:00
b40ed48776 restructuring files to /module 2021-10-21 16:52:27 +02:00
97cf6e52ac first commit 2021-10-21 16:52:27 +02:00
nobohan
92843677f9 location admin: add admin crud for location type 2021-10-21 16:30:37 +02:00
nobohan
e06a98e70a user menu: remove useless commented lines (user menus are implemented in their own chill bundles 2021-10-21 13:48:42 +02:00
nobohan
821480c06f calendar: add a menu user entry 2021-10-21 13:47:56 +02:00
8735602dd6 Merge branch 'household_filiation' of gitlab.com:Chill-Projet/chill-bundles into household_filiation 2021-10-21 10:31:46 +02:00
d7cf45885e vue_visgraph: vuex get household and update nodes array 2021-10-21 10:29:51 +02:00
nobohan
db67ed3194 rdv->calendar: add location 2021-10-20 22:04:20 +02:00
nobohan
8962c1c05f add fixture for location type 2021-10-20 21:46:16 +02:00
dded4fb804 rename method 2021-10-20 20:50:27 +02:00
02ca9add52 refactor naming ReferralsAvailable => referralSuggestion 2021-10-20 20:49:44 +02:00
3f138dc152 show users as suggestions, not in constrained list 2021-10-20 19:59:08 +02:00
nobohan
d1e2257db6 fix merge request conflict for improve address 2021-10-20 15:52:22 +02:00
0a058bad82 update list of referrers when loading and updating some parts of the course 2021-10-20 15:03:42 +02:00
8d947ea81b viewing permission checked for returned accompanying periods by-person 2021-10-20 13:37:27 +02:00
902c45f0cd endpoint created for acc periods by-person 2021-10-20 13:11:58 +02:00
4f21c7f219 simplifiy filter order 2021-10-20 13:11:02 +02:00
c8762d2bc2 list referral for an accompanying period 2021-10-20 13:10:28 +02:00
94c91d5825 simplifiy filter order 2021-10-20 13:09:38 +02:00
1b0c19a68f prepare vue_visgraph component, with store, dataset and display basic graph 2021-10-20 09:46:26 +02:00
2227d5c66f translation fixed in master vendee branch 2021-10-18 16:56:33 +02:00
47f7837ab2 Merge branch 'issue97_rename_field' into 'master'
utilisateur field label changed

See merge request Chill-Projet/chill-bundles!177
2021-10-18 14:48:48 +00:00
f889d43f6c update changelog 2021-10-18 16:47:16 +02:00
eecb11436e field label for duration of activity 2021-10-18 15:33:26 +02:00
220dafeb99 utilisateur field label changed 2021-10-18 14:50:34 +02:00
8be11314c3 Merge branch 'master' into HEAD 2021-10-18 13:49:00 +02:00
f89e92e88b Merge branch 'features/improve-admin-user-list' 2021-10-18 13:35:32 +02:00
acdb4fdd36 fixes in translation form admin 2021-10-18 13:34:59 +02:00
b73332c4a3 show errors in ChillCollectionType 2021-10-18 13:33:41 +02:00
8fb5a1b5e8 fixes in translation form admin 2021-10-18 13:33:19 +02:00
5d494221d2 confidential component created and added to personRenderBox on resourceItem and participationItem as demo. bug: eye icon only appears when clicking on the vue devtools extension in firefox? 2021-10-18 13:11:14 +02:00
nobohan
fcc8f67094 Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles 2021-10-18 11:24:29 +02:00
nobohan
99b99de9be update CHANGELOG 2021-10-18 11:23:14 +02:00
nobohan
31fd9cee57 update CHANGELOG 2021-10-18 11:21:13 +02:00
809eb9643e Merge branch 'optimize_address' into 'master'
Address: Optimize address

See merge request Chill-Projet/chill-bundles!170
2021-10-18 09:17:05 +00:00
89b0b94d22 Merge branch 'feature/form-move-household-with-checkboxes' into 'master'
rewrite form move household

See merge request Chill-Projet/chill-bundles!159
2021-10-18 09:14:28 +00:00
e6e5bfee4f update changelog [ci-skip] 2021-10-15 17:46:00 +02:00
9cbac89cae handle leaving household 2021-10-15 17:43:28 +02:00
8f361567ff form as carrousel finalized 2021-10-15 16:40:31 +02:00
8c87eaa46f upgrading changelog 2021-10-15 15:46:04 +02:00
6565e3f8e3 fix invisible selected item in multiselect 2021-10-15 15:37:16 +02:00
6876c23adb adapting vue_calendar to use Location 2021-10-15 15:28:33 +02:00
d86307327c fix error in LocationApiController customizeQuery 2021-10-15 14:12:06 +02:00
0e18a3ada9 adding location hidden field in Calendar formType 2021-10-15 13:13:00 +02:00
4677fadf6f adding activity location in show template + translations 2021-10-15 13:11:14 +02:00
3e4cb41f7a vue_activity Location i18n translations 2021-10-15 12:49:15 +02:00
ada9efc75d filter list of locations on backend side (GET location endpoint) 2021-10-15 12:01:57 +02:00
d0dd99db9a fix Location POST endpoint and saveNewLocation event method in vue_activity Location 2021-10-15 11:25:18 +02:00
e6845326d7 vue_activity location: add NewLocation fields, submit activity form with hidden field (+) 2021-10-15 09:09:47 +02:00
61488e9876 WIP test filtering elements on household [household editor] 2021-10-14 16:05:19 +02:00
a4af30e542 update changelog 2021-10-14 16:05:17 +02:00
58a8949cac download household on same address 2021-10-14 16:03:48 +02:00
c179649c56 load suggestion WIP 2021-10-14 16:03:48 +02:00
05b2b2f9b8 Link between address and reference, and api endpoint to find household
by address reference

* add a one-to-many link between address and address reference;
* update AddAddress.vue to add information on picked address reference;
* add an HouseholdACLAwareRepository, with a method to find household by
current address reference
* add an endpoint to retrieve household by address reference
* + tests
2021-10-14 16:03:48 +02:00
6430de94a7 try to fix button in controller issue 2021-10-14 16:03:48 +02:00
62d3bf8742 do not allow to update address from an existing household 2021-10-14 16:03:48 +02:00
0437e00dcd suggest only temporary addresses 2021-10-14 16:03:48 +02:00
dc7bcb5233 update changelog 2021-10-14 16:03:06 +02:00
b3bd4a5b49 Merge branch 'fix-tests/fix-2021-10-14' into 'master'
Fix tests with capitalization

See merge request Chill-Projet/chill-bundles!175
2021-10-14 14:01:18 +00:00
4f940b44ad Fix tests with capitalization 2021-10-14 14:01:18 +00:00
a75f4015c7 Merge branch 'features/thirdparty-improve-acl-collection' into 'master'
3party, suite

See merge request Chill-Projet/chill-bundles!173
2021-10-14 12:06:51 +00:00
eaeb6c18b0 try to fix loading of reports fixtures 2021-10-14 13:57:42 +02:00
9a02665053 some tweaks into PickAddressType 2021-10-14 13:54:19 +02:00
6fccc70e41 add some doc [ci-skip] 2021-10-13 23:02:53 +02:00
13b96637bb Refactor address vue app and create a PickAddressType 2021-10-13 22:58:54 +02:00
4d4662a634 adding endpoint for LocationType. fetch types and add form fields. 2021-10-13 19:31:48 +02:00
b418d13190 make somes changes on model: to manage isVisible field option + others 2021-10-13 15:47:48 +02:00
48f3c440a2 adding an API GET Location endpoint, fetch locations and list them in vue multiselect 2021-10-13 14:22:53 +02:00
342c462ed7 prepare vue Location component 2021-10-13 12:02:45 +02:00
49b1b6f413 vue_activity: add a Location sub-component, teleported in form 2021-10-13 09:56:29 +02:00
7c21818f00 vue_activity: removing v-model in a multiselect (try to fix warning in console) 2021-10-13 09:54:50 +02:00
2d0895b83d calendar: remove useless bootstrap col classes 2021-10-13 09:24:15 +02:00
01ff88074b add parent in thirdpartyrenderbox.vue 2021-10-12 17:50:32 +02:00
e570f5c28e adding Entities Location and LocationType (for activity/calendar) + doctrine migration 2021-10-12 17:38:09 +02:00
b84d0100e0 create style for badge 3party and introduce in ThirdPartyRenderBox.vue 2021-10-12 17:32:17 +02:00
88d073b9a9 handle types and categories in a single select input 2021-10-12 15:52:06 +02:00
nobohan
210c199a35 CHANGELOG: order addresses 2021-10-12 15:10:09 +02:00
nobohan
e4a05a1812 Address: order address in back-end 2021-10-12 15:09:34 +02:00
82ae300bd9 vue accourse banner: change "by" translation 2021-10-12 13:12:45 +02:00
85538f74b7 vue person renderbox, fix title 2021-10-12 13:12:45 +02:00
f1773997ce fix/adapt gender translation 2021-10-12 13:12:30 +02:00
ae7774ac39 init household filiation page with hello world visjs graph 2021-10-12 09:55:47 +02:00
9eec15873e fixtures for civility: add abbreviations 2021-10-12 09:44:51 +02:00
e9192c5011 adaptations for third party search 2021-10-12 09:37:35 +02:00
f4369553e1 fix layout for address 2021-10-12 09:37:35 +02:00
bc608832c2 fill changelog
[ci-skip]
2021-10-12 09:37:35 +02:00
313c17826e translation of company & contact and show parent in list 2021-10-12 09:37:35 +02:00
acbb33918f improve translation 2021-10-12 09:37:35 +02:00
cb29e1e8be Update CONVENTIONS.md [ci-skip] 2021-10-11 18:44:25 +00:00
799ed0de5c Add new file 2021-10-11 18:43:39 +00:00
76f84934d4 update changelog with today release 2021-10-11 17:36:20 +02:00
nobohan
62c0410bf5 address: sort cities by code and then by name + improve city display 2021-10-11 16:16:49 +02:00
nobohan
f7954d5159 address: sort address by street and street number 2021-10-11 16:05:03 +02:00
992b320820 replace continue instruction by equivalent break in switch 2021-10-11 15:01:37 +02:00
47897b5fe3 update changelog [ci-skip] 2021-10-11 14:54:08 +02:00
b5394a3de2 use entity_render_string in titles 2021-10-11 14:53:04 +02:00
2db9a98bfe fix bootstrapping listener for person capitalization name 2021-10-11 14:53:04 +02:00
0c5e5ac672 Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles 2021-10-11 14:42:57 +02:00
ffb99e26fb changelog correction 2021-10-11 14:41:18 +02:00
a27b228a6f Merge branch 'features/thirdparty-improve-acl-collection' 2021-10-11 14:31:47 +02:00
abedf83dbd fix flushing after person creation 2021-10-11 14:31:03 +02:00
80a05f76ba update changelog [ci-skip] 2021-10-11 14:17:35 +02:00
nobohan
30fcdfd1f6 addresses: remove duplicate in postal codes 2021-10-11 14:15:59 +02:00
0dbff5a6a7 rename tests for PickCenterType and desactivate them 2021-10-11 14:08:36 +02:00
d7ae279101 Create thirdparty on the fly with institution / contact 2021-10-11 14:08:36 +02:00
08764aa0b4 improve layout of third parties in AddPerson 2021-10-11 14:08:36 +02:00
c54edd8407 fix civility repository namespace 2021-10-11 14:08:36 +02:00
e465170c7b work on render box and list 2021-10-11 14:08:36 +02:00
72e9346b6b fix loading third party 2021-10-11 14:08:36 +02:00
0633fd812f handle kind as contacts 2021-10-11 14:08:36 +02:00
4d71a1c630 add possibility to generate filter/order elements, with only search box
for now
2021-10-11 14:08:36 +02:00
e286acf9fe fix namespace 2021-10-11 14:08:36 +02:00
7812442c9a page vue des tiers 2021-10-11 14:08:36 +02:00
9a708ca618 fix canonicalization and show only active children in form 2021-10-11 14:08:36 +02:00
58ddbfb67b remove occurences for ThirdPartyCivility 2021-10-11 14:08:36 +02:00
2820ad83de add trigger for canonicalization and anonymouse flag on 3party 2021-10-11 14:08:36 +02:00
ca3ced0308 various improvements on 3party 2021-10-11 14:08:36 +02:00
7ea2c36c5e crudification for thirdparty 2021-10-11 14:08:36 +02:00
a8edef13a3 refactor centerType 2021-10-11 14:08:36 +02:00
05b9476a71 crudification + corrections on thirdparty 2021-10-11 14:08:36 +02:00
cc7e38194f Merge branch 'submit_eventlistener' into 'master'
Submit eventlistener

See merge request Chill-Projet/chill-bundles!171
2021-10-11 07:41:03 +00:00
78b651bdc4 blur added to requestor in twig template 2021-10-08 23:44:06 +02:00
487103375d blur logic implemented on view.html.twig of Person by means of example 2021-10-08 22:21:40 +02:00
bfe5e0f515 Merge branch 'names_to_caps' into 'master'
Names to caps

See merge request Chill-Projet/chill-bundles!167
2021-10-08 16:43:29 +00:00
7ed61398ea Merge branch '207_activity_bugfix' into 'master'
option added to distinguish between edit and new action so that modification...

See merge request Chill-Projet/chill-bundles!168
2021-10-08 16:43:10 +00:00
1eba6a35aa Merge branch 'master' into resume-page 2021-10-08 17:56:27 +02:00
158fbfd241 updating changelog 2021-10-08 17:43:15 +02:00
02268792ba Activity: sharing badge-title include in list and in recent-list 2021-10-08 17:32:26 +02:00
afe076041f rename recent_list to list_recent 2021-10-08 17:23:52 +02:00
800ab896bc Activity, improve badge-title. Fix too long badges line break in a narrow inline wrapper. 2021-10-08 17:15:58 +02:00
nobohan
acbd6e761a address: zoom on postal code on select city 2021-10-08 15:51:51 +02:00
8f889248fb fix some limits with float-button asset 2021-10-08 13:01:44 +02:00
e12e5798ea refactor activity list css styles (wip) 2021-10-08 13:01:34 +02:00
52c1a01980 Refactoring sass chill colors variables and badge mixins 2021-10-08 13:01:10 +02:00
84189faae6 Translation for Last Items 2021-10-08 13:01:10 +02:00
3a07fa4faf resume short list style abstraction for accourse-work and activities (wip) 2021-10-08 13:01:04 +02:00
c87eda32cb Merge branch 'improve_address' into 'master'
Improve address

See merge request Chill-Projet/chill-bundles!169
2021-10-08 10:40:46 +00:00
nobohan
2d4b6d1dd1 minor correction following MR review + Changelog 2021-10-08 12:14:45 +02:00
1ffff1f72c restructuring files to /module 2021-10-07 17:10:52 +02:00
8fca704f74 adjustment so that altnames are fully capitalized 2021-10-07 17:05:09 +02:00
d524897838 entrypoint added to webpack and js included in create template for person 2021-10-07 16:57:22 +02:00
fb05d892a2 reorganization of files 2021-10-07 16:16:01 +02:00
48e59bac79 changelog updated 2021-10-07 15:50:35 +02:00
1ded5b7c01 first commit 2021-10-07 14:18:25 +02:00
nobohan
665b0f8533 postal code: adapt fixtures 2021-10-07 13:48:05 +02:00
nobohan
748fe28f8d postal code: rename fields to avoid confusion in load fixtures 2021-10-07 13:42:26 +02:00
nobohan
fd73fac1a8 adapt migration 2021-10-07 12:32:26 +02:00
aa852ec924 minor changes review: comments removed, logicexception, more test cases passed 2021-10-07 11:13:38 +02:00
9d6958a835 logic moved to controller instead of form 2021-10-07 10:56:10 +02:00
nobohan
3770318e6a enlarge the loadpostalcode command to more fields 2021-10-06 21:48:56 +02:00
nobohan
24320cb702 address: alter postalcode entity 2021-10-06 17:28:07 +02:00
7dd42c3fa2 accented letters in majascule 2021-10-06 15:52:11 +02:00
b510d6a7f5 option added to distinguish between edit and new action so that modification of activity with uactive type is possible 2021-10-06 14:07:26 +02:00
72d67624a2 minor fixes 2021-10-06 12:49:15 +02:00
Julie Lenaerts
0c4ea81550 eventListener created and tested for firstname, lastname and altnames 2021-10-06 12:16:45 +02:00
Julie Lenaerts
7d8f380050 entity listener added to person to capitalize names 2021-10-05 13:57:04 +02:00
af4cf55046 start of entity listener for person name capitalization 2021-10-04 19:33:12 +02:00
369a29af48 accompanying course work, specific render for list page or resume page (wip) 2021-10-04 14:22:27 +02:00
461b96ea37 duplicate templates deleted 2021-10-01 11:32:46 +02:00
fc237db98a fix: wrong template rendered for new course task 2021-10-01 11:32:32 +02:00
43daab1f7b transition button added to listitems of course tasks 2021-10-01 11:32:05 +02:00
85e8fe59a4 changes to TaskVoter reinstated, mistake made in conflict resolvement 2021-10-01 11:18:10 +02:00
262fefa92f access granted condition lifted temporarily to show the 'add new task' button on index page for Person 2021-10-01 10:52:05 +02:00
1403ee2ba5 redirect after submit bug fixed for edit and delete when coming from show.html.twig 2021-10-01 10:49:55 +02:00
548247188f temporarily lifted scope validation, currently no scopes in select list to be selected 2021-10-01 10:49:07 +02:00
6a34046e93 comments deleted, notations adjusted, ... 2021-10-01 10:47:32 +02:00
88b8ff86d1 reorganize templates for a better structure 2021-10-01 10:45:04 +02:00
cc258ba164 templates added for transition of course task and taskcontroller adapted to show correct template 2021-09-30 14:24:17 +02:00
5d69e48787 more conformity between URL's single-task 2021-09-30 14:22:20 +02:00
cb4059e5c3 comment out use of voter for menu entry, new way of handling rights? 2021-09-28 14:37:27 +02:00
8411c909ff notation modifications 2021-09-28 12:55:46 +02:00
41fc41b1da migration namespace adjusted 2021-09-28 12:55:46 +02:00
cb5b45cbe8 autowire and configure MenuBuilder 2021-09-28 12:55:46 +02:00
4c47a35457 Fix SingleTaskListType
accompanyingCourse also defined as a form option
2021-09-28 12:55:46 +02:00
34dd35f2e2 Changed name of PersonMenuBuilder
More general name since it also contains the AccompanyingPeriod task menu entry now.
2021-09-28 12:55:46 +02:00
6e3ce06fcf new/show/edit/delete/list functionality added for accompanyingperiod task 2021-09-28 12:55:46 +02:00
537518b66f controller and templates adapted to display list of accompanying period tasks + detailpage of task 2021-09-28 12:53:24 +02:00
4ad9714e8b Menu entry added in PersonMenuBuilder of taskbundle. Removed from menubuilder in Personbundle. Rename file, PersonMenuBuilder to MenuBuilder? 2021-09-28 12:53:23 +02:00
5a936cd20b templates + controller further adapted to work with accompanyingCourse. new and show methods don't work yet due to authorization/voter issues
templates adapted for use with accompanyingCourse tasks also
2021-09-28 12:53:23 +02:00
1fb14834b7 tasks added to accompanyingCourse menu 2021-09-28 12:53:23 +02:00
53fc5b8399 adaptation of newTask() method in singleTaskController 2021-09-28 12:49:38 +02:00
8318458805 relation between task and accompanyingcourse created 2021-09-28 12:49:38 +02:00
7515415888 autowire and configure MenuBuilder 2021-09-17 15:18:48 +02:00
27a52ce166 Fix SingleTaskListType
accompanyingCourse also defined as a form option
2021-09-17 14:53:15 +02:00
17b6f287dc Changed name of PersonMenuBuilder
More general name since it also contains the AccompanyingPeriod task menu entry now.
2021-09-17 14:49:43 +02:00
01ae50aca7 new/show/edit/delete/list functionality added for accompanyingperiod task 2021-09-17 14:48:29 +02:00
a156bd0863 controller and templates adapted to display list of accompanying period tasks + detailpage of task 2021-09-16 15:55:09 +02:00
b1dbd8b011 Menu entry added in PersonMenuBuilder of taskbundle. Removed from menubuilder in Personbundle. Rename file, PersonMenuBuilder to MenuBuilder? 2021-09-15 11:13:09 +02:00
b28b4e5fba templates + controller further adapted to work with accompanyingCourse. new and show methods don't work yet due to authorization/voter issues
templates adapted for use with accompanyingCourse tasks also
2021-09-10 15:19:59 +02:00
ead96f3836 tasks added to accompanyingCourse menu 2021-09-10 14:57:41 +02:00
27077c9d96 adaptation of newTask() method in singleTaskController 2021-09-09 18:21:41 +02:00
8a38712525 relation between task and accompanyingcourse created 2021-09-09 17:43:35 +02:00
624 changed files with 22898 additions and 10095 deletions

View File

@@ -15,7 +15,9 @@ before_script:
- curl -sS https://getcomposer.org/installer | php
- php -d memory_limit=2G composer.phar install
- php tests/app/bin/console doctrine:migrations:migrate -n
- php -d memory_limit=2G tests/app/bin/console doctrine:fixtures:load -n
- php -d memory_limit=2G tests/app/bin/console cache:clear --env=dev
- php -d memory_limit=3G tests/app/bin/console doctrine:fixtures:load -n
- php -d memory_limit=2G tests/app/bin/console cache:clear --env=test
- echo "before_script finished"
# Bring in any services we need http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service

View File

@@ -0,0 +1,24 @@
# Description of changes
<!--
describe here the change of your MR. It can be either a text, or a bullet list
for changes
-->
# Issues related
<!--
list the issues related to this MR.
It may be client issues, or dev issues
-->
* ...
* ...
# Tests
<!-- Describe tests if any, or why no tests -->

View File

@@ -10,18 +10,129 @@ and this project adheres to
## Unreleased
* [Aside activity] Fixes for aside activity
* categories with child
* fast creation buttons
* add ordering for types
<!-- write down unreleased development here -->
* [task] Select2 field in task form to allow search for a user (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/167)
* remove "search by phone configuration option": search by phone is now executed by default
* remplacer le classement par ordre alphabétique par un classement par ordre de pertinence, qui tient compte:
* de la présence d'une string avec le nom de la ville;
* de la similarité;
* du fait que la recherche commence par une partie du mot recherché
* ajouter la recherche par numéro de téléphone directement dans la barre de recherche et dans le formulaire recherche avancée;
* ajouter la recherche par date de naissance directement dans la barre de recherche;
* ajouter la recherche par ville dans la recherche avancée
* ajouter un lien vers le ménage dans les résultats de recherche
* ajouter l'id du parcours dans les résultats de recherche
* ajouter le demandeur dans les résultats de recherche
* ajout d'un bouton "recherche avancée" sur la page d'accueil
* [person] create an accompanying course: add client-side validation if no origin (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/210)
* [person] fix bounds for computing current person address: the new address appears immediatly
* [docgen] create a normalizer and serializer for normalization on doc format
## Test releases
### Test release 2021-11-15
* [main] fix adding multiple AddresseDeRelais (combine PickAddressType with ChillCollection)
* [person]: do not suggest the current household of the person (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/51)
* [person]: display other phone numbers in view + add message in case no others phone numbers (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/184)
* unnecessary whitespace removed from person banner after person-id + double parentheses removed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/290)
* [person]: delete accompanying period work, including related objects (cascade) (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/36)
* [address]: Display of incomplete address adjusted.
* [household]: improve relationship graph
* add form to create/edit/delete relationship link,
* improve graph refresh mechanism
* add feature to export canvas as image (png)
* [person suggest] In widget "add person", improve the pertinence of persons when one of the names starts with the pattern;
* [person] do not ask for center any more on person creation
* [3party] do not ask for center any more on 3party creation
### Test release 2021-11-08
* [person]: Display the name of a user when searching after a User (TMS)
* [person]: Add civility to the person
* [person]: Various improvements on the edit person form
* [person]: Set available_languages and available_countries as parameters for use in the edit person form
* [activity] Bugfix: documents can now be added to an activity.
* [tasks] improve tasks with filter order
* [tasks] refactor singleControllerTasks: limit the number of conditions from the context
* [validations] validation of accompanying period added: no duplicate participations or resources (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/60).
* [renderbox] If gender of person is not defined, no icon is displayed instead of neuter-icon (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/129).
* [confidential information] module added to blur confidential information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/248).
* refactor `AuthorizationHelper` and `UserACLAwareRepository` to fix constructor, and separate logic for parent role helper into `ParentRoleHelper`
* [main]: filter location and locationType in backend: exclude NULL names, only active and availableToUsers
* [activity]: perform client-side validation & show/hide fields in the "new location" modal
* [person]: normalize person with CenterResolverDispatcher and handle case where center is null or multiple in PersonRenderBox
* [docstore] voter for PersonDocument and AccompanyingCourseDocument on the 2.0 way (using VoterHelperFactory)
* [docstore] add authorization check inside controller and menu
* [activity]: fix inheritance for role `ACTIVITY FULL` and add missing acl in menu
* [person] show current address in search results
* [person] show alt names in search results
* [admin]: links to activity admin section added again.
* [household]: endDate field deleted from household edit form.
* [household]: View accompanying periods of current and old household members.
* [tasks]: different layout for task list / my tasks, and fix link to tasks in alert or in warning
* [admin]: links to activity admin section added again.
* [household]: household addresses ordered by ValidFrom date and by id to show the last created address on top.
* [socialWorkAction]: display of social issue and parent issues + banner context added.
* [DBAL dependencies] Upgrade to DBAL 3.1
### Test release 2021-10-27
* [person]: delete double actions buttons on search person page
* [person]: accompanying course work: remove creation date display the list of work + handle case when end date is null
* [main]: Add new pages with a menu for managing location and location type in the admin
* [main]: Add some fixtures for location type
* [calendar]: Pass the location when transforming a calendar item (rdv) into an activity
* [calendar]: Add a user menu for "my calendar"
### Test release 2021-10-18
* [3party]: french translation of contact and company
* [3party]: show parent in list
* [3party]: change color for badge "child"
* [3party]: fix address creation
* [household members editor] finalisation of editor
* [AccompanyingCourse banner]: replace translation referrer (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/70)
* [Location]: add location system in activity and RV (calendar). User can choose in location list or create a new location.
* [household]: add relationship page with dynamic data visualisation graph
## Test releases
### Test release 2021-10-11
* Address: zoom on postal code geometry + fix origin of manually entered postal code
* in the Address vue component, order the postal code and street address by alphabetic and numeric order
* add 3 new fields to PostalCode and adapt postal code command and fixtures
* [Aside activity] Fixes for aside activity
* categories with child
* fast creation buttons
* add ordering for types
* [AccompanyingCourse Resume page] badge-title for AccompanyingCourseWork and for Activities;
* Improve badges behaviour with small screens;
* [ThirdParty]:
* third party list
* create a kind contact/institution when create a new thirdparty, and set contact embedded as kind=child;
* filter thirdparties in list
* [FilterOrder]: add development kit for generating filter and ordering in list
* [Capitalization of names] person names are capitalized on creation, on prePersist event
* [On-The-Fly] modale works for showing, editing and creating person or thirdparty ;
* [AccompanyingCourse Resume page] associated persons list, can see household when hover, and with show on-the-fly modale when clicking person ;
### test release 2021-10-04
* [Household editor][UI] Update how household suggestion and addresses are picked;
See https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/80
* [AddAddress] Handle address suggestion;
* [CenterType][Create a person] when overriding the ACL rules, allow to show a PickCenterType
when no centers are reachable by the default ACL.
@@ -30,14 +141,41 @@ and this project adheres to
* a badge "requestor" is shown into search results;
* periods where the person is only requestor (without participating) are also shown;
Issues:
* https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/13
* https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/199
* [Person form] "accept sms" not required:
https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/37
https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/221
* [Household editor] suggest only temporarily addresses;
See https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/82
* On-The-Fly modale works for showing, editing and creating person and thirdparty ;
* AccompanyingCourse Resume page: list associated persons by household, see household when hover, and show on-the-fly modale when clicking on person ;
* [AddAddress] Handle address suggestion;
* [AddAddress][Entity address]: add a link between address and address reference;
* [Household editor] suggest household by comparing the temporary addresses from courses;
See https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/81
* On-The-Fly modale works for showing, editing and creating person and thirdparty
## Test released
<!--
Coming soon...
DO NOT ADD unreleased items here. Add them under "Unreleased" title
### Test release yyyy-mm-dd
-->
## Stable releases
No stable releases for v2+

383
CONVENTIONS.md Normal file
View File

@@ -0,0 +1,383 @@
# Conventions Chill
en cours de rédaction
## Assets: nommage des entrypoints
Trois types d'entrypoint:
* application vue (souvent spécifique à une page) -> préfixé par `vue_`;
* code js/css qui est réutilisé à plusieurs endroits:
* ckeditor
* async_upload (utilisé pour un formulaire)
* bootstrap
* chill.js
* ...
=> on préfixe `mod_`
* code css ou js pour une seule page
* ré-utilise parfois des "foncitionnalités": ShowHide, ...
=> on préfixe `page_`
Arborescence:
```
# Sous Resources/public
- chill/ => theme (chill)
- chillmain.scss -> push dans l'entrypoint chill
- lib/ => ne vont jamais dans un entrypoint, mais sont ré-utilisés par d'autres
- ShowHide
- Collection
- Select2
- module/ => termine dans des entrypoints ré-utilisables (mod_)
- bootstrap
- custom.scss
- custom/
- variables.scss
- ..
- forkawesome
- AsyncUpload
- vue/ => uniquement application vue (vue_)
- _components
- app
- page/ => uniquement pour une seule page (page_)
- login
- person
- personvendee
- household_edit_metadata
- index.js
```
## Organisation des feuilles de styles
Comment s'échaffaudent les styles dans Chill ?
1. l'entrypoint **mod_bootstrap** (module bootstrap) est le premier niveau. Toutes les parties(modules) de bootstrap sont convoquées dans le fichier ```bootstrap.js``` situé dans ```ChillMainBundle/Resources/public/module/bootstrap```.
* Au début, ce fichier importe le fichier ```variables.scss``` qui détermine la plupart des réglages bootstrap tels qu'on les a personnalisés. Ce fichier surcharge l'original, et de nombreuses variables y sont adaptées pour Chill.
* On veillera à ce qu'on puisse toujours comparer ce fichier à l'original de bootstrap. En cas de mise à jour de bootstrap, il faudra générer un diff, et adapter ce diff sur le fichier variable de la nouvelle version.
* A la fin on importe le fichier ```custom.scss```, qui comprends des adaptations de bootstrap pour le préparer à notre thème Chill.
* ce ```custom.scss``` peut être splitté en plus petits fichiers avec des ```@import 'custom/...'```
* L'idée est que cette première couche bootstrap règle un partie importante des styles de l'application, en particulier ce qui touche aux position du layout, aux points de bascules responsive, aux marges et écarts appliqués par défauts aux éléments qu'on manipule.
2. l'entrypoint **chill** est le second niveau. Il contient le thème Chill qui est reconnaissable à l'application.
* Chaque bundle a un dossier ```Resources/public/chill``` dans lequel on peut trouver une feuille sass principale, qui est éventuellement splittée avec des ```@imports```. Toutes ces feuilles sont compilées dans un unique entrypoint Chill, c'est le thème de l'application. Celui-ci surcharge bootstrap.
* La feuille chillmain.scss devrait contenir les cascades de styles les plus générales, celles qui sont appliquées à de nombreux endroits de l'application.
* La feuille chillperson.scss va aussi retrouver des styles propres aux différents contextes des personnes: person, household et accompanyingcourse.
* Certains bundles plus secondaires ne contiennent que des styles spécifiques à leur fonctionnement.
3. les entrypoints **vue_** sont utilisés pour des composants vue. Les fichiers vue peuvent contenir un bloc de styles scss. Ce sont des styles qui ne concernent que le composant et son héritage, le tag ```scoped``` précise justement sa portée (voir la doc).
4. les entrypoints **page_** sont utilisés pour ajouter des assets spécifiques à certaines pages, le plus souvent des scripts et des styles.
## Taguer du code html et construire la cascade de styles
L'exemple suivant montre comment taguer sans excès un élément de code. On remarque que:
* il n'est pas nécessaire de taguer toutes les classes intérieures,
* il ne faut pas répéter la classe parent dans toutes les classes enfants. La cascade sass va permettre de saisir le html avec souplesse sans alourdir la structure des balises.
* souvent la première classe sera déclinée par plusieurs classes qui commencent de la même manière: ```bloc-dark``` ajoute juste la version sombre de ```bloc```, on ne met pas ```bloc dark```, car on ne souhaite pas que la classe ```dark``` de ```bloc``` interagisse avec la même classe ```dark``` de ```table```. On aura donc un élément ```bloc bloc-dark``` et un élément ```table table-dark```.
```html
<div class="bloc bloc-dark mon-bloc">
<h3>mon titre</h3>
<ul class="record_actions">
<li>
<a class="btn btn-edit"></a>
</li>
<li></li>
<li></li>
</ul>
</div>
```
Finalement, il importe ici de définir ce qu'est un bloc, ce qu'est une zone d'actions et ce qu'est un bouton. Ces 3 éléments existent de manière autonome, ce sont les seuls qu'on tagge.
Par exemple pour mettre un style au titre on précise juste h3 dans la cascade bloc.
```sass
div.bloc {
// un bloc générique, utilisé à plusieurs endroits
&.bloc-dark {
// la version sombre du bloc
}
h3 {}
ul {
// une liste standard dans bloc
li {
// des items de liste standard dans bloc
}
}
}
div.mon-bloc {
// des exceptions spécifiques à mon-bloc,
// qui sont des adaptations de bloc
}
ul.record_actions {
// va uniformiser tous les record_actions de l'application
li {
//...
}
}
.btn {
// les boutons de bootstrap
.btn-edit {
// chill étends les boutons bootstrap pour ses propres besoins
}
}
</style>
```
## Render box
## URL
### Nommage des routes
:::warning
Ces règles n'ont pas toujours été utilisées par le passé. Elles sont souhaitées pour le futur.
:::
Les routes sont nommées de cette manière:
`chill_bundle_entite_action`
1. d'abord chill_ (pour tous les modules chill)
2. ensuite une string qui est identique, par bundle
3. si le point est un point d'api (json), alors ajouter la string `api`
4. ensuite une string qui indique sur quelle entité porte la route, voire également les sous-entités
5. ensuite une action (`list`, `view`, `edit`, `new`, ...)
Le fait d'indiquer `api` en 3 permet de distinguer les routes d'api qui sont générées par la configuration (qui sont toutes préfixées par `chill_api`, de celles générées manuellement. (Exemple: `chill_api_household__index`, et `chill_person_api_household_members_move`)
Si les points 4 et 5 sont inexistants, alors ils sont remplacés par d'autres éléments de manière à garantir l'unicité de la route, et sa bonne compréhension.
### URL
Les URL respectent également une convention:
#### Pour les pages html
:::warning
Ces règles n'ont pas toujours été utilisées par le passé. Elles sont souhaitées pour le futur.
:::
Syntaxe:
```
/{_locale}/bundle/entity/{id}/action
/{_locale}/bundle/entity/sub-entity/{id}/action
```
Les éléments suivants devraient se trouver dans la liste:
1. la locale;
2. un identifiant du bundle
3. l'entité auquel il se rapporte
4. les éventuelles sous-entités auxquelles l'url se rapport
5. l'action
Ces éléments peuvent être entrecoupés de l'identifiant d'une entité. Dans ce cas, cet identifiant se place juste après l'entité auquel il se rapporte.
Exemple:
```
# liste des échanges pour une personne
/fr/activity/person/25/activity/list
# nouvelle activité
/fr/activity/activity/new?person_id=25
```
#### Pour les API
:::info
Les routes générées automatiquement sont préfixées par chill_api
:::
Syntaxe:
```
/api/1.0/bundle/entity/{id}/action
/api/1.0/bundle/entity/sub-entity/{id}/action
```
Les éléments suivants devraient se trouver dans la liste:
1. la string `/api/` et puis la version (1.0)
2. un identifiant du bundle
3. l'entité auquel il se rapporte
4. les éventuelles sous-entités auxquelles l'url se rapport
5. l'action
Ces éléments peuvent être entrecoupés de l'identifiant d'une entité. Dans ce cas, cet identifiant se place juste après l'entité auquel il se rapporte.
## Règles UI chill
### Titre des pages
#### Chaque page contient un titre
Chaque page contient un titre dans la balise head. Ce titre est normalement identique à celui de l'entête de la page.
Astuce: il est possible d'utiliser la fonction `block` de twig pour cela:
```htmlmixed=
{% block title "Titre de la page" %}
{% block content %}
<h1>
{{ block('title')}}
</h1>
{% endblock %}
```
### Utilisation des `entity_render`
#### En twig
Les templates twig doivent toujours utiliser la fonction chill_entity_render_box pour effectuer le rendu des éléments suivants:
* User
* Person
* SocialIssue
* SocialAction
* Address
* ThirdParty
* ...
Exemple:
```
address|chill_entity_render_box
```
Justification:
* des éléments sont parfois personnalisés par installation (par exemple, le nom de chaque utilisateur sera suivi par le nom du service)
* pour rationaliser et rendre semblable les affichages
* pour simplifier le code twig
A prevoir:
* toujours trois positions:
* inline
* block
* item (dans un tableau, une ligne)
> block et item sont en fait la même option passée au render_box: render: bloc. Il y a aussi raw pour le inline, et label pour une titraille configurable avec des options.
> quand on passe loption render: bloc, on peut placer le render_box dans une boucle for plus large qui fonctionne avec la classe flex-table ou la classe flex-bloc, ce qui donnera un affichage en rangée (table) ou en blocs. [name=Mathieu]
#### En vue
Il existe systématiquement une "box" équivalente en vue.
#### Lien vers des sections
A chaque fois qu'on indique le nom d'une personne, un parcours, un ménage, il y a toujours:
* un lien pour accéder à son dossier (pour autant que l'utilisateur ait les droits d'accès);
* à moins qu'il ne soit indiqué dans une phrase, l'icône de son dossier avant ou après (donc un bonhomme pour la personne, une maison pour le ménage, un fa-random pour les parcours);
Ces éléments sont toujours proposé par des `render_box` par défaut. Des options permettent de les désactiver dans des cas particuliers
> à discuter, quelques réflexion:
> quelle est la logique qui domine pour les boutons ? on a symbolisé les 4 actions du crud par des couleurs: bleu(show) orange(edit) vert(create) et rouge(delete).
> Est-ce que c'est ça qui prime, et comment ça s'articule avec la logique des pictos ?
> Par exemple, il pourrait être logique d'utiliser l'oeil bleu pour voir l'objet, qu'il s'agisse d'une personne ou d'un parcours, ce serait plutôt le contexte, et l'infobulle (title) qui préciserait le contexte.
> Je pense que les pictos de boutons doivent faire référence à l'action, mais pas à l'objet. Autrement dit je n'utiliserais jamais l'icone du ménage ou du parcours dans les boutons.
> Pour représenter les ménages et les parcours, je pense qu'il faudrait trouver autre chose que forkawesome. Si c'est des pictos, trouver un motif différents et de tailles différente. Réfléchir à un couplage picto-couleur-forme différent, qui exprime le contexte et qui se distingue bien des boutons.
> Idem pour les badges, il faut une palette de badge qui couvre tous les besoins: socialIssue, socialActions, socialReason, members, etc. [name=Mathieu]
### Formulaires
#### Vocabulaire:
Utiliser toujours:
* `Créer` dans un `bt bt-create` pour les **liens** vers le formulairep pour créer une entité (pour parvenir au formulaire);
* `Enregistrer` dans un `bt bt-save` pour les boutons "Enregistrer" (dans un formulaire édition **ou** création);
* `Enregistrer et nouveau`
* `Enregistrer et voir`
* `Modifier` dans un `bt bt-edit` pour les **liens** vers le formulaire d'édition
* `Dupliquer` (préciser là où on peut le voir)
* `Annuler` pour quitter une page d'édition avec un lien vers la liste, ou le `returnPath`
#### Retour après un enregistrement
Après avoir cliqué sur "Créer" ou "Sauver", la page devrait revenir:
* vers le returnPath, s'il existe;
* sinon, vers la page "vue".
### Bandeaux contenant les boutons d'actions
Les boutons sont toujours dans un bandeau "sticky-form" dans le bas du formulaire ou de la page de liste.
Si pertinent:
* Le bandeau contient un bouton "Annuler" qui retourne à la page précédente. Il est obligatoire pour les formulaires, optionnel pour les listes ou les pages "résumés"
* Ce bouton "annuler" est toujours à gauche
```
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ chill_entity_return_path('route_name' { 'route': 'option' } )}}">{{ return_path_label }}</a>
</li>
<li>
<!-- action 1 -->
</li>
</ul>
```
### Messages flash
#### A la création d'une entité
A chaque fois qu'un élément est créé par un formulaire, un message flash doit apparaitre. Il indique:
> "L'élément a été créé"
Le nom de l'élément peut être remplacé par quelque chose de plus pertinent:
> * L'activité a été créée
> * Le rendez-vous a été créé
> * ...
#### A l'enregistrement d'une entité
A chaque fois qu'un élément est enregistré, un message flash doit apparaitre:
> * Les données ont été modifiées
>
#### Erreur sur un formulaire (erreur de validation)
En tête d'un formulaire, un message flash doit indiquer que des validations n'ont pas réussi:
> Ce formulaire contient des erreurs
Les erreurs doivent apparaitre attachée au champ qui les concerne. Toutefois, il est acceptable d'afficher les erreurs à la racine du formulaire s'il était complexe, techniquement, d'attacher les erreurs.
### Liens de retour
A chaque fois qu'un lien est indiqué, vérifier si on ne doit pas utiliser la fonction `chill_return_path`, `chill_forward_return_path` ou `chill_return_path_or`.
* depuis la page liste, vers l'ouverture d'un élément, ou le bouton création => utiliser `chill_path_add_return_path`
* dans ces pages d'éditions,
* utiliser `chill_return_path_or` dans le bouton "Cancel";
* pour les boutons "enregistrer et voir" et "Enregistrer et fermer" => ?

View File

@@ -54,6 +54,9 @@
"doctrine/doctrine-fixtures-bundle": "^3.3",
"fakerphp/faker": "^1.13",
"nelmio/alice": "^3.8",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"phpunit/phpunit": "^7.0",
"symfony/debug-bundle": "^5.1",
"symfony/dotenv": "^5.1",
@@ -88,7 +91,8 @@
},
"autoload-dev": {
"psr-4": {
"App\\": "tests/app/src/"
"App\\": "tests/app/src/",
"Chill\\DocGeneratorBundle\\Tests\\": "src/Bundle/ChillDocGeneratorBundle/tests"
}
},
"minimum-stability": "dev",

View File

@@ -23,15 +23,196 @@ Every time an entity is created, viewed or updated, the software check if the us
The user must be granted access to the action on this particular entity, with this scope and center.
TL;DR
=====
Resolve scope and center
------------------------
In a service, resolve the center and scope of an entity
.. code-block:: php
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher;
use Chill\MainBundle\Security\Resolver\ScopeResolverDispatcher;
class MyService {
private ScopeResolverDispatcher $scopeResolverDispatcher;
private CenterResolverDispatcher $centerResolverDispatcher;
public function myFunction($entity) {
/** @var null|Center[]|Center $center */
$center = $this->centerResolverDispatcher->resolveCenter($entity);
// $center may be null, an array of center, or an instance of Center
if ($this->scopeResolverDispatcher->isConcerned($entity) {
/** @var null|Scope[]|Scope */
$scope = $this-scopeResolverDispatcher->resolveScope($entity);
// $scope may be null, an array of Scope, or an instance of Scope
}
}
}
In twig template, resolve the center:
.. code-block:: twig
{# resolve a center #}
{% if person|chill_resolve_center is not null%}
{% if person|chill_resolve_center is iterable %}
{% set centers = person|chill_resolve_center %}
{% else %}
{% set centers = [ person|chill_resolve_center ] %}
{% endif %}
<span class="open_sansbold">
{{ 'Center'|trans|upper}} :
</span>
{% for c in centers %}
{{ c.name|upper }}
{% if not loop.last %}, {% endif %}
{% endfor %}
{%- endif -%}
In twig template, resolve the scope:
.. code-block:: twig
{% if entity|chill_is_scope_concerned %}
{% if entity|chill_resolve_scope is iterable %}
{% set scopes = entity|chill_resolve_scope %}
{% else %}
{% set scopes = [ entity|chill_resolve_scope ] %}
{% endif %}
<span>Scopes&nbsp;:</span>
{% for s in scopes %}
{{ c.name|localize_translatable_string }}
{% if not loop.last %}, {% endif %}
{% endfor %}
{%- endif -%}
Build a ``Voter``
-----------------
.. code-block:: php
<?php
namespace Chill\DocStoreBundle\Security\Authorization;
use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
use Chill\MainBundle\Security\Authorization\VoterHelperFactoryInterface;
use Chill\MainBundle\Security\Authorization\VoterHelperInterface;
use Chill\MainBundle\Security\ProvideRoleHierarchyInterface;
use Chill\DocStoreBundle\Entity\PersonDocument;
use Chill\PersonBundle\Entity\Person;
use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\Security\Core\Security;
class PersonDocumentVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
{
// roles should be stored into constants:
const CREATE = 'CHILL_PERSON_DOCUMENT_CREATE';
const SEE = 'CHILL_PERSON_DOCUMENT_SEE';
const SEE_DETAILS = 'CHILL_PERSON_DOCUMENT_SEE_DETAILS';
const UPDATE = 'CHILL_PERSON_DOCUMENT_UPDATE';
const DELETE = 'CHILL_PERSON_DOCUMENT_DELETE';
protected Security $security;
protected VoterHelperInterface $voterHelper;
public function __construct(
Security $security,
VoterHelperFactoryInterface $voterHelperFactory
) {
$this->security = $security;
// we build here a voter helper. This will ease the operations below.
// when the authorization model is changed, it will be easy to make a different implementation
// of the helper, instead of writing all Voters
$this->voterHelper = $voterHelperFactory
// create a builder with some context
->generate(self::class)
// add the support of given roles for given class:
->addCheckFor(Person::class, [self::SEE, self::CREATE])
->addCheckFor(PersonDocument::class, $this->getRoles())
->build();
}
protected function supports($attribute, $subject)
{
return $this->voterHelper->supports($attribute, $subject);
}
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
{
// basic check
if (!$token->getUser() instanceof User) {
return false;
}
// we first check the acl for associated elements.
// here, we must be able to see the person associated to the document:
if ($subject instanceof PersonDocument
&& !$this->security->isGranted(PersonVoter::SEE, $subject->getPerson())) {
// not possible to see the associated person ? Then, not possible to see the document!
return false;
}
// the voter helper will implements the logic:
return $this->voterHelper->voteOnAttribute($attribute, $subject, $token);
}
// all the method below are used to register roles into the admin part
public function getRoles()
{
return [
self::CREATE,
self::SEE,
self::SEE_DETAILS,
self::UPDATE,
self::DELETE
];
}
public function getRolesWithoutScope()
{
return array();
}
public function getRolesWithHierarchy()
{
return ['PersonDocument' => $this->getRoles() ];
}
}
From an user point of view
--------------------------
==========================
The software is design to allow fine tuned access rights for complicated installation and team structure. The administrators may also decide that every user has the right to see all resources, where team have a more simple structure.
Here is an overview of the model.
Chill can be multi-center
^^^^^^^^^^^^^^^^^^^^^^^^^
-------------------------
Chill is designed to be installed once for social center who work with multiple teams separated, or for social services's federation who would like to share the same installation of the software for all their members.
@@ -42,7 +223,7 @@ Otherwise, it is not required to create multiple center: Chill can also work for
Obviously, users working in the different centers are not allowed to see the entities (_persons_, _reports_, _activities_) of other centers. But users may be attached to multiple centers: consequently they will be able to see the entities of the multiple centers they are attached to.
Inside center, scope divide team
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--------------------------------
Users are attached to one or more center and, inside to those center, there may exists differents scopes. The aim of those _scopes_ is to divide the whole team of social worker amongst different departement, for instance: the social team, the psychologist team, the nurse team, the administrative team, ... Each team is granted of different rights amongst scope. For instance, the social team may not see the _activities_ of the psychologist team. The administrative team may see the date & time's activities, but is not allowed to see the detail of those entities (the personal notes, ...).
@@ -52,8 +233,38 @@ As entities have only one scopes, if some entities must be shared across two dif
Example: if some activities must be seen and updated between nurses and psychologists, the administrator will create a scope "nurse and psy" and add the ability for both team "nurse" and "psychologist" to "create", "see", and "update" the activities belonging to scope "nurse and psy".
Where does the ``scope`` and ``center`` comes from ?
====================================================
Most often, scope and center comes from user's input:
* when person is created, Chill asks the associated center to the user. Then, every entity associated to the user (Activity, ...) is associated to this center;
* when an entity is created, Chill asks the associated scope.
The UI check the model before adding those input into form. If the user hae access to only one center or scope, this scope or center is filled automatically, and the UI does not ask the user. Most of the times, the user does not see "Pick a scope" and "Pick a center" inputs.
Scope and Center are associated to entities through ``ManyToOne`` properties, which are then mapped to ``FOREIGN KEY`` in tables, ...
But sometimes, this implementation does not fits the needs:
* persons are associated to center *geographically*: the address of each person contains lat/lon coordinates, and the center is resolved from this coordinated;
* some would like to associated persons to multiple center, or one center;
* entities are associated to scope through the job reached by "creator" (an user);
* some would like not to use scope at all;
*
For this reasons, associated center and scopes must be resolved programmatically. The default implementation rely on the model association, as described above. But it becomes possible to change the behaviour on different implementations.
Is my entity "concerned" by scopes ?
------------------------------------
Some entities are concerned by scope, some not.
This is also programmatically resolved.
The concepts translated into code
-----------------------------------
===================================
.. figure:: /_static/access_control_model.png
@@ -81,7 +292,7 @@ At each step of his lifetime (creation, view of the entity and eventually of his
All those action are executed through symfony voters and helpers.
How to check authorization ?
----------------------------
============================
Just use the symfony way-of-doing, but do not forget to associate the entity you want to check access. For instance, in controller :
@@ -100,34 +311,23 @@ Just use the symfony way-of-doing, but do not forget to associate the entity you
And in template :
.. code-block:: html+jinja
.. code-block:: twig
{{ if is_granted('CHILL_ENTITY_SEE', entity) %}print something{% endif %}
Retrieving reachable scopes and centers
----------------------------------------
Retrieving reachable scopes and centers for a user
--------------------------------------------------
The class :class:`Chill\\MainBundle\\Security\\Authorization\\AuthorizationHelper` helps you to get centers and scope reachable by a user.
The class :class:`Chill\\MainBundle\\Security\\Authorization\\AuthorizationHelperInterface` helps you to get centers and scope reachable by a user.
Those methods are intentionnaly build to give information about user rights:
- getReachableCenters: to get reachable centers for a user
- getReachableScopes : to get reachable scopes for a user
.. note::
The service is reachable through the Depedency injection with the key `chill.main.security.authorization.helper`. Example :
.. code-block:: php
$helper = $container->get('chill.main.security.authorization.helper');
.. todo::
Waiting for a link between our api and this doc, we invite you to read the method signatures `here <https://github.com/Chill-project/Main/blob/add_acl/Security/Authorization/AuthorizationHelper.php>`_
Adding your own roles
=====================
---------------------
Extending Chill will requires you to define your own roles and rules for your entities. You will have to define your own voter to do so.
@@ -152,7 +352,7 @@ To create your own roles, you should:
Declare your role
------------------
^^^^^^^^^^^^^^^^^^
To declare new role, implement the class :class:`Chill\\MainBundle\\Security\\ProvideRoleInterface`.
@@ -212,69 +412,8 @@ Example of an implementation of :class:`Chill\\MainBundle\\Security\\ProvideRole
}
Implement your voter
--------------------
Inside this class, you might use the :class:`Chill\\MainBundle\\Security\\Authorization\\AuthorizationHelper` to check permission (do not re-invent the wheel). This is a real-world example:
.. code-block:: php
namespace Chill\ReportBundle\Security\Authorization;
use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
class ReportVoter extends AbstractChillVoter
{
const CREATE = 'CHILL_REPORT_CREATE';
const SEE = 'CHILL_REPORT_SEE';
const UPDATE = 'CHILL_REPORT_UPDATE';
/**
*
* @var AuthorizationHelper
*/
protected $helper;
public function __construct(AuthorizationHelper $helper)
{
$this->helper = $helper;
}
protected function getSupportedAttributes()
{
return array(self::CREATE, self::SEE, self::UPDATE);
}
protected function getSupportedClasses()
{
return array('Chill\ReportBundle\Entity\Report');
}
protected function isGranted($attribute, $report, $user = null)
{
if (! $user instanceof \Chill\MainBundle\Entity\User){
return false;
}
return $this->helper->userHasAccess($user, $report, $attribute);
}
}
Then, you will have to declare the service and tag it as a voter :
.. code-block:: yaml
services:
chill.report.security.authorization.report_voter:
class: Chill\ReportBundle\Security\Authorization\ReportVoter
arguments:
- "@chill.main.security.authorization.helper"
tags:
- { name: security.voter }
Adding role hierarchy
---------------------
^^^^^^^^^^^^^^^^^^^^^
You should prepend Symfony's security component directly from your code.
@@ -312,3 +451,484 @@ You should prepend Symfony's security component directly from your code.
}
Implement your voter
^^^^^^^^^^^^^^^^^^^^
Most of the time, Voter will check that:
1. The given role is reachable (= ``$attribute``)
2. for the given center,
3. and, if any, for the given role
4. if the entity is associated to another entity, this entity should be, at least, viewable by the user.
Thats what we call the "autorization logic". But this logic may be replace by a new one, and developers should take care of it.
Then voter implementation should take care of:
* check the access to associated entities. For instance, if an ``Activity`` is associated to a ``Person``, the voter should first check that the user can show the associated ``Person``;
* as far as possible, delegates the check for associated center, scopes, and check for authorization using the authorization logic. VoterHelper will ease the most common operation of this logic.
This is an example of implementation:
.. code-block:: php
<?php
namespace Chill\DocStoreBundle\Security\Authorization;
use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
use Chill\MainBundle\Security\Authorization\VoterHelperFactoryInterface;
use Chill\MainBundle\Security\Authorization\VoterHelperInterface;
use Chill\DocStoreBundle\Entity\PersonDocument;
use Chill\PersonBundle\Entity\Person;
use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Security;
class PersonDocumentVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
{
protected Security $security;
protected VoterHelperInterface $voterHelper;
public function __construct(
Security $security,
VoterHelperFactoryInterface $voterHelperFactory
) {
$this->security = $security;
// we build here a voter helper. This will ease the operations below.
// when the authorization model is changed, it will be easy to make a different implementation
// of the helper, instead of writing all Voters
$this->voterHelper = $voterHelperFactory
// create a builder with some context
->generate(self::class)
// add the support of given roles for given class:
->addCheckFor(Person::class, [self::SEE, self::CREATE])
->addCheckFor(PersonDocument::class, $this->getRoles())
->build();
}
protected function supports($attribute, $subject)
{
return $this->voterHelper->supports($attribute, $subject);
}
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
{
// basic check
if (!$token->getUser() instanceof User) {
return false;
}
// we first check the acl for associated elements.
// here, we must be able to see the person associated to the document:
if ($subject instanceof PersonDocument
&& !$this->security->isGranted(PersonVoter::SEE, $subject->getPerson())) {
// not possible to see the associated person ? Then, not possible to see the document!
return false;
}
// the voter helper will implements the logic of checking:
// 1. that the center is reachable
// 2. for this given entity
// 3. for this given scope
// 4. and for the given role
return $this->voterHelper->voteOnAttribute($attribute, $subject, $token);
}
public function getRoles()
{
// ...
}
public function getRolesWithoutScope()
{
// ...
}
public function getRolesWithHierarchy()
{
// ...
}
}
Then, you will have to declare the service and tag it as a voter :
.. code-block:: yaml
services:
chill.report.security.authorization.report_voter:
class: Chill\ReportBundle\Security\Authorization\ReportVoter
arguments:
- "@chill.main.security.authorization.helper"
tags:
- { name: security.voter }
How to resolve scope and center programmatically ?
==================================================
In a service, resolve the center and scope of an entity
.. code-block:: php
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher;
use Chill\MainBundle\Security\Resolver\ScopeResolverDispatcher;
class MyService {
private ScopeResolverDispatcher $scopeResolverDispatcher;
private CenterResolverDispatcher $centerResolverDispatcher;
public function myFunction($entity) {
/** @var null|Center[]|Center $center */
$center = $this->centerResolverDispatcher->resolveCenter($entity);
// $center may be null, an array of center, or an instance of Center
if ($this->scopeResolverDispatcher->isConcerned($entity) {
/** @var null|Scope[]|Scope */
$scope = $this-scopeResolverDispatcher->resolveScope($entity);
// $scope may be null, an array of Scope, or an instance of Scope
}
}
}
In twig template, resolve the center:
.. code-block:: twig
{# resolve a center #}
{% if person|chill_resolve_center is not null%}
{% if person|chill_resolve_center is iterable %}
{% set centers = person|chill_resolve_center %}
{% else %}
{% set centers = [ person|chill_resolve_center ] %}
{% endif %}
<span class="open_sansbold">
{{ 'Center'|trans|upper}} :
</span>
{% for c in centers %}
{{ c.name|upper }}
{% if not loop.last %}, {% endif %}
{% endfor %}
{%- endif -%}
In twig template, resolve the scope:
.. code-block:: twig
{% if entity|chill_is_scope_concerned %}
{% if entity|chill_resolve_scope is iterable %}
{% set scopes = entity|chill_resolve_scope %}
{% else %}
{% set scopes = [ entity|chill_resolve_scope ] %}
{% endif %}
<span>Scopes&nbsp;:</span>
{% for s in scopes %}
{{ c.name|localize_translatable_string }}
{% if not loop.last %}, {% endif %}
{% endfor %}
{%- endif -%}
What is the default implementation of Scope and Center resolver ?
-----------------------------------------------------------------
By default, the implementation rely on association into entities.
* implements ``Chill\MainBundle\Entity\HasCenterInterface`` on entities which have one or any center;
* implements ``Chill\MainBundle\Entity\HasCentersInterface`` on entities which have one, multiple or any centers;
* implements ``Chill\MainBundle\Entity\HasScopeInterface`` on entities which have one or any scope;
* implements ``Chill\MainBundle\Entity\HasScopesInterface`` on entities which have one or any scopes;
Then, the default implementation will resolve the center and scope based on the implementation in your model.
How to change the default behaviour ?
-------------------------------------
Implements those interface into services:
* ``Chill\MainBundle\Security\Resolver\CenterResolverInterface``;
* ``Chill\MainBundle\Security\Resolver\ScopeResolverInterface``;
Authorization into lists and index pages
========================================
Due to the fact that authorization model may be overriden, "list" and "index" pages should not rely on center and scope from controller. This must be delegated to dedicated service, which will be aware of the authorization model. We call them ``ACLAwareRepository``. This service must implements an interface, in order to allow to change the implementation.
The controller **must not** performs any DQL or SQL query.
Example in a controller:
.. code-block:: php
namespace Chill\TaskBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Chill\TaskBundle\Repository\SingleTaskAclAwareRepositoryInterface;
final class SingleTaskController extends AbstractController
{
private SingleTaskAclAwareRepositoryInterface $singleTaskAclAwareRepository;
/**
*
* @Route(
* "/{_locale}/task/single-task/list",
* name="chill_task_singletask_list"
* )
*/
public function listAction(
Request $request
) {
$this->denyAccessUnlessGranted(TaskVoter::SHOW, null);
$nb = $this->singleTaskAclAwareRepository->countByAllViewable(
'', // search pattern
[] // search flags
);
$paginator = $this->paginatorFactory->create($nb);
if (0 < $nb) {
$tasks = $this->singleTaskAclAwareRepository->findByAllViewable(
'', // search pattern
[] // search flags
$paginator->getCurrentPageFirstItemNumber(),
$paginator->getItemsPerPage(),
// ordering:
[
'startDate' => 'DESC',
'endDate' => 'DESC',
]
);
} else {
$tasks = [];
}
return $this->render('@ChillTask/SingleTask/List/index.html.twig', [
'tasks' => $tasks,
'paginator' => $paginator,
'filter_order' => $filterOrder
]);
}
}
Writing ``ACLAwareRepository``
------------------------------
The ACLAwareRepository should rely on interfaces
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
As described above, the ACLAwareRepository will perform the query for listing entities, and take care of authorization.
Those "ACLAwareRepositories" must be described into ``interfaces``.
The service must rely on this interface, and not on the default implementation.
Example: at first, we design an interface for listing ``SingleTask`` entities:
.. code-block:: php
<?php
namespace Chill\TaskBundle\Repository;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
interface SingleTaskAclAwareRepositoryInterface
{
/**
* @return SingleTask[]|array
*/
public function findByCurrentUsersTasks(?string $pattern = null, ?array $flags = [], ?int $start = 0, ?int $limit = 50, ?array $orderBy = []): array;
public function countByCurrentUsersTasks(?string $pattern = null, ?array $flags = []): int;
public function countByAllViewable(
?string $pattern = null,
?array $flags = []
): int;
/**
* @return SingleTask[]|array
*/
public function findByAllViewable(
?string $pattern = null,
?array $flags = [],
?int $start = 0,
?int $limit = 50,
?array $orderBy = []
): array;
}
Implements this interface and register the interface as an alias for the implementation.
.. code-block:: yaml
services:
Chill\TaskBundle\Repository\SingleTaskAclAwareRepository:
autowire: true
autoconfigure: true
Chill\TaskBundle\Repository\SingleTaskAclAwareRepositoryInterface: '@Chill\TaskBundle\Repository\SingleTaskAclAwareRepository'
Write the basic implementation for re-use: separate authorization logic and search logic
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The logic of such repository may be separated into two logic:
* the authorization logic (show only entities that the user is allowed to see);
* the search logic (filter entities on some criterias).
This logic should be separated into your implementation.
Considering this simple interface:
.. code-block:: php
interface MyEntityACLAwareRepositoryInterface {
public function countByAuthorized(array $criterias): int;
public function findByAuthorized(array $criteria, int $start, int $limit, array $orderBy): array;
}
The base implementation should separate the logic to allow an easy reuse. Here, the method ``buildQuery`` build a basic query without authorization logic, which can be re-used. The authorization logic is dedicated to a private method. For ease of user, the logic of adding ordering criterias and pagination parameters (``$start`` and ``$limit``) are also delegated to a public method.
.. code-block:: php
namespace Chill\MyBundle\Repository;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\QueryBuilder;
final class MyEntityACLAwareRepository implements MyEntityACLAwareRepositoryInterface {
private EntityManagerInterface $em;
// constructor omitted
public function countByAuthorized(array $criterias): int
{
$qb = $this->buildQuery($criterias);
return $this->addAuthorizations($qb)->select("COUNT(e)")->getQuery()->getResult()->getSingleScalarResult();
}
public function findByAuthorized(array $criteria, int $start, int $limit, array $orderBy): array
{
$qb = $this->buildQuery($criterias);
return $this->getResult($this->addAuthorizations($qb), $start, $limit, $orderBy);
}
public function getResult(QueryBuilder $qb, int $start, int $limit, array $orderBy): array
{
$qb
->setFirstResult($start)
->setMaxResults($limit)
;
// add order by logic
return $qb->getQuery()->getResult();
}
public function buildQuery(array $criterias): QueryBuilder
{
$qb = $this->em->createQueryBuilder();
// implement you logic with search criteria here
return $qb;
}
private function addAuthorizations(QueryBuilder $qb): QueryBuilder
{
// add authorization logic here
return $qb;
}
}
Once this logic is executed, it becomes easy to make a new implementation of the repository:
.. code-block:: php
namespace Chill\MyOtherBundle\Repository;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\QueryBuilder;
use Chill\MyBundle\Repository\MyEntityACLAwareRepository
final class AnotherEntityACLAwareRepository implements MyEntityACLAwareRepositoryInterface {
private EntityManagerInterface $em;
private \Chill\MyBundle\Repository\MyEntityACLAwareRepository $initial;
public function __construct(
EntityManagerInterface $em,
\Chill\MyBundle\Repository\MyEntityACLAwareRepository $initial
) {
$this->em = $em;
$this->initial = $initial;
}
public function countByAuthorized(array $criterias): int
{
$qb = $this->initial->buildQuery($criterias);
return $this->addAuthorizations($qb)->select("COUNT(e)")->getQuery()->getResult()->getSingleScalarResult();
}
public function findByAuthorized(array $criteria, int $start, int $limit, array $orderBy): array
{
$qb = $this->initial->buildQuery($criterias);
return $this->initial->getResult($this->addAuthorizations($qb), $start, $limit, $orderBy);
}
private function addAuthorizations(QueryBuilder $qb): QueryBuilder
{
// add a different authorization logic here
return $qb;
}
}
Then, register this service and decorates the old one:
.. code-block:: yaml
services:
Chill\MyOtherBundle\Repository\AnotherEntityACLAwareRepository:
autowire: true
autoconfigure: true
decorates: Chill\MyBundle\Repository\MyEntityACLAwareRepositoryInterface:

111
phpstan-baseline.neon Normal file
View File

@@ -0,0 +1,111 @@
parameters:
ignoreErrors:
-
message: "#^Variable property access on \\$this\\(Chill\\\\ActivityBundle\\\\Entity\\\\ActivityType\\)\\.$#"
count: 3
path: src/Bundle/ChillActivityBundle/Entity/ActivityType.php
-
message: "#^Foreach overwrites \\$key with its key variable\\.$#"
count: 1
path: src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php
-
message: "#^Instantiated class PhpOffice\\\\PhpWord\\\\TemplateProcessor not found\\.$#"
count: 1
path: src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorController.php
-
message: "#^Instantiated class PhpOffice\\\\PhpWord\\\\TemplateProcessor not found\\.$#"
count: 1
path: src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php
-
message: "#^Variable \\$participation might not be defined\\.$#"
count: 3
path: src/Bundle/ChillEventBundle/Controller/ParticipationController.php
-
message: "#^Foreach overwrites \\$value with its value variable\\.$#"
count: 1
path: src/Bundle/ChillEventBundle/Form/ChoiceLoader/EventChoiceLoader.php
-
message: "#^Variable method call on object\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php
-
message: "#^Cannot unset offset '_token' on array\\{formatter\\: mixed, export\\: mixed, centers\\: mixed, alias\\: string\\}\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Controller/ExportController.php
-
message: "#^Foreach overwrites \\$line with its value variable\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php
-
message: "#^Foreach overwrites \\$key with its key variable\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php
-
message: "#^Foreach overwrites \\$key with its value variable\\.$#"
count: 3
path: src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php
-
message: "#^Foreach overwrites \\$value with its value variable\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Form/ChoiceLoader/PostalCodeChoiceLoader.php
-
message: "#^Variable \\$message on left side of \\?\\? always exists and is not nullable\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Templating/ChillTwigHelper.php
-
message: "#^Variable \\$sqls on left side of \\?\\? always exists and is not nullable\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php
-
message: "#^Class Chill\\\\PersonBundle\\\\Entity\\\\Person constructor invoked with 1 parameter, 0 required\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
-
message: "#^Variable \\$street1Value might not be defined\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
-
message: "#^Variable method call on mixed\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php
-
message: "#^Foreach overwrites \\$value with its value variable\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php
-
message: "#^Foreach overwrites \\$action with its value variable\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Foreach overwrites \\$action with its value variable\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php
-
message: "#^Foreach overwrites \\$action with its value variable\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/SocialWork/ResultRepository.php
-
message: "#^Foreach overwrites \\$value with its value variable\\.$#"
count: 1
path: src/Bundle/ChillThirdPartyBundle/Form/ChoiceLoader/ThirdPartyChoiceLoader.php

131
phpstan-critical.neon Normal file
View File

@@ -0,0 +1,131 @@
parameters:
ignoreErrors:
-
message: "#^Implicit array creation is not allowed \\- variable \\$centers might not exist\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Entity\\\\Person\\:\\:\\$currentHouseholdParticipationAt\\.$#"
count: 3
path: src/Bundle/ChillPersonBundle/Entity/Person.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Entity\\\\Household\\\\PersonHouseholdAddress\\:\\:\\$relation\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Entity/Household/PersonHouseholdAddress.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Entity\\\\AccompanyingPeriod\\:\\:\\$work\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
-
message: "#^Undefined variable\\: \\$person$#"
count: 1
path: src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Household\\\\MembersEditorFactory\\:\\:\\$validator\\.$#"
count: 2
path: src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php
-
message: "#^Parameter \\$action of method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\AccompanyingPeriodWorkRepository\\:\\:buildQueryBySocialActionWithDescendants\\(\\) has invalid type Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\SocialAction\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Parameter \\$action of method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\AccompanyingPeriodWorkRepository\\:\\:countBySocialActionWithDescendants\\(\\) has invalid type Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\SocialAction\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Undefined variable\\: \\$action$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Undefined variable\\: \\$limit$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Undefined variable\\: \\$offset$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Undefined variable\\: \\$orderBy$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Variable variables are not allowed\\.$#"
count: 4
path: src/Bundle/ChillPersonBundle/Search/PersonSearch.php
-
message: "#^Function Chill\\\\PersonBundle\\\\Serializer\\\\Normalizer\\\\·\\\\is_array not found\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php
-
message: "#^Undefined variable\\: \\$value$#"
count: 1
path: src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php
-
message: "#^Undefined variable\\: \\$choiceSlug$#"
count: 1
path: src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php
-
message: "#^Undefined variable\\: \\$choiceSlug$#"
count: 1
path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php
-
message: "#^Undefined variable\\: \\$type$#"
count: 1
path: src/Bundle/ChillTaskBundle/Controller/TaskController.php
-
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\AbstractCRUDController\\:\\:getRoleFor\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php
-
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Controller\\\\UserController\\:\\:createEditForm\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Controller/UserController.php
-
message: "#^Undefined variable\\: \\$current$#"
count: 1
path: src/Bundle/ChillMainBundle/Pagination/PageGenerator.php
-
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AbstractChillVoter\\:\\:getSupportedAttributes\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php
-
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AbstractChillVoter\\:\\:getSupportedClasses\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php
-
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AbstractChillVoter\\:\\:isGranted\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php
-
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Controller\\\\PersonController\\:\\:\\$security\\.$#"
count: 3
path: src/Bundle/ChillPersonBundle/Controller/PersonController.php
-
message: "#^Call to an undefined method Chill\\\\ThirdPartyBundle\\\\Form\\\\Type\\\\PickThirdPartyTypeCategoryType\\:\\:transform\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php

852
phpstan-types.neon Normal file
View File

@@ -0,0 +1,852 @@
parameters:
ignoreErrors:
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivitytACL.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillActivityBundle/Entity/Activity.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillActivityBundle/Entity/ActivityReason.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php
-
message: "#^Method Chill\\\\ActivityBundle\\\\Export\\\\Export\\\\StatActivityDuration\\:\\:getDescription\\(\\) should return string but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php
-
message: "#^Method Chill\\\\ActivityBundle\\\\Export\\\\Export\\\\StatActivityDuration\\:\\:getTitle\\(\\) should return string but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillActivityBundle/Form/ActivityType.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillActivityBundle/Form/ActivityType.php
-
message: "#^Only booleans are allowed in &&, mixed given on the right side\\.$#"
count: 3
path: src/Bundle/ChillActivityBundle/Form/ActivityType.php
-
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
count: 2
path: src/Bundle/ChillActivityBundle/Form/ActivityType.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillActivityBundle/Security/Authorization/ActivityStatsVoter.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
path: src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php
-
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
count: 3
path: src/Bundle/ChillBudgetBundle/Form/ChargeType.php
-
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
count: 2
path: src/Bundle/ChillBudgetBundle/Form/ResourceType.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
path: src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillCalendarBundle/Entity/Calendar.php
-
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
count: 1
path: src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/AbstractCustomField.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 3
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 4
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php
-
message: "#^Method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldChoice\\:\\:buildForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\FormTypeInterface but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php
-
message: "#^Method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldDate\\:\\:buildForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\FormTypeInterface but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php
-
message: "#^Method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldLongChoice\\:\\:buildForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\FormTypeInterface but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php
-
message: "#^Method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldNumber\\:\\:buildForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\FormTypeInterface but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php
-
message: "#^Method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldText\\:\\:buildForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\FormTypeInterface but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php
-
message: "#^Method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldTitle\\:\\:buildForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\FormTypeInterface but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php
-
message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#"
count: 1
path: src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillDocStoreBundle/Entity/DocumentCategory.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillEventBundle/Entity/Participation.php
-
message: "#^Method Chill\\\\EventBundle\\\\Entity\\\\Participation\\:\\:offsetGet\\(\\) should return mixed but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillEventBundle/Entity/Participation.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillEventBundle/Form/ChoiceLoader/EventChoiceLoader.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillEventBundle/Form/ChoiceLoader/EventChoiceLoader.php
-
message: "#^Parameter \\$resolver of method Chill\\\\EventBundle\\\\Form\\\\EventTypeType\\:\\:setDefaultOptions\\(\\) has invalid type Symfony\\\\Component\\\\OptionsResolver\\\\OptionsResolverInterface\\.$#"
count: 1
path: src/Bundle/ChillEventBundle/Form/EventTypeType.php
-
message: "#^Parameter \\$resolver of method Chill\\\\EventBundle\\\\Form\\\\RoleType\\:\\:setDefaultOptions\\(\\) has invalid type Symfony\\\\Component\\\\OptionsResolver\\\\OptionsResolverInterface\\.$#"
count: 1
path: src/Bundle/ChillEventBundle/Form/RoleType.php
-
message: "#^Parameter \\$resolver of method Chill\\\\EventBundle\\\\Form\\\\StatusType\\:\\:setDefaultOptions\\(\\) has invalid type Symfony\\\\Component\\\\OptionsResolver\\\\OptionsResolverInterface\\.$#"
count: 1
path: src/Bundle/ChillEventBundle/Form/StatusType.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillEventBundle/Form/Type/PickEventType.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 2
path: src/Bundle/ChillEventBundle/Search/EventSearch.php
-
message: "#^Method Chill\\\\EventBundle\\\\Search\\\\EventSearch\\:\\:renderResult\\(\\) should return string but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillEventBundle/Search/EventSearch.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
path: src/Bundle/ChillEventBundle/Security/Authorization/EventVoter.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
path: src/Bundle/ChillEventBundle/Security/Authorization/ParticipationVoter.php
-
message: "#^Casting to string something that's already string\\.$#"
count: 5
path: src/Bundle/ChillFamilyMembersBundle/Entity/AbstractFamilyMember.php
-
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
count: 2
path: src/Bundle/ChillFamilyMembersBundle/Form/FamilyMemberType.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
path: src/Bundle/ChillFamilyMembersBundle/Security/Voter/FamilyMemberVoter.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php
-
message: "#^Parameter \\$scope of method Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\CRUDController\\:\\:getReachableCenters\\(\\) has invalid type Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\Scope\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/CRUD/Resolver/Resolver.php
-
message: "#^Method Chill\\\\MainBundle\\\\CRUD\\\\Resolver\\\\Resolver\\:\\:getConfigValue\\(\\) should return string but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/CRUD/Resolver/Resolver.php
-
message: "#^Call to function array_search\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php
-
message: "#^Method Chill\\\\MainBundle\\\\Command\\\\ChillImportUsersCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php
-
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php
-
message: "#^Method Chill\\\\MainBundle\\\\Command\\\\ChillUserSendRenewPasswordCodeCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php
-
message: "#^Method Chill\\\\MainBundle\\\\Command\\\\LoadAndUpdateLanguagesCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php
-
message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php
-
message: "#^Method Chill\\\\MainBundle\\\\Command\\\\LoadCountriesCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php
-
message: "#^Method Chill\\\\MainBundle\\\\Command\\\\LoadPostalCodesCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php
-
message: "#^Method Chill\\\\MainBundle\\\\Command\\\\SetPasswordCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Controller/PasswordController.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Controller/PostalCodeController.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php
-
message: "#^Call to function array_search\\(\\) requires parameter \\#3 to be set\\.$#"
count: 5
path: src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/ExportsCompilerPass.php
-
message: "#^Call to function array_search\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/SearchableServicesCompilerPass.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php
-
message: "#^Call to function array_search\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Entity/Address.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Entity/User.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Entity/User.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 6
path: src/Bundle/ChillMainBundle/Export/ExportManager.php
-
message: "#^Only booleans are allowed in a ternary operator condition, mixed given\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Form/ChoiceLoader/PostalCodeChoiceLoader.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Form/DataMapper/AddressDataMapper.php
-
message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/Form/Type/AddressType.php
-
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/Form/Type/AddressType.php
-
message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Form/Type/ChillTextareaType.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 3
path: src/Bundle/ChillMainBundle/Form/Type/DataTransformer/DateIntervalTransformer.php
-
message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Form/Type/TranslatableStringFormType.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelper.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/Security/ParentRoleHelper.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverVoter.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Security/PasswordRecover/TokenManager.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 3
path: src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php
-
message: "#^Method Chill\\\\MainBundle\\\\Timeline\\\\TimelineBuilder\\:\\:getTemplateData\\(\\) should return array but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/CRUD/Controller/OneToOneEntityPersonCRUDController.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php
-
message: "#^Method Chill\\\\PersonBundle\\\\Command\\\\ChillPersonMoveCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php
-
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php
-
message: "#^Call to function array_search\\(\\) requires parameter \\#3 to be set\\.$#"
count: 3
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 3
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 6
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Controller/PersonController.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/DependencyInjection/CompilerPass/AccompanyingPeriodTimelineCompilerPass.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Entity/Person.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 2
path: src/Bundle/ChillPersonBundle/Entity/PersonPhone.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
path: src/Bundle/ChillPersonBundle/Export/AbstractAccompanyingPeriodExportElement.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Export/Aggregator/CountryOfBirthAggregator.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Export/Aggregator/NationalityAggregator.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 3
path: src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 2
path: src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Export/Filter/GenderFilter.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php
-
message: "#^Only booleans are allowed in a ternary operator condition, mixed given\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php
-
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Form/Type/PickPersonType.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Household/MembersEditor.php
-
message: "#^Method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\AccompanyingPeriodWorkRepository\\:\\:buildQueryBySocialActionWithDescendants\\(\\) has invalid return type Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\QueryBuilder\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
path: src/Bundle/ChillPersonBundle/Repository/PersonRepository.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 3
path: src/Bundle/ChillPersonBundle/Search/PersonSearch.php
-
message: "#^Method Chill\\\\PersonBundle\\\\Search\\\\PersonSearch\\:\\:renderResult\\(\\) should return string but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Search/PersonSearch.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Search/SearchPersonApiProvider.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 2
path: src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillPersonBundle/Timeline/AbstractTimelineAccompanyingPeriod.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReportACL.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php
-
message: "#^Method Chill\\\\ReportBundle\\\\DataFixtures\\\\ORM\\\\LoadReports\\:\\:getRandomChoice\\(\\) should return array\\<string\\>\\|string but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 4
path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 2
path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillReportBundle/Security/Authorization/ReportVoter.php
-
message: "#^Method Chill\\\\ReportBundle\\\\Security\\\\Authorization\\\\ReportVoter\\:\\:supports\\(\\) should return bool but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillReportBundle/Security/Authorization/ReportVoter.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 4
path: src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillTaskBundle/DataFixtures/ORM/LoadTaskACL.php
-
message: "#^Casting to string something that's already string\\.$#"
count: 3
path: src/Bundle/ChillTaskBundle/Entity/AbstractTask.php
-
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
count: 2
path: src/Bundle/ChillTaskBundle/Form/SingleTaskListType.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 5
path: src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php
-
message: "#^Method Chill\\\\TaskBundle\\\\Timeline\\\\SingleTaskTaskLifeCycleEventTimelineProvider\\:\\:getTransitionByName\\(\\) should return Symfony\\\\Component\\\\Workflow\\\\Transition but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillTaskBundle/Timeline/SingleTaskTaskLifeCycleEventTimelineProvider.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php
-
message: "#^Method Chill\\\\TaskBundle\\\\Timeline\\\\TaskLifeCycleEventTimelineProvider\\:\\:getTransitionByName\\(\\) should return Symfony\\\\Component\\\\Workflow\\\\Transition but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillThirdPartyBundle/DependencyInjection/CompilerPass/ThirdPartyTypeCompilerPass.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 4
path: src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillThirdPartyBundle/Form/ChoiceLoader/ThirdPartyChoiceLoader.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillThirdPartyBundle/Form/ChoiceLoader/ThirdPartyChoiceLoader.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php
-
message: "#^Method Chill\\\\ThirdPartyBundle\\\\Search\\\\ThirdPartySearch\\:\\:renderResult\\(\\) should return string but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: src/Bundle/ChillThirdPartyBundle/Security/Voter/ThirdPartyVoter.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php

24
phpstan.neon.dist Normal file
View File

@@ -0,0 +1,24 @@
parameters:
level: 1
paths:
- src/
excludePaths:
- src/Bundle/*/Tests/*
- src/Bundle/*/tests/*
- src/Bundle/*/Test/*
- src/Bundle/*/config/*
- src/Bundle/*/migrations/*
- src/Bundle/*/translations/*
- src/Bundle/*/Resources/*
- src/Bundle/*/src/Tests/*
- src/Bundle/*/src/Test/*
- src/Bundle/*/src/config/*
- src/Bundle/*/src/migrations/*
- src/Bundle/*/src/translations/*
- src/Bundle/*/src/Resources/*
includes:
- phpstan-types.neon
- phpstan-critical.neon
- phpstan-baseline.neon

View File

@@ -37,6 +37,9 @@
<testsuite name="CalendarBundle">
<directory suffix="Test.php">src/Bundle/ChillCalendarBundle/Tests/</directory>
</testsuite>
<testsuite name="DocGeneratorBundle">
<directory suffix="Test.php">src/Bundle/ChillDocGeneratorBundle/tests/</directory>
</testsuite>
</testsuites>
<listeners>

View File

@@ -27,3 +27,4 @@ Version 1.5.5
=============
- [activity] replace dropdown for selecting reasons and use chillEntity for reason rendering
- fix bug: error when trying to edit activity of which the type has been deactivated

View File

@@ -1,37 +1,26 @@
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Controller;
use Chill\ActivityBundle\Repository\ActivityACLAwareRepository;
use Chill\ActivityBundle\Entity\ActivityReason;
use Chill\ActivityBundle\Repository\ActivityACLAwareRepositoryInterface;
use Chill\ActivityBundle\Repository\ActivityRepository;
use Chill\ActivityBundle\Repository\ActivityTypeCategoryRepository;
use Chill\ActivityBundle\Repository\ActivityTypeRepository;
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\MainBundle\Repository\LocationRepository;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Privacy\PrivacyEvent;
use Chill\PersonBundle\Repository\AccompanyingPeriodRepository;
use Chill\PersonBundle\Repository\PersonRepository;
use Chill\ThirdPartyBundle\Repository\ThirdPartyRepository;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
@@ -42,33 +31,56 @@ use Chill\ActivityBundle\Form\ActivityType;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Symfony\Component\Serializer\SerializerInterface;
/**
* Class ActivityController
*
* @package Chill\ActivityBundle\Controller
*/
class ActivityController extends AbstractController
final class ActivityController extends AbstractController
{
protected EventDispatcherInterface $eventDispatcher;
private EventDispatcherInterface $eventDispatcher;
protected AuthorizationHelper $authorizationHelper;
private LoggerInterface $logger;
protected LoggerInterface $logger;
private SerializerInterface $serializer;
protected SerializerInterface $serializer;
private ActivityACLAwareRepositoryInterface $activityACLAwareRepository;
protected ActivityACLAwareRepositoryInterface $activityACLAwareRepository;
private ActivityTypeRepository $activityTypeRepository;
private ThirdPartyRepository $thirdPartyRepository;
private PersonRepository $personRepository;
private LocationRepository $locationRepository;
private EntityManagerInterface $entityManager;
private ActivityRepository $activityRepository;
private AccompanyingPeriodRepository $accompanyingPeriodRepository;
private ActivityTypeCategoryRepository $activityTypeCategoryRepository;
public function __construct(
ActivityACLAwareRepositoryInterface $activityACLAwareRepository,
ActivityTypeRepository $activityTypeRepository,
ActivityTypeCategoryRepository $activityTypeCategoryRepository,
PersonRepository $personRepository,
ThirdPartyRepository $thirdPartyRepository,
LocationRepository $locationRepository,
ActivityRepository $activityRepository,
AccompanyingPeriodRepository $accompanyingPeriodRepository,
EntityManagerInterface $entityManager,
EventDispatcherInterface $eventDispatcher,
AuthorizationHelper $authorizationHelper,
LoggerInterface $logger,
SerializerInterface $serializer
) {
$this->activityACLAwareRepository = $activityACLAwareRepository;
$this->activityTypeRepository = $activityTypeRepository;
$this->activityTypeCategoryRepository = $activityTypeCategoryRepository;
$this->personRepository = $personRepository;
$this->thirdPartyRepository = $thirdPartyRepository;
$this->locationRepository = $locationRepository;
$this->activityRepository = $activityRepository;
$this->accompanyingPeriodRepository = $accompanyingPeriodRepository;
$this->entityManager = $entityManager;
$this->eventDispatcher = $eventDispatcher;
$this->authorizationHelper = $authorizationHelper;
$this->logger = $logger;
$this->serializer = $serializer;
}
@@ -78,8 +90,8 @@ class ActivityController extends AbstractController
*/
public function listAction(Request $request): Response
{
$em = $this->getDoctrine()->getManager();
$view = null;
$activities = [];
// TODO: add pagination
[$person, $accompanyingPeriod] = $this->getEntity($request);
@@ -89,10 +101,10 @@ class ActivityController extends AbstractController
$activities = $this->activityACLAwareRepository
->findByPerson($person, ActivityVoter::SEE, 0, null);
$event = new PrivacyEvent($person, array(
$event = new PrivacyEvent($person, [
'element_class' => Activity::class,
'action' => 'list'
));
]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
$view = 'ChillActivityBundle:Activity:listPerson.html.twig';
@@ -105,16 +117,18 @@ class ActivityController extends AbstractController
$view = 'ChillActivityBundle:Activity:listAccompanyingCourse.html.twig';
}
return $this->render($view, array(
'activities' => $activities,
'person' => $person,
'accompanyingCourse' => $accompanyingPeriod,
));
return $this->render(
$view,
[
'activities' => $activities,
'person' => $person,
'accompanyingCourse' => $accompanyingPeriod,
]
);
}
public function selectTypeAction(Request $request): Response
{
$em = $this->getDoctrine()->getManager();
$view = null;
[$person, $accompanyingPeriod] = $this->getEntity($request);
@@ -127,12 +141,17 @@ class ActivityController extends AbstractController
$data = [];
$activityTypeCategories = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityTypeCategory::class)
$activityTypeCategories = $this
->activityTypeCategoryRepository
->findBy(['active' => true], ['ordering' => 'ASC']);
foreach ($activityTypeCategories as $activityTypeCategory) {
$activityTypes = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityType::class)
->findBy(['active' => true, 'category' => $activityTypeCategory], ['ordering' => 'ASC']);
$activityTypes = $this
->activityTypeRepository
->findBy(
['active' => true, 'category' => $activityTypeCategory],
['ordering' => 'ASC']
);
$data[] = [
'activityTypeCategory' => $activityTypeCategory,
@@ -140,12 +159,6 @@ class ActivityController extends AbstractController
];
}
if ($request->query->has('activityData')) {
$activityData = $request->query->get('activityData');
} else {
$activityData = [];
}
if ($view === null) {
throw $this->createNotFoundException('Template not found');
}
@@ -154,13 +167,13 @@ class ActivityController extends AbstractController
'person' => $person,
'accompanyingCourse' => $accompanyingPeriod,
'data' => $data,
'activityData' => $activityData
'activityData' => $request->query->get('activityData', []),
]);
}
public function newAction(Request $request): Response
{
$em = $this->getDoctrine()->getManager();
$view = null;
[$person, $accompanyingPeriod] = $this->getEntity($request);
@@ -171,8 +184,11 @@ class ActivityController extends AbstractController
}
$activityType_id = $request->get('activityType_id', 0);
$activityType = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityType::class)
->find($activityType_id);
$activityType = $this->activityTypeRepository->find($activityType_id);
if (isset($activityType) && !$activityType->isActive()) {
throw new \InvalidArgumentException('Activity type must be active');
}
$activityData = null;
if ($request->query->has('activityData')) {
@@ -226,18 +242,23 @@ class ActivityController extends AbstractController
if (array_key_exists('personsId', $activityData)) {
foreach($activityData['personsId'] as $personId){
$concernedPerson = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)->find($personId);
$concernedPerson = $this->personRepository->find($personId);
$entity->addPerson($concernedPerson);
}
}
if (array_key_exists('professionalsId', $activityData)) {
foreach($activityData['professionalsId'] as $professionalsId){
$professional = $em->getRepository(\Chill\ThirdPartyBundle\Entity\ThirdParty::class)->find($professionalsId);
$professional = $this->thirdPartyRepository->find($professionalsId);
$entity->addThirdParty($professional);
}
}
if (array_key_exists('location', $activityData)) {
$location = $this->locationRepository->find($activityData['location']);
$entity->setLocation($location);
}
if (array_key_exists('comment', $activityData)) {
$comment = new CommentEmbeddable();
$comment->setComment($activityData['comment']);
@@ -259,8 +280,8 @@ class ActivityController extends AbstractController
])->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em->persist($entity);
$em->flush();
$this->entityManager->persist($entity);
$this->entityManager->flush();
$this->addFlash('success', $this->get('translator')->trans('Success : activity created!'));
@@ -288,7 +309,7 @@ class ActivityController extends AbstractController
public function showAction(Request $request, $id): Response
{
$em = $this->getDoctrine()->getManager();
$view = null;
[$person, $accompanyingPeriod] = $this->getEntity($request);
@@ -298,13 +319,14 @@ class ActivityController extends AbstractController
$view = 'ChillActivityBundle:Activity:showPerson.html.twig';
}
$entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
$entity = $this->activityRepository->find($id);
if (!$entity) {
if (null === $entity) {
throw $this->createNotFoundException('Unable to find Activity entity.');
}
if (null !== $accompanyingPeriod) {
// @TODO: Properties created dynamically.
$entity->personsAssociated = $entity->getPersonsAssociated();
$entity->personsNotAssociated = $entity->getPersonsNotAssociated();
}
@@ -312,7 +334,7 @@ class ActivityController extends AbstractController
// TODO revoir le Voter de Activity pour tenir compte qu'une activité peut appartenir a une période
// $this->denyAccessUnlessGranted('CHILL_ACTIVITY_SEE', $entity);
$deleteForm = $this->createDeleteForm($id, $person, $accompanyingPeriod);
$deleteForm = $this->createDeleteForm($entity->getId(), $person, $accompanyingPeriod);
// TODO
/*
@@ -328,21 +350,20 @@ class ActivityController extends AbstractController
throw $this->createNotFoundException('Template not found');
}
return $this->render($view, array(
return $this->render($view, [
'person' => $person,
'accompanyingCourse' => $accompanyingPeriod,
'entity' => $entity,
'delete_form' => $deleteForm->createView(),
));
]);
}
/**
* Displays a form to edit an existing Activity entity.
*
*/
public function editAction($id, Request $request): Response
{
$em = $this->getDoctrine()->getManager();
$view = null;
[$person, $accompanyingPeriod] = $this->getEntity($request);
@@ -352,9 +373,9 @@ class ActivityController extends AbstractController
$view = 'ChillActivityBundle:Activity:editPerson.html.twig';
}
$entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
$entity = $this->activityRepository->find($id);
if (!$entity) {
if (null === $entity) {
throw $this->createNotFoundException('Unable to find Activity entity.');
}
@@ -369,17 +390,18 @@ class ActivityController extends AbstractController
])->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em->persist($entity);
$em->flush();
$this->entityManager->persist($entity);
$this->entityManager->flush();
$this->addFlash('success', $this->get('translator')->trans('Success : activity updated!'));
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
$params['id'] = $id;
$params['id'] = $entity->getId();
return $this->redirectToRoute('chill_activity_activity_show', $params);
}
$deleteForm = $this->createDeleteForm($id, $person, $accompanyingPeriod);
$deleteForm = $this->createDeleteForm($entity->getId(), $person, $accompanyingPeriod);
/*
* TODO
@@ -397,23 +419,22 @@ class ActivityController extends AbstractController
$activity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
return $this->render($view, array(
return $this->render($view, [
'entity' => $entity,
'edit_form' => $form->createView(),
'delete_form' => $deleteForm->createView(),
'person' => $person,
'accompanyingCourse' => $accompanyingPeriod,
'activity_json' => $activity_array
));
]);
}
/**
* Deletes a Activity entity.
*
*/
public function deleteAction(Request $request, $id)
{
$em = $this->getDoctrine()->getManager();
$view = null;
[$person, $accompanyingPeriod] = $this->getEntity($request);
@@ -423,8 +444,7 @@ class ActivityController extends AbstractController
$view = 'ChillActivityBundle:Activity:confirm_deletePerson.html.twig';
}
/* @var $activity Activity */
$activity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
$activity = $this->activityRepository->find($id);
if (!$activity) {
throw $this->createNotFoundException('Unable to find Activity entity.');
@@ -433,35 +453,37 @@ class ActivityController extends AbstractController
// TODO
// $this->denyAccessUnlessGranted('CHILL_ACTIVITY_DELETE', $activity);
$form = $this->createDeleteForm($id, $person, $accompanyingPeriod);
$form = $this->createDeleteForm($activity->getId(), $person, $accompanyingPeriod);
if ($request->getMethod() === Request::METHOD_DELETE) {
$form->handleRequest($request);
if ($form->isValid()) {
$this->logger->notice("An activity has been removed", array(
$this->logger->notice("An activity has been removed", [
'by_user' => $this->getUser()->getUsername(),
'activity_id' => $activity->getId(),
'person_id' => $activity->getPerson() ? $activity->getPerson()->getId() : null,
'comment' => $activity->getComment()->getComment(),
'scope_id' => $activity->getScope() ? $activity->getScope()->getId() : null,
'reasons_ids' => $activity->getReasons()
->map(function ($ar) { return $ar->getId(); })
->map(
static fn (ActivityReason $ar): int => $ar->getId()
)
->toArray(),
'type_id' => $activity->getType()->getId(),
'duration' => $activity->getDurationTime() ? $activity->getDurationTime()->format('U') : null,
'date' => $activity->getDate()->format('Y-m-d'),
'attendee' => $activity->getAttendee()
));
]);
$em->remove($activity);
$em->flush();
$this->entityManager->remove($activity);
$this->entityManager->flush();
$this->addFlash('success', $this->get('translator')
->trans("The activity has been successfully removed."));
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
return $this->redirectToRoute('chill_activity_activity_list', $params);
}
}
@@ -470,18 +492,18 @@ class ActivityController extends AbstractController
throw $this->createNotFoundException('Template not found');
}
return $this->render($view, array(
return $this->render($view, [
'activity' => $activity,
'delete_form' => $form->createView(),
'person' => $person,
'accompanyingCourse' => $accompanyingPeriod,
));
]);
}
/**
* Creates a form to delete a Activity entity by id.
*/
private function createDeleteForm(int $id, ?Person $person, ?AccompanyingPeriod $accompanyingPeriod): Form
private function createDeleteForm(int $id, ?Person $person, ?AccompanyingPeriod $accompanyingPeriod): FormInterface
{
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
$params['id'] = $id;
@@ -489,19 +511,17 @@ class ActivityController extends AbstractController
return $this->createFormBuilder()
->setAction($this->generateUrl('chill_activity_activity_delete', $params))
->setMethod('DELETE')
->add('submit', SubmitType::class, array('label' => 'Delete'))
->getForm()
;
->add('submit', SubmitType::class, ['label' => 'Delete'])
->getForm();
}
private function getEntity(Request $request): array
{
$em = $this->getDoctrine()->getManager();
$person = $accompanyingPeriod = null;
if ($request->query->has('person_id')) {
$person_id = $request->get('person_id');
$person = $em->getRepository(Person::class)->find($person_id);
$person = $this->personRepository->find($person_id);
if ($person === null) {
throw $this->createNotFoundException('Person not found');
@@ -510,7 +530,7 @@ class ActivityController extends AbstractController
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
} elseif ($request->query->has('accompanying_period_id')) {
$accompanying_period_id = $request->get('accompanying_period_id');
$accompanyingPeriod = $em->getRepository(AccompanyingPeriod::class)->find($accompanying_period_id);
$accompanyingPeriod = $this->accompanyingPeriodRepository->find($accompanying_period_id);
if ($accompanyingPeriod === null) {
throw $this->createNotFoundException('Accompanying Period not found');
@@ -523,21 +543,20 @@ class ActivityController extends AbstractController
}
return [
$person, $accompanyingPeriod
$person,
$accompanyingPeriod
];
}
private function buildParamsToUrl(
?Person $person,
?AccompanyingPeriod $accompanyingPeriod
): array {
private function buildParamsToUrl(?Person $person, ?AccompanyingPeriod $accompanyingPeriod): array
{
$params = [];
if ($person) {
if (null !== $person) {
$params['person_id'] = $person->getId();
}
if ($accompanyingPeriod) {
if (null !== $accompanyingPeriod) {
$params['accompanying_period_id'] = $accompanyingPeriod->getId();
}

View File

@@ -22,8 +22,10 @@
namespace Chill\ActivityBundle\DataFixtures\ORM;
use Chill\PersonBundle\Entity\Person;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ObjectManager;
use Faker\Factory as FakerFactory;
use Chill\ActivityBundle\Entity\Activity;
@@ -31,14 +33,8 @@ use Chill\MainBundle\DataFixtures\ORM\LoadUsers;
use Chill\ActivityBundle\DataFixtures\ORM\LoadActivityReason;
use Chill\ActivityBundle\DataFixtures\ORM\LoadActivityType;
use Chill\MainBundle\DataFixtures\ORM\LoadScopes;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
/**
* Load reports into DB
*
* @author Champs-Libres Coop
*/
class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface
class LoadActivity extends AbstractFixture implements OrderedFixtureInterface
{
use \Symfony\Component\DependencyInjection\ContainerAwareTrait;
@@ -46,10 +42,12 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, C
* @var \Faker\Generator
*/
private $faker;
private EntityManagerInterface $em;
public function __construct()
public function __construct(EntityManagerInterface $em)
{
$this->faker = FakerFactory::create('fr_FR');
$this->em = $em;
}
public function getOrder()
@@ -84,15 +82,10 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, C
*
* @return \Chill\ActivityBundle\Entity\ActivityReason
*/
private function getRandomActivityReason(array $excludingIds)
private function getRandomActivityReason()
{
$reasonRef = LoadActivityReason::$references[array_rand(LoadActivityReason::$references)];
if (in_array($this->getReference($reasonRef)->getId(), $excludingIds)) {
// we have a reason which should be excluded. Find another...
return $this->getRandomActivityReason($excludingIds);
}
return $this->getReference($reasonRef);
}
@@ -107,7 +100,7 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, C
return $this->getReference($userRef);
}
public function newRandomActivity($person)
public function newRandomActivity($person): ?Activity
{
$activity = (new Activity())
->setUser($this->getRandomUser())
@@ -120,11 +113,13 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, C
// ->setAttendee($this->faker->boolean())
$usedId = array();
for ($i = 0; $i < rand(0, 4); $i++) {
$reason = $this->getRandomActivityReason($usedId);
$usedId[] = $reason->getId();
$activity->addReason($reason);
$reason = $this->getRandomActivityReason();
if (null !== $reason) {
$activity->addReason($reason);
} else {
return null;
}
}
return $activity;
@@ -132,21 +127,19 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, C
public function load(ObjectManager $manager)
{
$persons = $this->container->get('doctrine.orm.entity_manager')
->getRepository('ChillPersonBundle:Person')
$persons = $this->em
->getRepository(Person::class)
->findAll();
foreach($persons as $person) {
foreach ($persons as $person) {
$activityNbr = rand(0,3);
$ref = 'activity_'.$person->getFullnameCanonical();
for($i = 0; $i < $activityNbr; $i ++) {
print "Creating an activity type for : ".$person." (ref: ".$ref.") \n";
for ($i = 0; $i < $activityNbr; $i ++) {
$activity = $this->newRandomActivity($person);
$manager->persist($activity);
if (null !== $activity) {
$manager->persist($activity);
}
}
$this->setReference($ref, $activity);
}
$manager->flush();
}

View File

@@ -87,7 +87,9 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
ActivityVoter::UPDATE => array(ActivityVoter::SEE_DETAILS),
ActivityVoter::CREATE => array(ActivityVoter::SEE_DETAILS),
ActivityVoter::DELETE => array(ActivityVoter::SEE_DETAILS),
ActivityVoter::SEE_DETAILS => array(ActivityVoter::SEE)
ActivityVoter::SEE_DETAILS => array(ActivityVoter::SEE),
ActivityVoter::FULL => [ActivityVoter::CREATE, ActivityVoter::DELETE,
ActivityVoter::UPDATE],
)
));
}

View File

@@ -1,28 +1,10 @@
<?php
/*
*
* Copyright (C) 2015, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Chill\ActivityBundle\Entity;
use Chill\DocStoreBundle\Entity\Document;
use Chill\DocStoreBundle\Entity\StoredObject;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Chill\MainBundle\Entity\Location;
use Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodLinkedWithSocialIssuesEntityInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
@@ -37,7 +19,7 @@ use Chill\MainBundle\Entity\HasCenterInterface;
use Chill\MainBundle\Entity\HasScopeInterface;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
@@ -157,7 +139,7 @@ class Activity implements HasCenterInterface, HasScopeInterface, AccompanyingPer
private ?Collection $thirdParties = null;
/**
* @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject")
* @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject", cascade={"persist"})
*/
private Collection $documents;
@@ -177,6 +159,13 @@ class Activity implements HasCenterInterface, HasScopeInterface, AccompanyingPer
*/
private string $sentReceived = '';
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location")
* @groups({"read"})
*/
private ?Location $location = null;
public function __construct()
{
$this->reasons = new ArrayCollection();
@@ -194,7 +183,7 @@ class Activity implements HasCenterInterface, HasScopeInterface, AccompanyingPer
return $this->id;
}
public function setUser(User $user): self
public function setUser(UserInterface $user): self
{
$this->user = $user;
@@ -555,4 +544,22 @@ class Activity implements HasCenterInterface, HasScopeInterface, AccompanyingPer
return $this;
}
/**
* @return Location|null
*/
public function getLocation(): ?Location
{
return $this->location;
}
/**
* @param Location|null $location
* @return Activity
*/
public function setLocation(?Location $location): Activity
{
$this->location = $location;
return $this;
}
}

View File

@@ -1,19 +1,19 @@
<?php
/*
*
*
* Copyright (C) 2015, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -44,7 +44,7 @@ class ActivityReason
/**
* @var array
* @ORM\Column(type="json_array")
* @ORM\Column(type="json")
*/
private $name;
@@ -108,7 +108,7 @@ class ActivityReason
return $this->name;
}
}
/**
* Set category of the reason. If you set to the reason an inactive
* category, the reason will become inactive
@@ -121,7 +121,7 @@ class ActivityReason
if($this->category !== $category && ! $category->getActive()) {
$this->setActive(False);
}
$this->category = $category;
return $this;

View File

@@ -2,17 +2,17 @@
/*
* Copyright (C) 2015, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -43,7 +43,7 @@ class ActivityReasonCategory
/**
* @var string
* @ORM\Column(type="json_array")
* @ORM\Column(type="json")
*/
private $name;
@@ -52,7 +52,7 @@ class ActivityReasonCategory
* @ORM\Column(type="boolean")
*/
private $active = true;
/**
* Array of ActivityReason
* @var ArrayCollection
@@ -61,7 +61,7 @@ class ActivityReasonCategory
* mappedBy="category")
*/
private $reasons;
/**
* ActivityReasonCategory constructor.
*/
@@ -69,7 +69,7 @@ class ActivityReasonCategory
{
$this->reasons = new ArrayCollection();
}
/**
* @return string
*/
@@ -139,9 +139,9 @@ class ActivityReasonCategory
$reason->setActive($active);
}
}
$this->active = $active;
return $this;
}

View File

@@ -44,7 +44,7 @@ class ActivityType
private ?int $id;
/**
* @ORM\Column(type="json_array")
* @ORM\Column(type="json")
*/
private array $name = [];
@@ -248,6 +248,16 @@ class ActivityType
*/
private string $socialActionsLabel = '';
/**
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
*/
private int $locationVisible = self::FIELD_INVISIBLE;
/**
* @ORM\Column(type="string", nullable=false, options={"default"=""})
*/
private string $locationLabel = '';
/**
* @ORM\Column(type="float", options={"default"="0.0"})
*/
@@ -820,4 +830,29 @@ class ActivityType
return $this;
}
public function getLocationVisible(): ?int
{
return $this->locationVisible;
}
public function setLocationVisible(int $locationVisible): self
{
$this->locationVisible = $locationVisible;
return $this;
}
public function getLocationLabel(): ?string
{
return $this->locationLabel;
}
public function setLocationLabel(string $locationLabel): self
{
$this->locationLabel = $locationLabel;
return $this;
}
}

View File

@@ -1,31 +1,12 @@
<?php
/*
*
* Copyright (C) 2015, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class ActivityTypeCateogry
*
* @package Chill\ActivityBundle\Entity
* @ORM\Entity()
* @ORM\Table(name="activitytypecategory")
* @ORM\HasLifecycleCallbacks()
@@ -37,10 +18,10 @@ class ActivityTypeCategory
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id;
private ?int $id = null;
/**
* @ORM\Column(type="json_array")
* @ORM\Column(type="json")
*/
private array $name = [];
@@ -54,10 +35,7 @@ class ActivityTypeCategory
*/
private float $ordering = 0.0;
/**
* Get id
*/
public function getId(): int
public function getId(): ?int
{
return $this->id;
}

View File

@@ -1,70 +1,39 @@
<?php
/*
* Copyright (C) 2016 Champs-Libres <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Aggregator;
use Chill\ActivityBundle\Repository\ActivityReasonCategoryRepository;
use Chill\ActivityBundle\Repository\ActivityReasonRepository;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Symfony\Component\Form\FormBuilderInterface;
use Doctrine\ORM\QueryBuilder;
use Chill\MainBundle\Export\AggregatorInterface;
use Symfony\Component\Security\Core\Role\Role;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Doctrine\ORM\EntityRepository;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Doctrine\ORM\Query\Expr\Join;
use Chill\MainBundle\Export\ExportElementValidatedInterface;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
/**
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class ActivityReasonAggregator implements AggregatorInterface,
ExportElementValidatedInterface
class ActivityReasonAggregator implements AggregatorInterface, ExportElementValidatedInterface
{
/**
*
* @var EntityRepository
*/
protected $categoryRepository;
protected ActivityReasonCategoryRepository $activityReasonCategoryRepository;
/**
*
* @var EntityRepository
*/
protected $reasonRepository;
protected ActivityReasonRepository $activityReasonRepository;
/**
*
* @var TranslatableStringHelper
*/
protected $stringHelper;
protected TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
EntityRepository $categoryRepository,
EntityRepository $reasonRepository,
TranslatableStringHelper $stringHelper
ActivityReasonCategoryRepository $activityReasonCategoryRepository,
ActivityReasonRepository $activityReasonRepository,
TranslatableStringHelper $translatableStringHelper
) {
$this->categoryRepository = $categoryRepository;
$this->reasonRepository = $reasonRepository;
$this->stringHelper = $stringHelper;
$this->activityReasonCategoryRepository = $activityReasonCategoryRepository;
$this->activityReasonRepository = $activityReasonRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function alterQuery(QueryBuilder $qb, $data)
@@ -77,7 +46,7 @@ class ActivityReasonAggregator implements AggregatorInterface,
$elem = 'category.id';
$alias = 'activity_categories_id';
} else {
throw new \RuntimeException('the data provided are not recognized');
throw new \RuntimeException('The data provided are not recognized.');
}
$qb->addSelect($elem.' as '.$alias);
@@ -93,11 +62,12 @@ class ActivityReasonAggregator implements AggregatorInterface,
(! array_key_exists('activity', $join))
) {
$qb->add(
'join',
array('activity' =>
new Join(Join::INNER_JOIN, 'activity.reasons', 'reasons')
),
true);
'join',
[
'activity' => new Join(Join::INNER_JOIN, 'activity.reasons', 'reasons')
],
true
);
}
// join category if necessary
@@ -143,28 +113,33 @@ class ActivityReasonAggregator implements AggregatorInterface,
public function buildForm(FormBuilderInterface $builder)
{
$builder->add('level', ChoiceType::class, array(
'choices' => array(
'By reason' => 'reasons',
'By category of reason' => 'categories'
),
'multiple' => false,
'expanded' => true,
'label' => 'Reason\'s level'
));
$builder->add(
'level',
ChoiceType::class,
[
'choices' => [
'By reason' => 'reasons',
'By category of reason' => 'categories'
],
'multiple' => false,
'expanded' => true,
'label' => "Reason's level"
]
);
}
public function validateForm($data, ExecutionContextInterface $context)
{
if ($data['level'] === null) {
$context->buildViolation("The reasons's level should not be empty")
$context
->buildViolation("The reasons's level should not be empty.")
->addViolation();
}
}
public function getTitle()
public function getTitle()
{
return "Aggregate by activity reason";
return 'Aggregate by activity reason';
}
public function addRole()
@@ -177,41 +152,33 @@ class ActivityReasonAggregator implements AggregatorInterface,
// for performance reason, we load data from db only once
switch ($data['level']) {
case 'reasons':
$this->reasonRepository->findBy(array('id' => $values));
$this->activityReasonRepository->findBy(['id' => $values]);
break;
case 'categories':
$this->categoryRepository->findBy(array('id' => $values));
$this->activityReasonCategoryRepository->findBy(['id' => $values]);
break;
default:
throw new \RuntimeException(sprintf("the level data '%s' is invalid",
$data['level']));
throw new \RuntimeException(sprintf("The level data '%s' is invalid.", $data['level']));
}
return function($value) use ($data) {
if ($value === '_header') {
return $data['level'] === 'reasons' ?
'Group by reasons'
:
'Group by categories of reason'
;
return $data['level'] === 'reasons' ? 'Group by reasons' : 'Group by categories of reason';
}
switch ($data['level']) {
case 'reasons':
/* @var $r \Chill\ActivityBundle\Entity\ActivityReason */
$r = $this->reasonRepository->find($value);
$r = $this->activityReasonRepository->find($value);
return $this->stringHelper->localize($r->getCategory()->getName())
." > "
. $this->stringHelper->localize($r->getName());
;
break;
return sprintf(
"%s > %s",
$this->translatableStringHelper->localize($r->getCategory()->getName()),
$this->translatableStringHelper->localize($r->getName())
);
case 'categories':
$c = $this->categoryRepository->find($value);
$c = $this->activityReasonCategoryRepository->find($value);
return $this->stringHelper->localize($c->getName());
break;
// no need for a default : the default was already set above
return $this->translatableStringHelper->localize($c->getName());
}
};
@@ -222,12 +189,14 @@ class ActivityReasonAggregator implements AggregatorInterface,
// add select element
if ($data['level'] === 'reasons') {
return array('activity_reasons_id');
} elseif ($data['level'] === 'categories') {
return array ('activity_categories_id');
} else {
throw new \RuntimeException('the data provided are not recognised');
}
if ($data['level'] === 'categories') {
return array ('activity_categories_id');
}
throw new \RuntimeException('The data provided are not recognised.');
}
}

View File

@@ -1,75 +1,46 @@
<?php
/*
* Copyright (C) 2016 Champs-Libres <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Aggregator;
use Chill\ActivityBundle\Repository\ActivityTypeRepository;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Symfony\Component\Form\FormBuilderInterface;
use Doctrine\ORM\QueryBuilder;
use Chill\MainBundle\Export\AggregatorInterface;
use Symfony\Component\Security\Core\Role\Role;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Doctrine\ORM\EntityRepository;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Doctrine\ORM\Query\Expr\Join;
/**
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class ActivityTypeAggregator implements AggregatorInterface
{
/**
*
* @var EntityRepository
*/
protected $typeRepository;
/**
*
* @var TranslatableStringHelper
*/
protected $stringHelper;
const KEY = 'activity_type_aggregator';
protected ActivityTypeRepository $activityTypeRepository;
protected TranslatableStringHelperInterface $translatableStringHelper;
public const KEY = 'activity_type_aggregator';
public function __construct(
EntityRepository $typeRepository,
TranslatableStringHelper $stringHelper
ActivityTypeRepository $activityTypeRepository,
TranslatableStringHelperInterface $translatableStringHelper
) {
$this->typeRepository = $typeRepository;
$this->stringHelper = $stringHelper;
$this->activityTypeRepository = $activityTypeRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function alterQuery(QueryBuilder $qb, $data)
{
// add select element
// add select element
$qb->addSelect(sprintf('IDENTITY(activity.type) AS %s', self::KEY));
// add the "group by" part
$groupBy = $qb->addGroupBy(self::KEY);
$qb->addGroupBy(self::KEY);
}
/**
* Check if a join between Activity and another alias
*
*
* @param Join[] $joins
* @param string $alias the alias to search for
* @return boolean
@@ -81,7 +52,7 @@ class ActivityTypeAggregator implements AggregatorInterface
return true;
}
}
return false;
}
@@ -97,35 +68,33 @@ class ActivityTypeAggregator implements AggregatorInterface
public function getTitle()
{
return "Aggregate by activity type";
return 'Aggregate by activity type';
}
public function addRole()
{
return new Role(ActivityStatsVoter::STATS);
}
public function getLabels($key, array $values, $data)
public function getLabels($key, array $values, $data): \Closure
{
// for performance reason, we load data from db only once
$this->typeRepository->findBy(array('id' => $values));
return function($value) use ($data) {
$this->activityTypeRepository->findBy(['id' => $values]);
return function($value): string {
if ($value === '_header') {
return 'Activity type';
}
/* @var $r \Chill\ActivityBundle\Entity\ActivityType */
$t = $this->typeRepository->find($value);
$t = $this->activityTypeRepository->find($value);
return $this->stringHelper->localize($t->getName());
return $this->translatableStringHelper->localize($t->getName());
};
}
public function getQueryKeys($data)
public function getQueryKeys($data): array
{
return array(self::KEY);
return [self::KEY];
}
}

View File

@@ -1,51 +1,26 @@
<?php
/*
* Copyright (C) 2019 Champs Libres Cooperative <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Chill\ActivityBundle\Export\Aggregator;
use Chill\MainBundle\Repository\UserRepository;
use Symfony\Component\Form\FormBuilderInterface;
use Doctrine\ORM\QueryBuilder;
use Chill\MainBundle\Export\AggregatorInterface;
use Symfony\Component\Security\Core\Role\Role;
use Doctrine\ORM\Query\Expr\Join;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Doctrine\ORM\EntityManagerInterface;
use Chill\MainBundle\Entity\User;
/**
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class ActivityUserAggregator implements AggregatorInterface
{
/**
*
* @var EntityManagerInterface
*/
protected $em;
const KEY = 'activity_user_id';
function __construct(EntityManagerInterface $em)
{
$this->em = $em;
public const KEY = 'activity_user_id';
private UserRepository $userRepository;
public function __construct(
UserRepository $userRepository
) {
$this->userRepository = $userRepository;
}
public function addRole()
{
return new Role(ActivityStatsVoter::STATS);
@@ -53,9 +28,9 @@ class ActivityUserAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
// add select element
// add select element
$qb->addSelect(sprintf('IDENTITY(activity.user) AS %s', self::KEY));
// add the "group by" part
$qb->addGroupBy(self::KEY);
}
@@ -73,17 +48,14 @@ class ActivityUserAggregator implements AggregatorInterface
public function getLabels($key, $values, $data): \Closure
{
// preload users at once
$this->em->getRepository(User::class)
->findBy(['id' => $values]);
$this->userRepository->findBy(['id' => $values]);
return function($value) {
switch ($value) {
case '_header':
return 'activity user';
default:
return $this->em->getRepository(User::class)->find($value)
->getUsername();
if ($value === '_header') {
return 'activity user';
}
return $this->userRepository->find($value)->getUsername();
};
}
@@ -94,6 +66,6 @@ class ActivityUserAggregator implements AggregatorInterface
public function getTitle(): string
{
return "Aggregate by activity user";
return 'Aggregate by activity user';
}
}

View File

@@ -1,64 +1,40 @@
<?php
/*
* Copyright (C) 2015 Champs-Libres <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Export;
use Chill\ActivityBundle\Repository\ActivityRepository;
use Chill\MainBundle\Export\ExportInterface;
use Doctrine\ORM\QueryBuilder;
use Chill\MainBundle\Export\FormatterInterface;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Role\Role;
use Doctrine\ORM\Query;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Doctrine\ORM\EntityManagerInterface;
/**
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class CountActivity implements ExportInterface
{
/**
*
* @var EntityManagerInterface
*/
protected $entityManager;
protected ActivityRepository $activityRepository;
public function __construct(
EntityManagerInterface $em
)
{
$this->entityManager = $em;
ActivityRepository $activityRepository
) {
$this->activityRepository = $activityRepository;
}
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder)
public function buildForm(FormBuilderInterface $builder)
{
}
public function getDescription()
{
return "Count activities by various parameters.";
return 'Count activities by various parameters.';
}
public function getTitle()
{
return "Count activities";
return 'Count activities';
}
public function getType()
@@ -68,26 +44,26 @@ class CountActivity implements ExportInterface
public function initiateQuery(array $requiredModifiers, array $acl, array $data = array())
{
$qb = $this->entityManager->createQueryBuilder();
$centers = array_map(function($el) { return $el['center']; }, $acl);
$qb->select('COUNT(activity.id) as export_count_activity')
->from('ChillActivityBundle:Activity', 'activity')
->join('activity.person', 'person')
;
$qb->where($qb->expr()->in('person.center', ':centers'))
->setParameter('centers', $centers)
;
$centers = array_map(static fn($el) => $el['center'], $acl);
$qb = $this
->activityRepository
->createQueryBuilder('activity')
->select('COUNT(activity.id) as export_count_activity')
->join('activity.person', 'person');
$qb
->where($qb->expr()->in('person.center', ':centers'))
->setParameter('centers', $centers);
return $qb;
}
public function supportsModifiers()
{
return array('person', 'activity');
return ['person', 'activity'];
}
public function requiredRole()
{
return new Role(ActivityStatsVoter::STATS);
@@ -95,7 +71,7 @@ class CountActivity implements ExportInterface
public function getAllowedFormattersTypes()
{
return array(\Chill\MainBundle\Export\FormatterInterface::TYPE_TABULAR);
return [FormatterInterface::TYPE_TABULAR];
}
public function getLabels($key, array $values, $data)
@@ -103,19 +79,13 @@ class CountActivity implements ExportInterface
if ($key !== 'export_count_activity') {
throw new \LogicException("the key $key is not used by this export");
}
return function($value) {
return $value === '_header' ?
'Number of activities'
:
$value
;
};
return static fn($value) => $value === '_header' ? 'Number of activities' : $value;
}
public function getQueryKeys($data)
{
return array('export_count_activity');
return ['export_count_activity'];
}
public function getResult($qb, $data)

View File

@@ -1,31 +1,14 @@
<?php
/*
* Copyright (C) 2017 Champs-Libres <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Export;
use Chill\ActivityBundle\Repository\ActivityRepository;
use Chill\MainBundle\Export\ListInterface;
use Chill\ActivityBundle\Entity\ActivityReason;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Entity\Scope;
use Chill\ActivityBundle\Entity\ActivityType;
use Doctrine\ORM\Query\Expr;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Doctrine\DBAL\Exception\InvalidArgumentException;
use Symfony\Component\Security\Core\Role\Role;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Symfony\Component\Form\FormBuilderInterface;
@@ -37,33 +20,17 @@ use Chill\MainBundle\Export\FormatterInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* Create a list for all activities
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class ListActivity implements ListInterface
{
private ActivityRepository $activityRepository;
/**
*
* @var EntityManagerInterface
*/
protected $entityManager;
protected EntityManagerInterface $entityManager;
/**
*
* @var TranslatorInterface
*/
protected $translator;
protected TranslatorInterface $translator;
/**
*
* @var TranslatableStringHelper
*/
protected $translatableStringHelper;
protected TranslatableStringHelperInterface $translatableStringHelper;
protected $fields = array(
protected array $fields = [
'id',
'date',
'durationTime',
@@ -75,32 +42,28 @@ class ListActivity implements ListInterface
'person_firstname',
'person_lastname',
'person_id'
);
];
public function __construct(
EntityManagerInterface $em,
TranslatorInterface $translator,
TranslatableStringHelper $translatableStringHelper
)
{
EntityManagerInterface $em,
TranslatorInterface $translator,
TranslatableStringHelperInterface $translatableStringHelper,
ActivityRepository $activityRepository
) {
$this->entityManager = $em;
$this->translator = $translator;
$this->translatableStringHelper = $translatableStringHelper;
$this->activityRepository = $activityRepository;
}
/**
* {@inheritDoc}
*
* @param FormBuilderInterface $builder
*/
public function buildForm(FormBuilderInterface $builder)
{
$builder->add('fields', ChoiceType::class, array(
$builder->add('fields', ChoiceType::class, [
'multiple' => true,
'expanded' => true,
'choices' => array_combine($this->fields, $this->fields),
'label' => 'Fields to include in export',
'constraints' => [new Callback(array(
'constraints' => [new Callback([
'callback' => function($selected, ExecutionContextInterface $context) {
if (count($selected) === 0) {
$context->buildViolation('You must select at least one element')
@@ -108,19 +71,14 @@ class ListActivity implements ListInterface
->addViolation();
}
}
))]
));
])]
]);
}
/**
* {@inheritDoc}
*
* @return type
*/
public function getAllowedFormattersTypes()
{
return array(FormatterInterface::TYPE_LIST);
return [FormatterInterface::TYPE_LIST];
}
public function getDescription()
@@ -133,29 +91,32 @@ class ListActivity implements ListInterface
switch ($key)
{
case 'date' :
return function($value) {
if ($value === '_header') return 'date';
return static function($value) {
if ($value === '_header') {
return 'date';
}
$date = \DateTime::createFromFormat('Y-m-d H:i:s', $value);
return $date->format('d-m-Y');
};
case 'attendee':
return function($value) {
if ($value === '_header') return 'attendee';
return static function($value) {
if ($value === '_header') {
return 'attendee';
}
return $value ? 1 : 0;
};
case 'list_reasons' :
/* @var $activityReasonsRepository EntityRepository */
$activityRepository = $this->entityManager
->getRepository('ChillActivityBundle:Activity');
$activityRepository = $this->activityRepository;
return function($value) use ($activityRepository) {
if ($value === '_header') return 'activity reasons';
return function($value) use ($activityRepository): string {
if ($value === '_header') {
return 'activity reasons';
}
$activity = $activityRepository
->find($value);
$activity = $activityRepository->find($value);
return implode(", ", array_map(function(ActivityReason $r) {
@@ -168,21 +129,25 @@ class ListActivity implements ListInterface
};
case 'circle_name' :
return function($value) {
if ($value === '_header') return 'circle';
if ($value === '_header') {
return 'circle';
}
return $this->translatableStringHelper
->localize(json_decode($value, true));
return $this->translatableStringHelper->localize(json_decode($value, true));
};
case 'type_name' :
return function($value) {
if ($value === '_header') return 'activity type';
if ($value === '_header') {
return 'activity type';
}
return $this->translatableStringHelper
->localize(json_decode($value, true));
return $this->translatableStringHelper->localize(json_decode($value, true));
};
default:
return function($value) use ($key) {
if ($value === '_header') return $key;
return static function($value) use ($key) {
if ($value === '_header') {
return $key;
}
return $value;
};
@@ -209,14 +174,13 @@ class ListActivity implements ListInterface
return 'activity';
}
public function initiateQuery(array $requiredModifiers, array $acl, array $data = array())
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$centers = array_map(function($el) { return $el['center']; }, $acl);
// throw an error if any fields are present
if (!\array_key_exists('fields', $data)) {
throw new \Doctrine\DBAL\Exception\InvalidArgumentException("any fields "
. "have been checked");
throw new InvalidArgumentException('Any fields have been checked.');
}
$qb = $this->entityManager->createQueryBuilder();
@@ -227,7 +191,6 @@ class ListActivity implements ListInterface
->join('person.center', 'center')
->andWhere('center IN (:authorized_centers)')
->setParameter('authorized_centers', $centers);
;
foreach ($this->fields as $f) {
if (in_array($f, $data['fields'])) {
@@ -269,8 +232,6 @@ class ListActivity implements ListInterface
}
}
return $qb;
}
@@ -281,7 +242,7 @@ class ListActivity implements ListInterface
public function supportsModifiers()
{
return array('activity', 'person');
return ['activity', 'person'];
}
}

View File

@@ -1,89 +1,62 @@
<?php
/*
* Copyright (C) 2015 Champs-Libres <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Export;
use Chill\ActivityBundle\Repository\ActivityRepository;
use Chill\MainBundle\Export\ExportInterface;
use Doctrine\ORM\QueryBuilder;
use Chill\MainBundle\Export\FormatterInterface;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Role\Role;
use Doctrine\ORM\Query;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Doctrine\ORM\EntityManagerInterface;
/**
* This export allow to compute stats on activity duration.
*
*
* The desired stat must be given in constructor.
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class StatActivityDuration implements ExportInterface
{
/**
*
* @var EntityManagerInterface
*/
protected $entityManager;
const SUM = 'sum';
private ActivityRepository $activityRepository;
public const SUM = 'sum';
/**
* The action for this report.
*
* @var string
*/
protected $action;
protected string $action;
/**
* constructor
*
* @param EntityManagerInterface $em
* @param string $action the stat to perform
*/
public function __construct(
EntityManagerInterface $em,
$action = 'sum'
)
{
$this->entityManager = $em;
ActivityRepository $activityRepository,
string $action = 'sum'
) {
$this->action = $action;
$this->activityRepository = $activityRepository;
}
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder)
public function buildForm(FormBuilderInterface $builder)
{
}
public function getDescription()
{
if ($this->action === self::SUM) {
return "Sum activities duration by various parameters.";
return 'Sum activities duration by various parameters.';
}
}
public function getTitle()
{
if ($this->action === self::SUM) {
return "Sum activity duration";
return 'Sum activity duration';
}
}
public function getType()
@@ -91,31 +64,33 @@ class StatActivityDuration implements ExportInterface
return 'activity';
}
public function initiateQuery(array $requiredModifiers, array $acl, array $data = array())
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$centers = array_map(function($el) { return $el['center']; }, $acl);
$qb = $this->entityManager->createQueryBuilder();
$centers = array_map(
static fn(array $el): string => $el['center'],
$acl
);
$qb = $this->activityRepository->createQueryBuilder('activity');
$select = null;
if ($this->action === self::SUM) {
$select = "SUM(activity.durationTime) AS export_stat_activity";
$select = 'SUM(activity.durationTime) AS export_stat_activity';
}
$qb->select($select)
->from('ChillActivityBundle:Activity', 'activity')
->join('activity.person', 'person')
->join('person.center', 'center')
->where($qb->expr()->in('center', ':centers'))
->setParameter(':centers', $centers)
;
return $qb;
return $qb->select($select)
->join('activity.person', 'person')
->join('person.center', 'center')
->where($qb->expr()->in('center', ':centers'))
->setParameter(':centers', $centers);
}
public function supportsModifiers()
{
return array('person', 'activity');
return ['person', 'activity'];
}
public function requiredRole()
{
return new Role(ActivityStatsVoter::STATS);
@@ -123,32 +98,23 @@ class StatActivityDuration implements ExportInterface
public function getAllowedFormattersTypes()
{
return array(\Chill\MainBundle\Export\FormatterInterface::TYPE_TABULAR);
return [FormatterInterface::TYPE_TABULAR];
}
public function getLabels($key, array $values, $data)
{
if ($key !== 'export_stat_activity') {
throw new \LogicException("the key $key is not used by this export");
throw new \LogicException(sprintf('The key %s is not used by this export', $key));
}
switch ($this->action) {
case self::SUM:
$header = "Sum of activities duration";
}
return function($value) use ($header) {
return $value === '_header' ?
$header
:
$value
;
};
$header = $this->action === self::SUM ? 'Sum of activities duration' : false;
return static fn(string $value) => $value === '_header' ? $header : $value;
}
public function getQueryKeys($data)
{
return array('export_stat_activity');
return ['export_stat_activity'];
}
public function getResult($qb, $data)

View File

@@ -1,25 +1,12 @@
<?php
/*
* Copyright (C) 2017 Champs-Libres <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Filter;
use Chill\MainBundle\Export\FilterInterface;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\Extension\Core\Type\DateType;
@@ -28,34 +15,24 @@ use Chill\MainBundle\Form\Type\Export\FilterType;
use Doctrine\ORM\Query\Expr;
use Symfony\Component\Translation\TranslatorInterface;
/**
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class ActivityDateFilter implements FilterInterface
{
/**
*
* @var TranslatorInterface
*/
protected $translator;
protected TranslatorInterface $translator;
function __construct(TranslatorInterface $translator)
{
$this->translator = $translator;
}
public function addRole()
{
return null;
}
public function alterQuery(\Doctrine\ORM\QueryBuilder $qb, $data)
public function alterQuery(QueryBuilder $qb, $data)
{
$where = $qb->getDQLPart('where');
$clause = $qb->expr()->between('activity.date', ':date_from',
$clause = $qb->expr()->between('activity.date', ':date_from',
':date_to');
if ($where instanceof Expr\Andx) {
@@ -63,7 +40,7 @@ class ActivityDateFilter implements FilterInterface
} else {
$where = $qb->expr()->andX($clause);
}
$qb->add('where', $where);
$qb->setParameter('date_from', $data['date_from']);
$qb->setParameter('date_to', $data['date_to']);
@@ -74,35 +51,43 @@ class ActivityDateFilter implements FilterInterface
return 'activity';
}
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder)
public function buildForm(FormBuilderInterface $builder)
{
$builder->add('date_from', DateType::class, array(
'label' => "Activities after this date",
'data' => new \DateTime(),
'attr' => array('class' => 'datepicker'),
'widget'=> 'single_text',
'format' => 'dd-MM-yyyy',
));
$builder->add('date_to', DateType::class, array(
'label' => "Activities before this date",
'data' => new \DateTime(),
'attr' => array('class' => 'datepicker'),
'widget'=> 'single_text',
'format' => 'dd-MM-yyyy',
));
$builder->add(
'date_from',
DateType::class,
[
'label' => 'Activities after this date',
'data' => new \DateTime(),
'attr' => ['class' => 'datepicker'],
'widget'=> 'single_text',
'format' => 'dd-MM-yyyy',
]
);
$builder->add(
'date_to',
DateType::class,
[
'label' => 'Activities before this date',
'data' => new \DateTime(),
'attr' => ['class' => 'datepicker'],
'widget'=> 'single_text',
'format' => 'dd-MM-yyyy',
]
);
$builder->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) {
/* @var $filterForm \Symfony\Component\Form\FormInterface */
$filterForm = $event->getForm()->getParent();
$enabled = $filterForm->get(FilterType::ENABLED_FIELD)->getData();
if ($enabled === true) {
// if the filter is enabled, add some validation
$form = $event->getForm();
$date_from = $form->get('date_from')->getData();
$date_to = $form->get('date_to')->getData();
// check that fields are not empty
if ($date_from === null) {
$form->get('date_from')->addError(new FormError(
@@ -113,8 +98,8 @@ class ActivityDateFilter implements FilterInterface
$form->get('date_to')->addError(new FormError(
$this->translator->trans('This field '
. 'should not be empty')));
}
}
// check that date_from is before date_to
if (
($date_from !== null && $date_to !== null)
@@ -132,17 +117,18 @@ class ActivityDateFilter implements FilterInterface
public function describeAction($data, $format = 'string')
{
return array(
"Filtered by date of activity: only between %date_from% and %date_to%",
array(
"%date_from%" => $data['date_from']->format('d-m-Y'),
'%date_to%' => $data['date_to']->format('d-m-Y')
));
return [
'Filtered by date of activity: only between %date_from% and %date_to%',
[
'%date_from%' => $data['date_from']->format('d-m-Y'),
'%date_to%' => $data['date_to']->format('d-m-Y')
]
];
}
public function getTitle()
{
return "Filtered by date activity";
return 'Filtered by date activity';
}
}

View File

@@ -1,25 +1,12 @@
<?php
/*
* Copyright (C) 2016 Champs-Libres <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Filter;
use Chill\ActivityBundle\Repository\ActivityReasonRepository;
use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
@@ -28,41 +15,24 @@ use Chill\MainBundle\Templating\TranslatableStringHelper;
use Doctrine\ORM\Query\Expr;
use Symfony\Component\Security\Core\Role\Role;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\Expr\Join;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Chill\MainBundle\Export\ExportElementValidatedInterface;
/**
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class ActivityReasonFilter implements FilterInterface,
ExportElementValidatedInterface
class ActivityReasonFilter implements FilterInterface, ExportElementValidatedInterface
{
/**
*
* @var TranslatableStringHelper
*/
protected $translatableStringHelper;
/**
* The repository for activity reasons
*
* @var EntityRepository
*/
protected $reasonRepository;
protected TranslatableStringHelperInterface $translatableStringHelper;
protected ActivityReasonRepository $activityReasonRepository;
public function __construct(
TranslatableStringHelper $helper,
EntityRepository $reasonRepository
TranslatableStringHelper $helper,
ActivityReasonRepository $activityReasonRepository
) {
$this->translatableStringHelper = $helper;
$this->reasonRepository = $reasonRepository;
$this->activityReasonRepository = $activityReasonRepository;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$where = $qb->getDQLPart('where');
@@ -75,12 +45,12 @@ class ActivityReasonFilter implements FilterInterface,
&&
!$this->checkJoinAlreadyDefined($join['activity'], 'reasons')
)
OR
||
(! array_key_exists('activity', $join))
) {
$qb->add(
'join',
array('activity' => new Join(Join::INNER_JOIN, 'activity.reasons', 'reasons')),
'join',
array('activity' => new Join(Join::INNER_JOIN, 'activity.reasons', 'reasons')),
true
);
}
@@ -90,25 +60,25 @@ class ActivityReasonFilter implements FilterInterface,
} else {
$where = $qb->expr()->andX($clause);
}
$qb->add('where', $where);
$qb->setParameter('selected_activity_reasons', $data['reasons']);
}
/**
* Check if a join between Activity and Reason is already defined
*
*
* @param Join[] $joins
* @return boolean
*/
private function checkJoinAlreadyDefined(array $joins, $alias)
private function checkJoinAlreadyDefined(array $joins, $alias): bool
{
foreach ($joins as $join) {
if ($join->getAlias() === $alias) {
return true;
}
}
return false;
}
@@ -119,51 +89,47 @@ class ActivityReasonFilter implements FilterInterface,
public function buildForm(FormBuilderInterface $builder)
{
//create a local copy of translatableStringHelper
$helper = $this->translatableStringHelper;
$builder->add('reasons', EntityType::class, array(
'class' => 'ChillActivityBundle:ActivityReason',
'choice_label' => function (ActivityReason $reason) use ($helper) {
return $helper->localize($reason->getName());
},
'group_by' => function(ActivityReason $reason) use ($helper) {
return $helper->localize($reason->getCategory()->getName());
},
$builder->add('reasons', EntityType::class, [
'class' => ActivityReason::class,
'choice_label' => fn(ActivityReason $reason) => $this->translatableStringHelper->localize($reason->getName()),
'group_by' => fn(ActivityReason $reason) => $this->translatableStringHelper->localize($reason->getCategory()->getName()),
'multiple' => true,
'expanded' => false
));
]);
}
public function validateForm($data, ExecutionContextInterface $context)
{
if ($data['reasons'] === null || count($data['reasons']) === 0) {
$context->buildViolation("At least one reason must be choosen")
$context
->buildViolation('At least one reason must be chosen')
->addViolation();
}
}
public function getTitle()
public function getTitle()
{
return 'Filter by reason';
}
public function addRole()
{
return new Role(ActivityStatsVoter::STATS);
}
public function describeAction($data, $format = 'string')
{
// collect all the reasons'name used in this filter in one array
$reasonsNames = array_map(
function(ActivityReason $r) {
return "\"".$this->translatableStringHelper->localize($r->getName())."\"";
},
$this->reasonRepository->findBy(array('id' => $data['reasons']->toArray()))
);
return array("Filtered by reasons: only %list%",
["%list%" => implode(", ", $reasonsNames)]);
fn(ActivityReason $r): string => '"' . $this->translatableStringHelper->localize($r->getName()) . '"',
$this->activityReasonRepository->findBy(array('id' => $data['reasons']->toArray()))
);
return [
'Filtered by reasons: only %list%',
[
'%list%' => implode(", ", $reasonsNames),
]
];
}
}

View File

@@ -1,67 +1,37 @@
<?php
/*
* Copyright (C) 2018 Champs-Libres <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Filter;
use Chill\ActivityBundle\Repository\ActivityTypeRepository;
use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Doctrine\ORM\Query\Expr;
use Symfony\Component\Security\Core\Role\Role;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\Expr\Join;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Chill\MainBundle\Export\ExportElementValidatedInterface;
use Chill\ActivityBundle\Entity\ActivityType;
/**
*
*
*/
class ActivityTypeFilter implements FilterInterface,
ExportElementValidatedInterface
class ActivityTypeFilter implements FilterInterface, ExportElementValidatedInterface
{
/**
*
* @var TranslatableStringHelper
*/
protected $translatableStringHelper;
/**
* The repository for activity reasons
*
* @var EntityRepository
*/
protected $typeRepository;
protected TranslatableStringHelperInterface $translatableStringHelper;
protected ActivityTypeRepository $activityTypeRepository;
public function __construct(
TranslatableStringHelper $helper,
EntityRepository $typeRepository
TranslatableStringHelperInterface $translatableStringHelper,
ActivityTypeRepository $activityTypeRepository
) {
$this->translatableStringHelper = $helper;
$this->typeRepository = $typeRepository;
$this->translatableStringHelper = $translatableStringHelper;
$this->activityTypeRepository = $activityTypeRepository;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$where = $qb->getDQLPart('where');
@@ -72,14 +42,14 @@ class ActivityTypeFilter implements FilterInterface,
} else {
$where = $qb->expr()->andX($clause);
}
$qb->add('where', $where);
$qb->setParameter('selected_activity_types', $data['types']);
}
/**
* Check if a join between Activity and Reason is already defined
*
*
* @param Join[] $joins
* @return boolean
*/
@@ -90,7 +60,7 @@ class ActivityTypeFilter implements FilterInterface,
return true;
}
}
return false;
}
@@ -101,48 +71,50 @@ class ActivityTypeFilter implements FilterInterface,
public function buildForm(FormBuilderInterface $builder)
{
//create a local copy of translatableStringHelper
$helper = $this->translatableStringHelper;
$builder->add('types', EntityType::class, array(
'class' => ActivityType::class,
'choice_label' => function (ActivityType $type) use ($helper) {
return $helper->localize($type->getName());
},
'multiple' => true,
'expanded' => false
));
$builder->add(
'types',
EntityType::class,
[
'class' => ActivityType::class,
'choice_label' => fn(ActivityType $type) => $this->translatableStringHelper->localize($type->getName()),
'multiple' => true,
'expanded' => false
]
);
}
public function validateForm($data, ExecutionContextInterface $context)
{
if ($data['types'] === null || count($data['types']) === 0) {
$context->buildViolation("At least one type must be choosen")
$context
->buildViolation('At least one type must be chosen')
->addViolation();
}
}
public function getTitle()
public function getTitle()
{
return 'Filter by activity type';
}
public function addRole()
{
return new Role(ActivityStatsVoter::STATS);
}
public function describeAction($data, $format = 'string')
{
// collect all the reasons'name used in this filter in one array
$reasonsNames = array_map(
function(ActivityType $t) {
return "\"".$this->translatableStringHelper->localize($t->getName())."\"";
},
$this->typeRepository->findBy(array('id' => $data['types']->toArray()))
);
return array("Filtered by activity type: only %list%",
["%list%" => implode(", ", $reasonsNames)]);
fn(ActivityType $t): string => '"' . $this->translatableStringHelper->localize($t->getName()) . '"',
$this->activityTypeRepository->findBy(['id' => $data['types']->toArray()])
);
return [
'Filtered by activity type: only %list%',
[
'%list%' => implode(", ", $reasonsNames),
]
];
}
}

View File

@@ -1,25 +1,14 @@
<?php
/*
* Copyright (C) 2017 Champs-Libres <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Filter;
use Chill\ActivityBundle\Repository\ActivityReasonRepository;
use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\Extension\Core\Type\DateType;
@@ -29,78 +18,58 @@ use Doctrine\ORM\Query\Expr;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Chill\ActivityBundle\Entity\ActivityReason;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\EntityManager;
use Chill\PersonBundle\Export\Declarations;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Chill\MainBundle\Export\ExportElementValidatedInterface;
/**
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class PersonHavingActivityBetweenDateFilter implements FilterInterface,
ExportElementValidatedInterface
class PersonHavingActivityBetweenDateFilter implements FilterInterface, ExportElementValidatedInterface
{
/**
*
* @var TranslatableStringHelper
*/
protected $translatableStringHelper;
/**
*
* @var EntityRepository
*/
protected $activityReasonRepository;
/**
*
* @var TranslatorInterface
*/
protected $translator;
protected TranslatableStringHelperInterface $translatableStringHelper;
protected ActivityReasonRepository $activityReasonRepository;
protected TranslatorInterface $translator;
public function __construct(
TranslatableStringHelper $translatableStringHelper,
EntityRepository $activityReasonRepository,
TranslatorInterface $translator
TranslatableStringHelper $translatableStringHelper,
ActivityReasonRepository $activityReasonRepository,
TranslatorInterface $translator
) {
$this->translatableStringHelper = $translatableStringHelper;
$this->activityReasonRepository = $activityReasonRepository;
$this->translator = $translator;
$this->translator = $translator;
}
public function addRole()
{
return null;
}
public function alterQuery(\Doctrine\ORM\QueryBuilder $qb, $data)
public function alterQuery(QueryBuilder $qb, $data)
{
// create a query for activity
$sqb = $qb->getEntityManager()->createQueryBuilder();
$sqb->select("person_person_having_activity.id")
->from("ChillActivityBundle:Activity", "activity_person_having_activity")
->join("activity_person_having_activity.person", "person_person_having_activity")
;
$sqb->select('person_person_having_activity.id')
->from('ChillActivityBundle:Activity', 'activity_person_having_activity')
->join('activity_person_having_activity.person', 'person_person_having_activity');
// add clause between date
$sqb->where("activity_person_having_activity.date BETWEEN "
. ":person_having_activity_between_date_from"
. " AND "
. ":person_having_activity_between_date_to");
$sqb->where('activity_person_having_activity.date BETWEEN '
. ':person_having_activity_between_date_from'
. ' AND '
. ':person_having_activity_between_date_to');
// add clause activity reason
$sqb->join('activity_person_having_activity.reasons',
'reasons_person_having_activity');
$sqb->join('activity_person_having_activity.reasons', 'reasons_person_having_activity');
$sqb->andWhere(
$sqb->expr()->in(
'reasons_person_having_activity',
":person_having_activity_reasons")
);
$sqb->expr()->in(
'reasons_person_having_activity', ':person_having_activity_reasons'
)
);
$where = $qb->getDQLPart('where');
$clause = $qb->expr()->in('person.id', $sqb->getDQL());
@@ -109,11 +78,11 @@ class PersonHavingActivityBetweenDateFilter implements FilterInterface,
} else {
$where = $qb->expr()->andX($clause);
}
$qb->add('where', $where);
$qb->setParameter('person_having_activity_between_date_from',
$qb->setParameter('person_having_activity_between_date_from',
$data['date_from']);
$qb->setParameter('person_having_activity_between_date_to',
$qb->setParameter('person_having_activity_between_date_to',
$data['date_to']);
$qb->setParameter('person_having_activity_reasons', $data['reasons']);
}
@@ -123,51 +92,45 @@ class PersonHavingActivityBetweenDateFilter implements FilterInterface,
return Declarations::PERSON_IMPLIED_IN;
}
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder)
public function buildForm(FormBuilderInterface $builder)
{
$builder->add('date_from', DateType::class, array(
'label' => "Implied in an activity after this date",
$builder->add('date_from', DateType::class, [
'label' => 'Implied in an activity after this date',
'data' => new \DateTime(),
'attr' => array('class' => 'datepicker'),
'attr' => ['class' => 'datepicker'],
'widget'=> 'single_text',
'format' => 'dd-MM-yyyy',
));
$builder->add('date_to', DateType::class, array(
'label' => "Implied in an activity before this date",
]);
$builder->add('date_to', DateType::class, [
'label' => 'Implied in an activity before this date',
'data' => new \DateTime(),
'attr' => array('class' => 'datepicker'),
'attr' => ['class' => 'datepicker'],
'widget'=> 'single_text',
'format' => 'dd-MM-yyyy',
));
$builder->add('reasons', EntityType::class, array(
'class' => 'ChillActivityBundle:ActivityReason',
'choice_label' => function (ActivityReason $reason) {
return $this->translatableStringHelper
->localize($reason->getName());
},
'group_by' => function(ActivityReason $reason) {
return $this->translatableStringHelper
->localize($reason->getCategory()->getName());
},
]);
$builder->add('reasons', EntityType::class, [
'class' => ActivityReason::class,
'choice_label' => fn (ActivityReason $reason): ?string => $this->translatableStringHelper->localize($reason->getName()),
'group_by' => fn(ActivityReason $reason): ?string => $this->translatableStringHelper->localize($reason->getCategory()->getName()),
'data' => $this->activityReasonRepository->findAll(),
'multiple' => true,
'expanded' => false,
'label' => "Activity reasons for those activities"
));
'label' => 'Activity reasons for those activities'
]);
$builder->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) {
/* @var $filterForm \Symfony\Component\Form\FormInterface */
/* @var FormInterface $filterForm */
$filterForm = $event->getForm()->getParent();
$enabled = $filterForm->get(FilterType::ENABLED_FIELD)->getData();
if ($enabled === true) {
// if the filter is enabled, add some validation
$form = $event->getForm();
$date_from = $form->get('date_from')->getData();
$date_to = $form->get('date_to')->getData();
// check that fields are not empty
if ($date_from === null) {
$form->get('date_from')->addError(new FormError(
@@ -178,8 +141,8 @@ class PersonHavingActivityBetweenDateFilter implements FilterInterface,
$form->get('date_to')->addError(new FormError(
$this->translator->trans('This field '
. 'should not be empty')));
}
}
// check that date_from is before date_to
if (
($date_from !== null && $date_to !== null)
@@ -194,35 +157,37 @@ class PersonHavingActivityBetweenDateFilter implements FilterInterface,
}
});
}
public function validateForm($data, ExecutionContextInterface $context)
{
if ($data['reasons'] === null || count($data['reasons']) === 0) {
$context->buildViolation("At least one reason must be choosen")
$context->buildViolation('At least one reason must be chosen')
->addViolation();
}
}
public function describeAction($data, $format = 'string')
{
return array(
"Filtered by person having an activity between %date_from% and "
. "%date_to% with reasons %reasons_name%",
array(
"%date_from%" => $data['date_from']->format('d-m-Y'),
return [
'Filtered by person having an activity between %date_from% and '
. '%date_to% with reasons %reasons_name%',
[
'%date_from%' => $data['date_from']->format('d-m-Y'),
'%date_to%' => $data['date_to']->format('d-m-Y'),
"%reasons_name%" => implode(", ", array_map(
function (ActivityReason $r) {
return '"'.$this->translatableStringHelper->
localize($r->getName()).'"';
},
$data['reasons']))
));
'%reasons_name%' => implode(
", ",
array_map(
fn(ActivityReason $r): string => '"' . $this->translatableStringHelper->localize($r->getName()) . '"',
$data['reasons']
)
)
]
];
}
public function getTitle()
{
return "Filtered by person having an activity in a period";
return 'Filtered by person having an activity in a period';
}
}

View File

@@ -6,6 +6,7 @@ use Chill\ActivityBundle\Entity\Activity;
use Chill\ActivityBundle\Entity\ActivityPresence;
use Chill\ActivityBundle\Entity\ActivityReason;
use Chill\DocStoreBundle\Form\StoredObjectType;
use Chill\MainBundle\Entity\Location;
use Chill\MainBundle\Form\Type\ChillCollectionType;
use Chill\MainBundle\Form\Type\CommentType;
use Chill\PersonBundle\Entity\Person;
@@ -93,15 +94,13 @@ class ActivityType extends AbstractType
/** @var \Chill\ActivityBundle\Entity\ActivityType $activityType */
$activityType = $options['activityType'];
if (!$activityType->isActive()) {
throw new \InvalidArgumentException('Activity type must be active');
}
// TODO revoir la gestion des center au niveau du form des activité.
if ($options['center']) {
$builder->add('scope', ScopePickerType::class, [
'center' => $options['center'],
'role' => $options['role']
'role' => $options['role'],
// TODO make required again once scope and rights are fixed
'required' => false
]);
}
@@ -224,7 +223,7 @@ class ActivityType extends AbstractType
if ($activityType->isVisible('comment')) {
$builder->add('comment', CommentType::class, [
'label' => empty($activityType->getLabel('comment'))
'label' => empty($activityType->getLabel('comment'))
? 'activity.comment' : $activityType->getLabel('comment'),
'required' => $activityType->isRequired('comment'),
]);
@@ -304,6 +303,23 @@ class ActivityType extends AbstractType
;
}
if ($activityType->isVisible('location')) {
$builder->add('location', HiddenType::class)
->get('location')
->addModelTransformer(new CallbackTransformer(
function (?Location $location): string {
if (null === $location) {
return '';
}
return $location->getId();
},
function (?string $id): ?Location {
return $this->om->getRepository(Location::class)->findOneBy(['id' => (int) $id]);
}
))
;
}
if ($activityType->isVisible('emergency')) {
$builder->add('emergency', CheckboxType::class, [
'label' => $activityType->getLabel('emergency'),

View File

@@ -1,56 +1,29 @@
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Form\Type;
use Chill\ActivityBundle\Repository\ActivityTypeRepository;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Doctrine\ORM\EntityRepository;
use Chill\ActivityBundle\Entity\ActivityType;
/**
* Description of TranslatableActivityType
*
* @author Champs-Libres Coop
*/
class TranslatableActivityType extends AbstractType
{
protected TranslatableStringHelperInterface $translatableStringHelper;
/**
*
* @var TranslatableStringHelper
*/
protected $translatableStringHelper;
protected $activityTypeRepository;
protected ActivityTypeRepository $activityTypeRepository;
public function __construct(
TranslatableStringHelper $helper,
EntityRepository $activityTypeRepository
)
{
TranslatableStringHelperInterface $helper,
ActivityTypeRepository $activityTypeRepository
) {
$this->translatableStringHelper = $helper;
$this->activityTypeRepository = $activityTypeRepository;
}
@@ -65,22 +38,21 @@ class TranslatableActivityType extends AbstractType
return EntityType::class;
}
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder, array $options) {
/* @var $qb \Doctrine\ORM\QueryBuilder */
public function buildForm(FormBuilderInterface $builder, array $options) {
/* @var QueryBuilder $qb */
$qb = $options['query_builder'];
if ($options['active_only'] === true) {
$qb->where($qb->expr()->eq('at.active', ':active'));
$qb->setParameter('active', true, \Doctrine\DBAL\Types\Type::BOOLEAN);
$qb->setParameter('active', true, Types::BOOLEAN);
}
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
array(
'class' => 'ChillActivityBundle:ActivityType',
'class' => ActivityType::class,
'active_only' => true,
'query_builder' => $this->activityTypeRepository
->createQueryBuilder('at'),

View File

@@ -2,29 +2,27 @@
namespace Chill\ActivityBundle\Menu;
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
{
protected TokenStorageInterface $tokenStorage;
protected AuthorizationHelper $authorizationHelper;
protected TranslatorInterface $translator;
protected Security $security;
public function __construct(
TokenStorageInterface $tokenStorage,
AuthorizationHelper $authorizationHelper,
Security $security,
TranslatorInterface $translator
) {
$this->security = $security;
$this->translator = $translator;
$this->authorizationHelper = $authorizationHelper;
$this->tokenStorage = $tokenStorage;
}
public static function getMenuIds(): array
{
@@ -35,7 +33,8 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
{
$period = $parameters['accompanyingCourse'];
if (AccompanyingPeriod::STEP_DRAFT !== $period->getStep()) {
if (AccompanyingPeriod::STEP_DRAFT !== $period->getStep()
&& $this->security->isGranted(ActivityVoter::SEE, $period)) {
$menu->addChild($this->translator->trans('Activity'), [
'route' => 'chill_activity_activity_list',
'routeParameters' => [

View File

@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
namespace Chill\ActivityBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Security;
final class AdminMenuBuilder implements LocalMenuBuilderInterface
{
private Security $security;
public function __construct(Security $security)
{
$this->security = $security;
}
public static function getMenuIds(): array
{
return ['admin_index', 'admin_section', 'admin_activity'];
}
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
if (!$this->security->isGranted('ROLE_ADMIN')) {
return;
}
if (in_array($menuId, ['admin_index', 'admin_section'])) {
$menu->addChild('Activities', [
'route' => 'chill_admin_activity_index'
])
->setExtras([
'order' => 2000,
'explain' => "Activity configuration"
]);
} else {
$menu
->addChild('Activities', [
'route' => 'chill_admin_activity_index'
])
->setExtras([
'order' => '60'
]);
}
}
}

View File

@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace Chill\ActivityBundle\Repository;
use Chill\ActivityBundle\Entity\ActivityReasonCategory;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method ActivityReasonCategory|null find($id, $lockMode = null, $lockVersion = null)
* @method ActivityReasonCategory|null findOneBy(array $criteria, array $orderBy = null)
* @method ActivityReasonCategory[] findAll()
* @method ActivityReasonCategory[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ActivityReasonCategoryRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, ActivityReasonCategory::class);
}
}

View File

@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace Chill\ActivityBundle\Repository;
use Chill\ActivityBundle\Entity\ActivityReason;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method ActivityReason|null find($id, $lockMode = null, $lockVersion = null)
* @method ActivityReason|null findOneBy(array $criteria, array $orderBy = null)
* @method ActivityReason[] findAll()
* @method ActivityReason[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ActivityReasonRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, ActivityReason::class);
}
}

View File

@@ -1,24 +1,6 @@
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2021, Champs Libres Cooperative SCRLFS,
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Repository;
@@ -29,10 +11,10 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method AccompanyingPeriodParticipation|null find($id, $lockMode = null, $lockVersion = null)
* @method AccompanyingPeriodParticipation|null findOneBy(array $criteria, array $orderBy = null)
* @method AccompanyingPeriodParticipation[] findAll()
* @method AccompanyingPeriodParticipation[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
* @method Activity|null find($id, $lockMode = null, $lockVersion = null)
* @method Activity|null findOneBy(array $criteria, array $orderBy = null)
* @method Activity[] findAll()
* @method Activity[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ActivityRepository extends ServiceEntityRepository
{
@@ -42,12 +24,7 @@ class ActivityRepository extends ServiceEntityRepository
}
/**
* @param $person
* @param array $scopes
* @param string[] $orderBy
* @param int $limit
* @param int $offset
* @return array|Activity[]
* @return Activity[]
*/
public function findByPersonImplied(Person $person, array $scopes, ?array $orderBy = [ 'date' => 'DESC'], ?int $limit = 100, ?int $offset = 0): array
{
@@ -63,8 +40,7 @@ class ActivityRepository extends ServiceEntityRepository
':person MEMBER OF a.persons'
)
)
->setParameter('person', $person)
;
->setParameter('person', $person);
foreach ($orderBy as $k => $dir) {
$qb->addOrderBy('a.'.$k, $dir);
@@ -72,17 +48,11 @@ class ActivityRepository extends ServiceEntityRepository
$qb->setMaxResults($limit)->setFirstResult($offset);
return $qb->getQuery()
->getResult();
return $qb->getQuery()->getResult();
}
/**
* @param AccompanyingPeriod $period
* @param array $scopes
* @param int|null $limit
* @param int|null $offset
* @param array|string[] $orderBy
* @return array|Activity[]
* @return Activity[]
*/
public function findByAccompanyingPeriod(AccompanyingPeriod $period, array $scopes, ?bool $allowNullScope = false, ?int $limit = 100, ?int $offset = 0, array $orderBy = ['date' => 'desc']): array
{
@@ -92,8 +62,7 @@ class ActivityRepository extends ServiceEntityRepository
if (!$allowNullScope) {
$qb
->where($qb->expr()->in('a.scope', ':scopes'))
->setParameter('scopes', $scopes)
;
->setParameter('scopes', $scopes);
} else {
$qb
->where(
@@ -102,16 +71,14 @@ class ActivityRepository extends ServiceEntityRepository
$qb->expr()->isNull('a.scope')
)
)
->setParameter('scopes', $scopes)
;
->setParameter('scopes', $scopes);
}
$qb
->andWhere(
$qb->expr()->eq('a.accompanyingPeriod', ':period')
)
->setParameter('period', $period)
;
->setParameter('period', $period);
foreach ($orderBy as $k => $dir) {
$qb->addOrderBy('a.'.$k, $dir);
@@ -119,7 +86,6 @@ class ActivityRepository extends ServiceEntityRepository
$qb->setMaxResults($limit)->setFirstResult($offset);
return $qb->getQuery()
->getResult();
return $qb->getQuery()->getResult();
}
}

View File

@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace Chill\ActivityBundle\Repository;
use Chill\ActivityBundle\Entity\ActivityTypeCategory;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method ActivityTypeCategory|null find($id, $lockMode = null, $lockVersion = null)
* @method ActivityTypeCategory|null findOneBy(array $criteria, array $orderBy = null)
* @method ActivityTypeCategory[] findAll()
* @method ActivityTypeCategory[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ActivityTypeCategoryRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, ActivityTypeCategory::class);
}
}

View File

@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace Chill\ActivityBundle\Repository;
use Chill\ActivityBundle\Entity\ActivityType;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method ActivityType|null find($id, $lockMode = null, $lockVersion = null)
* @method ActivityType|null findOneBy(array $criteria, array $orderBy = null)
* @method ActivityType[] findAll()
* @method ActivityType[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ActivityTypeRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, ActivityType::class);
}
}

View File

@@ -1,7 +1,9 @@
// Access to Bootstrap variables and mixins
@import '~ChillMainAssets/module/bootstrap/shared';
// activity creation first step: select type page
//// ACTIVITY CREATION
// first step: select type page
div.new-activity-select-type {
div.activity-row {
display: flex;
@@ -21,91 +23,36 @@ div.new-activity-select-type {
}
}
// exceptions for flex-table in list-records
div.activity-list {
div.flex-table {
div.item-bloc {
div.item-row.main {
div.item-col {
&:first-child {
flex-basis: 15%;
}
ul.list-content {
li.social-issues, li.social-actions {
.badge-primary {
font-variant: small-caps;
font-weight: bold;
font-size: 88%;
margin-bottom: 0.2em;
}
}
li.social-issues .badge-primary {
background-color: $orange;
}
li.social-actions .badge-primary {
background-color: $green;
}
}
}
}
div.item-row.comment {
margin-left: 15%;
blockquote.chill-user-quote {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
}
div.item-row.details {
margin-left: 15%;
//// ACTIVITY LIST PAGE
// precise badge-title specific details
// override flex-bloc to adapt in list
// TODO refund this
div.accompanyingCourse.flex-bloc.concerned-groups {
margin: 0;
width: 100%;
justify-content: space-around;
div.item-bloc {
box-shadow: unset;
padding: 0;
flex-basis: 25%;
div.item-row {
flex-direction: column;
div.item-col {
&:first-child {
width: unset;
}
&:last-child {
border-top: 0;
margin-top: 0;
padding-top: 0;
ul.list-content {
padding: 0;
}
}
}
}
}
h2.badge-title {
div.duration {
font-size: smaller;
padding-left: 1em;
margin-top: 1em;
}
ul.list-content {
font-size: 70%;
list-style-type: none;
padding-left: 0;
margin: 0;
li {
margin-bottom: 0.2em;
// exception: change bg color for action badges above badge-title
.bg-light {
background-color: $chill-light-gray !important;
}
}
ul.list-content {
list-style-type: none;
padding-left: 1em;
margin: 0 0;
li {
margin-bottom: 0.2em;
}
}
}
div.duration {
font-size: smaller;
padding-left: 1em;
margin-top: 1em;
}
}
}
}
}
div.main {
padding: 1em;
}
// exceptions for flex-bloc in concerned-groups
//// ACTIVITY SHOW AND FORM PAGES
// Exceptions for flex-bloc in concerned-groups
div.flex-bloc.concerned-groups {
margin-top: 1em;
div.item-bloc {
@@ -130,7 +77,6 @@ div.flex-bloc.concerned-groups {
}
}
/// CHILL ENTITY RENDER BOX
.chill-entity {

View File

@@ -1,17 +1,20 @@
<template>
<concerned-groups></concerned-groups>
<social-issues-acc></social-issues-acc>
<location></location>
</template>
<script>
import ConcernedGroups from './components/ConcernedGroups.vue';
import SocialIssuesAcc from './components/SocialIssuesAcc.vue';
import Location from './components/Location.vue';
export default {
name: "App",
components: {
ConcernedGroups,
SocialIssuesAcc
SocialIssuesAcc,
Location
}
}
</script>

View File

@@ -3,16 +3,61 @@ import { getSocialIssues } from 'ChillPersonAssets/vuejs/AccompanyingCourse/api.
/*
* Load socialActions by socialIssue (id)
*/
const getSocialActionByIssue = (id) => {
const getSocialActionByIssue = (id) => {
const url = `/api/1.0/person/social/social-action/by-social-issue/${id}.json`;
return fetch(url)
.then(response => {
if (response.ok) { return response.json(); }
throw Error('Error with request resource response');
throw Error('Error with request resource response');
});
};
/*
* Load Locations
*/
const getLocations = () => {
const url = `/api/1.0/main/location.json`;
return fetch(url)
.then(response => {
if (response.ok) { return response.json(); }
throw Error('Error with request resource response');
});
};
/*
* Load Location Types
*/
const getLocationTypes = () => {
const url = `/api/1.0/main/location-type.json`;
return fetch(url)
.then(response => {
if (response.ok) { return response.json(); }
throw Error('Error with request resource response');
});
};
/*
* Post a Location
*/
const postLocation = (body) => {
const url = `/api/1.0/main/location.json`;
return fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=utf-8'
},
body: JSON.stringify(body)
})
.then(response => {
if (response.ok) { return response.json(); }
throw Error('Error with request resource response');
});
};
export {
getSocialIssues,
getSocialActionByIssue
getSocialActionByIssue,
getLocations,
getLocationTypes,
postLocation
};

View File

@@ -11,9 +11,12 @@
</div>
<div v-if="getContext === 'accompanyingCourse' && filterSuggestedPersons.length > 0">
<ul>
<ul class="list-unstyled">
<li v-for="p in filterSuggestedPersons" @click="addNewPerson(p)">
{{ p.text }}
<span class="badge bg-primary" style="cursor: pointer;">
<i class="fa fa-plus fa-fw text-success"></i>
{{ p.text }}
</span>
</li>
</ul>
</div>
@@ -73,9 +76,12 @@ export default {
addPersons: {
key: 'activity',
options: {
type: ['person', 'thirdparty', 'user'], // TODO add 'user'
type: ['person', 'thirdparty', 'user'],
priority: null,
uniq: false,
button: {
size: 'btn-sm'
}
}
}
}

View File

@@ -4,7 +4,7 @@
<span class="chill_denomination">
{{ textCutted }}
</span>
<a class="fa fa-fw fa-times"
<a class="fa fa-fw fa-times text-danger text-decoration-none"
@click.prevent="$emit('remove', person)">
</a>
</span>

View File

@@ -0,0 +1,74 @@
<template>
<teleport to="#location">
<div class="mb-3 row">
<label class="col-form-label col-sm-4">
{{ $t('activity.location') }}
</label>
<div class="col-sm-8">
<VueMultiselect
name="selectLocation"
id="selectLocation"
label="name"
track-by="id"
open-direction="top"
:multiple="false"
:searchable="true"
:placeholder="$t('activity.choose_location')"
:custom-label="customLabel"
:options="locations"
v-model="location">
</VueMultiselect>
<new-location v-bind:locations="locations"></new-location>
</div>
</div>
</teleport>
</template>
<script>
import { mapState } from "vuex";
import VueMultiselect from 'vue-multiselect';
import NewLocation from './Location/NewLocation.vue';
import { getLocations } from '../api.js';
export default {
name: "Location",
components: {
NewLocation,
VueMultiselect
},
data() {
return {
locations: []
}
},
computed: {
...mapState(['activity']),
location: {
get() {
return this.activity.location;
},
set(value) {
this.$store.dispatch('updateLocation', value);
}
}
},
mounted() {
this.getLocationsList();
},
methods: {
getLocationsList() {
getLocations().then(response => new Promise(resolve => {
console.log('getLocations', response);
this.locations = response.results;
resolve();
}))
},
customLabel(value) {
return `${value.locationType.title.fr} ${value.name ? value.name : ''}`;
}
}
}
</script>

View File

@@ -0,0 +1,271 @@
<template>
<div>
<ul class="record_actions">
<li>
<a class="btn btn-sm btn-create" @click="openModal">
{{ $t('activity.create_new_location') }}
</a>
</li>
</ul>
<teleport to="body">
<modal v-if="modal.showModal"
:modalDialogClass="modal.modalDialogClass"
@close="modal.showModal = false">
<template v-slot:header>
<h3 class="modal-title">{{ $t('activity.create_new_location') }}</h3>
</template>
<template v-slot:body>
<form>
<div class="form-floating mb-3">
<p v-if="errors.length">
<b>{{ $t('activity.errors') }}</b>
<ul>
<li v-for="error in errors" :key="error">{{ error }}</li>
</ul>
</p>
</div>
<div class="form-floating mb-3">
<select class="form-select form-select-lg" id="type" required v-model="selectType">
<option selected disabled value="">{{ $t('activity.choose_location_type') }}</option>
<option v-for="t in locationTypes" :value="t" :key="t.id">
{{ t.title.fr }}
</option>
</select>
<label>{{ $t('activity.location_fields.type') }}</label>
</div>
<div class="form-floating mb-3">
<input class="form-control form-control-lg" id="name" v-model="inputName" placeholder />
<label for="name">{{ $t('activity.location_fields.name') }}</label>
</div>
<add-address
:context="addAddress.context"
:options="addAddress.options"
:addressChangedCallback="submitNewAddress"
v-if="showAddAddress"
ref="addAddress">
</add-address>
<div class="form-floating mb-3" v-if="showContactData">
<input class="form-control form-control-lg" id="phonenumber1" v-model="inputPhonenumber1" placeholder />
<label for="phonenumber1">{{ $t('activity.location_fields.phonenumber1') }}</label>
</div>
<div class="form-floating mb-3" v-if="hasPhonenumber1">
<input class="form-control form-control-lg" id="phonenumber2" v-model="inputPhonenumber2" placeholder />
<label for="phonenumber2">{{ $t('activity.location_fields.phonenumber2') }}</label>
</div>
<div class="form-floating mb-3" v-if="showContactData">
<input class="form-control form-control-lg" id="email" v-model="inputEmail" placeholder />
<label for="email">{{ $t('activity.location_fields.email') }}</label>
</div>
</form>
</template>
<template v-slot:footer>
<button class="btn btn-save"
@click.prevent="saveNewLocation"
>
{{ $t('action.save') }}
</button>
</template>
</modal>
</teleport>
</div>
</template>
<script>
import Modal from 'ChillMainAssets/vuejs/_components/Modal.vue';
import AddAddress from "ChillMainAssets/vuejs/Address/components/AddAddress.vue";
import { mapState } from "vuex";
import { getLocationTypes, postLocation } from "../../api";
export default {
name: "NewLocation",
components: {
Modal,
AddAddress,
},
props: ['locations'],
data() {
return {
errors: [],
selected: {
type: null,
name: null,
addressId: null,
phonenumber1: null,
phonenumber2: null,
email: null,
},
locationTypes: [],
modal: {
showModal: false,
modalDialogClass: "modal-dialog-scrollable modal-xl"
},
addAddress: {
options: {
button: {
text: { create: 'activity.create_address', edit: 'activity.edit_address' },
size: 'btn-sm'
},
title: { create: 'activity.create_address', edit: 'activity.edit_address' },
},
context: {
target: { //name, id
},
edit: false,
addressId: null
}
}
}
},
computed: {
...mapState(['activity']),
selectType: {
get() {
return this.selected.type;
},
set(value) {
this.selected.type = value;
}
},
inputName: {
get() {
return this.selected.name;
},
set(value) {
this.selected.name = value;
}
},
inputEmail: {
get() {
return this.selected.email;
},
set(value) {
this.selected.email = value;
}
},
inputPhonenumber1: {
get() {
return this.selected.phonenumber1;
},
set(value) {
this.selected.phonenumber1 = value;
}
},
inputPhonenumber2: {
get() {
return this.selected.phonenumber2;
},
set(value) {
this.selected.phonenumber2 = value;
}
},
hasPhonenumber1() {
return this.selected.phonenumber1 !== null && this.selected.phonenumber1 !== "";
},
showAddAddress() {
let cond = false;
if (this.selected.type) {
if (this.selected.type.addressRequired !== 'never') {
cond = true;
}
}
return cond;
},
showContactData() {
let cond = false;
if (this.selected.type) {
if (this.selected.type.contactData !== 'never') {
cond = true;
}
}
return cond;
},
},
mounted() {
this.getLocationTypesList();
},
methods: {
checkForm() {
let cond = true;
this.errors = [];
if (!this.selected.type) {
this.errors.push('Type de localisation requis');
cond = false;
} else {
if (this.selected.type.addressRequired === 'required' && !this.selected.addressId) {
this.errors.push('Adresse requise');
cond = false;
}
if (this.selected.type.contactData === 'required' && !this.selected.phonenumber1) {
this.errors.push('Numéro de téléphone requis');
cond = false;
}
if (this.selected.type.contactData === 'required' && !this.selected.email) {
this.errors.push('Adresse email requise');
cond = false;
}
}
return cond;
},
getLocationTypesList() {
getLocationTypes().then(response => new Promise(resolve => {
console.log('getLocationTypes', response);
this.locationTypes = response.results.filter(t => t.availableForUsers === true);
resolve();
}))
},
openModal() {
this.modal.showModal = true;
},
saveNewLocation() {
if (this.checkForm()) {
console.log('saveNewLocation', this.selected);
let body = {
type: 'location',
name: this.selected.name,
locationType: {
id: this.selected.type.id,
type: 'location-type'
},
phonenumber1: this.selected.phonenumber1,
phonenumber2: this.selected.phonenumber2,
email: this.selected.email,
};
if (this.selected.addressId) {
body = Object.assign(body, {
address: {
id: this.selected.addressId
}
});
}
postLocation(body)
.then(
location => new Promise(resolve => {
console.log('postLocation', location);
this.locations.push(location);
this.$store.dispatch('updateLocation', location);
resolve();
this.modal.showModal = false;
})
).catch(
err => {
this.errors.push(err.message);
}
);
};
},
submitNewAddress(payload) {
console.log('submitNewAddress', payload);
this.selected.addressId = payload.addressId;
this.addAddress.context.addressId = payload.addressId;
this.addAddress.context.edit = true;
}
}
}
</script>

View File

@@ -1,12 +1,12 @@
<template>
<teleport to="#social-issues-acc">
<div class="mb-3 row">
<div class="col-4">
<label class="col-form-label">{{ $t('activity.social_issues') }}</label>
</div>
<div class="col-8">
<check-social-issue
v-for="issue in socialIssuesList"
v-bind:key="issue.id"
@@ -14,7 +14,7 @@
v-bind:selection="socialIssuesSelected"
@updateSelected="updateIssuesSelected">
</check-social-issue>
<div class="my-3">
<VueMultiselect
name="otherIssues"
@@ -28,16 +28,15 @@
v-bind:taggable="false"
v-bind:multiple="false"
v-bind:searchable="true"
v-bind:allow-empty="true"
v-bind:allow-empty="true"
v-bind:show-labels="false"
v-bind:loading="issueIsLoading"
v-bind:placeholder="$t('activity.choose_other_social_issue')"
v-bind:options="socialIssuesOther"
v-model="value"
@select="addIssueInList">
</VueMultiselect>
</div>
</div>
</div>
@@ -46,11 +45,11 @@
<label class="col-form-label">{{ $t('activity.social_actions') }}</label>
</div>
<div class="col-8">
<div v-if="actionIsLoading === true">
<i class="chill-green fa fa-circle-o-notch fa-spin fa-lg"></i>
</div>
<check-social-action
v-if="socialIssuesSelected.length || socialActionsSelected.length"
v-for="action in socialActionsList"
@@ -59,19 +58,18 @@
v-bind:selection="socialActionsSelected"
@updateSelected="updateActionsSelected">
</check-social-action>
<span v-else class="inline-choice chill-no-data-statement mt-3">
{{ $t('activity.select_first_a_social_issue') }}
</span>
</div>
</div>
</teleport>
</template>
<script>
import { readonly } from 'vue';
import VueMultiselect from 'vue-multiselect';
import CheckSocialIssue from './SocialIssuesAcc/CheckSocialIssue.vue';
import CheckSocialAction from './SocialIssuesAcc/CheckSocialAction.vue';
@@ -113,7 +111,7 @@ export default {
this.issueIsLoading = true;
getSocialIssues().then(response => new Promise((resolve, reject) => {
this.$store.commit('updateIssuesOther', response.results);
/* Add in list the issues already associated (if not yet listed)
*/
this.socialIssuesSelected.forEach(issue => {
@@ -121,34 +119,34 @@ export default {
this.$store.commit('addIssueInList', issue);
}
}, this);
/* Remove from multiselect the issues that are not yet in checkbox list
*/
this.socialIssuesList.forEach(issue => {
this.$store.commit('removeIssueInOther', issue);
}, this);
/* Filter issues
*/
this.$store.commit('filterList', 'issues');
/* Add in list the actions already associated (if not yet listed)
*/
this.socialActionsSelected.forEach(action => {
this.$store.commit('addActionInList', action);
}, this);
/* Filter issues
*/
this.$store.commit('filterList', 'actions');
this.issueIsLoading = false;
resolve();
}));
}));
},
methods: {
/* When choosing an issue in multiselect, add it in checkboxes (as selected),
/* When choosing an issue in multiselect, add it in checkboxes (as selected),
remove it from multiselect, and add socialActions concerned
*/
addIssueInList(value) {
@@ -171,30 +169,30 @@ export default {
//console.log('updateActionsSelected', actions);
this.$store.dispatch('updateActionsSelected', actions);
},
/* Add socialActions concerned: after reset, loop on each issue selected
/* Add socialActions concerned: after reset, loop on each issue selected
to get social actions concerned
*/
updateActionsList() {
//console.log('updateActionsList');
this.resetActionsList();
this.socialIssuesSelected.forEach(item => {
this.actionIsLoading = true;
getSocialActionByIssue(item.id)
.then(actions => new Promise((resolve, reject) => {
actions.results.forEach(action => {
this.$store.commit('addActionInList', action);
}, this);
this.$store.commit('filterList', 'actions');
this.actionIsLoading = false;
resolve();
}));
}, this);
},
/* Reset socialActions List: flush list and restore selected actions
/* Reset socialActions List: flush list and restore selected actions
*/
resetActionsList() {
this.$store.commit('resetActionsList');
@@ -207,7 +205,7 @@ export default {
</script>
<style src="vue-multiselect/dist/vue-multiselect.css"></style>
<style lang="scss">
<style lang="scss" scoped>
span.multiselect__single {
display: none !important;
}

View File

@@ -1,14 +1,15 @@
import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n'
const appMessages = {
const activityMessages = {
fr: {
activity: {
//
errors: "Le formulaire contient des erreurs",
social_issues: "Problématiques sociales",
choose_other_social_issue: "Ajouter une autre problématique sociale...",
social_actions: "Actions d'accompagnement",
select_first_a_social_issue: "Sélectionnez d'abord une problématique sociale",
//
add_persons: "Ajouter des personnes concernées",
bloc_persons: "Usagers",
@@ -16,12 +17,28 @@ const appMessages = {
bloc_persons_not_associated: "Tiers non-pro.",
bloc_thirdparty: "Tiers professionnels",
bloc_users: "T(M)S",
//
location: "Localisation",
choose_location: "Choisissez une localisation",
choose_location_type: "Choisissez un type de localisation",
create_new_location: "Créer une nouvelle localisation",
location_fields: {
name: "Nom",
type: "Type",
phonenumber1: "Téléphone",
phonenumber2: "Autre téléphone",
email: "Adresse courriel",
},
create_address: 'Créer une adresse',
edit_address: "Modifier l'adresse"
}
}
}
Object.assign(appMessages.fr, personMessages.fr);
Object.assign(activityMessages.fr, personMessages.fr);
export {
appMessages
activityMessages
};

View File

@@ -1,11 +1,11 @@
import { createApp } from 'vue';
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n'
import { appMessages } from './i18n'
import { activityMessages } from './i18n'
import store from './store'
import App from './App.vue';
const i18n = _createI18n(appMessages);
const i18n = _createI18n(activityMessages);
const app = createApp({
template: `<app></app>`,

View File

@@ -114,6 +114,10 @@ const store = createStore({
state.activity.users = state.activity.users.filter(user => user !== payload);
break;
};
},
updateLocation(state, value) {
console.log('### mutation: updateLocation', value);
state.activity.location = value;
}
},
actions: {
@@ -173,6 +177,12 @@ const store = createStore({
break;
};
commit('removePersonInvolved', payload);
},
updateLocation({ commit }, value) {
console.log('### action: updateLocation', value);
let hiddenLocation = document.getElementById("chill_activitybundle_activity_location");
hiddenLocation.value = value.id;
commit('updateLocation', value);
}
}
});

View File

@@ -0,0 +1,90 @@
<h2 class="badge-title">
<span class="title_label">
{% if activity.date %}
<h3>{{ activity.date|format_date('short') }}</h3>
{% endif %}
<div class="duration">
{% if activity.durationTime and t.durationTimeVisible %}
<p>
<abbr class="fa fa-fw fa-hourglass-end" title="{{ 'Duration Time'|trans }}"></abbr>
{{ activity.durationTime|date('H:i') }}
</p>
{% endif %}
{% if activity.travelTime and t.travelTimeVisible %}
<p>
<abbr class="fa fa-fw fa-car" title="{{ 'Travel time'|trans }}"></abbr>
{{ activity.travelTime|date('H:i') }}
</p>
{% endif %}
</div>
</span>
<span class="title_action">
{{ activity.type.name | localize_translatable_string }}
<ul class="small_in_title">
{% if activity.location and t.locationVisible %}
<li>
<span class="item-key">{{ 'location'|trans ~ ': ' }}</span>
<span>{{ activity.location.locationType.title|localize_translatable_string }}</span>
{{ activity.location.name }}
</li>
{% endif %}
{% if activity.user and t.userVisible %}
<li>
<span class="item-key">{{ 'Referrer'|trans ~ ': ' }}</span>
{{ activity.user.usernameCanonical }}
</li>
{% endif %}
</ul>
<ul class="list-content">
{%- if t.reasonsVisible -%}
{%- if activity.reasons is not empty -%}
<li class="reasons">
{% for r in activity.reasons %}
{{ r|chill_entity_render_box }}
{% endfor %}
</li>
{%- endif -%}
{% endif %}
{%- if t.socialIssuesVisible %}
{%- if activity.socialIssues is not empty -%}
<li class="social-issues">
{% for r in activity.socialIssues %}
{{ r|chill_entity_render_box }}
{% endfor %}
</li>
{%- endif -%}
{% endif %}
{%- if t.socialActionsVisible -%}
{%- if activity.socialActions is not empty -%}
<li class="social-actions">
{% for r in activity.socialActions %}
{{ r|chill_entity_render_box }}
{% endfor %}
</li>
{%- endif -%}
{% endif %}
</ul>
</span>
</h2>
{#
{% if context == 'person' and activity.accompanyingPeriod is not empty %}
<div class="mt-3">
<a class="btn btn-sm btn-outline-primary"
title="{{ 'Period number %number%'|trans({'%number%': activity.accompanyingPeriod.id}) }}"
href="{{ chill_path_add_return_path(
"chill_person_accompanying_course_index",
{ 'accompanying_period_id': activity.accompanyingPeriod.id }
) }}"><i class="fa fa-random"></i>
</a>
</div>
{% endif %}
#}

View File

@@ -5,17 +5,17 @@
{% if context == 'person' %}
{% set blocs = [
{ 'title': 'Others persons'|trans,
{ 'title': 'Others persons'|trans,
'items': entity.persons,
'path' : 'chill_person_view',
'key' : 'person_id'
},
{ 'title': 'Third parties'|trans,
{ 'title': 'Third parties'|trans,
'items': entity.thirdParties,
'path' : 'chill_3party_3party_show',
'key' : 'thirdparty_id'
},
{ 'title': 'Users concerned'|trans,
{ 'title': 'Users concerned'|trans,
'items': entity.users,
'path' : 'admin_user_show',
'key' : 'id'
@@ -23,24 +23,23 @@
] %}
{% else %}
{% set blocs = [
{ 'title': 'Persons in accompanying course'|trans,
{ 'title': 'Persons in accompanying course'|trans,
'items': entity.personsAssociated,
'path' : 'chill_person_view',
'key' : 'person_id'
},
{ 'title': 'Third persons'|trans,
{ 'title': 'Third persons'|trans,
'items': entity.personsNotAssociated,
'path' : 'chill_person_view',
'key' : 'person_id'
},
{ 'title': 'Third parties'|trans,
{ 'title': 'Third parties'|trans,
'items': entity.thirdParties,
'path' : 'chill_3party_3party_show',
'key' : 'thirdparty_id'
},
{ 'title': 'Users concerned'|trans,
{ 'title': 'Users concerned'|trans,
'items': entity.users,
'path' : 'admin_user_show',
'key' : 'id'
},
] %}
@@ -58,6 +57,7 @@
<ul class="list-content">
{% for item in bloc.items %}
<li>
{% if bloc.path is defined %}
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
<span class="{% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}">
{{ item|chill_entity_render_box({
@@ -66,6 +66,14 @@
}) }}
</span>
</a>
{% else %}
<span class="{% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}">
{{ item|chill_entity_render_box({
'render': 'raw',
'addAltNames': false
}) }}
</span>
{% endif %}
</li>
{% endfor %}
</ul>
@@ -85,6 +93,7 @@
<ul class="list-content">
{% for item in bloc.items %}
<li>
{% if bloc.path is defined %}
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
<span class="{% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}">
{{ item|chill_entity_render_box({
@@ -93,6 +102,12 @@
}) }}
</span>
</a>
{% else %}
{{ item|chill_entity_render_box({
'render': 'raw',
'addAltNames': false
}) }}
{% endif %}
</li>
{% endfor %}
</ul>
@@ -101,3 +116,38 @@
{% endfor %}
</div>
{% endif %}
{% if (with_display == 'wrap-list') %}
<div class="concerned-groups wrap-list">
{% for bloc in blocs %}
<div class="wl-row">
{% if bloc.items|length > 0 %}
<div class="wl-col title">
<h4>{{ bloc.title }}</h4>
</div>
<div class="wl-col list">
{% for item in bloc.items %}
<span class="wl-item {% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}">
{% if bloc.path is defined %}
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
{{ item|chill_entity_render_box({
'render': 'raw',
'addAltNames': false
}) }}
</a>
{% else %}
{{ item|chill_entity_render_box({
'render': 'raw',
'addAltNames': false
}) }}
{% endif %}
</span>
{% endfor %}
</div>
{% endif %}
</div>
{% endfor %}
</div>
{% endif %}

View File

@@ -10,7 +10,7 @@
'title' : 'Remove activity'|trans,
'confirm_question' : 'Are you sure you want to remove the activity about "%name%" ?'|trans({ '%name%' : accompanyingCourse.id } ),
'cancel_route' : 'chill_activity_activity_list',
'cancel_parameters' : { 'accompanying_course_id' : accompanyingCourse.id, 'id' : activity.id },
'cancel_parameters' : { 'accompanying_period_id' : accompanyingCourse.id, 'id' : activity.id },
'form' : delete_form
} ) }}
{% endblock %}

View File

@@ -54,7 +54,10 @@
{{ form_row(edit_form.date) }}
{% endif %}
{# TODO .. location #}
{%- if edit_form.location is defined -%}
{{ form_row(edit_form.location) }}
<div id="location"></div>
{% endif %}
{%- if edit_form.durationTime is defined -%}
{{ form_row(edit_form.durationTime) }}

View File

@@ -6,10 +6,10 @@
{% block content %}
<div class="activity-edit">
<div id="activity"></div> {# <=== vue component #}
{% include 'ChillActivityBundle:Activity:edit.html.twig' %}
<div id="activity"></div> {# <=== vue component #}
{% include 'ChillActivityBundle:Activity:edit.html.twig' %}
</div>
{% endblock %}
@@ -18,10 +18,10 @@
{{ encore_entry_link_tags('mod_async_upload') }}
<script type="text/javascript">
window.addEventListener('DOMContentLoaded', function (e) {
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ edit_form.vars.form.vars.name }}"]',
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ edit_form.vars.form.vars.name }}"]',
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
});
window.activity = {{ activity_json|json_encode|raw }};
window.activity = {{ activity_json|json_encode|raw }};
</script>
{{ encore_entry_script_tags('vue_activity') }}
{% endblock %}

View File

@@ -22,10 +22,10 @@
{% block personcontent %}
<div class="activity-edit">
<div id="activity"></div> {# <=== vue component #}
{% include 'ChillActivityBundle:Activity:edit.html.twig' %}
<div id="activity"></div> {# <=== vue component #}
{% include 'ChillActivityBundle:Activity:edit.html.twig' %}
</div>
{% endblock %}
@@ -33,7 +33,7 @@
{{ encore_entry_link_tags('mod_async_upload') }}
<script type="text/javascript">
window.addEventListener('DOMContentLoaded', function (e) {
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ edit_form.vars.form.vars.name }}"]',
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ edit_form.vars.form.vars.name }}"]',
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
});
window.activity = {{ activity_json|json_encode|raw }};

View File

@@ -1,4 +1,4 @@
<div class="activity-list context-{{ context }}">
<div class="context-{{ context }}">
{% if activities|length == 0 %}
<p class="chill-no-data-statement">
@@ -7,176 +7,56 @@
</p>
{% else %}
<div class="flex-table">
<div class="flex-table activity-list">
{% for activity in activities %}
{% set t = activity.type %}
<div class="item-bloc">
<div class="item-row main">
<div class="item-col">
{% if activity.date %}
<h3>{{ activity.date|format_date('long') }}</h3>
{% endif %}
<div class="duration">
{% if activity.durationTime and t.durationTimeVisible %}
<p>
<i class="fa fa-fw fa-hourglass-end"></i>
{{ activity.durationTime|date('H:i') }}
</p>
{% endif %}
{% if activity.travelTime and t.travelTimeVisible %}
<p>
<i class="fa fa-fw fa-car"></i>
{{ activity.travelTime|date('H:i') }}
</p>
{% endif %}
</div>
{% if context == 'person' and activity.accompanyingPeriod is not empty %}
<div class="mt-3">
<a class="btn btn-sm btn-outline-primary"
title="{{ 'Period number %number%'|trans({'%number%': activity.accompanyingPeriod.id}) }}"
href="{{ chill_path_add_return_path(
"chill_person_accompanying_course_index",
{ 'accompanying_period_id': activity.accompanyingPeriod.id }
) }}"><i class="fa fa-random"></i>
</a>
</div>
{% endif %}
</div>
<div class="item-col">
<div class="float-button top">
<div class="box">
<div class="action">
<ul class="record_actions">
<li>
<a href="{{ path('chill_activity_activity_show', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}"
class="btn btn-sm btn-show "></a>
</li>
{% if no_action is not defined or no_action == false %}
{# TODO
{% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
#}
<li>
<a href="{{ path('chill_activity_activity_edit', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}"
class="btn btn-sm btn-update "></a>
</li>
{# TODO
{% endif %}
{% if is_granted('CHILL_ACTIVITY_DELETE', activity) %}
#}
<li>
<a href="{{ path('chill_activity_activity_delete', { 'id': activity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}"
class="btn btn-sm btn-delete "></a>
</li>
{# TODO
{% endif %}
#}
{% endif %}
</ul>
</div>
<ul class="list-content">
{% if activity.user and t.userVisible %}
<li>
<abbr class="referrer" title="{{ 'Referrer'|trans }}">ref:</abbr>
<b>{{ activity.user.usernameCanonical }}</b>
</li>
{% endif %}
<li>
<b>{{ activity.type.name | localize_translatable_string }}</b>
{% if activity.attendee is not null and t.attendeeVisible %}
{% if activity.attendee %}
{{ '→ ' ~ 'present'|trans|capitalize }}
{% else %}
{{ '→ ' ~ 'not present'|trans|capitalize }}
{% endif %}
{% endif %}
</li>
<li>
<b>{{ 'location'|trans ~ ': ' }}</b>
Domicile de l'usager
{# TODO {% if activity.location %}{{ activity.location }}{% endif %}
#}
</li>
{%- if t.reasonsVisible -%}
<li>
{%- if activity.reasons is not empty -%}
{% for r in activity.reasons %}
{{ r|chill_entity_render_box }}
{% endfor %}
{%- endif -%}
</li>
{% endif %}
{%- if t.socialIssuesVisible %}
<li class="social-issues">
{%- if activity.socialIssues is not empty -%}
{% for r in activity.socialIssues %}
{{ r|chill_entity_render_box }}
{% endfor %}
{%- endif -%}
</li>
{% endif %}
{%- if t.socialActionsVisible -%}
<li class="social-actions">
{%- if activity.socialActions is not empty -%}
{% for r in activity.socialActions %}
{{ r|chill_entity_render_box }}
{% endfor %}
{%- endif -%}
</li>
{% endif %}
</ul>
</div>
</div>
</div>
<div class="item-row">
{% include '@ChillActivity/Activity/activity-badge-title.html.twig' %}
</div>
{% if activity.comment.comment is not empty
or activity.persons|length > 0
or activity.thirdParties|length > 0
or activity.users|length > 0
%}
<div class="item-row comment separator">
{% if activity.comment.comment is not empty %}
{{ activity.comment|chill_entity_render_box({
'disable_markdown': false,
'limit_lines': 3,
'metadata': false,
}) }}
{% endif %}
</div>
<div class="item-row details">
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {
'context': context,
'with_display': 'bloc',
'entity': activity,
'badge_person': true
} %}
</div>
<div class="main">
{% if activity.comment.comment is not empty %}
{{ activity.comment|chill_entity_render_box({
'disable_markdown': false,
'limit_lines': 3,
'metadata': false,
}) }}
{% endif %}
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {
'context': context,
'with_display': 'row',
'entity': activity,
'badge_person': true
} %}
</div>
{% endif %}
<div class="item-row separator">
<div class="updatedBy"></div>
<ul class="record_actions">
<li>
<a href="{{ path('chill_activity_activity_show', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}"
class="btn btn-sm btn-show "></a>
</li>
{% if no_action is not defined or no_action == false %}
<li>
<a href="{{ path('chill_activity_activity_edit', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}"
class="btn btn-sm btn-update "></a>
</li>
<li>
<a href="{{ path('chill_activity_activity_delete', { 'id': activity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}"
class="btn btn-sm btn-delete "></a>
</li>
{% endif %}
</ul>
</div>
</div>
{% endfor %}

View File

@@ -0,0 +1,10 @@
<div class="activity-list">
{% for activity in activities | slice(0,5) %}
{% set t = activity.type %}
<a href="{{ path('chill_activity_activity_show', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}"></a>
{% include '@ChillActivity/Activity/activity-badge-title.html.twig' %}
{% endfor %}
</div>

View File

@@ -55,7 +55,10 @@
{{ form_row(form.date) }}
{% endif %}
{# TODO .. location #}
{%- if form.location is defined -%}
{{ form_row(form.location) }}
<div id="location"></div>
{% endif %}
{%- if form.durationTime is defined -%}
{{ form_row(form.durationTime) }}

View File

@@ -6,10 +6,10 @@
{% block personcontent %}
<div class="activity-new">
<div id="activity"></div> {# <=== vue component #}
{% include 'ChillActivityBundle:Activity:new.html.twig' with {'context': 'person'} %}
<div id="activity"></div> {# <=== vue component #}
{% include 'ChillActivityBundle:Activity:new.html.twig' with {'context': 'person'} %}
</div>
{% endblock %}
@@ -17,7 +17,7 @@
{{ encore_entry_link_tags('mod_async_upload') }}
<script type="text/javascript">
window.addEventListener('DOMContentLoaded', function (e) {
chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]',
chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]',
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
});
window.activity = {{ activity_json|json_encode|raw }};

View File

@@ -55,13 +55,28 @@
{% endif %}
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'bloc' } %}
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'bloc', 'badge_person': 'true' } %}
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
<dt class="inline">{{ 'Date'|trans }}</dt>
<dd>{{ entity.date|format_date('long') }}</dd>
{% if t.locationVisible %}
<dt class="inline">{{ 'Activity location'|trans }}</dt>
<dd>
{% if entity.location is not null %}
<p>
<span>{{ entity.location.locationType.title|localize_translatable_string }}</span>
{{ entity.location.name }}
</p>
{{ entity.location.address|chill_entity_render_box }}
{% else %}
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
{% endif %}
</dd>
{% endif %}
{% if t.durationTimeVisible %}
<dt class="inline">{{ 'Duration Time'|trans }}</dt>
<dd>{% if entity.durationTime is not null %}
@@ -73,7 +88,7 @@
{% endif %}
{% if t.travelTimeVisible %}
<dt class="inline">{{ 'Travel Time'|trans }}</dt>
<dt class="inline">{{ 'Travel time'|trans }}</dt>
<dd>{% if entity.travelTime is not null %}
{{ entity.travelTime|date('H:i') }}
{% else %}

View File

@@ -1,4 +1,2 @@
{{ dump(notification) }}
<a href="{{ path('chill_activity_activity_show', {'id': notification.relatedEntityId }) }}">Go to Activity</a>

View File

@@ -1,94 +1,53 @@
<?php
/*
* Chill is a software for social workers
* Copyright (C) 2015 Champs Libres <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Timeline;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
use Chill\MainBundle\Timeline\TimelineProviderInterface;
use Chill\ActivityBundle\Repository\ActivityACLAwareRepository;
use Doctrine\ORM\EntityManager;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Role\Role;
use Doctrine\ORM\Mapping\ClassMetadata;
use Chill\PersonBundle\Entity\Person;
use Chill\MainBundle\Entity\Scope;
use Chill\ActivityBundle\Entity\Activity;
use Chill\MainBundle\Timeline\TimelineSingleQuery;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* Provide activity for inclusion in timeline
*
*/
class TimelineActivityProvider implements TimelineProviderInterface
{
/**
*
* @var EntityManager
*/
protected $em;
/**
*
* @var AuthorizationHelper
*/
protected $helper;
/**
*
* @var \Chill\MainBundle\Entity\User
*/
protected $user;
protected EntityManagerInterface $em;
protected AuthorizationHelperInterface $helper;
protected UserInterface $user;
protected ActivityACLAwareRepository $aclAwareRepository;
private const SUPPORTED_CONTEXTS = [ 'center', 'person'];
/**
* TimelineActivityProvider constructor.
*
* @param EntityManager $em
* @param AuthorizationHelper $helper
* @param TokenStorageInterface $storage
*/
public function __construct(
EntityManager $em,
AuthorizationHelper $helper,
EntityManagerInterface $em,
AuthorizationHelperInterface $helper,
TokenStorageInterface $storage,
ActivityACLAwareRepository $aclAwareRepository
)
{
) {
$this->em = $em;
$this->helper = $helper;
$this->aclAwareRepository = $aclAwareRepository;
if (!$storage->getToken()->getUser() instanceof \Chill\MainBundle\Entity\User)
if (!$storage->getToken()->getUser() instanceof User)
{
throw new \RuntimeException('A user should be authenticated !');
}
$this->user = $storage->getToken()->getUser();
}
/**
*
*
* {@inheritDoc}
*/
public function fetchQuery($context, array $args)
@@ -97,43 +56,42 @@ class TimelineActivityProvider implements TimelineProviderInterface
return TimelineSingleQuery::fromArray($this->aclAwareRepository
->queryTimelineIndexer($context, $args));
}
$metadataActivity = $this->em->getClassMetadata(Activity::class);
[$where, $parameters] = $this->getWhereClauseForPerson($args['person']);
return TimelineSingleQuery::fromArray([
'id' => $metadataActivity->getTableName()
.'.'.$metadataActivity->getColumnName('id'),
'type' => 'activity',
'date' => $metadataActivity->getTableName()
.'.'.$metadataActivity->getColumnName('date'),
'FROM' => $this->getFromClausePerson($args['person']),
'FROM' => $this->getFromClausePerson(),
'WHERE' => $where,
'parameters' => $parameters
]);
}
private function getWhereClauseForPerson(Person $person)
{
$parameters = [];
$metadataActivity = $this->em->getClassMetadata(Activity::class);
$associationMapping = $metadataActivity->getAssociationMapping('person');
$role = new Role('CHILL_ACTIVITY_SEE');
$reachableScopes = $this->helper->getReachableScopes($this->user,
$role, $person->getCenter());
$reachableScopes = $this->helper->getReachableScopes($this->user, $role->getRole(), $person->getCenter());
$whereClause = sprintf(' {activity.person_id} = ? AND {activity.scope_id} IN ({scopes_ids}) ');
$scopes_ids = [];
// first parameter: activity.person_id
// first parameter: activity.person_id
$parameters[] = $person->getId();
// loop on reachable scopes
// loop on reachable scopes
foreach ($reachableScopes as $scope) {
if (\in_array($scope->getId(), $scopes_ids)) {
continue;
}
$scopes_ids[] = '?';
$scopes_ids[] = '?';
$parameters[] = $scope->getId();
}
@@ -151,47 +109,40 @@ class TimelineActivityProvider implements TimelineProviderInterface
$parameters
];
}
private function getFromClausePerson()
private function getFromClausePerson(): string
{
$metadataActivity = $this->em->getClassMetadata(Activity::class);
$metadataPerson = $this->em->getClassMetadata(Person::class);
$associationMapping = $metadataActivity->getAssociationMapping('person');
return $metadataActivity->getTableName().' JOIN '
.$metadataPerson->getTableName().' ON '
.$metadataPerson->getTableName().'.'.
$associationMapping['joinColumns'][0]['referencedColumnName']
.' = '
.$associationMapping['joinColumns'][0]['name']
;
return sprintf(
"%s JOIN %s ON %s.%s = %s",
$metadataActivity->getTableName(),
$metadataPerson->getTableName(),
$metadataPerson->getTableName(),
$associationMapping['joinColumns'][0]['referencedColumnName'],
$associationMapping['joinColumns'][0]['name']
);
}
/**
*
* {@inheritDoc}
*/
public function getEntities(array $ids)
public function getEntities(array $ids): array
{
$activities = $this->em->getRepository(Activity::class)
->findBy(array('id' => $ids));
$result = array();
foreach($activities as $activity) {
$result[$activity->getId()] = $activity;
}
return $result;
}
/**
*
* {@inheritDoc}
*/
public function getEntityTemplate($entity, $context, array $args)
public function getEntityTemplate($entity, $context, array $args): array
{
$this->checkContext($context);
return [
'template' => 'ChillActivityBundle:Timeline:activity_person_context.html.twig',
'template_data' => [
@@ -201,26 +152,25 @@ class TimelineActivityProvider implements TimelineProviderInterface
];
}
/**
*
* {@inheritDoc}
*/
public function supportsType($type)
public function supportsType($type): bool
{
return $type === 'activity';
}
/**
* check if the context is supported
*
* @param string $context
* Check if the context is supported.
*
* @throws \LogicException if the context is not supported
*/
private function checkContext($context)
private function checkContext(string $context)
{
if (FALSE === \in_array($context, self::SUPPORTED_CONTEXTS)) {
throw new \LogicException("The context '$context' is not "
. "supported. Currently only 'person' is supported");
throw new \LogicException(
sprintf(
"The context '%s' is not supported. Currently only 'person' is supported",
$context
)
);
}
}

View File

@@ -1,4 +1,7 @@
services:
_defaults:
autowire: true
autoconfigure: true
chill.activity.timeline:
class: Chill\ActivityBundle\Timeline\TimelineActivityProvider
@@ -13,17 +16,14 @@ services:
- { name: chill.timeline, context: 'center' }
Chill\ActivityBundle\Menu\:
autowire: true
autoconfigure: true
resource: '../Menu/'
tags: ['chill.menu_builder']
Chill\ActivityBundle\Notification\:
autowire: true
autoconfigure: true
resource: '../Notification'
Chill\ActivityBundle\Security\Authorization\:
resource: '../Security/Authorization/'
autowire: true
autoconfigure: true
Chill\ActivityBundle\Repository\:
resource: '../Repository/'

View File

@@ -1,82 +1,56 @@
services:
_defaults:
autowire: true
autoconfigure: true
chill.activity.export.count_activity:
class: Chill\ActivityBundle\Export\Export\CountActivity
arguments:
- "@doctrine.orm.entity_manager"
tags:
- { name: chill.export, alias: 'count_activity' }
chill.activity.export.sum_activity_duration:
class: Chill\ActivityBundle\Export\Export\StatActivityDuration
arguments:
- "@doctrine.orm.entity_manager"
- "sum"
tags:
- { name: chill.export, alias: 'sum_activity_duration' }
chill.activity.export.list_activity:
class: Chill\ActivityBundle\Export\Export\ListActivity
arguments:
- "@doctrine.orm.entity_manager"
- "@translator"
- "@chill.main.helper.translatable_string"
tags:
- { name: chill.export, alias: 'list_activity' }
chill.activity.export.reason_filter:
class: Chill\ActivityBundle\Export\Filter\ActivityReasonFilter
arguments:
- "@chill.main.helper.translatable_string"
- "@chill_activity.repository.reason"
tags:
- { name: chill.export_filter, alias: 'activity_reason_filter' }
chill.activity.export.type_filter:
class: Chill\ActivityBundle\Export\Filter\ActivityTypeFilter
arguments:
- "@chill.main.helper.translatable_string"
- "@chill_activity.repository.activity_type"
tags:
- { name: chill.export_filter, alias: 'activity_type_filter' }
chill.activity.export.date_filter:
class: Chill\ActivityBundle\Export\Filter\ActivityDateFilter
arguments:
- "@translator"
tags:
- { name: chill.export_filter, alias: 'activity_date_filter' }
chill.activity.export.person_having_an_activity_between_date_filter:
class: Chill\ActivityBundle\Export\Filter\PersonHavingActivityBetweenDateFilter
arguments:
- "@chill.main.helper.translatable_string"
- "@chill_activity.repository.reason"
- "@translator"
tags:
- #0 register as a filter
name: chill.export_filter
alias: 'activity_person_having_ac_bw_date_filter'
chill.activity.export.reason_aggregator:
class: Chill\ActivityBundle\Export\Aggregator\ActivityReasonAggregator
arguments:
- "@chill_activity.repository.reason_category"
- "@chill_activity.repository.reason"
- "@chill.main.helper.translatable_string"
tags:
- { name: chill.export_aggregator, alias: activity_reason_aggregator }
chill.activity.export.type_aggregator:
class: Chill\ActivityBundle\Export\Aggregator\ActivityTypeAggregator
arguments:
- "@chill_activity.repository.activity_type"
- "@chill.main.helper.translatable_string"
tags:
- { name: chill.export_aggregator, alias: activity_type_aggregator }
chill.activity.export.user_aggregator:
class: Chill\ActivityBundle\Export\Aggregator\ActivityUserAggregator
arguments:
$em: "@doctrine.orm.entity_manager"
tags:
- { name: chill.export_aggregator, alias: activity_user_aggregator }

View File

@@ -1,4 +1,6 @@
services:
Chill\ActivityBundle\DataFixtures\ORM\:
autowire: true
autoconfigure: true
resource: ../../DataFixtures/ORM
tags: [ 'doctrine.fixture.orm' ]

View File

@@ -1,28 +1,12 @@
---
services:
chill_activity.repository.activity_type:
class: Doctrine\ORM\EntityRepository
factory: ['@doctrine.orm.entity_manager', getRepository]
arguments:
- 'Chill\ActivityBundle\Entity\ActivityType'
chill_activity.repository.reason:
class: Doctrine\ORM\EntityRepository
factory: ['@doctrine.orm.entity_manager', getRepository]
arguments:
- 'Chill\ActivityBundle\Entity\ActivityReason'
chill_activity.repository.reason_category:
class: Doctrine\ORM\EntityRepository
factory: ['@doctrine.orm.entity_manager', getRepository]
arguments:
- 'Chill\ActivityBundle\Entity\ActivityReasonCategory'
Chill\ActivityBundle\Repository\ActivityRepository:
tags: [doctrine.repository_service]
arguments:
- '@Doctrine\Persistence\ManagerRegistry'
chill_activity.repository.activity_type: '@Chill\ActivityBundle\Repository\ActivityTypeRepository'
chill_activity.repository.reason: '@Chill\ActivityBundle\Repository\ActivityReasonRepository'
chill_activity.repository.reason_category: '@Chill\ActivityBundle\Repository\ActivityReasonCategoryRepository'
# This is not a repository but merely a service. It needs to be moved out for simplicity.
# The autowire and autoconfigure should be enabled globally and removed from the definition of the service.
# Once autoloaded, there is no need to alias it to the interface here, it will be done automatically by Symfony.
Chill\ActivityBundle\Repository\ActivityACLAwareRepository:
autowire: true
autoconfigure: true

View File

@@ -4,7 +4,7 @@ namespace Chill\Migrations\Activity;
use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;
/**
* Add an "active" column on activitytype table

View File

@@ -22,7 +22,6 @@ final class Version20210401090853 extends AbstractMigration
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SEQUENCE activitytypecategory_id_seq INCREMENT BY 1 MINVALUE 1 START 1000');
$this->addSql('CREATE TABLE activitytypecategory (id INT NOT NULL, name JSON NOT NULL, active BOOLEAN NOT NULL, PRIMARY KEY(id))');
$this->addSql('COMMENT ON COLUMN activitytypecategory.name IS \'(DC2Type:json_array)\'');
$this->addSql('INSERT INTO activitytypecategory VALUES(1, \'{"fr": "Défaut", "en": "Default"}\', true)');
}

View File

@@ -51,7 +51,6 @@ final class Version20210408122329 extends AbstractMigration
$this->addSql('ALTER TABLE activitytype ADD socialDataLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
$this->addSql('ALTER TABLE activitytype ALTER name SET NOT NULL');
$this->addSql('ALTER TABLE activitytype ALTER active DROP DEFAULT');
$this->addSql('COMMENT ON COLUMN activitytype.name IS \'(DC2Type:json_array)\'');
}
public function down(Schema $schema) : void

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace Chill\Migrations\Activity;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20211119173555 extends AbstractMigration
{
public function getDescription(): string
{
return 'remove comment on deprecated json_array type';
}
public function up(Schema $schema): void
{
$columns = [
'activitytype.name',
'activitytypecategory.name'
];
foreach ($columns as $col) {
$this->addSql("COMMENT ON COLUMN $col IS NULL");
}
}
public function down(Schema $schema): void
{
$this->throwIrreversibleMigrationException();
}
}

View File

@@ -6,7 +6,6 @@ Duration time: Durée
Duration Time: Durée
durationTime: durée
Travel time: Durée de déplacement
Reasons: Sujets
Attendee: Présence de la personne
attendee: présence de la personne
list_reasons: liste des sujets
@@ -23,6 +22,7 @@ Update: Mettre à jour
Update activity: Modifier l'activité
Scope: Cercle
Activity data: Données de l'activité
Activity location: Localisation de l'activité
No reason associated: Aucun sujet
No social issues associated: Aucune problématique sociale
No social actions associated: Aucune action d'accompagnement
@@ -99,10 +99,13 @@ CHILL_ACTIVITY_LIST: Liste des activités
Activities: Activités
Activity configuration: Configuration des activités
Activity configuration menu: Configuration des activités
Activity Types: Types d'activité
Activity types: Types d'activité
Activity type configuration: Configuration des categories d'activités
Activity Reasons: Sujets d'une activité
Activity Reasons Category: Catégories de sujet d'activités
Activity Types Categories: Catégories des types d'activité
Activity Presences: Presences des activités
# Crud
crud:
@@ -210,3 +213,5 @@ Group by reasons: Sujet d'activité
Aggregate by activity user: Aggréger par utilisateur lié à l'activité
Aggregate by activity type: Aggréger par type d'activité
Aggregate by activity reason: Aggréger par sujet de l'activité
Last activities: Les dernières activités

View File

@@ -7,6 +7,7 @@ namespace Chill\AsideActivityBundle\Controller;
use Chill\AsideActivityBundle\Entity\AsideActivity;
use Chill\AsideActivityBundle\Repository\AsideActivityCategoryRepository;
use Chill\MainBundle\CRUD\Controller\CRUDController;
use Chill\MainBundle\Templating\Listing\FilterOrderHelper;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\HttpFoundation\Request;
use Chill\MainBundle\Pagination\PaginatorInterface;
@@ -14,15 +15,14 @@ use Doctrine\Common\Collections\Criteria;
final class AsideActivityController extends CRUDController
{
private $categoryRepository;
private AsideActivityCategoryRepository $categoryRepository;
public function __construct(AsideActivityCategoryRepository $categoryRepository)
{
$this->categoryRepository = $categoryRepository;
}
protected function buildQueryEntities(string $action, Request $request)
protected function buildQueryEntities(string $action, Request $request, ?FilterOrderHelper $filterOrder = null)
{
$qb = parent::buildQueryEntities($action, $request);
@@ -53,7 +53,7 @@ final class AsideActivityController extends CRUDController
$asideActivity = new AsideActivity();
$duration = $request->query->get('duration', '300');
$duration = \DateTime::createFromFormat('U', $duration);
$duration = \DateTime::createFromFormat('U', $duration);
$asideActivity->setDuration($duration);
$categoryId = $request->query->get('type', 7);

View File

@@ -19,8 +19,6 @@ final class ChillAsideActivityExtension extends Extension implements PrependExte
{
/**
* {@inheritdoc}
*
* @phpstan-ignore-next-line
*/
public function load(array $configs, ContainerBuilder $container): void
{
@@ -111,4 +109,4 @@ final class ChillAsideActivityExtension extends Extension implements PrependExte
]
]);
}
}
}

View File

@@ -44,13 +44,15 @@ class AsideActivityCategory
* @ORM\ManyToOne(targetEntity=AsideActivityCategory::class, inversedBy="children")
* @ORM\JoinColumn(nullable=true)
*/
private $parent;
private ?AsideActivityCategory $parent = null;
/**
* @ORM\OneToMany(targetEntity=AsideActivityCategory::class, mappedBy="parent")
*/
private $children;
private AsideActivityCategory $oldParent;
public function __construct()
{
$this->children = new ArrayCollection();

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Chill\AsideActivityBundle\Form;
use Chill\AsideActivityBundle\Entity\AsideActivityCategory;
@@ -14,12 +16,11 @@ use Symfony\Component\Form\FormBuilderInterface;
final class AsideActivityCategoryType extends AbstractType
{
private CategoryRender $categoryRender;
protected $translatableStringHelper;
public function __construct(TranslatableStringHelper $translatableStringHelper, CategoryRender $categoryRender)
{
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(
CategoryRender $categoryRender
) {
$this->categoryRender = $categoryRender;
}

View File

@@ -25,18 +25,16 @@ use Symfony\Component\Templating\EngineInterface;
final class AsideActivityFormType extends AbstractType
{
protected array $timeChoices;
private array $timeChoices;
private TokenStorageInterface $storage;
private CategoryRender $categoryRender;
public function __construct (
TranslatableStringHelper $translatableStringHelper,
ParameterBagInterface $parameterBag,
TokenStorageInterface $storage,
CategoryRender $categoryRender
){
$this->timeChoices = $parameterBag->get('chill_aside_activity.form.time_duration');
$this->translatableStringHelper = $translatableStringHelper;
$this->storage = $storage;
$this->categoryRender = $categoryRender;
}
@@ -58,7 +56,7 @@ final class AsideActivityFormType extends AbstractType
$builder
->add('agent', EntityType::class,
[
'label' => 'Agent',
'label' => 'For agent',
'required' => true,
'class' => User::class,
'data' => $this->storage->getToken()->getUser(),

View File

@@ -32,7 +32,7 @@ final class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuild
])
->setExtras([
'order' => 900,
'explain' => "Configure aside activities categories"
'explain' => "Aside activity type configuration"
]);
} else {
$menu

View File

@@ -1,7 +1,7 @@
{% extends "@ChillAsideActivity/Admin/layout_asideactivity.html.twig" %}
{% block admin_content %}
<h1>{{ 'Aside Activity Type list'|trans }}</h1>
<h1>{{ 'Aside Activity Type List'|trans }}</h1>
<table class="records_list table table-bordered border-dark">
<thead>

View File

@@ -30,7 +30,9 @@ final class CategoryRender implements ChillEntityRenderInterface
{
$options = array_merge(self::DEFAULT_ARGS, $options);
$titles[] = $this->translatableStringHelper->localize($asideActivityCategory->getTitle());
$titles = [
$this->translatableStringHelper->localize($asideActivityCategory->getTitle()),
];
while ($asideActivityCategory->hasParent()) {
$asideActivityCategory = $asideActivityCategory->getParent();

View File

@@ -3,6 +3,7 @@ Show the aside activity: Voir l'activité annexe
Edit the aside activity: Modifier l'activité annexe
Remove aside activity: Supprimer l'activité annexe
Aside activity: Activité annexe
Aside Activity Type List: Liste des catégories d'activités annexes
Duration time: Durée
durationTime: durée
user_username: nom de l'utilisateur
@@ -45,7 +46,7 @@ Back to the list: Retour à la liste
Choose the duration: Choisir la durée
Choose a category: Choisir une catégorie
Is active: Actif
Agent: Utilisateur
For agent: Pour l'utilisateur
date: Date
Duration: Durée
Note: Note
@@ -156,6 +157,11 @@ The activity has been successfully removed.: L'activité a été supprimée.
#Menu
Create an aside activity: "Créer une activité annexe"
Aside activity categories: Catégories des activités annexes
Aside activity configuration menu: "Menu de configuration des activités annexes"
Aside activity configuration: "Configuration des activités annexes"
Phonecall: "Appel téléphonique"
# admin
Aside activities: Activités annexes
Aside activity types: Types d'activités annexes
Aside activity type configuration: Configuration des categories d'activités annexes

View File

@@ -1,42 +1,34 @@
<?php
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Form;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\AMLI\BudgetBundle\Config\ConfigRepository;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\AMLI\BudgetBundle\Entity\Charge;
class ChargeType extends AbstractType
{
/**
*
* @var ConfigRepository
*/
protected $configRepository;
/**
*
* @var TranslatableStringHelper
*/
protected $translatableStringHelper;
protected ConfigRepository $configRepository;
protected TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
ConfigRepository $configRepository,
TranslatableStringHelper $translatableStringHelper
ConfigRepository $configRepository,
TranslatableStringHelperInterface $translatableStringHelper
) {
$this->configRepository = $configRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
@@ -45,24 +37,23 @@ class ChargeType extends AbstractType
'placeholder' => 'Choose a charge type'
])
->add('amount', MoneyType::class)
->add('comment', TextAreaType::class, [
->add('comment', TextareaType::class, [
'required' => false
])
;
]);
if ($options['show_start_date']) {
$builder->add('startDate', ChillDateType::class, [
'label' => 'Start of validity period'
]);
}
if ($options['show_end_date']) {
$builder->add('endDate', ChillDateType::class, [
'required' => false,
'label' => 'End of validity period'
]);
}
if ($options['show_help']) {
$builder->add('help', ChoiceType::class, [
'choices' => [
@@ -77,48 +68,39 @@ class ChargeType extends AbstractType
]);
}
}
private function getTypes()
{
$charges = $this->configRepository
->getChargesLabels();
// rewrite labels to filter in language
foreach ($charges as $key => $labels) {
$charges[$key] = $this->translatableStringHelper->localize($labels);
}
\asort($charges);
return \array_flip($charges);
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Chill\AMLI\BudgetBundle\Entity\Charge',
'data_class' => Charge::class,
'show_start_date' => true,
'show_end_date' => true,
'show_help' => true
));
$resolver
->setAllowedTypes('show_start_date', 'boolean')
->setAllowedTypes('show_end_date', 'boolean')
->setAllowedTypes('show_help', 'boolean')
;
->setAllowedTypes('show_help', 'boolean');
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'chill_amli_budgetbundle_charge';
}
}

View File

@@ -1,7 +1,10 @@
<?php
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Form;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -10,32 +13,22 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\AMLI\BudgetBundle\Config\ConfigRepository;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
class ResourceType extends AbstractType
{
/**
*
* @var ConfigRepository
*/
protected $configRepository;
/**
*
* @var TranslatableStringHelper
*/
protected $translatableStringHelper;
protected ConfigRepository $configRepository;
protected TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
ConfigRepository $configRepository,
TranslatableStringHelper $translatableStringHelper
ConfigRepository $configRepository,
TranslatableStringHelperInterface $translatableStringHelper
) {
$this->configRepository = $configRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
@@ -45,17 +38,16 @@ class ResourceType extends AbstractType
'label' => 'Resource element type'
])
->add('amount', MoneyType::class)
->add('comment', TextAreaType::class, [
->add('comment', TextareaType::class, [
'required' => false
])
;
]);
if ($options['show_start_date']) {
$builder->add('startDate', ChillDateType::class, [
'label' => 'Start of validity period'
]);
}
if ($options['show_end_date']) {
$builder->add('endDate', ChillDateType::class, [
'required' => false,
@@ -63,25 +55,7 @@ class ResourceType extends AbstractType
]);
}
}
private function getTypes()
{
$resources = $this->configRepository
->getResourcesLabels();
// rewrite labels to filter in language
foreach ($resources as $key => $labels) {
$resources[$key] = $this->translatableStringHelper->localize($labels);
}
asort($resources);
return \array_flip($resources);
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
@@ -89,20 +63,29 @@ class ResourceType extends AbstractType
'show_start_date' => true,
'show_end_date' => true
));
$resolver
->setAllowedTypes('show_start_date', 'boolean')
->setAllowedTypes('show_end_date', 'boolean')
;
->setAllowedTypes('show_end_date', 'boolean');
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'chill_amli_budgetbundle_resource';
}
private function getTypes()
{
$resources = $this->configRepository
->getResourcesLabels();
// rewrite labels to filter in language
foreach ($resources as $key => $labels) {
$resources[$key] = $this->translatableStringHelper->localize($labels);
}
asort($resources);
return \array_flip($resources);
}
}

View File

@@ -1,24 +1,6 @@
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Chill\CalendarBundle\Controller;
@@ -26,9 +8,11 @@ use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Privacy\PrivacyEvent;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
@@ -42,11 +26,6 @@ use Chill\MainBundle\Pagination\PaginatorFactory;
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Component\Routing\Annotation\Route;
/**
* Class CalendarController
*
* @package Chill\CalendarBundle\Controller
*/
class CalendarController extends AbstractController
{
protected EventDispatcherInterface $eventDispatcher;
@@ -97,9 +76,9 @@ class CalendarController extends AbstractController
'calendarItems' => $calendarItems,
'user' => $user
]);
}
} elseif ($accompanyingPeriod instanceof AccompanyingPeriod) {
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
$total = $this->calendarRepository->countByAccompanyingPeriod($accompanyingPeriod);
$paginator = $this->paginator->create($total);
$calendarItems = $this->calendarRepository->findBy(
@@ -117,6 +96,8 @@ class CalendarController extends AbstractController
'paginator' => $paginator
]);
}
throw new \Exception('Unable to list actions.');
}
/**
@@ -125,13 +106,14 @@ class CalendarController extends AbstractController
*/
public function newAction(Request $request): Response
{
$view = null;
$em = $this->getDoctrine()->getManager();
[$user, $accompanyingPeriod] = $this->getEntity($request);
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
$view = '@ChillCalendar/Calendar/newByAccompanyingCourse.html.twig';
}
}
// elseif ($user instanceof User) {
// $view = '@ChillCalendar/Calendar/newUser.html.twig';
// }
@@ -161,17 +143,18 @@ class CalendarController extends AbstractController
$params = $this->buildParamsToUrl($user, $accompanyingPeriod);
return $this->redirectToRoute('chill_calendar_calendar_list', $params);
} elseif ($form->isSubmitted() and !$form->isValid()) {
$this->addFlash('error', $this->get('translator')->trans('This form contains errors'));
}
if ($form->isSubmitted() and !$form->isValid()) {
$this->addFlash('error', $this->get('translator')->trans('This form contains errors'));
}
if ($view === null) {
throw $this->createNotFoundException('Template not found');
}
$entity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
return $this->render($view, [
'user' => $user,
'accompanyingCourse' => $accompanyingPeriod,
@@ -187,44 +170,49 @@ class CalendarController extends AbstractController
*/
public function showAction(Request $request, $id): Response
{
$view = null;
$em = $this->getDoctrine()->getManager();
[$user, $accompanyingPeriod] = $this->getEntity($request);
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
$view = '@ChillCalendar/Calendar/showByAccompanyingCourse.html.twig';
}
}
elseif ($user instanceof User) {
$view = '@ChillCalendar/Calendar/showByUser.html.twig';
}
$entity = $em->getRepository('ChillCalendarBundle:Calendar')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Calendar entity.');
}
if (null !== $accompanyingPeriod) {
$entity->personsAssociated = $entity->getPersonsAssociated();
$entity->personsNotAssociated = $entity->getPersonsNotAssociated();
}
// $deleteForm = $this->createDeleteForm($id, $accompanyingPeriod);
if ($view === null) {
throw $this->createNotFoundException('Template not found');
}
$personsId = [];
foreach ($entity->getPersons() as $p) {
array_push($personsId, $p->getId());
/** @var Calendar $entity */
$entity = $em->getRepository('ChillCalendarBundle:Calendar')->find($id);
if (null === $entity) {
throw $this->createNotFoundException('Unable to find Calendar entity.');
}
$professionalsId = [];
foreach ($entity->getProfessionals() as $p) {
array_push($professionalsId, $p->getId());
if (null !== $accompanyingPeriod) {
// @TODO: These properties are declared dynamically.
// It must be removed.
// @See https://wiki.php.net/rfc/deprecate_dynamic_properties
$entity->personsAssociated = $entity->getPersonsAssociated();
$entity->personsNotAssociated = $entity->getPersonsNotAssociated();
}
// $deleteForm = $this->createDeleteForm($id, $accompanyingPeriod);
$personsId = array_map(
static fn (Person $p): int => $p->getId(),
$entity->getPersons()
);
$professionalsId = array_map(
static fn (ThirdParty $thirdParty): ?int => $thirdParty->getId(),
$entity->getProfessionals()
);
$durationTime = $entity->getEndDate()->diff($entity->getStartDate());
$durationTimeInMinutes = $durationTime->days*1440 + $durationTime->h*60 + $durationTime->i;
@@ -234,12 +222,13 @@ class CalendarController extends AbstractController
'professionalsId' => $professionalsId,
'date' => $entity->getStartDate()->format('Y-m-d'),
'durationTime' => $durationTimeInMinutes,
'location' => $entity->getLocation()->getId(),
'comment' => $entity->getComment()->getComment(),
];
return $this->render($view, [
'accompanyingCourse' => $accompanyingPeriod,
'entity' => $entity,
'entity' => $entity,
'user' => $user,
'activityData' => $activityData
//'delete_form' => $deleteForm->createView(),
@@ -254,6 +243,7 @@ class CalendarController extends AbstractController
*/
public function editAction($id, Request $request): Response
{
$view = null;
$em = $this->getDoctrine()->getManager();
[$user, $accompanyingPeriod] = $this->getEntity($request);
@@ -282,8 +272,11 @@ class CalendarController extends AbstractController
$this->addFlash('success', $this->get('translator')->trans('Success : calendar item updated!'));
$params = $this->buildParamsToUrl($user, $accompanyingPeriod);
return $this->redirectToRoute('chill_calendar_calendar_list', $params);
} elseif ($form->isSubmitted() and !$form->isValid()) {
}
if ($form->isSubmitted() and !$form->isValid()) {
$this->addFlash('error', $this->get('translator')->trans('This form contains errors'));
}
@@ -294,7 +287,7 @@ class CalendarController extends AbstractController
}
$entity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
return $this->render($view, [
'entity' => $entity,
'form' => $form->createView(),
@@ -311,13 +304,14 @@ class CalendarController extends AbstractController
*/
public function deleteAction(Request $request, $id)
{
$view = null;
$em = $this->getDoctrine()->getManager();
[$user, $accompanyingPeriod] = $this->getEntity($request);
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
$view = '@ChillCalendar/Calendar/confirm_deleteByAccompanyingCourse.html.twig';
}
}
elseif ($user instanceof User) {
$view = '@ChillCalendar/Calendar/confirm_deleteByUser.html.twig';
}
@@ -366,7 +360,7 @@ class CalendarController extends AbstractController
/**
* Creates a form to delete a Calendar entity by id.
*/
private function createDeleteForm(int $id, ?User $user, ?AccompanyingPeriod $accompanyingPeriod): Form
private function createDeleteForm(int $id, ?User $user, ?AccompanyingPeriod $accompanyingPeriod): FormInterface
{
$params = $this->buildParamsToUrl($user, $accompanyingPeriod);
$params['id'] = $id;
@@ -413,17 +407,14 @@ class CalendarController extends AbstractController
];
}
private function buildParamsToUrl(
?User $user,
?AccompanyingPeriod $accompanyingPeriod
): array {
private function buildParamsToUrl(?User $user, ?AccompanyingPeriod $accompanyingPeriod): array {
$params = [];
if ($user) {
if (null !== $user) {
$params['user_id'] = $user->getId();
}
if ($accompanyingPeriod) {
if (null !== $accompanyingPeriod) {
$params['accompanying_period_id'] = $accompanyingPeriod->getId();
}

View File

@@ -1,25 +1,30 @@
<?php
declare(strict_types=1);
namespace Chill\CalendarBundle\DataFixtures\ORM;
use Chill\CalendarBundle\Entity\CalendarRange;
use Chill\MainBundle\DataFixtures\ORM\LoadUsers;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Repository\UserRepository;
use DateTimeImmutable;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ObjectManager;
class LoadCalendarRange extends Fixture implements FixtureGroupInterface, OrderedFixtureInterface
{
private UserRepository $userRepository;
public static array $references = [];
public function __construct(
EntityManagerInterface $em
UserRepository $userRepository
) {
$this->userRepository = $em->getRepository(User::class);
$this->userRepository = $userRepository;
}
public function getOrder(): int
@@ -32,12 +37,10 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere
return ['calendar'];
}
public static $references = [];
public function load(ObjectManager $manager): void
{
$arr = range(-50, 50);
print "Creating calendar range ('plage de disponibilités')\n";
$users = $this->userRepository->findAll();
@@ -70,7 +73,7 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere
->setUser($u)
->setStartDate($startEvent)
->setEndDate($endEvent);
$manager->persist($calendarRange);
}
@@ -79,4 +82,4 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere
}
$manager->flush();
}
}
}

View File

@@ -2,6 +2,7 @@
namespace Chill\CalendarBundle\Entity;
use Chill\MainBundle\Entity\Location;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
@@ -136,6 +137,13 @@ class Calendar
*/
private ?bool $sendSMS;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location")
* @groups({"read"})
*/
private ?Location $location = null;
public function __construct()
{
$this->comment = new CommentEmbeddable();
@@ -354,7 +362,7 @@ class Calendar
return $this;
}
public function getPersonsAssociated(): array
public function getPersonsAssociated(): array
{
if (null !== $this->accompanyingPeriod) {
$personsAssociated = [];
@@ -363,11 +371,11 @@ class Calendar
$personsAssociated[] = $participation->getPerson();
}
}
return $personsAssociated;
return $personsAssociated;
}
return [];
}
public function getPersonsNotAssociated(): array
{
if (null !== $this->accompanyingPeriod) {
@@ -407,4 +415,22 @@ class Calendar
]));
}
/**
* @return Location|null
*/
public function getLocation(): ?Location
{
return $this->location;
}
/**
* @param Location|null $location
* @return Calendar
*/
public function setLocation(?Location $location): Calendar
{
$this->location = $location;
return $this;
}
}

View File

@@ -34,7 +34,7 @@ class CancelReason
private $canceledBy;
/**
* @ORM\Column(type="json_array")
* @ORM\Column(type="json")
*/
private $name = [];

View File

@@ -25,7 +25,7 @@ class Invite
private User $user;
/**
* @ORM\Column(type="json_array")
* @ORM\Column(type="json")
*/
private array $status = [];

View File

@@ -2,6 +2,7 @@
namespace Chill\CalendarBundle\Form;
use Chill\MainBundle\Entity\Location;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -155,7 +156,7 @@ class CalendarType extends AbstractType
}
))
;
$builder->add('calendarRange', HiddenType::class);
$builder->get('calendarRange')
->addModelTransformer(new CallbackTransformer(
@@ -178,6 +179,20 @@ class CalendarType extends AbstractType
))
;
$builder->add('location', HiddenType::class)
->get('location')
->addModelTransformer(new CallbackTransformer(
function (?Location $location): string {
if (null === $location) {
return '';
}
return $location->getId();
},
function (?string $id): ?Location {
return $this->om->getRepository(Location::class)->findOneBy(['id' => (int) $id]);
}
))
;
// $builder->add('invites', HiddenType::class);
// $builder->get('invites')

View File

@@ -0,0 +1,92 @@
<?php
/*
* Copyright (C) 2018 Champs Libres Cooperative <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Chill\CalendarBundle\Menu;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Knp\Menu\MenuItem;
use Chill\TaskBundle\Templating\UI\CountNotificationTask;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
/**
*
* @author Champs-Libres
*/
class UserMenuBuilder implements LocalMenuBuilderInterface
{
/**
*
* @var CountNotificationTask
*/
public $counter;
/*
* @var TokenStorageInterface
*/
public $tokenStorage;
/**
*
* @var TranslatorInterface
*/
public $translator;
/**
*
* @var AuthorizationCheckerInterface
*/
public $authorizationChecker;
public function __construct(
CountNotificationTask $counter,
TokenStorageInterface $tokenStorage,
TranslatorInterface $translator,
AuthorizationCheckerInterface $authorizationChecker
) {
$this->counter = $counter;
$this->tokenStorage = $tokenStorage;
$this->translator = $translator;
$this->authorizationChecker = $authorizationChecker;
}
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
$user = $this->tokenStorage->getToken()->getUser();
if ($this->authorizationChecker->isGranted('ROLE_USER')){
$menu->addChild("My calendar list", [
'route' => 'chill_calendar_calendar_list'
])
->setExtras([
'order' => 9,
'icon' => 'tasks'
]);
}
}
public static function getMenuIds(): array
{
return [ 'user' ];
}
}

View File

@@ -1,9 +1,10 @@
<template>
<concerned-groups></concerned-groups>
<location></location>
<teleport to="#calendarControls">
<calendar-user-selector
<calendar-user-selector
v-bind:users="users"
v-bind:calendarEvents="calendarEvents"
v-bind:calendarEvents="calendarEvents"
v-bind:updateEventsSource="updateEventsSource"
v-bind:showMyCalendar="showMyCalendar"
v-bind:toggleMyCalendar="toggleMyCalendar"
@@ -22,6 +23,7 @@
<script>
import ConcernedGroups from 'ChillActivityAssets/vuejs/Activity/components/ConcernedGroups.vue';
import Location from 'ChillActivityAssets/vuejs/Activity/components/Location.vue';
import CalendarUserSelector from '../_components/CalendarUserSelector/CalendarUserSelector.vue';
import '@fullcalendar/core/vdom'; // solves problem with Vite
import frLocale from '@fullcalendar/core/locales/fr';
@@ -35,6 +37,7 @@ export default {
name: "App",
components: {
ConcernedGroups,
Location,
CalendarUserSelector,
FullCalendar
},

View File

@@ -1,5 +1,6 @@
import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n'
import { calendarUserSelectorMessages } from '../_components/CalendarUserSelector/js/i18n';
import { activityMessages } from 'ChillActivityAssets/vuejs/Activity/i18n';
const appMessages = {
fr: {
@@ -17,6 +18,7 @@ const appMessages = {
Object.assign(appMessages.fr, personMessages.fr);
Object.assign(appMessages.fr, calendarUserSelectorMessages.fr);
Object.assign(appMessages.fr, activityMessages.fr);
export {
appMessages

View File

@@ -66,6 +66,11 @@ const store = createStore({
setEvents(state, payload) {
console.log(payload)
state.currentEvent = {start: payload.start, end: payload.end}
},
// Location
updateLocation(state, value) {
console.log('### mutation: updateLocation', value);
state.activity.location = value;
}
},
actions: {
@@ -130,6 +135,14 @@ const store = createStore({
commit('setEvents', payload);
},
// Location
updateLocation({ commit }, value) {
console.log('### action: updateLocation', value);
let hiddenLocation = document.getElementById("chill_calendarbundle_calendar_location");
hiddenLocation.value = value.id;
commit('updateLocation', value);
}
}
});

View File

@@ -38,7 +38,10 @@
{{ form_row(form.calendarRange) }}
{% endif %}
.. location
{%- if form.location is defined -%}
{{ form_row(form.location) }}
<div id="location"></div>
{% endif %}
{%- if form.comment is defined -%}
{{ form_row(form.comment) }}
@@ -56,7 +59,7 @@
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a
<a
class="btn btn-cancel"
{%- if context == 'user' -%}
href="{{ chill_return_path_or('chill_calendar_calendar_list', { 'user_id': user.id } )}}"

View File

@@ -6,14 +6,10 @@
{% block content %}
<div class="calendar-edit">
<div class="row justify-content-center">
<div class="col-md-10 col-xxl">
<div id="calendar"></div> {# <=== vue component #}
{% include 'ChillCalendarBundle:Calendar:edit.html.twig' with {'context': 'accompanyingCourse'} %}
</div>
</div>
<div id="calendar"></div> {# <=== vue component #}
{% include 'ChillCalendarBundle:Calendar:edit.html.twig' with {'context': 'accompanyingCourse'} %}
</div>
{% endblock %}
@@ -21,7 +17,7 @@
{{ parent() }}
<script type="text/javascript">
window.addEventListener('DOMContentLoaded', function (e) {
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ form.vars.form.vars.name }}"]',
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ form.vars.form.vars.name }}"]',
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
});
window.entity = {{ entity_json|json_encode|raw }};
@@ -40,4 +36,4 @@
{% block block_post_menu %}
<div id="calendarControls"></div>
{% endblock %}
{% endblock %}

View File

@@ -4,14 +4,10 @@
{% block content %}
<div class="calendar-edit">
<div class="row justify-content-center">
<div class="col-md-10 col-xxl">
<div id="calendar"></div> {# <=== vue component #}
{% include 'ChillCalendarBundle:Calendar:edit.html.twig' with {'context': 'user'} %}
</div>
</div>
<div id="calendar"></div> {# <=== vue component #}
{% include 'ChillCalendarBundle:Calendar:edit.html.twig' with {'context': 'user'} %}
</div>
{% endblock %}
@@ -19,7 +15,7 @@
{{ parent() }}
<script type="text/javascript">
window.addEventListener('DOMContentLoaded', function (e) {
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ form.vars.form.vars.name }}"]',
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ form.vars.form.vars.name }}"]',
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
});
window.entity = {{ entity_json|json_encode|raw }};

View File

@@ -34,7 +34,10 @@
{{ form_row(form.endDate) }}
{% endif %}
.. location
{%- if form.location is defined -%}
{{ form_row(form.location) }}
<div id="location"></div>
{% endif %}
{%- if form.comment is defined -%}
{{ form_row(form.comment) }}
@@ -48,9 +51,9 @@
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a
<a
class="btn btn-cancel"
{%- if context == 'person' -%}
{%- if context == 'person' -%}
href="{{ chill_return_path_or('chill_calendar_calendar_list', { 'person_id': person.id } )}}"
{%- else -%}
href="{{ chill_return_path_or('chill_calendar_calendar_list', { 'accompanying_period_id': accompanyingCourse.id } )}}"

View File

@@ -6,25 +6,21 @@
{% block content %}
<div class="calendar-new">
<div class="row justify-content-center">
<div class="col-md-10 col-xxl">
<div id="calendar"></div> {# <=== vue component #}
{% include 'ChillCalendarBundle:Calendar:new.html.twig' with {'context': 'accompanyingCourse'} %}
</div>
</div>
</div>
<div id="calendar"></div> {# <=== vue component #}
{% include 'ChillCalendarBundle:Calendar:new.html.twig' with {'context': 'accompanyingCourse'} %}
</div>
{% endblock %}
{% block js %}
{{ parent() }}
<script type="text/javascript">
window.addEventListener('DOMContentLoaded', function (e) {
chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]',
chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]',
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
});
window.entity = {{ entity_json|json_encode|raw }};
window.entity = {{ entity_json|json_encode|raw }};
</script>
{{ encore_entry_script_tags('vue_calendar') }}
{% endblock %}

View File

@@ -36,6 +36,20 @@
<dt class="inline">{{ 'status'|trans }}</dt>
<dd>{{ entity.status }}</dd>
<dt class="inline">{{ 'calendar location'|trans }}</dt>
<dd>
{% if entity.location is not null %}
<p>
<span>{{ entity.location.locationType.title|localize_translatable_string }}</span>
{{ entity.location.name }}
</p>
{{ entity.location.address|chill_entity_render_box }}
{% else %}
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
{% endif %}
</dd>
{% if not entity.comment.isEmpty %}
<dt class="inline">{{ 'calendar comment'|trans }}</dt>
<dd>{{ entity.comment|chill_entity_render_box }}</dd>

View File

@@ -6,10 +6,8 @@
{% block content -%}
<div class="calendar-show">
<div class="row justify-content-center">
<div class="col-md-10 col-xxl">
{% include 'ChillCalendarBundle:Calendar:show.html.twig' with {'context': 'accompanyingCourse'} %}
</div>
</div>
</div>
{% include 'ChillCalendarBundle:Calendar:show.html.twig' with {'context': 'accompanyingCourse'} %}
</div>
{% endblock content %}

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