Compare commits

...

1450 Commits

Author SHA1 Message Date
85e1754af0 patchOnTheFly improved 2021-12-10 17:16:45 +01:00
e94bbc1271 further conversions to general makeFetch and toasts 2021-12-01 10:43:18 +01:00
fb9df1dba0 Merge branch 'convert_to_makeFetch' of gitlab.com:Chill-Projet/chill-bundles into convert_to_makeFetch 2021-11-30 15:03:01 +01:00
a579ff96a1 further transitioning to using the general makeFetch method everywhere + toasts 2021-11-30 14:51:20 +01:00
e76e5dd02d fix argument type 2021-11-30 14:50:26 +01:00
Pol Dellaiera
a3da9c538c tests: Fix argument type. 2021-11-30 14:22:15 +01:00
Pol Dellaiera
5a2d297c2e tests: Fix argument type. 2021-11-30 14:10:38 +01:00
Pol Dellaiera
56037f796b fix: Import missing annotation. 2021-11-30 14:02:20 +01:00
Pol Dellaiera
1041627f87 sa: Remove now obsolete reported PHPStan issues. 2021-11-30 13:55:46 +01:00
Pol Dellaiera
cd3be25c22 cs: Remove duplicated headers. 2021-11-30 13:54:58 +01:00
Pol Dellaiera
47c5855a21 cs: Switch to a stricter way of coding - this might break in a lot of places. 2021-11-30 13:33:18 +01:00
Pol Dellaiera
28d2c42454 cs: Enable more risky rules. 2021-11-30 12:27:49 +01:00
Pol Dellaiera
733bee06a8 cs: Enable more risky rules. 2021-11-30 12:19:29 +01:00
Pol Dellaiera
579c349e28 cs: Enable more risky rules. 2021-11-30 12:09:24 +01:00
Pol Dellaiera
6ce511889f cs: Enable more risky rules. 2021-11-30 12:03:02 +01:00
Pol Dellaiera
a43784c3a1 cs: Enable risky rule random_api_migration. 2021-11-30 11:55:02 +01:00
Pol Dellaiera
91d12c4a96 cs: Enable risky rule static_lambda. 2021-11-30 11:43:34 +01:00
Pol Dellaiera
a9188355c5 cs: Enable more risky rules. 2021-11-30 11:37:57 +01:00
cb1002ca04 further transitioning to using the general makeFetch method everywhere + toasts 2021-11-30 11:31:20 +01:00
Pol Dellaiera
c8195e6df5 cs: Enable more risky rules. 2021-11-30 11:28:52 +01:00
Pol Dellaiera
3631fd99fd cs: Enable risky rule is_null. 2021-11-30 10:22:38 +01:00
Pol Dellaiera
e11c249131 Fix constant name. 2021-11-30 10:09:17 +01:00
Pol Dellaiera
6e9827806f Remove obsolete PHPStan issues. 2021-11-30 10:08:12 +01:00
Pol Dellaiera
f531cdc0ec cs: Enable a couple of risky rules. 2021-11-30 09:39:45 +01:00
acc4647346 [person search] increase pertinence when person's lastname starts with
search pattern
2021-11-29 23:24:34 +01:00
54a4b48174 [person search] fix bug when using birhtdateafter and birthdate before on advanced search 2021-11-29 23:11:13 +01:00
e99b14b870 [activity] fix loading of social action in edit mode 2021-11-29 23:01:17 +01:00
7b0c7988df [activity] handle case when there is no action associated to selected
issues
2021-11-29 22:43:14 +01:00
55b9242690 [bugfix][activity form] check the presence of location / social issues /
persons fields
2021-11-29 21:57:29 +01:00
4854f40648 [bugfix] fix template "new" for activity 2021-11-29 21:27:17 +01:00
217b74b9e2 [Household] when two adresses on same date, close the existing one 2021-11-29 21:27:17 +01:00
18cfe17878 changelog: new release today 2021-11-29 21:27:17 +01:00
aca1d1f9e9 Merge branch 'master' into 295_resume_retouches 2021-11-29 15:43:16 +01:00
2102e65729 Merge branch 'issue180_activity_coherence' into 'master'
activity: edit an activity: choose the context based on the activity, not the url parameters

See merge request Chill-Projet/chill-bundles!226
2021-11-29 13:56:12 +00:00
juminet
975fbfbdee activity: edit an activity: choose the context based on the activity, not the url parameters 2021-11-29 13:56:12 +00:00
3b725a8a12 Merge branch '295_resume_retouches' into 'master'
295 resume retouches

See merge request Chill-Projet/chill-bundles!238
2021-11-29 13:48:18 +00:00
5d9ceb5757 295 resume retouches 2021-11-29 13:48:18 +00:00
3c70cec396 merge origin/master 2021-11-29 14:33:29 +01:00
16b130b9a5 Merge remote-tracking branch 'origin/master' into issue314_suggest_persons 2021-11-29 14:28:39 +01:00
eee9bff711 remove entities which are present twice 2021-11-29 14:28:24 +01:00
4acedc84b0 vue_accourse: fix list-suggest asset for items suggestions 2021-11-29 13:55:38 +01:00
c64ab86f8e Merge remote-tracking branch 'origin/master' into issue314_suggest_persons 2021-11-29 13:45:37 +01:00
bd98e9cc9b Merge branch 'add_toasters' into 'master'
Display of toasts for accompanying course + general makeFetch

See merge request Chill-Projet/chill-bundles!221
2021-11-29 12:39:11 +00:00
d5a269356b Display of toasts for accompanying course + general makeFetch 2021-11-29 12:39:11 +00:00
02a8c1ae10 Merge branch 'issue313_activity' into 'master'
activity: avoid existing entities being added in Users, ThirdParties, Persons

See merge request Chill-Projet/chill-bundles!237
2021-11-29 12:27:55 +00:00
juminet
b300858bdd activity: avoid existing entities being added in Users, ThirdParties, Persons 2021-11-29 12:27:54 +00:00
f58df2a25a update changelog 2021-11-29 12:35:05 +01:00
ed38322218 Merge branch '_concernedgroups_twig_' into 295_resume_retouches 2021-11-29 12:29:57 +01:00
be71decee5 concernedGroups.html.twig check if block isVisible, count block and adjust width 2021-11-29 12:29:15 +01:00
58119b3de0 Merge branch 'issue297_confidential_toggle' into 'master'
confidential toggle rights

See merge request Chill-Projet/chill-bundles!227
2021-11-29 11:01:51 +00:00
e4e1edff68 confidential toggle rights 2021-11-29 11:01:51 +00:00
6d6f930afa Merge branch 'issue307_location' into 'master'
improve location encoding

See merge request Chill-Projet/chill-bundles!230
2021-11-29 10:40:10 +00:00
ccff346dbb resume page: change order for masonry blocks, don't render empty blocks 2021-11-29 10:51:26 +01:00
nobohan
cb89fc5ef5 person: style list-suggest 2021-11-29 10:16:23 +01:00
6ee01621c8 update changelog 2021-11-29 09:46:27 +01:00
nobohan
efaaa72a7e upd CHANGELOG 2021-11-29 09:34:46 +01:00
nobohan
037532d13c person: entities suggestion in parcours: style list 2021-11-29 09:31:33 +01:00
nobohan
60422f5eee person: suggest entities for resources 2021-11-28 22:53:36 +01:00
nobohan
4abb1a7a57 person: suggest entities for requestor 2021-11-28 22:32:19 +01:00
nobohan
0ad7ca6235 person: init suggested entities in accompanying course
(working)
2021-11-28 22:17:00 +01:00
nobohan
5fab0ffe27 accompanying course: add resource 2021-11-28 21:16:48 +01:00
406ec14c3d add JS masonry placement on resume page 2021-11-27 16:34:55 +01:00
aeb165d6cc update changelog 2021-11-27 12:27:57 +01:00
d616c20534 accourse resume page: add all informations needed for activities 2021-11-27 12:24:54 +01:00
nobohan
44a09903a0 person: init suggested entities in accompanying course 2021-11-26 21:08:07 +01:00
34c525e378 accourse resume page: social-actions, list of evaluations with colored triangle bullet 2021-11-26 20:10:00 +01:00
16fcfda88f accourse resume page: social-actions, put some items in 2 columns 2021-11-26 19:57:06 +01:00
93dbc32009 accourse resume page: add all informations needed for social-actions
cfr. vendee PROPOSITION_INFO_AFFICHEES.xlsx (column F)
2021-11-26 18:56:56 +01:00
40ca1e276b styles sheets cleaning 2021-11-26 17:08:29 +01:00
74660448a1 accourse resume page: actions and activities are clickable links 2021-11-26 16:51:00 +01:00
10070d1581 update changelog 2021-11-25 19:13:17 +01:00
37cc540970 vue_accourseWorkEdit: improve show/hide button + list-suggest improve hyphens on badge too large 2021-11-25 19:04:13 +01:00
nobohan
5aa5cb3e08 location: use fetchResults for getLocations and getLocationTypes 2021-11-25 17:22:25 +01:00
8ac3dab0a2 update changelog 2021-11-25 16:54:49 +01:00
nobohan
f002d48efd location: fix error when there is no defaultFor defined for locationType entities 2021-11-25 16:53:02 +01:00
666b4c9f5e Merge branch '_resume_test_persons' into 295_resume_retouches 2021-11-25 16:51:30 +01:00
d274ba3823 #258 apply assets to lists of suggestion, adapt item-title case 2021-11-25 16:49:50 +01:00
nobohan
aad4b6e5d0 location: allow null value for defaultFor 2021-11-25 16:18:45 +01:00
nobohan
36c57511e8 location: fix code style with phpstan 2021-11-25 16:10:08 +01:00
3f35f0e251 add unique constraint on property validFor for LocationType 2021-11-25 15:40:38 +01:00
nobohan
09a679ffb9 upd CHANGELOG 2021-11-25 15:40:38 +01:00
nobohan
3d5db29a4c location: filter location api point only by active and availableForUsers 2021-11-25 15:39:30 +01:00
nobohan
e73179688a activity: format location label for parcours location 2021-11-25 15:39:30 +01:00
nobohan
2ee4a6b2ac calendar: dynamic way of creating location when creating a calendar 2021-11-25 15:39:30 +01:00
nobohan
220f297391 calendar: cast collection to array 2021-11-25 15:39:30 +01:00
nobohan
d13d42b9bf activity: group locations by type in the selector 2021-11-25 15:39:30 +01:00
nobohan
0bd0487801 activity: fix the on-the-fly POSTing of the location entity 2021-11-25 15:39:30 +01:00
nobohan
d27f085ac9 location: change display in twig 2021-11-25 15:39:30 +01:00
nobohan
c7f2717676 activity: new activity: show address in parcours location 2021-11-25 15:39:30 +01:00
nobohan
a2f6f2b5cb activity: post new location on-the-fly 2021-11-25 15:39:30 +01:00
nobohan
1b579f7930 activity: label location 2021-11-25 15:39:30 +01:00
nobohan
c1a2112d48 activity: add location from concerned person and 3rd parties in the location selector 2021-11-25 15:39:30 +01:00
nobohan
1519fcd4dd activity: add location of the accompanying course 2021-11-25 15:39:30 +01:00
nobohan
b808e970ab activity: correct activityController after rebase 2021-11-25 15:39:30 +01:00
nobohan
92e59e211d activity: suggest location based on accompanying period (WIP) 2021-11-25 15:39:30 +01:00
nobohan
7eeb2f2a7d main: LocationType: add new property defaultFor in the admin 2021-11-25 15:39:30 +01:00
nobohan
32af076986 main: locationType: add defaultFor property 2021-11-25 15:39:30 +01:00
nobohan
e3040f4bfb correct deprecated activity method 2021-11-25 15:39:30 +01:00
nobohan
1bd6df7ce2 correct deprecated activity method 2021-11-25 15:39:30 +01:00
69e260f0b1 Merge branch 'issue317_add_geom_to_postal_code' into 'master'
Issue317 add geom to postal code

See merge request Chill-Projet/chill-bundles!236
2021-11-25 13:16:36 +00:00
6d67f2706d Merge branch 'feature/add-api-endpoint-for-permission'
See https://gitlab.com/Chill-Projet/chill-bundles/-/merge_requests/232
2021-11-25 14:15:08 +01:00
aecd0e33a3 resume page: try alternatives with row/cols placement 2021-11-25 14:11:24 +01:00
4f1c373704 resume page: add persons and others infos 2021-11-25 14:11:24 +01:00
33c7a495c7 #258 add scss asset to manage suggestions lists (add/remove) 2021-11-25 14:08:13 +01:00
b09f32b1c2 vue_activity: adapt bloc width, depends of blocs number 2021-11-25 14:08:13 +01:00
032a61b367 update changelog 2021-11-25 12:13:25 +01:00
983cfb646c Merge add_toasters: handle 422 method and add toaster into course editor
See https://gitlab.com/Chill-Projet/chill-bundles/-/merge_requests/221

Squashed commit of the following:

commit 4f68f83aba74a88898779037aeb24d45c622759e
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Thu Nov 25 12:07:37 2021 +0100

    scope in course editor: show toast when error, instead of restoring the
    previous state

commit fdca8c1c87a4972bb6107bb16ab76844a28cae72
Merge: 53d6e68f8 b97f49782
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Wed Nov 24 17:39:27 2021 +0100

    Merge remote-tracking branch 'origin/add_toasters' into add_toasters

commit 53d6e68f8c5e158ac1848403d18146690ffeacf2
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Wed Nov 24 17:38:52 2021 +0100

    better validation messages

commit b97f497822fa6f6057e3b1cf3697044192ea9052
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Wed Nov 24 17:36:59 2021 +0100

    methods added to api.js again so they can be imported in other bundles still. To be refactored later with general makeFetch method?

commit e6089f75b4f66669cbd84f496c3b867901de9c8c
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Wed Nov 24 17:20:05 2021 +0100

    fix validator for participation overlaps

commit e47e6741b9f179dae63f39a596b7ba7410b3ac88
Merge: 25a80fcb2 05385509e
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Wed Nov 24 16:31:50 2021 +0100

    Merge remote-tracking branch 'origin/master' into add_toasters

commit 25a80fcb26cfb3ab7afab0abc1fcb6c0d0af7a6d
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Tue Nov 23 18:22:35 2021 +0100

    error object/message changed if not 422 or 403

commit 0c602cee8c127ab7f0723819a691a98c4e0615e2
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Tue Nov 23 17:13:47 2021 +0100

    Toasts displayed with differentiation between different errors

    error objects created accordingly

commit 252e57a06da1101e4ebc025974b247c472b8c2ed
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Tue Nov 23 17:12:55 2021 +0100

    generic makeFetch implemented almost everywhere

    api.js file no longer needs to contain a separate function to make an api call.

commit 8532eeee7656f6f9761168fb5e2102778ee932b7
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Tue Nov 23 17:10:48 2021 +0100

    Moved generic api methods into one file apiMethods.js

     imports adapted throughout bundles

commit c44bd5e75b32d5fbc8951247324ebf5fb85f3b37
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Tue Nov 23 11:27:24 2021 +0100

    migration deleted

commit dbeee090f46b3653c306a1825dcb05637e1f9b31
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Tue Nov 23 11:27:13 2021 +0100

    toast plugin initialized with options in the root

commit ec3919e357ee26f6c5016360d2083d19688217f4
Merge: 1ab401b5d b8889ed58
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Tue Nov 23 10:52:24 2021 +0100

    merge conflicts fixed

commit 1ab401b5d55a28f9c027ee539da58ef1da3d797c
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Tue Nov 23 10:40:02 2021 +0100

    add options when vue toast plugin is loaded

commit ad4e630bdd87c8ec16455bab0c2b053c1d838050
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Mon Nov 22 18:58:44 2021 +0100

    fixes to throw and catch error

commit 1c19748866d738bcb9e336f1035d9d78c6941d34
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Wed Nov 17 20:22:06 2021 +0100

    toast added to banner

commit 35949b90532b60161e14e815a78b3b69b053b62d
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Wed Nov 17 20:16:35 2021 +0100

    few more actions using makeFetch

commit e94c13e396f496565955294aec360db37f92374b
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Wed Nov 17 19:48:58 2021 +0100

    For accompanyingcourse app general makeFetch + displayToast implemented

commit 35eac75edf2c8d39ee2a04f119bb99a946fe3ea9
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Wed Nov 17 17:12:31 2021 +0100

    general makeFetch method implemented + toasts displayed in progress

commit 541bb10547bd7b96815a22a755ecf7f809d8cc87
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Wed Nov 17 12:36:20 2021 +0100

    general fetch method adjusted and tested on addParticipation: works

commit b7f27e8079bc815d88ffc925ec7a4fae3fba5f02
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Wed Nov 17 11:50:09 2021 +0100

    changelog updated

commit 028519ee3e93991aeb3131656e5f17e728ebdb1c
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Wed Nov 17 11:42:55 2021 +0100

    adjustment of error message using templating render

commit 508139b4476a46028a40b0b5300a8c65f79414a9
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Wed Nov 17 11:41:52 2021 +0100

    toast display for 422 errors on participations, requestor, resources + bugfix in requestor component (display of 'remove' btn if non-anonymous

commit 3e5d4862fcbbf5708f52c0038bf030dc0cbae5bb
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Tue Nov 16 15:38:03 2021 +0100

    debugging fetch method

commit 8b971a2357aac952ea6cd9487da20f4064c26a8d
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Tue Nov 16 14:31:45 2021 +0100

    general fetch method in _abstratAPI and testcase implementation; still needs to take care of commit into store

commit 05488740ab138ed279a4626310c5427d9f732793
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Tue Nov 16 11:13:28 2021 +0100

    testcase: toaster working when adding a resource to an accompanying course. Needs to be generalized

commit 5050e8a516107710216fa11aafcf852c52e1eb03
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Tue Nov 16 09:22:36 2021 +0100

    start of toaster popup

commit b8889ed58d3abb68d1c2859b31bf7428addda36e
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Mon Nov 22 18:58:44 2021 +0100

    fixes to throw and catch error

commit 0c017eb908e65919876d3bed69d3daa27699f2cc
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Wed Nov 17 20:22:06 2021 +0100

    toast added to banner

commit 80d8c5f12be4b0cfcded2948f385b4e3627e9afb
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Wed Nov 17 20:16:35 2021 +0100

    few more actions using makeFetch

commit 9cfcc61d995f75651902af97fe640f00f994ce9b
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Wed Nov 17 19:48:58 2021 +0100

    For accompanyingcourse app general makeFetch + displayToast implemented

commit 2855b0293a4a3fef2baf22fa035316bac13abf3f
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Wed Nov 17 17:12:31 2021 +0100

    general makeFetch method implemented + toasts displayed in progress

commit febbc8b9cdd9ec811546ce2948e2e1bded7c2116
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Wed Nov 17 12:36:20 2021 +0100

    general fetch method adjusted and tested on addParticipation: works

commit 16b59681b97cf995689aa464ae2a310c3efbb603
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Wed Nov 17 11:50:09 2021 +0100

    changelog updated

commit 41df29bdef84af010892708bfd0e37ff826f7aee
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Wed Nov 17 11:42:55 2021 +0100

    adjustment of error message using templating render

commit 8c98fe602c26e61285f12f5f7d58d646655f4caa
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Wed Nov 17 11:41:52 2021 +0100

    toast display for 422 errors on participations, requestor, resources + bugfix in requestor component (display of 'remove' btn if non-anonymous

commit 689ca8aa0ac249d577fe2ead5b3fcc0298dbad90
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Tue Nov 16 15:38:03 2021 +0100

    debugging fetch method

commit 07234c5fa996fb9f0352719ee366b34b093807eb
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Tue Nov 16 14:31:45 2021 +0100

    general fetch method in _abstratAPI and testcase implementation; still needs to take care of commit into store

commit 2a482516e952aa720b5aa8b4cb68ab33f93ce47b
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Tue Nov 16 11:13:28 2021 +0100

    testcase: toaster working when adding a resource to an accompanying course. Needs to be generalized

commit b7dcc5e7d4b1489a8edc175a0c2c1b0d649c6c0f
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date:   Tue Nov 16 09:22:36 2021 +0100

    start of toaster popup
2021-11-25 12:12:43 +01:00
nobohan
b594826f1e upd CHANGELOG 2021-11-24 17:44:51 +01:00
nobohan
4c4ba73c89 address: translate multi-select messages 2021-11-24 17:41:58 +01:00
nobohan
5781f2af89 main: add the coordinates of the postal code if no full address is selected 2021-11-24 17:21:43 +01:00
92753604fa fix backend error in activity::getPersonsNotAssociated() 2021-11-24 17:03:35 +01:00
8a0d16dc53 Merge branch 'bugfix/accompanying-period-filter-list-by-person-using-acl' into 'master'
List for accompanying course for a person: filter using acl

See merge request Chill-Projet/chill-bundles!235
2021-11-24 15:55:45 +00:00
551486b5ea List for accompanying course for a person: filter using acl 2021-11-24 15:55:45 +00:00
09a96df6a4 update changelog 2021-11-24 16:16:40 +01:00
153576df70 Merge remote-tracking branch 'origin/master' into feature/add-api-endpoint-for-permission 2021-11-24 16:15:51 +01:00
05385509ef Merge branch 'issue310_activity-acl-on-button' into 'master'
check acl before showing button for creating activity in person/activity

See merge request Chill-Projet/chill-bundles!234
2021-11-24 15:14:07 +00:00
b81c834b5e check acl before showing button for creating activity in person/activity 2021-11-24 15:14:06 +00:00
5be3b3f423 Merge branch 'bugfix/person-has-center-fix-tests' into 'master'
remove deprecation on PersonHasCenterValidator and fix tests

See merge request Chill-Projet/chill-bundles!233
2021-11-24 14:20:17 +00:00
a2681a02f9 remove deprecation on PersonHasCenterValidator and fix tests 2021-11-24 14:20:17 +00:00
95e306ccd6 Merge branch 'master' into 295_resume_retouches 2021-11-24 13:52:55 +01:00
41f0578966 changelog updated 2021-11-24 12:01:57 +01:00
cd9ce1b458 link to thirdparty resume page fixed 2021-11-24 11:59:11 +01:00
00fb82664f Merge branch 'master' into 295_resume_retouches 2021-11-24 11:47:47 +01:00
9993bfc96f fix cs and add test 2021-11-23 23:28:56 +01:00
fdbaa8cbef add endpoint for getting permissions info 2021-11-23 23:04:29 +01:00
d0856a9a39 reformat to 4 spaces 2021-11-23 22:53:11 +01:00
Pol Dellaiera
d933a30847 ci: Enable PHPCSFixer diff on CI. 2021-11-23 16:21:27 +01:00
Pol Dellaiera
e209e5c186 chore: Remove PHPStan dependency - added by drupol/php-conventions. 2021-11-23 15:32:15 +01:00
Pol Dellaiera
0248dddc9e cs: Fix AccompanyingCourseController. 2021-11-23 15:25:12 +01:00
Pol Dellaiera
cd55e80275 ci: Update Gitlab CI. 2021-11-23 15:19:01 +01:00
Pol Dellaiera
d586f848f5 chore: Update PHPStan configuration - add deprecations baseline. 2021-11-23 15:19:01 +01:00
Pol Dellaiera
ffbd572513 chore: Update .gitignore - add dev paths to ignore. 2021-11-23 15:19:01 +01:00
f23be44b9a fix: show validation message when closing course 2021-11-23 15:06:55 +01:00
da8422d0a7 use full text representation for referre in course banner 2021-11-23 15:06:55 +01:00
Pol Dellaiera
a2c209a857 cs: Third and last part. 2021-11-23 14:45:31 +01:00
Pol Dellaiera
3ea35682eb cs: Second part - ignore test/app subdirectory. 2021-11-23 14:34:34 +01:00
Pol Dellaiera
5f37304796 cs: Remove "...use self;...". 2021-11-23 14:28:14 +01:00
Pol Dellaiera
1ddef0e232 cs: Add missing configuration file. 2021-11-23 14:27:50 +01:00
Pol Dellaiera
c288e11cb8 Update submodule. 2021-11-23 14:22:51 +01:00
Pol Dellaiera
4bd2894c4f ci: Update CI add Code Style stage. 2021-11-23 14:10:12 +01:00
Pol Dellaiera
8f96a1121d cs: Fix code style (safe rules only). 2021-11-23 14:08:50 +01:00
Pol Dellaiera
149d7ce991 chore: Add/update static files. 2021-11-23 14:05:45 +01:00
Pol Dellaiera
9c167df78a sa: Fix SA issues. 2021-11-23 12:49:20 +01:00
Pol Dellaiera
ba9e5d10b5 Merge branch 'ci-update' 2021-11-23 12:42:12 +01:00
Pol Dellaiera
70ed9e75db tests: Fix "...Class "Chill\MainBundle\Security\Resolver\CenterResolverDispatcher" is declared "final" and cannot be mocked....". 2021-11-23 12:41:09 +01:00
Pol Dellaiera
45063fa6fe sa: Fix "...Variable property access on string...". 2021-11-23 12:41:03 +01:00
Pol Dellaiera
c5da567480 Update CI. 2021-11-23 12:39:38 +01:00
Pol Dellaiera
1e804f351c fix: Strict types interfaces: VoterHelperInterface, ProvideRoleHierarchyInterface and ProvideRoleInterface. 2021-11-23 11:39:45 +01:00
Pol Dellaiera
328b4c4596 fix: Strict types interfaces: VoterHelperInterface, ProvideRoleHierarchyInterface and ProvideRoleInterface. 2021-11-23 10:40:34 +01:00
05dda33a7a Activity: fixes in voter
* the role CREATE is now transformed to CREATE_ACCOMPANYING_COURSE or
CREATE_PERSON when the subject is, respectively, a course or a person;
* the button at the list of activities is now labeled "create"
* the role FULL give access to both role
acTIVITY_CREATE_ACCOMPANYING_COURSE and ACTIVITY_CREATE_PERSON, but not
ACTIVITY_CREATE directly.
2021-11-23 09:06:05 +01:00
f9b33fdfb8 change definition of person involved: add all periods which are not closed 2021-11-23 09:05:36 +01:00
3eaa8494cd update changelog 2021-11-22 21:42:21 +01:00
0867965d9c Minor fixes for closing accompanying course:
* check that transition can be applyied in menu;
* change organisation for activityVoter, and check for authorization in
    Activity Controller
* fix label 'create' in accompanying course document
* minor fix in accompanying course document voter
* change color when course is closed and show old user, and startdate /
    enddate
2021-11-22 20:24:08 +01:00
4c1e416a14 Merge remote-tracking branch 'origin/master' into issue296_internal_close_accourse 2021-11-22 17:14:11 +01:00
e43d22c1e0 resume: improve resources bloc 2021-11-22 17:02:08 +01:00
6028167513 allow the case when the referrer is null 2021-11-22 16:33:36 +01:00
21b33fb4f6 accourse resume page: add requestor and resources informations 2021-11-22 15:05:52 +01:00
f3792b2ed6 Merge remote-tracking branch 'origin/master' into issue294_suggestPersonInActivity 2021-11-22 14:06:27 +01:00
764bb6a21f fixes for settign a localisation 2021-11-22 13:43:33 +01:00
69384a84d1 Merge remote-tracking branch 'origin/master' into issue133_user_current_location 2021-11-22 13:43:22 +01:00
99d412adc9 Merge branch 'bugfix/person-json-normalization-circular-reference' into 'master'
fix circular reference in center normalization

See merge request Chill-Projet/chill-bundles!229
2021-11-22 12:02:23 +00:00
2826e079e8 key "centers" for person is an array. key center deprecated 2021-11-22 12:59:36 +01:00
b43a3d394b fix circular reference in center normalization 2021-11-22 12:41:47 +01:00
fe3d4e1f0a fix return type for center resolver 2021-11-22 12:22:28 +01:00
4664394a89 Merge commit '98760bc5' 2021-11-22 11:10:51 +01:00
94b0e365e3 fix down migration 2021-11-22 11:01:55 +01:00
130deb26f3 fix banner and person entity render block with multiple centers 2021-11-22 11:01:51 +01:00
98760bc5e8 Merge remote-tracking branch 'origin/master' into doc/authorizaton-documentation-update 2021-11-22 10:30:05 +01:00
2c74e268d3 voter fixes 2021-11-22 10:19:14 +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
nobohan
3ce3613c71 activity: change name of property type in activityType to allow property 'type' in the serializer (by DiscriminatorMap) 2021-11-19 14:12:41 +01:00
nobohan
4645244975 upd CHANGELOG 2021-11-19 13:42:59 +01:00
nobohan
d89a948fa1 activity: generalise concernedGroups component for use with calendar 2021-11-19 13:28:35 +01:00
nobohan
aa53df8bb0 activity: avoid adding persons|Users|Thirdparty if not allowed 2021-11-19 13:28:35 +01:00
nobohan
f5a6314ca2 calendar: can add User from suggested entities 2021-11-19 13:28:35 +01:00
nobohan
bdb24750ab calendar: remove done TODO 2021-11-19 13:28:35 +01:00
nobohan
631ffa02f7 calendar: add suggestion for concernedGroups 2021-11-19 13:28:35 +01:00
nobohan
d0e9829a3c activity: fix links to third party view page 2021-11-19 13:28:35 +01:00
nobohan
e40ea6902c calendar: fix type hinting in Calendar controller 2021-11-19 13:28:35 +01:00
nobohan
aae7d2fb2a activity: naming of addSuggestedEntities 2021-11-19 13:28:35 +01:00
nobohan
b3cd7c5cdb activity: suggest requestor, user and ressources for adding persons|user|3rdparty 2021-11-19 13:28:35 +01:00
nobohan
909e2ca070 activity: delete admin_user_show in twig template because this route is not defined and should not be defined 2021-11-19 13:28:35 +01:00
9e75c7e9b2 Merge branch 'issue296_internal_close_accourse' of gitlab.com:Chill-Projet/chill-bundles into issue296_internal_close_accourse 2021-11-19 12:43:49 +01:00
167b7b20d1 change menu entry order 2021-11-19 12:43:14 +01:00
f145d6c921 voters adjusted 2021-11-19 12:43:14 +01:00
fc8a766c25 badge adapted+ menu entry + persistance of object fixed 2021-11-19 12:43:14 +01:00
57cf46a0af adjustment to apply validation 2021-11-19 12:43:14 +01:00
a20d7222a8 transition added + attempt voter 2021-11-19 12:43:14 +01:00
e9e3b85518 changelog updated 2021-11-19 12:43:14 +01:00
e38729aa65 use statement fix 2021-11-19 12:43:14 +01:00
5928215c0d closed step added + form/controller/template basic start 2021-11-19 12:43:14 +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
7fe316b49a change menu entry order 2021-11-19 11:35:31 +01:00
210c8b8b97 voters adjusted 2021-11-19 11:29:29 +01:00
26a13ae6df badge adapted+ menu entry + persistance of object fixed 2021-11-19 09:46:24 +01:00
f2bf88ec90 adjustment to apply validation 2021-11-19 08:45:28 +01:00
6c48a22f86 transition added + attempt voter 2021-11-19 08:37:56 +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
dcbed94050 changelog updated 2021-11-18 15:01:03 +01:00
6db180e7ca use statement fix 2021-11-18 14:56:59 +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
ce5af04df7 closed step added + form/controller/template basic start 2021-11-18 14:46:33 +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
nobohan
be92ac4a08 user: correct dependency injection for form for locationType and userCurrentLocation 2021-11-18 11:26:14 +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
nobohan
11b82f7468 upd CHANGELOG 2021-11-17 15:22:55 +01:00
nobohan
63e5220084 activity: add user current location as default for a new activity 2021-11-17 15:21:53 +01:00
nobohan
cd4de2e244 activity: fix type error + add new property for new form 2021-11-17 15:19:24 +01:00
nobohan
f0ff4c18af upd CHANGELOG 2021-11-17 14:20:18 +01:00
nobohan
593817f12e user: refine display of location name (as usual, service injection does not work) 2021-11-17 14:12:22 +01:00
nobohan
480e02af01 user: add change location for user in user menu 2021-11-17 13:54:32 +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
nobohan
5905038425 user: current location edit form and page 2021-11-17 11:35:54 +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
nobohan
32c7695d80 user: correct property name 2021-11-16 17:51:05 +01:00
nobohan
02f6a1d110 user: add location to user entity 2021-11-16 17:35:58 +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
nobohan
cae3defedb address: zoom to postal code 2021-10-08 14:50:09 +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
78f66d4f14 Address: Assign origin = 3 for postalCode created by users 2021-10-08 12:36:48 +02: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
ddbd6a9f23 Merge branch 'improvements_acitivite_annexe' into 'master'
Improvements acitivite annexe

See merge request Chill-Projet/chill-bundles!153
2021-10-04 14:48:37 +00:00
b5eaea0e88 Merge branch 'fixes/aside-activities-before-integration' into 'improvements_acitivite_annexe'
Fixes/aside activities before integration

See merge request Chill-Projet/chill-bundles!165
2021-10-04 14:35:14 +00:00
ed8a569fea remove obsolete test 2021-10-04 16:30:08 +02:00
c41bc7bef9 prevent recursion 2021-10-04 16:16:34 +02:00
27dea97bc6 fixes minor for admin aside activity 2021-10-04 15:55:35 +02:00
27125b838e various minor fixes in aside activities 2021-10-04 15:15:26 +02:00
369a29af48 accompanying course work, specific render for list page or resume page (wip) 2021-10-04 14:22:27 +02:00
4c55631297 Merge conflicts in translations.yaml resolved.
# Conflicts:
#   src/Bundle/ChillAsideActivityBundle/src/translations/messages.fr.yml
#   src/Bundle/ChillMainBundle/translations/messages.fr.yml
2021-10-04 11:22:03 +00:00
cd6dec5082 Display of aside activity title styling changed from badge to normal title display 2021-10-04 12:11:27 +02:00
152a7de1dc section menu entries de-activated for role_admin 2021-10-04 12:09:26 +02:00
da19f68440 Title display of aside activities adjusted to display full title (parent > child > ...) Styling to be discussed 2021-10-04 11:20:07 +02:00
e895125d12 view template replaced by CRUD view template 2021-10-04 10:47:09 +02:00
fe9b76a1fb Merge remote-tracking branch 'origin/master' 2021-10-04 10:17:32 +02:00
baf9251000 update changelog 2021-10-04 10:17:13 +02:00
665b38d166 fix details (translations, etc.) 2021-10-04 09:50:05 +02:00
9450d34af0 Merge branch 'fix/center-type-show-hidden-when-no-center-reachable' into 'master'
[CenterType] switch to hidden type with null value when no center is reachable

See merge request Chill-Projet/chill-bundles!162
2021-10-03 19:23:24 +00:00
42301c9df7 Merge branch 'master' into 'fix/center-type-show-hidden-when-no-center-reachable'
# Conflicts:
#   CHANGELOG.md
2021-10-03 19:19:04 +00:00
eb1a7b2374 Merge branch 'fix/household-summary-show-comment-when-no-address' into 'master'
[household summary] show comment form even if no address are registered

See merge request Chill-Projet/chill-bundles!163
2021-10-03 19:17:44 +00:00
7f661f9022 Merge branch 'master' into 'fix/household-summary-show-comment-when-no-address'
# Conflicts:
#   CHANGELOG.md
2021-10-03 19:17:35 +00:00
178ffdf6bf Merge branch 'feature/add-requestor-in-search-results' into 'master'
Feature/add requestor in search results

See merge request Chill-Projet/chill-bundles!161
2021-10-03 19:16:35 +00:00
5f0238f614 Merge branch 'master' into 'feature/add-requestor-in-search-results'
# Conflicts:
#   CHANGELOG.md
2021-10-03 19:16:17 +00:00
cfaa64884d Merge branch 'fix/accept-sms-not-required' into 'master'
[person form] accept sms is not required

See merge request Chill-Projet/chill-bundles!160
2021-10-03 19:14:34 +00:00
faba2b67eb updating changelog 2021-10-01 21:20:19 +02:00
a981661ea5 resume, list associated_persons : improve design, hover effects 2021-10-01 21:14:27 +02:00
3a3baa79c8 resume: list associated persons sorted by household. add method in entity 2021-10-01 20:48:45 +02:00
e35f002f2b improvements based on draft review of MR 153 2021-10-01 19:05:03 +02:00
fbd17a1de6 OnTheFly: adding displayBadge option to replace button by badge
When using displayBadge=true, you need to pass buttonText=string with badge content.

Limitation: onTheFly cannot use directly PersonRenderBox to display badge,
because it don't have person object in props !
2021-10-01 18:46:25 +02:00
77d86d3836 [household summary] show comment form even if no address are registered 2021-10-01 16:53:27 +02:00
eb11597f9c [CenterType] switch to hidden type with null value when no center is
reachable
2021-10-01 16:38:35 +02:00
daa8b03c8b Merge branch 'onTheFly' into resume_accourse 2021-10-01 14:11:32 +02:00
9ee679a3b3 fix vue syntax error 2021-10-01 14:11:03 +02:00
8791c78426 Merge branch 'onTheFly' into resume_accourse 2021-10-01 14:07:37 +02:00
abd60f7ddf resume: include _insert_vue_onthefly template 2021-10-01 14:06:15 +02:00
75348f6ba7 otf: add data attributes and pass them in vue component 2021-10-01 14:03:58 +02:00
75a06d6896 Merge branch 'onTheFly' into resume_accourse 2021-10-01 13:12:03 +02:00
65782d3a6b fix js syntax 2021-10-01 13:11:34 +02:00
1dc01fa8e2 create OnTheFly rootComponent structure, and twig include template to insert it 2021-10-01 13:08:12 +02:00
db9a203df0 otf: prepare to create vue root component: moving files 2021-10-01 12:18:40 +02:00
2a7e3c0334 resume: display associated persons from accourse 2021-10-01 11:55:32 +02:00
ad72904aa9 resume accourse: simplify alerts with simple link to edit page 2021-10-01 11:41:02 +02:00
0b57b3c74d Merge branch 'master' into onTheFly 2021-10-01 11:38:15 +02:00
8c0abbc5cd updating changelog 2021-10-01 11:37:06 +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
c42b7c014b udpate changelog [ci-skip] 2021-10-01 11:00:25 +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
0d5d4b3f05 add accompanying period where the person is requestor + badge in results 2021-10-01 09:50:13 +02:00
a3e43fcaaa [person form] accept sms is not required 2021-09-30 23:27:56 +02:00
4047399b76 otf: comments to remember things to improve 2021-09-30 21:22:28 +02:00
4c9d352c46 otf: post/patch thirdparty ok, with addAddress creation/edition 2021-09-30 21:11:51 +02:00
a316cb9568 otf: manage address in edit/create form (wip) 2021-09-30 15:46:34 +02:00
14539f6f88 Merge branch 'onTheFly' into thirdparty 2021-09-30 15:13:03 +02:00
92e6506ecb tp: adapt controller/entity/formtype to works with new ACL (TO BE CHECKED)
* rename type by types -> getTypes() getter
* adapt controller to fix centers errors
* remove voteOnAttribute return always true in voter
2021-09-30 15:03:47 +02:00
59fed905e9 AddAddress: in onlyButton case, button is not in ul.record_actions 2021-09-30 15:02:48 +02:00
577d665f09 batch replace hideAddress option by onlyButton 2021-09-30 14:36:01 +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
decc3c7463 otf: replace button by link in show modale 2021-09-30 13:44:04 +02:00
1eb8d04a32 fix property into json body with endpoint PATCH thirdparty 2021-09-30 13:23:11 +02:00
2f60ab4d17 fix chill_resolve_center in person banner when n centers > 1 2021-09-30 12:35:36 +02:00
3cf9920718 Merge branch 'master' into onTheFly 2021-09-30 12:08:24 +02:00
Pol Dellaiera
f1f13996f9 fix: Fix missing parameter. 2021-09-30 12:07:58 +02:00
29838a4d8e Merge branch 'onTheFly' of gitlab.com:Chill-Projet/chill-bundles into onTheFly 2021-09-30 12:04:59 +02:00
e9b1f442bc api docs adjusted to patch/post address on thirdparty 2021-09-30 12:02:54 +02:00
e2feea15f9 stash commit 2021-09-30 11:57:20 +02:00
14a13c7bd5 CourseLocation: improve warning alerts
manually cherrypick from 5b0b1441d3c7ef0717f21adac8566e1beb1af52c on local branch resume_accourse
2021-09-30 11:55:28 +02:00
5a37bfd1a0 Merge remote-tracking branch 'origin/master' 2021-09-30 11:51:35 +02:00
bd7f2d997e fix link to edit in wopi 2021-09-30 11:51:26 +02:00
309fe40564 Merge branch 'accourse_impr' into onTheFly 2021-09-30 11:43:49 +02:00
Pol Dellaiera
f8f019cfe6 fix: Fix bug in getSize() method. 2021-09-30 11:09:55 +02:00
460f0daf0a Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles 2021-09-29 23:53:19 +02:00
5de05c0ee9 Merge branch 'master' into accourse_impr 2021-09-29 23:51:56 +02:00
Pol Dellaiera
7f721da08a fix: Remove obsolete code. 2021-09-29 22:38:48 +02:00
Pol Dellaiera
9a34aa59bb fix: Add missing dependency. 2021-09-29 21:50:44 +02:00
Pol Dellaiera
00259dae20 fix: Update ChillDocumentManager::getSize(). 2021-09-29 21:46:47 +02:00
Pol Dellaiera
fb8b8b354f refactor: Update Wopi::checkFileInfo() so it can authenticate users from access token. 2021-09-29 20:25:32 +02:00
d8c34c3089 otf: thirdparty corrections 2021-09-29 19:53:28 +02:00
74b649fb2c no location button for requestor 2021-09-29 19:30:57 +02:00
bac8e8d0b8 cleaning 2021-09-29 19:27:22 +02:00
008a10dab8 otf: patch person and thirdparty from the store, emit parent method saveFormOnTheFly() 2021-09-29 17:47:21 +02:00
a2df3c8144 rdv avant échanges dans le menu 2021-09-29 16:04:05 +02:00
d8444455c0 Merge branch 'feature/form-move-household-with-checkboxes' 2021-09-29 15:43:40 +02:00
c793159593 quick fix stored boject 2021-09-29 15:27:11 +02:00
26140de7de Merge remote-tracking branch 'origin/master' 2021-09-29 15:15:17 +02:00
2c1d3d08c3 temporary stored object fixes 2021-09-29 15:15:10 +02:00
Pol Dellaiera
86c2a5c3e8 fix: Update ChillDocumentManager. Fix statuscode and return types. 2021-09-29 15:07:27 +02:00
9420c34f58 Merge branch 'onTheFly' of gitlab.com:Chill-Projet/chill-bundles into onTheFly 2021-09-29 15:05:12 +02:00
d94fec3352 Merge branch 'onTheFly' of gitlab.com:Chill-Projet/chill-bundles into onTheFly 2021-09-29 15:03:14 +02:00
ba98283348 fix specs.yaml indentation 2021-09-29 15:02:54 +02:00
bfd95bff39 otf: add patch api endpoint for person and thirdparty 2021-09-29 14:57:41 +02:00
Pol Dellaiera
664fcd07ef fix: Update StoredObject uuid property. 2021-09-29 14:52:22 +02:00
a8df0070e8 Merge branch 'onTheFly' of gitlab.com:Chill-Projet/chill-bundles into onTheFly 2021-09-29 14:47:37 +02:00
440e21a83b Merge branch 'onTheFly' of gitlab.com:Chill-Projet/chill-bundles into onTheFly 2021-09-29 14:40:23 +02:00
8c2d211661 Merge remote-tracking branch 'origin/master' 2021-09-29 14:29:27 +02:00
f2ebb1f33c PATCH added for person endpoint 2021-09-29 14:22:55 +02:00
c53636c40b Merge branch 'refactor/sync-wopi' into 'master'
Refactor and synchronize WOPI packages

See merge request Chill-Projet/chill-bundles!157
2021-09-29 12:05:31 +00:00
0ec095b59a allow to remove / update address in household member editor 2021-09-29 13:57:36 +02:00
86c5376cc2 bypass ACL restriction
fix response 500 when otf create new person
2021-09-29 13:35:33 +02:00
0e54b8cdf0 add a changelog 2021-09-29 13:26:54 +02:00
53e82f1b2a store created address into new household 2021-09-29 12:54:53 +02:00
f4999548ac handle suggestion in addAddress component 2021-09-29 12:48:18 +02:00
302f60e722 addAddress: remove commented old method 2021-09-29 12:14:58 +02:00
5b7484b1ce Merge branch 'onTheFly' of gitlab.com:Chill-Projet/chill-bundles into onTheFly 2021-09-29 11:42:40 +02:00
fc1dd499c4 POST, PUT, PATCH working for thirdparty and added to swagger. Assert for 'centers'(temporarily) removed from thirdparty entity 2021-09-29 11:41:08 +02:00
3824a380ff otf: prepare with debug (wip) 2021-09-29 11:37:53 +02:00
315253589e create api endpoint for duplciating address 2021-09-29 11:32:23 +02:00
af24637dc4 update return type for prepare client trait 2021-09-29 11:31:44 +02:00
0fe248320d OnTheFly (otf): fix clickable radio tab on create modal 2021-09-29 11:21:45 +02:00
a26d278510 comment console.log 2021-09-29 11:21:06 +02:00
9641fd3fcc WIP add address to new household 2021-09-28 23:06:59 +02:00
2b3c4b7af9 fix boundary in getCurrentMembers/getNonCurrentMembers 2021-09-28 23:06:40 +02:00
8853359405 remove dump
(cherry picked from commit e2230409b8)
2021-09-28 19:38:02 +00:00
704ec76ca4 rewrite the destination for household / leave household 2021-09-28 21:35:41 +02:00
Pol Dellaiera
6020ee2cb2 chore: Update .editorconfig file. 2021-09-28 20:35:19 +02:00
Pol Dellaiera
ba53ce40fa Add migration file. 2021-09-28 20:32:43 +02:00
Pol Dellaiera
ab845d4569 Synchronize ChillWopiBundle with latest upstream WOPI packages. 2021-09-28 17:50:53 +02:00
Pol Dellaiera
dcb92b1378 Update StoredObject entity. 2021-09-28 17:49:32 +02:00
Pol Dellaiera
59fcd1e96b Update local ChillDocStore composer.json. 2021-09-28 17:40:49 +02:00
Pol Dellaiera
0aec2fc1d1 Update local ChillWopiBundle composer.json. 2021-09-28 17:39:54 +02:00
Pol Dellaiera
e43ae56e73 Update root composer.json. 2021-09-28 17:39:23 +02:00
3040ed9483 tp onthefly: add add-address (wip) 2021-09-28 16:26:59 +02:00
adc94aaeea javascript syntax correction 2021-09-28 16:26:32 +02:00
c5fa1b883c onthefly: adding tp i18n file 2021-09-28 16:25:38 +02:00
644d0420ce creation of endpoints POST, PUT, PATCH, but still errors 2021-09-28 16:23:24 +02:00
e2230409b8 remove dump 2021-09-28 15:59:31 +02:00
472866ce91 fix search by birthdate 2021-09-28 15:54:09 +02:00
d5d12c4a17 fix tests for user controller 2021-09-28 15:54:08 +02:00
e72ba4c940 bypass ACL restriction 2021-09-28 15:34:15 +02:00
nobohan
ca7ba90717 hotfix: repair creation activity (was an error linked to ListenToActivityCreate) 2021-09-28 14:53:00 +02:00
f3ba3aeed9 Merge branch 'master' into thirdparty 2021-09-28 14:47:52 +02:00
cb4059e5c3 comment out use of voter for menu entry, new way of handling rights? 2021-09-28 14:37:27 +02:00
c791c48248 tp: adapt to new ACL interface (wip) 2021-09-28 14:06:52 +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
5da332a06e fix error on previous commit, when creating new accourse 2021-09-27 13:14:42 +02:00
eb89fa2cd4 CourseLocation: replace in accourse vue component the old resume _warning_address.html.twig message 2021-09-27 13:03:17 +02:00
82db55cfec CourseLocation: change add-address key, cleaning add-address options 2021-09-27 11:18:11 +02:00
349a0e69f1 accourse: add warning alert box in each bloc with minimum confirm conditions 2021-09-27 10:56:43 +02:00
4de106ec30 accourse service: improve styles of checkboxes list 2021-09-27 10:21:11 +02:00
9851efa804 fix deathdate not inialized 2021-09-24 16:54:11 +02:00
327fcbef8b Merge branch 'review_documents_accourse' into 'master'
Review documents accourse

See merge request Chill-Projet/chill-bundles!154
2021-09-24 14:52:17 +00:00
d60b6aa3c4 fix phpunit 2021-09-24 16:45:24 +02:00
f0d0f16d3c fix namespace in migration files 2021-09-24 16:36:36 +02:00
832c7bab9f last migration deleted: duplicate 2021-09-24 16:20:58 +02:00
78b56dc32d attempt to fix migrations 2021-09-24 16:04:32 +02:00
6301c4c10b optimisation twig template 2021-09-24 14:42:37 +02:00
b87c995d22 fix UserMenuBuilder so that menu entry is not visible for admin menu 2021-09-24 14:42:07 +02:00
960db6aefc fast aside activity creation implemented 2021-09-24 14:41:37 +02:00
62f8d2c01d fixes quick for accompanying cours edocument voter 2021-09-24 13:51:43 +02:00
388db459bf Merge branch 'admin-for-users' into 'master'
improve admin for users

See merge request Chill-Projet/chill-bundles!150
2021-09-24 10:35:09 +00:00
d1e28b1afc Merge branch '107_documents_parcours' into 'master'
107 ajouter documents aux parcours

See merge request Chill-Projet/chill-bundles!151
2021-09-24 10:33:11 +00:00
d3bf64a00c Merge remote-tracking branch 'origin/master' into HEAD 2021-09-24 12:32:19 +02:00
84223316c4 Merge branch 'master' into improve_address 2021-09-24 11:31:23 +02:00
9f07e6a272 Address: fetch POST valid dates when applying changes from datePane 2021-09-24 11:22:48 +02:00
47d6270b7f Merge commit 'a9ce72034be03f5c84799f5982f97f515900504a' 2021-09-24 10:37:18 +02:00
1d4b1d852f improve layout for admin 2021-09-24 10:35:34 +02:00
430177f0c7 some finalisation for admin user 2021-09-24 10:35:34 +02:00
72b1916da8 continue CRUD user 2021-09-24 10:35:34 +02:00
b5c2dd7bd2 fix-admin and crudify user admin 2021-09-24 10:35:34 +02:00
a9ce72034b Merge branch 'fix-tests/rdv-2' into 'features/rdv'
Fix tests/rdv 2

See merge request Chill-Projet/chill-bundles!147
2021-09-24 08:33:42 +00:00
f93c2d8d32 Merge branch 'fix/use-autoconfigure-and-autowire' into 'master'
Update controller and the way they are autoloaded

See merge request Chill-Projet/chill-bundles!149
2021-09-24 08:33:03 +00:00
463b615595 Aside Activity: improve french translations 2021-09-24 09:13:05 +02:00
95e0198952 Address: twig insert, complete options for use cases 2021-09-23 16:22:10 +02:00
f93c13234a accourse stickyNav: insert a component, replace deprecated anchor name by id 2021-09-23 16:20:33 +02:00
ee3776288b vue_accourse, resources bloc: change for flex-bloc placement 2021-09-23 15:52:44 +02:00
694213e79a household banner: don't limit maximum number of members 2021-09-23 15:45:09 +02:00
a28c996164 stash commit 2 2021-09-23 14:55:54 +02:00
05c5eaa925 stash commit 2021-09-23 14:54:11 +02:00
d4116a4659 Merge branch 'master' into improvements_acitivite_annexe 2021-09-23 14:39:39 +02:00
6b91808987 fix error with doctrine:fixtures:load 2021-09-23 14:08:29 +02:00
d5f1de1fbc Merge branch 'master' into person_renderbox_thirdparty_onthefly 2021-09-23 13:56:28 +02:00
fa9b571d6b Merge branch 'improve_address' into person_renderbox_thirdparty_onthefly 2021-09-23 13:46:54 +02:00
nobohan
d172ae9682 rdv -> activity: add comment 2021-09-23 13:43:12 +02:00
nobohan
1a6c37e5a6 rdv->activity: create event for storing the linked activity to a calendar 2021-09-23 13:43:12 +02:00
nobohan
99f2692684 activity: correction of displaying activity when durationTime or travelTime is null 2021-09-23 13:43:12 +02:00
nobohan
c6bbe46bae rdv: rdv -> activity: fix some bugs (duplicate person var name, case keys are missing) 2021-09-23 13:43:12 +02:00
nobohan
17036e83ba rdv: rdv-> activity: convert some fields 2021-09-23 13:43:12 +02:00
nobohan
e8d8a57b4b rdv: rdv -> activity: pass calendar data to new activity controller 2021-09-23 13:43:12 +02:00
nobohan
3385cb2dda rdv: rename twig view file 2021-09-23 13:43:12 +02:00
nobohan
5b81bffcf6 rdv: twig - headings change 2021-09-23 13:43:12 +02:00
nobohan
27674985bd rdv: add pagination in calendar item list + refactor list views 2021-09-23 13:43:12 +02:00
3c3baed1ce Merge branch 'features/allow-customize-acl' into 'master'
Features/allow customize acl

See merge request Chill-Projet/chill-bundles!140
2021-09-23 11:33:31 +00:00
efd9380d13 Address use next/previous button if datePane and if context new 2021-09-23 12:32:05 +02:00
0808f5a6f3 Address datePane: convert selectedAddress to pass and view it with addressRenderBox 2021-09-23 11:51:40 +02:00
1c568a75ec Address: pass useDatePane option in showPane addressRenderBox, display dates in showPane 2021-09-23 11:07:17 +02:00
e7676c5c2e display address renderbox on datePane (wip) 2021-09-23 10:34:06 +02:00
a8024ba38f Address datePane: validTo date display and format 2021-09-23 10:34:06 +02:00
d994612987 change buttons apparence for datePane back to editPane 2021-09-23 10:34:06 +02:00
3ee0f4bf20 datePane, back to previous editPane 2021-09-23 10:34:06 +02:00
15897b4f33 asideactivity category entity changed to have parent and children properties 2021-09-22 20:35:46 +02:00
ca86eb3c56 disable datePane with courseLocation 2021-09-22 20:34:17 +02:00
14fdeac4fd Merge branch 'improve_address' into person_renderbox_thirdparty_onthefly 2021-09-22 20:32:28 +02:00
98f1f19e9a courseLocation: commit context addressId change when remove PersonLocation (fix bad address in editPane) 2021-09-22 20:27:08 +02:00
4630e2b80c remove unused and comment console log 2021-09-22 20:26:50 +02:00
5d99e261e1 CourseLocation: load initAddressContext() earlier allow AddAddress to getInitialAddress() (fix) 2021-09-22 19:41:17 +02:00
f7ec87e012 Address: hideAddress option mask too loading and alerts 2021-09-22 19:26:33 +02:00
0ed2dc8b13 Address: courseLocation, update addressId when commit context in store 2021-09-22 19:25:37 +02:00
d52ab2188c Address: fix callback function when called by another component (CourseLocation and HouseholdMembersEditor) 2021-09-22 18:48:15 +02:00
4768785bb5 Address: improve forceRedirect condition, if backUrl is null or undefined 2021-09-22 18:43:44 +02:00
47d0043462 disable suggestPane step 2021-09-22 16:28:35 +02:00
aa1f02ebd4 style of aside activity list adapted 2021-09-22 16:23:31 +02:00
1672e873a3 view page created for aside activity 2021-09-22 16:23:11 +02:00
f8d5dcf937 AddAddress: improve loading transition between step0/step1 and step2 2021-09-22 15:16:06 +02:00
544af59009 configuration of duration parametres for aside activity 2021-09-22 15:10:09 +02:00
851fa663ca Merge branch 'improve_address' into person_renderbox_thirdparty_onthefly 2021-09-22 14:07:09 +02:00
019a66c915 tp: Address, twig options: check to remove forceRedirect, and disable backUrl 2021-09-22 14:04:26 +02:00
dfc6ed9bf3 Address: remove forceRedirect option: backUrl option not null is considerated as forceRedirect true 2021-09-22 14:00:40 +02:00
dbb9e6a663 Address: success message exception when redirection 2021-09-22 13:57:33 +02:00
d6f6f49090 address renderbox, improve how display address-more informations 2021-09-22 13:57:29 +02:00
7c2422743e Address: remove unused translations specific to household or person context 2021-09-22 13:55:24 +02:00
e336990b16 comment console.log 2021-09-22 13:55:24 +02:00
dee27ee01f Address: extend hideAddress option for twig cases 2021-09-22 13:55:24 +02:00
f1c29a8bd3 Household summary: improve Address display when there is no address 2021-09-22 13:55:24 +02:00
7df923c669 fix vendor dir in composer.json 2021-09-22 12:28:35 +02:00
b06e726ad1 fix required fields in user controller test 2021-09-22 12:28:14 +02:00
c62254caec add scope selection on accompanying course 2021-09-22 12:23:26 +02:00
c382008b4d fix tests (wip) 2021-09-22 12:23:15 +02:00
f5348daddf Merge branch 'improve_address' into person_renderbox_thirdparty_onthefly 2021-09-22 11:41:41 +02:00
e13b7bf195 fix countrySelection multiselect with fetch async countries
edit context: display country for existing address
new context: repair editPane, load countries

note: adding id for country and postcode in address endpoint json
2021-09-22 11:39:03 +02:00
edc528ff92 Fixed migration 2021-09-22 10:06:58 +02:00
62e70c0c36 Fix layout of flash message in main template 2021-09-21 15:12:25 +02:00
f2e945dc0f UserMenu entry added for aside activities list 2021-09-21 11:52:45 +02:00
d2ce4865c0 display all aside activities created for and created by user with temporary badge 2021-09-21 11:42:18 +02:00
7fe0f08300 tp api endpoints: use default controller (fix) 2021-09-21 10:48:40 +02:00
7d2e82d69b Merge branch 'improve_address' into person_renderbox_thirdparty_onthefly 2021-09-20 20:16:39 +02:00
3f3dd83132 fix error in afterLastPaneAction 2021-09-20 20:15:38 +02:00
f3b755e46e fix warning with getSuccessText 2021-09-20 20:15:38 +02:00
8ba74f8de8 editPane, change button if datePane after 2021-09-20 20:15:38 +02:00
690f649dd1 applyChanges, if DatePane or not 2021-09-20 20:15:38 +02:00
75a240a2d6 parent callback will cast afterLastPaneAction, that manage redirection or context changes 2021-09-20 20:15:38 +02:00
717cd03d95 Address: context id received from twig are integer 2021-09-20 20:15:38 +02:00
1e829707be tp: wip.. write postAddressToThirdparty api for AddAddress callback 2021-09-20 20:13:20 +02:00
e7928c222d creating endpoint for scopes 2021-09-20 14:11:33 +02:00
120f7d8026 upgrade voter and acl for activities and implement autoconfiguration for
ChillProvideRole interface
2021-09-20 13:56:44 +02:00
b6c58a5c31 Continue work on ACL rewritting
* fix center resolver dispatcher
* add scope resolver
* tests for authorization helper
2021-09-20 13:56:44 +02:00
74598ee926 apply new role on accompanying period 2021-09-20 13:56:43 +02:00
cf40f38463 rename voter helepers 2021-09-20 13:56:43 +02:00
ebb2f5d243 Add shortcut person <-> current address, and update api for
re-implements searching

* add geographic function ST_CONTAINS
* add a link between the current valid address and person, optimized on
database side;
* update PersonACLAwareRepository for re-using methods elsewhere.
2021-09-20 13:56:43 +02:00
50b7554aea optimize query for current address + documentation 2021-09-20 13:56:43 +02:00
f63d4fcfba optimize query for person 2021-09-20 13:56:43 +02:00
6bc83edfe9 Refactor PersonSearch and create PersonACLAwareRepository
The search api delegates the query to a person acl aware "repository"
(although this does not implements ObjectRepository interface).
2021-09-20 13:56:43 +02:00
f87f03b5c0 Move CenterResolverInterface auto-configuring to bundledefinition
It seems that the service encountered in bundle loaded before does not
works.
2021-09-20 13:56:43 +02:00
addcf72ae6 improve addresses 2021-09-20 13:56:43 +02:00
b4e78a948b remove NOT NULL for User::usernamecanonical 2021-09-20 13:56:43 +02:00
9b38e486df extends User entity + alter admin (WIP) 2021-09-20 13:56:43 +02:00
960bac8c37 create alias for RoleProvider for allowing autowiring 2021-09-20 13:56:43 +02:00
dc09c9424a refactor ACL for easy voter. Apply on TaskVoter 2021-09-20 13:56:43 +02:00
5b70fb2ee5 adapt UI and controller for Person without centers 2021-09-20 13:56:43 +02:00
2450655452 enable autoloading for form in person bundle 2021-09-20 13:56:43 +02:00
41d76542b4 move validation on person into annotations 2021-09-20 13:56:43 +02:00
7faddbe3fe move birthday validator to namespace person + rewrite tests 2021-09-20 13:56:43 +02:00
eec798cfd3 entity person: create a validator to check a person entity is linked
with a center

This validator take a parameter in configuration
2021-09-20 13:56:43 +02:00
03e8624528 entity person: allow center to be not null 2021-09-20 13:56:43 +02:00
501ffe7829 Merge branch 'improve_address' into person_renderbox_thirdparty_onthefly 2021-09-18 21:48:42 +02:00
a842229d5e improve addAddress 2021-09-18 21:47:04 +02:00
4b87e16f6d Merge branch 'improve_address' into person_renderbox_thirdparty_onthefly 2021-09-18 17:05:13 +02:00
2788170f03 slot buttons up from actionButtons to addAddress 2021-09-18 17:02:45 +02:00
1b4e5c4956 tp: adapt variables for _insert_vue_address 2021-09-18 16:58:49 +02:00
601c16ac27 first commit: rendez-vous menu entry deleted from task usermenubuilder. Start sous-types 2021-09-17 17:00:23 +02:00
bde9e44f87 Merge branch 'improve_address' into person_renderbox_thirdparty_onthefly 2021-09-17 15:55:57 +02:00
4855ec2065 AddAddress: adding a forceRedirect option 2021-09-17 15:55:10 +02:00
c440d8a2bd tp: adapt variables for include _insert_vue_address 2021-09-17 15:32:36 +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
210d819125 tp: adapt variables for include _insert_vue_address 2021-09-17 13:26:57 +02:00
8204107ceb Merge branch 'improve_address' into person_renderbox_thirdparty_onthefly 2021-09-17 13:26:28 +02:00
3f3b7af42b AddAddress: adjust Open and Close methods for each step 2021-09-17 13:25:18 +02:00
331dd286e7 AddAddress: adding a new stickyActions option 2021-09-17 13:25:18 +02:00
f048395a89 AddAddress: reorganize 4 steps Pane: show, suggest, edit, and date 2021-09-17 13:25:18 +02:00
6a60758c0d AddAddress: openPanesInModal, uniq option to enable/disable all step123 in Modal 2021-09-17 13:25:18 +02:00
782f0bc332 twig _insert_vue_address, rename mode create 2021-09-17 13:25:18 +02:00
4bafa83b65 Address: rename [Show|Edit]AddressPane files 2021-09-17 13:25:18 +02:00
6e42b08627 Address: remove unused file 2021-09-17 13:25:18 +02:00
3c5f0ce15e Merge branch 'improve_address' into person_renderbox_thirdparty_onthefly 2021-09-16 22:25:55 +02:00
7ab57eba9a AddAddress: adding useDate.validFrom/validTo options 2021-09-16 22:21:47 +02:00
3279db85de Merge branch 'improve_address' into person_renderbox_thirdparty_onthefly 2021-09-16 21:26:10 +02:00
6ab1391bd8 addAddress: allow other rootcomponent to not precise bindmodal options 2021-09-16 21:21:40 +02:00
ce40814aa9 Merge branch 'improve_address' into person_renderbox_thirdparty_onthefly 2021-09-16 21:17:29 +02:00
c58d1eccc5 AddAddress: rename callback method 2021-09-16 20:49:46 +02:00
f66df3b77c fix include parameters missing comma 2021-09-16 20:36:11 +02:00
2aa0bbf371 tp: fix bindModalStep variable rename with _insert_vue_address 2021-09-16 20:34:10 +02:00
0bb0b24c21 Merge branch 'improve_address' into person_renderbox_thirdparty_onthefly 2021-09-16 19:58:03 +02:00
aae2ee32f6 add-address sub-component key 2021-09-16 19:56:15 +02:00
8dbdc28df1 vue_accourse: AddAddress final submit, managed by callback and not an event 2021-09-16 19:56:15 +02:00
9ff58fe0c3 Address: replace variable entity.type by entity.name 2021-09-16 19:56:15 +02:00
da32afeb3f addAddress: improve boolean variables 2021-09-16 19:56:15 +02:00
a5ceb551eb twig pass arguments to vue_address with dataset attributes 2021-09-16 19:56:15 +02:00
17a3f45247 AddAddress final submit, managed by callback and not an event 2021-09-16 19:56:15 +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
9ef91eabfb table style adjusted 2021-09-16 09:42:46 +02:00
310e9f5a82 tp: adapt _insert_vue_address include parameters 2021-09-15 18:41:14 +02:00
9725970c56 tp: adapt _insert_vue_address include parameters 2021-09-15 18:31:58 +02:00
546a2e4fa1 Merge branch 'improve_address' into person_renderbox_thirdparty_onthefly 2021-09-15 18:20:18 +02:00
c2f75654dd move _insert_vue_address include template in main, make it more generic
because it is used with person and household,
but prepare to extend for thirdparty
2021-09-15 18:17:06 +02:00
683eac91d8 thirdparty, manage case with only one type
in that case, type field is hidden, uniq type is automatically written in table
2021-09-15 16:25:55 +02:00
6e31e01e51 tp: rename field translation 2021-09-15 16:25:26 +02:00
e94790b8ab tp form: call vue_address to manage address, wip
show some limits with AddAddress:
* bug with option buttonText overriding default
* need to improve step1
2021-09-15 12:59:16 +02:00
92fae5cba2 tp list: table chill appearance, small action buttons 2021-09-15 12:54:46 +02:00
df28494f16 Merge branch 'household_integration' into person_renderbox_thirdparty_onthefly 2021-09-15 12:19:18 +02:00
4046a7ca9b before resume dashboards: disable accompanyingCourse resume persons, requestor, and resources 2021-09-15 12:14:03 +02:00
910016f722 tp: prepare address to be managed by vue (adapt formType) + add aliases methods isChild and isParent 2021-09-15 11:50:03 +02:00
a4f446c6b9 fix flashbag double col-8 2021-09-15 11:42:02 +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
d7a4e6c037 Banner context fixed parent() passed to template 2021-09-15 10:42:56 +02:00
e03f41ffbc user access rights put back in to place 2021-09-14 15:56:56 +02:00
2e5c2de363 Documents can be added/viewed/edited for an accompanyingCourse + menu entry added 2021-09-14 15:44:06 +02:00
Pol Dellaiera
951d686366 refactor: Update WOPI related stuff based on upstream changes. 2021-09-14 15:08:00 +02:00
Pol Dellaiera
fe533bc716 chore: Normalize composer.json file. 2021-09-14 15:07:23 +02:00
Pol Dellaiera
6c47ce53e7 chore: Remove duplicated entry from composer.json. 2021-09-14 15:06:22 +02:00
4448547fcd Merge branch 'master' into person_renderbox_thirdparty_onthefly 2021-09-14 14:11:33 +02:00
b80d109d8e fix vue_calendar encore_entry_link_tags 2021-09-14 11:51:36 +02:00
dd0e695ac2 Merge branch 'household_integration' 2021-09-14 11:30:46 +02:00
6a21bcc520 Merge branch 'rdv' 2021-09-14 11:30:05 +02:00
f7cb93fdac Update controller and the way they are autoloaded 2021-09-14 10:30:52 +02:00
7dc85b8474 vue_household_members_editor: address suggestions in bootstrap accordion style
+ store manage show/hide suggestions toggle (like householdSuggestions)
2021-09-13 19:15:04 +02:00
ee01020ae6 fix multiselect calendarUserSelector badge appearance 2021-09-13 16:38:43 +02:00
dcbac34b96 Merge branch 'aside-activity-merging' into 'master'
Various improvements for aside activity

See merge request Chill-Projet/chill-bundles!148
2021-09-13 14:17:06 +00:00
6fe78b7177 fix data provider 2021-09-13 16:12:25 +02:00
6fa0d229af enable test suite for aside activity 2021-09-13 15:25:10 +02:00
e4cfb4804b various improvements aside acdtivity 2021-09-13 15:20:01 +02:00
6c61b2da30 translations 2021-09-13 15:06:20 +02:00
dc2f094ca2 vue_household_members_editor: suggestions in bootstrap accordion style 2021-09-13 15:04:12 +02:00
4525f01d5f fix loading of paginator factory in CRUDCONtroller 2021-09-13 14:44:30 +02:00
3fe7e131a2 tests written and working 2021-09-13 13:55:17 +02:00
db92531257 dataFixtures fixed and executed + start of test script 2021-09-13 13:55:17 +02:00
5512e25cdf menu entries for admin section of aside activity categories changed but not yet complete 2021-09-13 13:55:17 +02:00
a0df8d8c61 create aside activity added to sections menu 2021-09-13 13:55:17 +02:00
a6826623bc query_builder added to form : only active users displayed in select list 2021-09-13 13:52:18 +02:00
267c3bae6e attempt to add aside activity to sections menu: not working yet 2021-09-13 13:52:17 +02:00
a131510ea8 dataFixtures made but not tested 2021-09-13 13:52:17 +02:00
eca00d155f aside activities query added to filter by current user 2021-09-13 13:52:14 +02:00
6680ba19ce final class changed for entity asideActivity + css fixed for record_action buttons 2021-09-13 13:50:49 +02:00
nobohan
813da1f9e0 rdv: reset calendar after all promises are done 2021-09-13 13:43:39 +02:00
337a6eb974 vue_household_members_editor: toggle suggestion button out of conditionnal record_actions 2021-09-13 13:29:37 +02:00
ed31dc3157 enable test for calendar 2021-09-13 13:13:17 +02:00
98729af065 vue_household_members_editor: fix store error with dispatch 2021-09-13 12:46:26 +02:00
75aa600a20 fix composer.json and upgrade base app 2021-09-13 12:41:55 +02:00
caca9ad71f Merge branch 'master' into person_renderbox_thirdparty_onthefly 2021-09-13 12:18:01 +02:00
5a4cb31ea5 Merge branch 'household_integration' into 'master'
household members integration

See merge request Chill-Projet/chill-bundles!143
2021-09-13 10:03:36 +00:00
nobohan
c82efc4fd5 rdv MR review: change name of routes + others modifications 2021-09-13 11:58:48 +02:00
6ab0007f02 fix: person-render-box need props options 2021-09-13 11:10:02 +02:00
672133fb5e repair banner in vue_household_members_editor component 2021-09-13 10:48:38 +02:00
nobohan
503c97d8c6 rdv: remove duplicate comment in rdv list 2021-09-13 10:01:52 +02:00
nobohan
5dc430ed31 rdv: various UI improvements on my calendar 2021-09-10 22:00:24 +02:00
nobohan
855686c0ba rdv: add content of calendar item in a modal 2021-09-10 17:31:19 +02:00
da9d81dc05 vue_accourse: GET form submit for no_household persons 2021-09-10 17:18:43 +02:00
fa938471aa vue_accourse: move no-household warning above table 2021-09-10 16:39:59 +02:00
c89e2662b1 household resume page, improve ux 2021-09-10 15:36:30 +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
nobohan
f6f24d0beb rdv: style my calendar 2021-09-10 14:11:48 +02:00
nobohan
29c148f924 rdv: can remove from delete calendar ranges 2021-09-10 14:11:48 +02:00
nobohan
0ab53f4659 rdv: add header 2021-09-10 14:11:48 +02:00
nobohan
c42ec1d493 rdv: plages de disponibilites: remove new events before it was saved 2021-09-10 14:11:48 +02:00
nobohan
82e76d7d5a rdv: plages de disponibilités: various UX/UI improvements 2021-09-10 14:11:47 +02:00
nobohan
0a274eb2a4 Enable DELETE in the ApiController 2021-09-10 14:11:47 +02:00
nobohan
6bfc180951 rdv: plages de disponibilites: copy the next day + refresh after save 2021-09-10 14:11:46 +02:00
nobohan
e1ccc8aba5 rdv: edition plage de disponibilités: copy events to next day (WIP) 2021-09-10 14:11:46 +02:00
nobohan
25b85fcc68 rdv: edit calendar ranges: add delete + doc swagger 2021-09-10 14:11:46 +02:00
nobohan
bcb36ddc11 rdv: edit calendar range: fix display of new calendar ranges 2021-09-10 14:11:45 +02:00
nobohan
6d607e3939 rdv: edit calendar ranges: create and update calendar ranges 2021-09-10 14:11:45 +02:00
nobohan
0fe6d7d00b rdv: add calendar range events in myCalendar 2021-09-10 14:11:44 +02:00
nobohan
329d3cc3d8 rdv: add API entry point for POSTing calendar range 2021-09-10 14:11:44 +02:00
nobohan
ee4d23ff82 rdv: init vue component for calendar range editing + refactor vue calendar code 2021-09-10 14:11:44 +02:00
nobohan
54ea954a5a rdv: init unit tests 2021-09-10 14:11:43 +02:00
nobohan
864f84fede rdv: change entrypoint for calendar css + correct calendar controls as a function of context 2021-09-10 14:11:43 +02:00
nobohan
68538f0e85 rdv: add user menu entry for my calendar list 2021-09-10 14:11:42 +02:00
nobohan
74957154b1 rdv: pages by User 2021-09-10 14:11:40 +02:00
ff7cb6ca79 adding unlink chill button 2021-09-10 11:40:59 +02:00
753e6c1105 adding a dev page with sass assets album 2021-09-10 11:34:08 +02:00
27077c9d96 adaptation of newTask() method in singleTaskController 2021-09-09 18:21:41 +02:00
88c192c22e change namespace migration 2021-09-09 17:44:37 +02:00
8a38712525 relation between task and accompanyingcourse created 2021-09-09 17:43:35 +02:00
05aaa32881 track all files added in other bundles 2021-09-09 16:46:26 +02:00
5211fb2fe9 Documents added to accompanying course menu 2021-09-09 16:42:53 +02:00
3a6a0da1dd accourse associated_persons: display alert warning if persons without household 2021-09-06 19:41:09 +02:00
e99a371f3a vue personRenderBox: adding an option to display householdLink 2021-09-06 19:39:52 +02:00
dba3ede9e1 when a person has a household without address: display no_data message, even if option addNoData is false 2021-09-06 18:46:37 +02:00
a94a757ae6 accourse: don't display old participations (fix counter) 2021-09-06 16:50:10 +02:00
cf78c59e76 vue personRenderBox when no returnPath 2021-09-06 16:37:30 +02:00
6e57d16ebf fix conflict with fa-ul and floatbutton (different with top or bottom) 2021-09-06 16:36:27 +02:00
f4ce634061 not used, see Entity/AddressRenderBox.vue in MainAssets 2021-09-06 16:18:08 +02:00
f9402ec981 adding confirmation modal when person leave accourse 2021-09-06 16:04:38 +02:00
98b0b3beeb applying floatbutton logic on person/thirdparty vue renderbox 2021-09-06 15:49:15 +02:00
1a95b44577 accourse: don't display old participations
(they will be still visible in history)
2021-09-06 15:12:53 +02:00
93c08f7e18 vue_accourse: adding current_household link on associated_persons 2021-09-06 15:05:08 +02:00
1262d8cc16 Merge branch 'improve_address' into household_integration 2021-09-06 12:52:25 +02:00
e5690b7575 Merge branch 'master' into household_integration 2021-09-06 12:32:09 +02:00
406426111a Merge branch 'post-prototypage' into 'master'
Post prototypage: vue household integration

See merge request Chill-Projet/chill-bundles!141
2021-09-06 08:00:29 +00:00
374ac652d4 AddAddress: submitNewAddress return callback payload, and parent patch date then postTo (TO BE MORE TESTED)
improve pattern for better reusability of AddAddress component
2021-09-04 14:26:03 +02:00
2208518ca0 AddAddress: add new address or update existing address: split fetch cascade and factorize reused functions 2021-09-04 12:47:47 +02:00
d51752fa41 Address, city/address selector: update writeNew flag when choose existing or create new 2021-09-04 12:40:42 +02:00
3ccc82147b Merge branch 'fix_address' into person_renderbox_thirdparty_onthefly 2021-09-03 18:57:33 +02:00
81f97980fc household members: fold/unfold accordion 2021-09-03 18:53:35 +02:00
8b945dc38b test a new chill help tooltip 2021-09-03 18:30:43 +02:00
b11592fb6d templates added and adapted, still problems with scope 2021-09-03 16:05:55 +02:00
d575b48e76 household banner: <a> tag inside <span> if we want flex order 2021-09-03 15:31:00 +02:00
3fefaf1e4d household summary: put member box in a reused include template 2021-09-03 13:59:31 +02:00
9b8b60ed75 twig person/thirdparty renderbox: add a customArea option
with 2 areas to begin:
* before the label
* after the label
2021-09-03 13:07:47 +02:00
f2f39d0922 household: improve ux in form to edit a member 2021-09-03 13:02:35 +02:00
eb067fe59b integration, test css class floatbutton 2021-09-03 13:01:24 +02:00
aad0d295ef services added to config files 2021-09-03 12:29:51 +02:00
46560da67d start of controller and formtype: adaptation from DocumentPersonController 2021-09-03 12:20:34 +02:00
3bb0e470bc entity recreated + repository + migration done 2021-09-03 11:26:04 +02:00
81b7e769e1 lightly increase heading 3-6 weight 2021-09-03 11:21:39 +02:00
7c37a5f583 a bunch of files that were deleted after doing composer.phar update 2021-09-03 11:04:34 +02:00
c51b129a5e AccompanyingCourseDocument created 2021-09-03 11:02:56 +02:00
21630a37af household banner: badge-member and holder mark in person theme 2021-09-03 10:59:44 +02:00
f2248a1e9c translation, wip 2021-09-03 09:59:54 +02:00
d8b2d3cd90 rename address-render-box component
(cfr b9602aa72 - file had been moved and renamed,
now we just rename component name into import and template
)
2021-09-02 22:28:32 +02:00
b14b27c110 Merge branch 'fix_address' into post-prototypage 2021-09-02 21:07:39 +02:00
f6e65dddbe vue Address: listen to citySelector to automatically fill city name and postcode fields 2021-09-02 21:06:11 +02:00
b940348452 Merge branch 'fix_address' into post-prototypage 2021-09-02 19:28:52 +02:00
90faa27461 vue Address: listen to adresssSelector to automatically fill street/number fields 2021-09-02 19:15:40 +02:00
a4118b1235 Merge branch 'person_renderbox_thirdparty_onthefly' into post-prototypage 2021-09-02 12:25:33 +02:00
903d57ea9d person_renderbox fix if there is no birthdate 2021-09-01 17:36:17 +02:00
820def6294 make onTheFly with API call 2021-09-01 17:35:11 +02:00
19a4542e2b creation of API endpoint thirdparty 2021-09-01 17:34:30 +02:00
9961c38b3c thirdparty onthefly, still with hardcoded data 2021-09-01 14:36:18 +02:00
f41997e6da creation api endpoint. Route found, but ajax call still needs to be tested 2021-09-01 14:33:31 +02:00
3927fd738c new choose button, improve household renderbox 2021-08-31 16:02:18 +02:00
b69fdd459a fix vue renderbox component name 2021-08-31 15:26:00 +02:00
1a2cb22b5b household, wip 2021-08-31 12:41:19 +02:00
3fa4f1b28b address multiline as option in householdrenderbox 2021-08-31 11:06:44 +02:00
c0d2454473 household render box flex table 2021-08-27 18:03:21 +02:00
2cffd61b86 Merge branch 'post-prototypage' of gitlab.com:Chill-Projet/chill-bundles into post-prototypage 2021-08-27 17:49:52 +02:00
b9602aa720 rename/move vue AddressRenderBox 2021-08-27 17:31:44 +02:00
219a41e034 rename/move vue AddressRenderBox 2021-08-27 16:12:26 +02:00
983bca97ac fix vue Address duplicate details 2021-08-27 15:55:39 +02:00
c1d19640a9 fix content position for household-members 2021-08-27 15:55:39 +02:00
5fd7d869bf Entity/PersonRenderBox.vue with render=badge 2021-08-27 15:55:39 +02:00
4f6011348d merge 2 subcomponent to use only Entity/PersonRenderBox.vue 2021-08-27 15:55:39 +02:00
d4430246f7 hop 2021-08-27 15:54:59 +02:00
8182e35c9c renderbox options changed to not display age for thirdparties, but yes in person modal 2021-08-27 15:13:21 +02:00
c258179017 move and rename vue HouseholdRenderBox 2021-08-27 11:02:35 +02:00
2333b5c6b4 rename some translations 2021-08-27 09:55:13 +02:00
a302f0fdbf invert firstname lastname when creating new person (TO BE CONFIRMED) 2021-08-27 09:35:28 +02:00
52a0c0e95b create new person: add an action and put action buttons in a dropdown 2021-08-27 09:30:15 +02:00
c5f40c53ea further adaptations to display deathdate. deathdate added to what API returns 2021-08-26 16:42:33 +02:00
5194cad354 Adaptations for display of age and deathdate (different scenarios not all finished) 2021-08-26 14:53:04 +02:00
34df295801 replace store by data() for OnTheFly creation in AddPersons component 2021-08-26 00:17:38 +02:00
ccb302ad28 move postPerson fetch method out of OnTheFly component for addPersons create person case
OnTheFly don't use store anymore, but addPerson still use it
2021-08-25 23:45:52 +02:00
a0fd3cd481 move postPerson fetch method from children to onthefly first level (to squash) 2021-08-25 22:47:00 +02:00
25f43bc758 move postPerson fetch method from grant-children to children (to squash) 2021-08-25 21:25:39 +02:00
e369e43b00 onthefly create new person: adding result in suggested/selected list 2021-08-25 18:46:06 +02:00
88362bd284 start of updating personrenderbox to display age. only one scenario done 2021-08-25 17:46:51 +02:00
5884fbaffc use operator in person search api 2021-08-24 00:02:37 +02:00
ddd1eb5d10 [person box] respect "demi-quadratin" in birthdate-deathdate separation 2021-08-24 00:01:56 +02:00
7d6def733c [person bloc] handle null values in date + improve layout on dead person
and age
2021-08-23 19:20:41 +02:00
bfed062910 Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles 2021-08-23 19:02:55 +02:00
d3e52e81f1 Merge branch 'fix/person-creation' 2021-08-23 18:43:31 +02:00
647bdb2749 fix tests 2021-08-23 18:19:47 +02:00
8fb4a7110e fix double person creation + button for creating accompanying course on creation + simplification person create
The controller now register data from a previous post on the form, and
register it in the session.

The next post compare the data with previous one and, if yes, show a
review page if there are "alternate persons.
2021-08-23 17:55:56 +02:00
cd6aeefb07 ac menu: rename some items
https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/32
2021-08-23 15:55:24 +02:00
668b3e182e fix title of page translations and coherency 2021-08-22 22:24:46 +02:00
a0b914380b make badge-thirdparty as badge person, with just different color 2021-08-22 20:55:11 +02:00
bbc3399e19 ac list: pill badge for flags 2021-08-22 20:45:23 +02:00
52fa4b5549 ac work list: add an option to mask button text 2021-08-22 20:34:51 +02:00
3894c7a56d ac work: better color 2021-08-22 20:20:27 +02:00
4933edaa94 share accompanying_course_work-list on resume page 2021-08-22 20:13:42 +02:00
9fd455b622 adding sticky-form-buttons to activity list 2021-08-22 17:06:36 +02:00
3451bcaab1 réglages 2021-08-22 16:49:16 +02:00
d1344d6d54 activity list: an option disable edit and delete button (for resume page) 2021-08-22 15:17:17 +02:00
73a1d42ee7 fix conflict with AccompanyingPeriod list button 2021-08-22 14:55:30 +02:00
3ceb3d4b2b Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles 2021-08-22 14:46:20 +02:00
10b1edda11 improve concernedGroups in Activity list
TODO refund concernedGroups for better flexibility
2021-08-22 14:43:04 +02:00
a0f0e4e9ad disable 'Add an accompanying period in the past' in dropdown 2021-08-22 13:13:15 +02:00
b79c1f02da Accourse Work list: improve design 2021-08-22 13:05:45 +02:00
c798b1290c [course list in person file] remove action on course list 2021-08-22 11:56:51 +02:00
af0905c6e0 [person details page] remove addresses
L'adresse est indiquée dans le bandeau.

Les adresses de résidence sont gérées dans une entrée de menu spécifique
2021-08-22 11:47:52 +02:00
bd528c9025 [person list with period] add current showed person to new accompanying period 2021-08-22 11:41:52 +02:00
4fed96f988 Merge branch 'features/suggest-acc-course-persons-in-activity' 2021-08-22 11:28:57 +02:00
3bffde6123 fix global responsive_debug if env != dev 2021-08-22 10:34:35 +02:00
9fa82fc44c Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles 2021-08-22 10:33:04 +02:00
4001bb0996 Merge branch 'features/remove-parent-social-issues' into 'master'
Features/remove parent social issues

See merge request Chill-Projet/chill-bundles!137
2021-08-21 22:55:12 +00:00
d6135641c5 add a list of suggested persons on activity 2021-08-22 00:50:37 +02:00
075f22e79c configure SocialIssue consistency on Activity and AccompanyingPeriod 2021-08-22 00:02:22 +02:00
09e5cc1545 create api for social issue consistency 2021-08-22 00:02:22 +02:00
37b73931c4 ac work, design 2021-08-21 20:29:42 +02:00
4ad6786bf2 AccourseWork list : design title 2021-08-21 19:45:33 +02:00
d11c493e2d detail on resume accourse page 2021-08-21 17:41:08 +02:00
9795704532 adding global responsive_debug (false) in env=dev 2021-08-21 16:20:34 +02:00
883cb858a9 use chill_entity_render_box/string and design a badge-person 2021-08-21 15:10:25 +02:00
b301c1d405 flex-table accompanyingcourse-list used in two contexts + wraplist title style 2021-08-21 14:54:04 +02:00
6959de4e39 reorganise styles sheets in person/chill/scss 2021-08-21 12:59:46 +02:00
9c25132216 socialissues badge style in multiselect 2021-08-21 12:38:26 +02:00
87a917d11c accompanyingPeriod button 2021-08-21 10:32:11 +02:00
026562c32f remove unused styles 2021-08-21 10:04:20 +02:00
b37de4cd4f activity list: badges for issues, actions and reasons 2021-08-20 23:59:37 +02:00
14cbb1dd28 AccompanyingCourse: improve design of CourseLocation block 2021-08-20 23:04:51 +02:00
4d65c54996 [design proposal] adding a mixin to style social issue badge 2021-08-20 20:40:05 +02:00
2a3f869882 Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles 2021-08-20 18:46:43 +02:00
d198c33f9c Merge branch 'improve_ux' into master 2021-08-20 18:43:35 +02:00
949a453b48 remove commented code + fix style 2021-08-20 18:41:57 +02:00
4f1a9c205f Merge branch 'ameliorations_composants_vue' into 'improve_ux'
Ameliorations composants vue

See merge request Chill-Projet/chill-bundles!134
2021-08-20 16:09:22 +00:00
638af4728f Merge remote-tracking branch 'origin/features/rdv' 2021-08-20 18:01:44 +02:00
742445e7b3 allow to close editor 2021-08-20 17:57:30 +02:00
nobohan
223efba655 rdv:add swagger config file for calendar bundle 2021-08-20 17:46:32 +02:00
nobohan
fec8fa50ed issue 190: fix flat and buildingName inversion in address normalizer 2021-08-20 17:15:08 +02:00
d2b0b9d7da reorganise flex-table assets, improve search results, and accompanyingPeriods list 2021-08-20 16:38:07 +02:00
nobohan
de8478f3e5 rdv: various UI improvements to the calendar 2021-08-20 16:14:51 +02:00
bf0a24b38e various fixes accompanying period 2021-08-20 15:07:36 +02:00
Marc Ducobu
026ac91e69 Injection firstPerson in doc 2021-08-20 15:01:59 +02:00
nobohan
6a6b1760f5 rdv: style properly the events when clicking 2021-08-20 14:56:18 +02:00
38dcca7397 AccompanyingPeriod list: adding new wrapheader asset and improve wraplist structure
wrapheader manage header of flex-table first row. the 2 cascades are independant.
2021-08-20 13:35:15 +02:00
176b68417a Merge remote-tracking branch 'origin/master' 2021-08-20 13:01:03 +02:00
1d2299e143 Merge branch 'integrate_wopi_bundle' into 'master'
Integration of wopi bundle with controller

See merge request Chill-Projet/chill-bundles!133
2021-08-20 10:49:43 +00:00
20ef04683d Merge remote-tracking branch 'origin/features/rdv' 2021-08-20 12:48:37 +02:00
b9674d7d28 Merge branch 'master' into integrate_wopi_bundle 2021-08-20 12:45:11 +02:00
ffec80c5fd Merge remote-tracking branch 'origin/master' 2021-08-20 12:44:57 +02:00
7f28effc1e Associate generate document with evaluation and update UX to go back to
documents
2021-08-20 12:44:15 +02:00
28f69d8dec chill person assets: we need to use mixins and variables into sass sheets imported 2021-08-20 12:31:16 +02:00
80672a038c Merge remote-tracking branch 'origin/master' into integrate_wopi_bundle 2021-08-20 11:05:42 +02:00
Marc Ducobu
9fc7ed0fb6 Merge branch 'docgen3' into 'master'
Docgen3

See merge request Chill-Projet/chill-bundles!135
2021-08-20 07:53:05 +00:00
Marc Ducobu
975f27f780 Good parameters for FOMULAIRE_AEB 2021-08-20 09:51:37 +02:00
Marc Ducobu
043e865eb0 Add column for DocGeneratorTemplate.index 2021-08-20 09:49:46 +02:00
Marc Ducobu
0479ddb42b Data injection in to file on openstack 2021-08-20 09:49:46 +02:00
f2b5cd7636 Accourse: toggle flags bg-danger in banner + misc 2021-08-20 01:35:01 +02:00
d100de4fcd In AccompanyingPeriod list, only show existing informations
That rule must be the same for each list,
we show empty datas messages in the complete show view
2021-08-20 00:46:28 +02:00
e711ac1feb Merge branch 'ameliorations_composants_vue' into improve_ux 2021-08-20 00:40:42 +02:00
5b8439e13c adding a new 'wraplist' sass element in flex-table collection: applied with AccompanyingPeriod lists 2021-08-20 00:38:40 +02:00
06abefd576 add redirection to wopi after doc generation 2021-08-19 23:30:45 +02:00
nobohan
3799627bf1 rdv: twig layout and field formatting 2021-08-19 21:50:52 +02:00
8295788d7f Merge branch 'feature/add-ChillWopiBundle' 2021-08-19 21:34:01 +02:00
71e6b356c3 Merge branch 'features/localize-accompanying-course-2' into 'master'
Improve UX for handling location in accompanying course

See merge request Chill-Projet/chill-bundles!125
2021-08-19 19:03:41 +00:00
bbcf9cc4ca handle creation of address 2021-08-19 20:59:17 +02:00
07030922e8 [household member editor] integrate with adresses and course
* redirection to a returnPath given into query search
* button for creating address
2021-08-19 20:00:20 +02:00
c16c517e97 [acc course location] allow to locate course from the index page 2021-08-19 20:00:20 +02:00
a0afaa568d [AccompanyingCourse location] Indicate course location on course index
page
2021-08-19 20:00:20 +02:00
75d3dfb830 Merge branch 'feature/link-evaluations-to-docgen' into 'master'
Feature/link evaluations to docgen

See merge request Chill-Projet/chill-bundles!130
2021-08-19 17:58:56 +00:00
a797143511 create document from evaluation 2021-08-19 19:47:27 +02:00
nobohan
4ae9b29924 rdv: correct redirections 2021-08-19 19:01:01 +02:00
Marc Ducobu
364346d0aa Merge branch 'docgen3' into 'master'
Docgen3

See merge request Chill-Projet/chill-bundles!132
2021-08-19 16:53:28 +00:00
nobohan
1a025ead1b rdv: twig layout + teleport calendar controls 2021-08-19 18:45:59 +02:00
Marc Ducobu
73c90f8c6a Debug docgen admin view error name 2021-08-19 18:42:07 +02:00
Marc Ducobu
772388298d Debug docgen view repository error name 2021-08-19 18:42:07 +02:00
Marc Ducobu
4184a74e7e Styling refactoring 2021-08-19 18:42:07 +02:00
Marc Ducobu
237476dc28 Save generated doc in openstack 2021-08-19 18:42:07 +02:00
Marc Ducobu
e6f5ef91ec Generation du doc àpd du template 2021-08-19 18:42:07 +02:00
Pol Dellaiera
c9cc0dd2a9 Update status code. 2021-08-19 17:03:22 +02:00
Pol Dellaiera
10c9526b49 Fix property name. 2021-08-19 16:58:41 +02:00
Pol Dellaiera
53cad32910 Update checkFileInfo 2021-08-19 16:49:55 +02:00
Pol Dellaiera
2a40645604 Pass the filename, not the id. 2021-08-19 16:33:04 +02:00
Pol Dellaiera
da505ed106 Add missing favicon url 2021-08-19 16:30:12 +02:00
Pol Dellaiera
fe4b9647b9 fix path to twig template. 2021-08-19 16:29:14 +02:00
Pol Dellaiera
1d7ef9300c Add missing router service. 2021-08-19 16:28:36 +02:00
Pol Dellaiera
bb9e175849 Add missing psr17 service. 2021-08-19 16:27:41 +02:00
Pol Dellaiera
5a3fd2712c refactor: Add test controller. 2021-08-19 16:25:53 +02:00
nobohan
7e64ec0a45 rdv: fix conflict when merging features/rdv 2021-08-19 16:19:36 +02:00
Pol Dellaiera
0a183c8cfc Revert "fix: Fix services definitions."
This reverts commit 3599508a3b.
2021-08-19 16:11:33 +02:00
Pol Dellaiera
60328032d8 Revert "Remove obsolete controller."
This reverts commit 494573e5b4.
2021-08-19 16:11:32 +02:00
nobohan
cf4f25aaff rdv: update fixtures 2021-08-19 16:07:44 +02:00
Pol Dellaiera
71900010f6 fix: Fix property name. 2021-08-19 16:06:05 +02:00
Pol Dellaiera
3599508a3b fix: Fix services definitions. 2021-08-19 16:04:43 +02:00
Pol Dellaiera
b1c15ec8ce fix: Update checkFileInfo, getFile and putFile. Remove obsolete code in unsupported methods. 2021-08-19 16:03:19 +02:00
nobohan
6a609eb1ab rdv: fix regression with multiple groups for property on calendar 2021-08-19 16:00:37 +02:00
Marc Ducobu
96ade5bd36 Merge branch 'fix-crud' into 'master'
fix crud paginator pbm

See merge request Chill-Projet/chill-bundles!131
2021-08-19 13:33:54 +00:00
Marc Ducobu
6383c1ca7b fix crud paginator pbm 2021-08-19 15:32:58 +02:00
Marc Ducobu
8be99bfe50 Merge branch 'docgen2' into 'master'
Api point for docgen templates

See merge request Chill-Projet/chill-bundles!129
2021-08-19 13:27:25 +00:00
13ff55c967 Desactivate tests which randomly fails with new fixtures 2021-08-19 15:25:11 +02:00
8c0d8692b0 Merge branch 'features/work-evaluation-save' into 'master'
[Social Work] Save evaluations

See merge request Chill-Projet/chill-bundles!126
2021-08-19 13:22:42 +00:00
nobohan
65bce1aacb rdv: available calendar ranges 2021-08-19 15:19:25 +02:00
60f7bdc926 serialization forr evaluations 2021-08-19 15:03:56 +02:00
Pol Dellaiera
4f39676e97 Remove obsolete OpenStack and Configuration stuff. 2021-08-19 14:24:40 +02:00
Pol Dellaiera
84a460c4e7 Remove obsolete file. 2021-08-19 14:18:24 +02:00
Pol Dellaiera
494573e5b4 Remove obsolete controller. 2021-08-19 14:18:24 +02:00
Pol Dellaiera
c16fc77d01 fix: Fix service naming, remove the suffix. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
282539ae6b fix: Add wiring for UserProviderInterface. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
50f1d3cd10 fix: Add UserProviderInterface dependency. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
4e04714a42 fix: Add wiring for UserProviderInterface. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
8992b99d56 fix: Add user data. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
62536ab2ff fix: Format date properly. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
b189726380 fix: Fix mimeType detection/discovery. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
a63c26482e fix: Fix mimeType detection/discovery. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
c208797daf fix: Update StoredObject entity. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
0366d0cb17 fix: Add exceptions. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
2b7fa630fc refactor: Add nyholm/psr7. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
a41b959fbd refactor: Fix TempUrlGeneratorInterface wiring. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
e4d9129af2 refactor: Add TempUrlGeneratorInterface wiring. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
72fc6e05cc refactor: Add WopiInterface wiring. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
47a2af6f19 Update composer.json. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
1bd01aefae refactor: Update ChillWopiBundle - Work in progress. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
c6b6fa5bf6 refactor: Update ChillDocStoreBundle - Add StoredObject repository. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
36d582c8ab Update configuration. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
df544bdfa4 update 2021-08-19 14:17:54 +02:00
Pol Dellaiera
12e17fac82 debug 2021-08-19 14:17:54 +02:00
Pol Dellaiera
b2d84a7677 Update. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
ebb679dbbb Update services.php. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
61bb595bba Update Test controller. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
c7aafc6730 Update services.php 2021-08-19 14:17:54 +02:00
Pol Dellaiera
24b675ce97 Fix path to services.php. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
3c888238c5 Fix services file. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
1bd00535ce Update services for controllers. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
d616e00660 Add test routes and controller. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
5d5ad9e4f7 Fix OpenStack service. 2021-08-19 14:17:54 +02:00
Pol Dellaiera
28af73db19 Fix typo. 2021-08-19 14:17:53 +02:00
Marc Ducobu
d8ca9cf082 Api point for docgen templates 2021-08-19 11:15:20 +02:00
nobohan
0457ee2b8d rdv: add my calendar + checkbox 2021-08-19 10:52:47 +02:00
bab06796f1 improve editing of evaluation
- an evaluation type can be repeated multiple times on the same action;
- in vue, evaluation are listed by key, not id,
- adding an evaluation make appears directly in "edit" mode;
- ...
2021-08-19 10:14:10 +02:00
nobohan
7c4f976230 rdv: add user calendar endpoint + add this calendar in the calendar 2021-08-18 23:16:52 +02:00
9447516694 fix bug in saving evaluation dates 2021-08-18 22:30:32 +02:00
nobohan
dbf72774c2 rdv: add main user in fullcalendar form 2021-08-18 21:09:08 +02:00
nobohan
a70d5cc263 rdv: fullcalendar: save calendarRange id as an extended prop in the calendar entity 2021-08-18 21:09:08 +02:00
nobohan
07eb5c797a rdv: fullcalendar: manage event clicking 2021-08-18 21:09:08 +02:00
nobohan
a54434a677 rdv: add fr locale to fullcalendar + colorise users calendars 2021-08-18 21:09:08 +02:00
nobohan
ca9738b55a rdv: fullcalendar: add current user by default 2021-08-18 21:09:08 +02:00
nobohan
b40c25595a rdv: fullcalendar: select and unselect user calendars 2021-08-18 21:09:08 +02:00
nobohan
e6deb6bc7a rdv: fullcalendar: update events source dynamically 2021-08-18 21:09:08 +02:00
nobohan
e499ebdf8b rdv: add dynamic event sources in fullcalendar (WIP) 2021-08-18 21:09:08 +02:00
nobohan
07f086dd61 rdv: fix calendar users loading for multiselect 2021-08-18 21:09:08 +02:00
nobohan
f2d79919f0 rdv: add calendar user selector widget 2021-08-18 21:09:08 +02:00
nobohan
02a9e21f62 rdv: set the calendar ranges as an API point + fetch them into the calendar view 2021-08-18 21:09:08 +02:00
nobohan
323434f34e rdv: add fixture for calendar range 2021-08-18 21:09:08 +02:00
nobohan
afad23eb0f rdv: fix timezone issue for editing events 2021-08-18 21:09:08 +02:00
nobohan
981c819f56 rdv: add current event date when edit 2021-08-18 21:09:07 +02:00
nobohan
9907b59379 rdv: renaming of variable + enable to display selected event 2021-08-18 21:09:07 +02:00
nobohan
dc3c8a4032 rdv: translations + layout (twig) 2021-08-18 21:09:07 +02:00
nobohan
95b50f2b99 rdv: add calendar list in menu 2021-08-18 21:09:07 +02:00
nobohan
b106a03534 rdv: hook i18n translations into the App.vue 2021-08-18 21:09:07 +02:00
nobohan
b7c5a459f7 rdv: change type of date to datetime in calendarRange 2021-08-18 21:09:07 +02:00
nobohan
4a6914be22 rdv: use datetime instead of date fields 2021-08-18 21:09:07 +02:00
nobohan
5181098339 rdv: connect fullcalendar vue component to startDate and endDate fields 2021-08-18 21:09:07 +02:00
nobohan
cc3e7f54a7 rdv: minor corrections following MR review 2021-08-18 21:09:07 +02:00
df7e76a2e7 rdv: MR comment 2021-08-18 21:09:07 +02:00
ccd5ac74fd rdv: MR comment 2021-08-18 21:09:07 +02:00
29c2ed3ce8 rdv: MR comment 2021-08-18 21:09:07 +02:00
4c17ce7926 rdv: MR comment 2021-08-18 21:09:07 +02:00
d49fd9738b rdv: MR comment 2021-08-18 21:09:07 +02:00
892e43d195 rdv: MR comment 2021-08-18 21:09:07 +02:00
nobohan
fe3cbdadab rdv: fullcalendar: add 3 buttons 'month - week - day' 2021-08-18 21:09:07 +02:00
nobohan
c54290a265 rdv: adapt calendar entities: drop useless field and change field type 2021-08-18 21:09:07 +02:00
nobohan
de6df983a0 rdv: add translations 2021-08-18 21:09:07 +02:00
nobohan
0585455bbe rdv: fullcalendar vue: use store and add an event on date select 2021-08-18 21:09:07 +02:00
nobohan
f508971b6a rdv: add fullcalendar.js as a vuejs component (POC) 2021-08-18 21:09:07 +02:00
nobohan
5c8b247f40 rdv: correct edit page 2021-08-18 21:09:07 +02:00
nobohan
9c7c890943 rdv: delete a rdv 2021-08-18 21:09:07 +02:00
nobohan
7e02b284ca rdv: others pages: edit, list 2021-08-18 21:09:07 +02:00
nobohan
d4ec5d137e rdv: add validation 2021-08-18 21:09:07 +02:00
nobohan
d542f582e6 rdv: allow null concerned persons in form 2021-08-18 21:09:07 +02:00
nobohan
3c37802821 rdv: add show calendar 2021-08-18 21:09:07 +02:00
nobohan
227be0b482 rdv: add default status on rdv when creating a new rdv 2021-08-18 21:09:07 +02:00
nobohan
4b8736ae57 rdv: fix adding thirdparty when creating a rdv 2021-08-18 21:09:07 +02:00
nobohan
206347de91 rdv: add entity to serialize (WIP) 2021-08-18 21:09:07 +02:00
nobohan
516c286519 rdv: can add thirdparty to a rdv 2021-08-18 21:09:07 +02:00
nobohan
adc462b735 rdv: simplify the vuejs component (removed not used parts) 2021-08-18 21:09:07 +02:00
nobohan
43d6dc835f rdv: add thirdParty in concerned persons (WIP) 2021-08-18 21:09:07 +02:00
nobohan
1557b8f80a rdv: add the concernedGroup vuejs component in add a new rdv 2021-08-18 21:09:07 +02:00
nobohan
20d113b1db rdv: some fixes for the new rdv 2021-08-18 21:09:06 +02:00
nobohan
114df16e0f rdv: add new rdv form 2021-08-18 21:09:06 +02:00
nobohan
b01eba2533 rdv: add route, twig for listing and creating calendar items 2021-08-18 21:09:06 +02:00
nobohan
75caf3fa14 rdv: adapt entities + add fixtures 2021-08-18 21:09:06 +02:00
nobohan
fdccdfe7b1 rdv: add first migration 2021-08-18 21:09:06 +02:00
nobohan
38ec2b5de9 rdv: correct entities with FQCN 2021-08-18 21:09:06 +02:00
nobohan
3010df2016 calendar: add entities 2021-08-18 21:09:06 +02:00
nobohan
3e7a9522b6 init Calendar bundle 2021-08-18 21:09:06 +02:00
Pol Dellaiera
364aff36a4 Add initial set of files. 2021-08-10 15:13:46 +02:00
Pol Dellaiera
3f1b5b2319 Add ChillWopiBundle. 2021-08-10 15:13:34 +02:00
1712 changed files with 105593 additions and 72314 deletions

View File

@@ -7,6 +7,7 @@ charset = utf-8
end_of_line = LF
insert_final_newline = true
trim_trailing_whitespace = true
indent_size = 4
[*.{php,html,twig}]
indent_style = space

2
.gitignore vendored
View File

@@ -20,3 +20,5 @@ docs/build/
.phpunit.result.cache
###< phpunit/phpunit ###
/.php-cs-fixer.cache
/.idea/

View File

@@ -1,48 +1,87 @@
---
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
# Select what we should cache between builds
cache:
paths:
- tests/app/vendor/
- .composer
before_script:
# add extensions to postgres
- PGPASSWORD=$POSTGRES_PASSWORD psql -U $POSTGRES_USER -h db -c "CREATE EXTENSION IF NOT EXISTS unaccent; CREATE EXTENSION IF NOT EXISTS pg_trgm;"
# Install and run Composer
- mkdir -p $COMPOSER_HOME
- 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
- echo "before_script finished"
paths:
- tests/app/vendor/
- .cache
# Bring in any services we need http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service
# See http://docs.gitlab.com/ee/ci/services/README.html for examples.
services:
- name: postgis/postgis:12-3.1-alpine
alias: db
- name: redis
alias: redis
- name: postgis/postgis:12-3.1-alpine
alias: db
- name: redis
alias: redis
# Set any variables we need
variables:
# Configure postgres environment variables (https://hub.docker.com/r/_/postgres/)
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
# fetch the chill-app using git submodules
GIT_SUBMODULE_STRATEGY: recursive
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_URL: redis://redis:6379
# change vendor dir to make the app install into tests/apps
COMPOSER_VENDOR_DIR: tests/app/vendor
# cache some composer data
COMPOSER_HOME: .composer
GIT_DEPTH: 1
# Configure postgres environment variables (https://hub.docker.com/r/_/postgres/)
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
# fetch the chill-app using git submodules
GIT_SUBMODULE_STRATEGY: recursive
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_URL: redis://redis:6379
# change vendor dir to make the app install into tests/apps
COMPOSER_VENDOR_DIR: tests/app/vendor
stages:
- Composer install
- Tests
# Run our tests
test:
script:
- php -d memory_limit=3G bin/phpunit --colors=never
build:
stage: Composer install
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
before_script:
- curl -sS https://getcomposer.org/installer | php
- php -d memory_limit=2G composer.phar config -g cache-dir "$(pwd)/.cache"
script:
- php -d memory_limit=2G composer.phar install --optimize-autoloader --no-ansi --no-interaction --no-progress
cache:
paths:
- .cache/
artifacts:
expire_in: 30 min
paths:
- bin
- tests/app/vendor/
code_style:
stage: Tests
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
script:
- bin/grumphp run --tasks=phpcsfixer
artifacts:
expire_in: 30 min
paths:
- bin
- tests/app/vendor/
sa_tests:
stage: Tests
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
script:
- bin/grumphp run --tasks=phpstan
artifacts:
expire_in: 30 min
paths:
- bin
- tests/app/vendor/
unit_tests:
stage: Tests
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
script:
- php tests/app/bin/console doctrine:migrations:migrate -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
- php -d memory_limit=3G bin/phpunit --colors=never
artifacts:
expire_in: 30 min
paths:
- bin
- tests/app/vendor/

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 -->

79
.php_cs.dist.php Normal file
View File

@@ -0,0 +1,79 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/** @var \drupol\PhpCsFixerConfigsPhp\Config\Php73 $config */
$config = require __DIR__ . '/tests/app/vendor/drupol/php-conventions/config/php73/php_cs_fixer.config.php';
$config
->getFinder()
->ignoreDotFiles(false)
->notPath('tests/app')
->name(['.php_cs.dist.php']);
$rules = $config->getRules();
$riskyRules = [
'ternary_to_elvis_operator' => false,
'php_unit_mock_short_will_return' => false,
'php_unit_set_up_tear_down_visibility' => false,
'php_unit_construct' => false,
'php_unit_dedicate_assert' => false,
'php_unit_expectation' => false,
'php_unit_mock' => false,
'php_unit_namespaced' => false,
'php_unit_no_expectation_annotation' => false,
'php_unit_test_case_static_method_calls' => false,
'php_unit_test_annotation' => false,
// 'final_internal_class' => false,
// 'strict_param' => false,
// 'declare_strict_types' => false,
// 'strict_comparison' => false,
// 'no_unreachable_default_argument_value' => false,
// 'ereg_to_preg' => false,
// 'ordered_interfaces' => false,
// 'error_suppression' => false,
// 'non_printable_character' => false,
// 'ordered_traits' => false,
// 'no_useless_sprintf' => false,
// 'dir_constant' => false,
// 'no_alias_functions' => false,
// 'implode_call' => false,
// 'combine_nested_dirname' => false,
// 'pow_to_exponentiation' => false,
// 'comment_to_phpdoc' => false,
// 'no_unset_on_property' => false,
// 'native_constant_invocation' => false,
// 'function_to_constant' => false,
// 'is_null' => false,
// 'native_function_invocation' => false,
// 'no_trailing_whitespace_in_string' => false,
// 'array_push' => false,
// 'fopen_flag_order' => false,
// 'fopen_flags' => false,
// 'logical_operators' => false,
// 'modernize_types_casting' => false,
// 'no_homoglyph_names' => false,
// 'no_unneeded_final_method' => false,
// 'random_api_migration' => false,
// 'static_lambda' => false,
// 'set_type_to_cast' => false,
// 'string_line_ending' => false,
// 'psr_autoloading' => false,
];
$rules = array_merge(
$rules,
$riskyRules
);
$rules['header_comment']['header'] = trim(file_get_contents(__DIR__ . '/resource/header.txt'));
return $config->setRules($rules);

231
CHANGELOG.md Normal file
View File

@@ -0,0 +1,231 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to
* [Semantic Versioning](https://semver.org/spec/v2.0.0.html) for stable releases;
* date versioning for test releases
## Unreleased
<!-- write down unreleased development here -->
* [person search] fix bug when using birthdate after and birthdate before
* [person search] increase pertinence when lastname begins with search pattern
## Test releases
### Test release 2021-11-19 - bis
* [household] do not allow to create two addresses on the same date
* [activity] handle case when there is no social action associated to social issue
* [activity] layout for issues / actions
* [activity][bugfix] in edit mode, the form will now load the social action list
### Test release 2021-11-29
* [person] suggest entities (person | thirdparty) when creating/editing the accompanying course (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/119)
* [activity] add custom validation on the Activity class, based on what is required from the ActivityType (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/188)
* [main] translate multiselect messages when selecting/creating address
* [main] set the coordinates of the city when creating a new address OR choosing "pas d'adresse complète"
* Use the user.label in accompanying course banner, instead of username;
* fix: show validation message when closing accompanying course;
* [thirdparty] link from modal to thirdparty detail page fixed (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/228)
* [assets] new asset to style suggestions lists (with add/remove item link) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/258)
* [accompanyingCourseWorkEdit] improves hyphenation and line breaks for long badges
* [acompanyingCourse] improve Resume page
* complete all needed informations,
* actions and activities are clickables,
* better placement with js masonry blocks on top of content area,
* https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/101
* https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/295
* [activity/calendar] on show page, concerned groups of persons table adapt itself to isVisibles options
* [activity] remove the "plus" button in activity list
* [activity] check ACL on activity list in person context
* [list for accompanying course in person] filter list using ACL
* [validation] toasts are displayed for errors when modifying accompanying course (generalization required).
* [period] only the user can enable confidentiality
* add an endpoint for checking permissions. See https://gitlab.com/Chill-Projet/chill-bundles/-/merge_requests/232
* [activity] for a new activity: suggest and create on-the-fly locations based on the accompanying course location + location of the suggested parties
* [calendar] for a new rdv: suggest and create on-the-fly locations based on the accompanying course location + location of the suggested parties
### Test release 2021-11-22
* [activity] delete admin_user_show in twig template because this route is not defined and should be defined
* [activity] suggest requestor, user and ressources for adding persons|user|3rdparty
* [calendar] suggest persons, professionals and invites for adding persons|3rdparty|user
* [activity] take into account the restrictions on person|thirdparties|users visibilities defined in ActivityType
* [main] Add currentLocation to the User entity + add a page for selecting this location + add in the user menu (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/133)
* [activity] add user current location as default location for a new activity (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/133)
* [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
* [person normalization] the key center is now "centers" and is an array. Empty array if no center
* [accompanyingCourse] Ability to close accompanying course (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/296)
* [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)
* [list result] show all courses, except ones with period closed
* [accompanyingCourse] improve banner with small carousel to display slide social-issues or slide associated persons (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/69)
### 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 releases
### 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.
* [Household] Show comment event if no address are associated with the household;
* [Person results] Add requestor into search results:
* 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+

411
CONVENTIONS.md Normal file
View File

@@ -0,0 +1,411 @@
# 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.
```scss
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" => ?
### Assets pour les listes de suggestion
Créer une liste de suggestions à ajouter (tout l'item est cliquable)
```html
<ul class="list-suggest add-items">
<li>
<span>item</span>
</li>
</ul>
```
Créer une liste de suggestions à enlever (avec une croix rouge cliquable, l'ancre a est vide)
```html
<ul class="list-suggest remove-items">
<li>
<span>
item
<a></a>
</span>
</li>
</ul>
```
Créer un titre enlevable (avec une croix rouge cliquable, l'ancre a est vide)
```html
<div class="item-title">
title
<a></a>
</div>
```

View File

@@ -629,12 +629,12 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
chill-bundles
Copyright (C) 2021 Chill Project
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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
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,

View File

@@ -1,12 +1,74 @@
{
"name": "chill-project/chill-bundles",
"license": "AGPL-3.0-only",
"type": "library",
"description": "Most used bundles for chill-project",
"keywords": [
"chill",
"social worker"
],
"license": "AGPL-3.0-only",
"require": {
"champs-libres/async-uploader-bundle": "dev-sf4",
"champs-libres/wopi-bundle": "dev-master",
"composer/package-versions-deprecated": "^1.10",
"doctrine/doctrine-bundle": "^2.1",
"doctrine/doctrine-migrations-bundle": "^3.0",
"doctrine/orm": "^2.7",
"erusev/parsedown": "^1.7",
"graylog2/gelf-php": "^1.5",
"knplabs/knp-menu": "^3.1",
"knplabs/knp-menu-bundle": "^3.0",
"knplabs/knp-time-bundle": "^1.12",
"league/csv": "^9.7.1",
"nyholm/psr7": "^1.4",
"phpoffice/phpspreadsheet": "^1.16",
"ramsey/uuid-doctrine": "^1.7",
"sensio/framework-extra-bundle": "^5.5",
"symfony/asset": "4.*",
"symfony/browser-kit": "^5.2",
"symfony/css-selector": "^5.2",
"symfony/expression-language": "4.*",
"symfony/form": "4.*",
"symfony/intl": "4.*",
"symfony/mime": "^4 || ^5",
"symfony/monolog-bundle": "^3.5",
"symfony/security-bundle": "4.*",
"symfony/serializer": "^5.2",
"symfony/swiftmailer-bundle": "^3.5",
"symfony/templating": "4.*",
"symfony/translation": "4.*",
"symfony/twig-bundle": "^4.4",
"symfony/validator": "4.*",
"symfony/webpack-encore-bundle": "^1.11",
"symfony/workflow": "4.*",
"symfony/yaml": "4.*",
"twig/extra-bundle": "^2.12 || ^3.0",
"twig/intl-extra": "^3.0",
"twig/markdown-extra": "^3.3",
"twig/twig": "^2.12 || ^3.0"
},
"conflict": {
"symfony/symfony": "*"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.3",
"drupol/php-conventions": "^5",
"fakerphp/faker": "^1.13",
"nelmio/alice": "^3.8",
"phpstan/phpstan-strict-rules": "^1.0",
"phpunit/phpunit": "^7.0",
"symfony/debug-bundle": "^5.1",
"symfony/dotenv": "^5.1",
"symfony/maker-bundle": "^1.20",
"symfony/phpunit-bridge": "^5.2",
"symfony/stopwatch": "^5.1",
"symfony/var-dumper": "4.*",
"symfony/web-profiler-bundle": "^5.0"
},
"config": {
"bin-dir": "bin",
"vendor-dir": "tests/app/vendor"
},
"autoload": {
"psr-4": {
"Chill\\ActivityBundle\\": "src/Bundle/ChillActivityBundle",
@@ -21,74 +83,23 @@
"Chill\\TaskBundle\\": "src/Bundle/ChillTaskBundle",
"Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle",
"Chill\\AsideActivityBundle\\": "src/Bundle/ChillAsideActivityBundle/src",
"Chill\\DocGeneratorBundle\\": "src/Bundle/ChillDocGeneratorBundle"
"Chill\\DocGeneratorBundle\\": "src/Bundle/ChillDocGeneratorBundle",
"Chill\\CalendarBundle\\": "src/Bundle/ChillCalendarBundle",
"Chill\\WopiBundle\\": "src/Bundle/ChillWopiBundle/src"
}
},
"autoload-dev": {
"psr-4": {
"App\\": "tests/app/src/"
"App\\": "tests/app/src/",
"Chill\\DocGeneratorBundle\\Tests\\": "src/Bundle/ChillDocGeneratorBundle/tests"
}
},
"require": {
"champs-libres/async-uploader-bundle": "dev-sf4",
"graylog2/gelf-php": "^1.5",
"symfony/form": "4.*",
"symfony/twig-bundle": "^4.4",
"twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0",
"composer/package-versions-deprecated": "^1.10",
"doctrine/doctrine-bundle": "^2.1",
"doctrine/doctrine-migrations-bundle": "^3.0",
"doctrine/orm": "^2.7",
"symfony/asset": "4.*",
"symfony/monolog-bundle": "^3.5",
"symfony/security-bundle": "4.*",
"symfony/translation": "4.*",
"symfony/validator": "4.*",
"sensio/framework-extra-bundle": "^5.5",
"symfony/yaml": "4.*",
"symfony/webpack-encore-bundle": "^1.11",
"knplabs/knp-menu": "^3.1",
"knplabs/knp-menu-bundle": "^3.0",
"symfony/templating": "4.*",
"twig/intl-extra": "^3.0",
"symfony/workflow": "4.*",
"symfony/expression-language": "4.*",
"knplabs/knp-time-bundle": "^1.12",
"symfony/intl": "4.*",
"symfony/swiftmailer-bundle": "^3.5",
"league/csv": "^9.7.1",
"phpoffice/phpspreadsheet": "^1.16",
"symfony/browser-kit": "^5.2",
"symfony/css-selector": "^5.2",
"twig/markdown-extra": "^3.3",
"erusev/parsedown": "^1.7",
"symfony/serializer": "^5.2",
"symfony/webpack-encore-bundle": "^1.11"
},
"conflict": {
"symfony/symfony": "*"
},
"require-dev": {
"fakerphp/faker": "^1.13",
"phpunit/phpunit": "^7.0",
"symfony/dotenv": "^5.1",
"symfony/maker-bundle": "^1.20",
"doctrine/doctrine-fixtures-bundle": "^3.3",
"symfony/stopwatch": "^5.1",
"symfony/web-profiler-bundle": "^5.0",
"symfony/var-dumper": "4.*",
"symfony/debug-bundle": "^5.1",
"symfony/phpunit-bridge": "^5.2",
"nelmio/alice": "^3.8"
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
}
},
"config": {
"bin-dir": "bin"
}
}

View File

@@ -1,123 +1,126 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Export\Filter;
use Chill\MainBundle\Export\ExportElementValidatedInterface;
use Chill\MainBundle\Export\FilterInterface;
use DateTime;
use Doctrine\ORM\Query\Expr;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Doctrine\ORM\Query\Expr;
use Chill\MainBundle\Form\Type\Export\FilterType;
use Symfony\Component\Form\FormError;
use Chill\MainBundle\Export\ExportElementValidatedInterface;
class BirthdateFilter implements FilterInterface, ExportElementValidatedInterface
class BirthdateFilter implements ExportElementValidatedInterface, FilterInterface
{
// add specific role for this filter
// add specific role for this filter
public function addRole()
{
// we do not need any new role for this filter, so we return null
return null;
}
// here, we alter the query created by Export
public function alterQuery(\Doctrine\ORM\QueryBuilder $qb, $data)
{
$where = $qb->getDQLPart('where');
// we create the clause here
$clause = $qb->expr()->between(
'person.birthdate',
':date_from',
':date_to'
);
// we have to take care **not to** remove previous clauses...
if ($where instanceof Expr\Andx) {
$where->add($clause);
} else {
$where = $qb->expr()->andX($clause);
}
$qb->add('where', $where);
// we add parameters from $data. $data contains the parameters from the form
$qb->setParameter('date_from', $data['date_from']);
$qb->setParameter('date_to', $data['date_to']);
}
// we give information on which type of export this filter applies
public function applyOn()
{
return 'person';
}
public function getTitle()
{
return 'Filter by person\'s birthdate';
}
// we build a form to collect some parameters from the users
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder)
{
$builder->add('date_from', DateType::class, array(
'label' => "Born after this date",
'data' => new \DateTime(),
'attr' => array('class' => 'datepicker'),
'widget'=> 'single_text',
$builder->add('date_from', DateType::class, [
'label' => 'Born after this date',
'data' => new DateTime(),
'attr' => ['class' => 'datepicker'],
'widget' => 'single_text',
'format' => 'dd-MM-yyyy',
));
$builder->add('date_to', DateType::class, array(
'label' => "Born before this date",
'data' => new \DateTime(),
'attr' => array('class' => 'datepicker'),
'widget'=> 'single_text',
]);
$builder->add('date_to', DateType::class, [
'label' => 'Born before this date',
'data' => new DateTime(),
'attr' => ['class' => 'datepicker'],
'widget' => 'single_text',
'format' => 'dd-MM-yyyy',
));
}
// the form created above must be validated. The process of validation
// is executed here. This function is added by the interface
// `ExportElementValidatedInterface`, and can be ignore if there is
// no need for a validation
public function validateForm($data, ExecutionContextInterface $context)
{
$date_from = $data['date_from'];
$date_to = $data['date_to'];
if ($date_from === null) {
$context->buildViolation('The "date from" should not be empty')
//->atPath('date_from')
->addViolation();
}
if ($date_to === null) {
$context->buildViolation('The "date to" should not be empty')
//->atPath('date_to')
->addViolation();
}
if (
($date_from !== null && $date_to !== null)
&&
$date_from >= $date_to
) {
$context->buildViolation('The date "date to" should be after the '
. 'date given in "date from" field')
->addViolation();
}
}
// here, we alter the query created by Export
public function alterQuery(\Doctrine\ORM\QueryBuilder $qb, $data)
{
$where = $qb->getDQLPart('where');
// we create the clause here
$clause = $qb->expr()->between('person.birthdate', ':date_from',
':date_to');
// we have to take care **not to** remove previous clauses...
if ($where instanceof Expr\Andx) {
$where->add($clause);
} else {
$where = $qb->expr()->andX($clause);
}
$qb->add('where', $where);
// we add parameters from $data. $data contains the parameters from the form
$qb->setParameter('date_from', $data['date_from']);
$qb->setParameter('date_to', $data['date_to']);
]);
}
// here, we create a simple string which will describe the action of
// the filter in the Response
public function describeAction($data, $format = 'string')
{
return array('Filtered by person\'s birtdate: '
. 'between %date_from% and %date_to%', array(
return ['Filtered by person\'s birtdate: '
. 'between %date_from% and %date_to%', [
'%date_from%' => $data['date_from']->format('d-m-Y'),
'%date_to%' => $data['date_to']->format('d-m-Y')
));
'%date_to%' => $data['date_to']->format('d-m-Y'),
], ];
}
public function getTitle()
{
return 'Filter by person\'s birthdate';
}
// the form created above must be validated. The process of validation
// is executed here. This function is added by the interface
// `ExportElementValidatedInterface`, and can be ignore if there is
// no need for a validation
public function validateForm($data, ExecutionContextInterface $context)
{
$date_from = $data['date_from'];
$date_to = $data['date_to'];
if (null === $date_from) {
$context->buildViolation('The "date from" should not be empty')
//->atPath('date_from')
->addViolation();
}
if (null === $date_to) {
$context->buildViolation('The "date to" should not be empty')
//->atPath('date_to')
->addViolation();
}
if (
(null !== $date_from && null !== $date_to)
&& $date_from >= $date_to
) {
$context->buildViolation('The date "date to" should be after the '
. 'date given in "date from" field')
->addViolation();
}
}
}

View File

@@ -1,118 +1,117 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Export\Export;
use Chill\MainBundle\Export\ExportInterface;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use Doctrine\ORM\Query;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Symfony\Component\Security\Core\Role\Role;
use Chill\PersonBundle\Export\Declarations;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Role\Role;
/**
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class CountPerson implements ExportInterface
{
/**
*
* @var EntityManagerInterface
*/
protected $entityManager;
public function __construct(
EntityManagerInterface $em
)
{
EntityManagerInterface $em
) {
$this->entityManager = $em;
}
public function getType()
public function buildForm(FormBuilderInterface $builder)
{
return Declarations::PERSON_TYPE;
// this export does not add any form
}
public function getAllowedFormattersTypes()
{
return [FormatterInterface::TYPE_TABULAR];
}
public function getDescription()
{
return "Count peoples by various parameters.";
return 'Count peoples by various parameters.';
}
public function getTitle()
public function getLabels($key, array $values, $data)
{
return "Count peoples";
// the Closure which will be executed by the formatter.
return function ($value) {
switch ($value) {
case '_header':
// we have to process specifically the '_header' string,
// which will be used by the formatter to show a column title
return $this->getTitle();
default:
// for all value, we do not process them and return them
// immediatly
return $value;
}
};
}
public function requiredRole()
{
return new Role(PersonVoter::STATS);
}
public function initiateQuery(array $requiredModifiers, array $acl, array $data = array())
{
// we gather all center the user choose.
$centers = array_map(function($el) { return $el['center']; }, $acl);
$qb = $this->entityManager->createQueryBuilder();
$qb->select('COUNT(person.id) AS export_result')
->from('ChillPersonBundle:Person', 'person')
->join('person.center', 'center')
->andWhere('center IN (:authorized_centers)')
->setParameter('authorized_centers', $centers);
;
return $qb;
}
public function getResult($qb, $data)
{
return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR);
}
public function getQueryKeys($data)
{
// this array match the result keys in the query. We have only
// one column.
return array('export_result');
return ['export_result'];
}
public function getLabels($key, array $values, $data)
public function getResult($qb, $data)
{
// the Closure which will be executed by the formatter.
return function($value) {
switch($value) {
case '_header':
// we have to process specifically the '_header' string,
// which will be used by the formatter to show a column title
return $this->getTitle();
default:
// for all value, we do not process them and return them
// immediatly
return $value;
};
return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR);
}
public function getAllowedFormattersTypes()
public function getTitle()
{
return array(FormatterInterface::TYPE_TABULAR);
return 'Count peoples';
}
public function buildForm(FormBuilderInterface $builder) {
// this export does not add any form
public function getType()
{
return Declarations::PERSON_TYPE;
}
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
// we gather all center the user choose.
$centers = array_map(static function ($el) { return $el['center']; }, $acl);
$qb = $this->entityManager->createQueryBuilder();
$qb->select('COUNT(person.id) AS export_result')
->from('ChillPersonBundle:Person', 'person')
->join('person.center', 'center')
->andWhere('center IN (:authorized_centers)')
->setParameter('authorized_centers', $centers);
return $qb;
}
public function requiredRole()
{
return new Role(PersonVoter::STATS);
}
public function supportsModifiers()
{
// explain the export manager which formatters and filters are allowed
return array(Declarations::PERSON_TYPE, Declarations::PERSON_IMPLIED_IN);
return [Declarations::PERSON_TYPE, Declarations::PERSON_IMPLIED_IN];
}
}

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:

View File

@@ -1,42 +1,49 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MyBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
class ItemController extends Controller {
public function yourAction()
class example extends Controller
{
public function yourAction()
{
$em = $this->getDoctrine()->getManager();
// first, get the number of total item are available
$total = $em
->createQuery("SELECT COUNT (item.id) FROM ChillMyBundle:Item item")
->getSingleScalarResult();
->createQuery('SELECT COUNT (item.id) FROM ChillMyBundle:Item item')
->getSingleScalarResult();
// get the PaginatorFactory
$paginatorFactory = $this->get('chill_main.paginator_factory');
// create a pagination instance. This instance is only valid for
// create a pagination instance. This instance is only valid for
// the current route and parameters
$paginator = $paginatorFactory->create($total);
// launch your query on item. Limit the query to the results
// for the current page using the paginator
$items = $em->createQuery("SELECT item FROM ChillMyBundle:Item item WHERE <your clause>")
$items = $em->createQuery('SELECT item FROM ChillMyBundle:Item item WHERE <your clause>')
// use the paginator to get the first item number
->setFirstResult($paginator->getCurrentPage()->getFirstItemNumber())
// use the paginator to get the number of items to display
->setMaxResults($paginator->getItemsPerPage());
return $this->render('ChillMyBundle:Item:list.html.twig', array(
return $this->render(
'ChillMyBundle:Item:list.html.twig',
[
'items' => $items,
'paginator' => $paginator
);
'paginator' => $paginator,
]
);
}
}

View File

@@ -1,43 +1,53 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\HealthBundle\Controller;
use Chill\HealthBundle\Security\Authorization\ConsultationVoter;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Security\Core\Role\Role;
class ConsultationController extends Controller
{
/**
*
* @param int $id personId
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws type
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function listAction($id)
{
/* @var $person \Chill\PersonBundle\Entity\Person */
/** @var \Chill\PersonBundle\Entity\Person $person */
$person = $this->get('chill.person.repository.person')
->find($id);
if ($person === null) {
throw $this->createNotFoundException("The person is not found");
if (null === $person) {
throw $this->createNotFoundException('The person is not found');
}
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
/* @var $authorizationHelper \Chill\MainBundle\Security\Authorization\AuthorizationHelper */
/** @var \Chill\MainBundle\Security\Authorization\AuthorizationHelper $authorizationHelper */
$authorizationHelper = $this->get('chill.main.security.'
. 'authorization.helper');
$circles = $authorizationHelper->getReachableCircles(
$this->getUser(),
new Role(ConsultationVoter::SEE),
$this->getUser(),
new Role(ConsultationVoter::SEE),
$person->getCenter()
);
// create a query which take circles into account
);
// create a query which take circles into account
$consultations = $this->getDoctrine()->getManager()
->createQuery('SELECT c FROM ChillHealthBundle:Consultation c '
. 'WHERE c.patient = :person AND c.circle IN(:circles) '
@@ -45,11 +55,10 @@ class ConsultationController extends Controller
->setParameter('person', $person)
->setParameter('circles', $circles)
->getResult();
return $this->render('ChillHealthBundle:Consultation:list.html.twig', array(
'person' => $person,
'consultations' => $consultations
));
return $this->render('ChillHealthBundle:Consultation:list.html.twig', [
'person' => $person,
'consultations' => $consultations,
]);
}
}

View File

@@ -1,64 +1,63 @@
<?php
# Chill\MainBundle\DependencyInjection\Configuration.php
namespace Chill\MainBundle\DependencyInjection;
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\DependencyInjection;
use Chill\MainBundle\DependencyInjection\Widget\AddWidgetConfigurationTrait;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Chill\MainBundle\DependencyInjection\Widget\AddWidgetConfigurationTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Configure the main bundle
* Configure the main bundle.
*/
class Configuration implements ConfigurationInterface
class ChillMainConfiguration implements ConfigurationInterface
{
use AddWidgetConfigurationTrait;
/**
*
* @var ContainerBuilder
*/
* @var ContainerBuilder
*/
private $containerBuilder;
public function __construct(array $widgetFactories = array(),
ContainerBuilder $containerBuilder)
{
public function __construct(
array $widgetFactories,
ContainerBuilder $containerBuilder
) {
// we register here widget factories (see below)
$this->setWidgetFactories($widgetFactories);
$this->setWidgetFactories($widgetFactories);
// we will need the container builder later...
$this->containerBuilder = $containerBuilder;
$this->containerBuilder = $containerBuilder;
}
/**
* {@inheritDoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('chill_main');
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('chill_main');
$rootNode
->children()
$rootNode
->children()
// ...
->arrayNode('widgets')
->canBeDisabled()
->children()
->arrayNode('widgets')
->canBeDisabled()
->children()
// we declare here all configuration for homepage place
->append($this->addWidgetsConfiguration('homepage', $this->containerBuilder))
->end() // end of widgets/children
->end() // end of widgets
->end() // end of root/children
->end() // end of root
;
->append($this->addWidgetsConfiguration('homepage', $this->containerBuilder))
->end() // end of widgets/children
->end() // end of widgets
->end() // end of root/children
->end() // end of root
;
return $treeBuilder;
return $treeBuilder;
}
}

View File

@@ -1,16 +1,19 @@
<?php
#Chill\MainBundle\DependencyInjection\ChillMainExtension.php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Chill\MainBundle\DependencyInjection\Widget\Factory\WidgetFactoryInterface;
use Chill\MainBundle\DependencyInjection\Configuration;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
/**
* This class load config for chillMainExtension.
@@ -18,42 +21,42 @@ use Chill\MainBundle\DependencyInjection\Configuration;
class ChillMainExtension extends Extension implements Widget\HasWidgetFactoriesExtensionInterface
{
/**
* widget factory
*
* widget factory.
*
* @var WidgetFactoryInterface[]
*/
protected $widgetFactories = array();
protected $widgetFactories = [];
public function addWidgetFactory(WidgetFactoryInterface $factory)
{
$this->widgetFactories[] = $factory;
}
public function getConfiguration(array $config, ContainerBuilder $container)
{
return new Configuration($this->widgetFactories, $container);
}
/**
*
* @return WidgetFactoryInterface[]
*/
public function getWidgetFactories()
{
return $this->widgetFactories;
}
public function load(array $configs, ContainerBuilder $container)
{
// configuration for main bundle
$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);
// add the key 'widget' without the key 'enable'
$container->setParameter('chill_main.widgets',
array('homepage' => $config['widgets']['homepage']));
// ...
// add the key 'widget' without the key 'enable'
$container->setParameter(
'chill_main.widgets',
['homepage' => $config['widgets']['homepage']]
);
// ...
}
public function getConfiguration(array $config, ContainerBuilder $container)
{
return new Configuration($this->widgetFactories, $container);
}
}

View File

@@ -1,69 +1,73 @@
<?php
# Chill/PersonBundle/Widget/PersonListWidgetFactory
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Widget;
use Chill\MainBundle\DependencyInjection\Widget\Factory\AbstractWidgetFactory;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* add configuration for the person_list widget.
*/
class PersonListWidgetFactory extends AbstractWidgetFactory
class ChillPersonAddAPersonListWidgetFactory extends AbstractWidgetFactory
{
/*
* append the option to the configuration
* see http://symfony.com/doc/current/components/config/definition.html
*
*/
/*
* append the option to the configuration
* see http://symfony.com/doc/current/components/config/definition.html
*
*/
public function configureOptions($place, NodeBuilder $node)
{
$node->booleanNode('only_active')
->defaultTrue()
->end();
->defaultTrue()
->end();
$node->integerNode('number_of_items')
->defaultValue(50)
->end();
$node->scalarNode('filtering_class')
->defaultNull()
->end();
->defaultNull()
->end();
}
/*
* return an array with the allowed places where the widget can be rendered
*
* @return string[]
*/
/**
* return an array with the allowed places where the widget can be rendered.
*
* @return string[]
*/
public function getAllowedPlaces()
{
return array('homepage');
return ['homepage'];
}
/*
* return the widget alias
*
* @return string
*/
public function getWidgetAlias()
{
return 'person_list';
}
/*
* return the service id for the service which will render the widget.
*
* this service must implements `Chill\MainBundle\Templating\Widget\WidgetInterface`
*
* the service must exists in the container, and it is not required that the service
*
* the service must exists in the container, and it is not required that the service
* has the `chill_main` tag.
*/
public function getServiceId(ContainerBuilder $containerBuilder, $place, $order, array $config)
{
return 'chill_person.widget.person_list';
}
}
/**
* return the widget alias.
*
* @return string
*/
public function getWidgetAlias()
{
return 'person_list';
}
}

View File

@@ -1,66 +1,73 @@
<?php
# Chill/PersonBundle/Widget/PersonListWidget.php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Widget;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\MainBundle\Templating\Widget\WidgetInterface;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use DateTime;
use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\Expr;
use Doctrine\DBAL\Types\Type;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Symfony\Component\Security\Core\Role\Role;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Security\Core\User\UserInterface;
use Twig_Environment;
/**
* add a widget with person list.
*
* add a widget with person list.
*
* The configuration is defined by `PersonListWidgetFactory`
*/
class PersonListWidget implements WidgetInterface
class ChillPersonAddAPersonWidget implements WidgetInterface
{
/**
* Repository for persons
*
* @var EntityRepository
* the authorization helper.
*
* @var AuthorizationHelper;
*/
protected $personRepository;
protected $authorizationHelper;
/**
* The entity manager
* The entity manager.
*
* @var EntityManager
*/
protected $entityManager;
/**
* the authorization helper
*
* @var AuthorizationHelper;
*/
protected $authorizationHelper;
/**
* Repository for persons.
*
* @var EntityRepository
*/
protected $personRepository;
/**
* @var TokenStorage
*/
protected $tokenStorage;
/**
*
* @var UserInterface
*/
protected $user;
public function __construct(
EntityRepository $personRepostory,
EntityManager $em,
AuthorizationHelper $authorizationHelper,
TokenStorage $tokenStorage
) {
EntityRepository $personRepostory,
EntityManager $em,
AuthorizationHelper $authorizationHelper,
TokenStorage $tokenStorage
) {
$this->personRepository = $personRepostory;
$this->authorizationHelper = $authorizationHelper;
$this->tokenStorage = $tokenStorage;
@@ -68,27 +75,24 @@ class PersonListWidget implements WidgetInterface
}
/**
*
* @param type $place
* @param array $context
* @param array $config
*
* @return string
*/
public function render(\Twig_Environment $env, $place, array $context, array $config)
{
public function render(Twig_Environment $env, $place, array $context, array $config)
{
$qb = $this->personRepository
->createQueryBuilder('person');
->createQueryBuilder('person');
// show only the person from the authorized centers
$and = $qb->expr()->andX();
$centers = $this->authorizationHelper
->getReachableCenters($this->getUser(), new Role(PersonVoter::SEE));
->getReachableCenters($this->getUser(), new Role(PersonVoter::SEE));
$and->add($qb->expr()->in('person.center', ':centers'));
$qb->setParameter('centers', $centers);
// add the "only active" where clause
if ($config['only_active'] === true) {
if (true === $config['only_active']) {
$qb->join('person.accompanyingPeriods', 'ap');
$or = new Expr\Orx();
// add the case where closingDate IS NULL
@@ -98,32 +102,30 @@ class PersonListWidget implements WidgetInterface
$or->add($andWhenClosingDateIsNull);
// add the case when now is between opening date and closing date
$or->add(
(new Expr())->between(':now', 'ap.openingDate', 'ap.closingDate')
);
(new Expr())->between(':now', 'ap.openingDate', 'ap.closingDate')
);
$and->add($or);
$qb->setParameter('now', new \DateTime(), Type::DATE);
$qb->setParameter('now', new DateTime(), Type::DATE);
}
// adding the where clause to the query
$qb->where($and);
$qb->setFirstResult(0)->setMaxResults($config['number_of_items']);
$persons = $qb->getQuery()->getResult();
return $env->render(
'ChillPersonBundle:Widget:homepage_person_list.html.twig',
array('persons' => $persons)
);
['persons' => $persons]
);
}
/**
*
* @return UserInterface
*/
private function getUser()
{
// return a user
}
}

View File

@@ -1,51 +1,48 @@
<?php
# Chill/PersonBundle/DependencyInjection/ChillPersonExtension.php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Chill\MainBundle\DependencyInjection\MissingBundleException;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
/**
* This is the class that loads and manages your bundle configuration
* This is the class that loads and manages your bundle configuration.
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class ChillPersonExtension extends Extension implements PrependExtensionInterface
{
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
// ...
// ...
}
/**
*
* Add a widget "add a person" on the homepage, automatically
*
* Add a widget "add a person" on the homepage, automatically.
*
* @param \Chill\PersonBundle\DependencyInjection\containerBuilder $container
*/
public function prepend(ContainerBuilder $container)
public function prepend(ContainerBuilder $container)
{
$container->prependExtensionConfig('chill_main', array(
'widgets' => array(
'homepage' => array(
array(
$container->prependExtensionConfig('chill_main', [
'widgets' => [
'homepage' => [
[
'widget_alias' => 'add_person',
'order' => 2
)
)
)
));
'order' => 2,
],
],
],
]);
}
}

14
grumphp.yml Normal file
View File

@@ -0,0 +1,14 @@
imports:
- {
resource: tests/app/vendor/drupol/php-conventions/config/php73/grumphp.yml,
}
parameters:
tasks.phpcsfixer.config: .php_cs.dist.php
tasks.license.name: AGPL-3.0
tasks.license.holder: Champs-Libres
tasks.license.date_from: 2001
tasks.phpcsfixer.allow_risky: true
tasks.phpcsfixer.diff: true
tasks.phpstan.level: 1

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

126
phpstan-critical.neon Normal file
View File

@@ -0,0 +1,126 @@
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\\: \\$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

1620
phpstan-deprecations.neon Normal file

File diff suppressed because it is too large Load Diff

497
phpstan-types.neon Normal file
View File

@@ -0,0 +1,497 @@
parameters:
ignoreErrors:
-
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: "#^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: "#^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: "#^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: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
count: 1
path: src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/AbstractCustomField.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: "#^Method Chill\\\\EventBundle\\\\Entity\\\\Participation\\:\\:offsetGet\\(\\) should return mixed but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillEventBundle/Entity/Participation.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: "#^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: "#^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: "#^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: "#^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: "#^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: "#^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: "#^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: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Entity/User.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: "#^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: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.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: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.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: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 6
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 2
path: src/Bundle/ChillPersonBundle/Entity/PersonPhone.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: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 2
path: src/Bundle/ChillPersonBundle/Export/Export/ListPerson.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: "#^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: "#^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: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 2
path: src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.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: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 2
path: src/Bundle/ChillReportBundle/Export/Export/ReportList.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: "#^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: "#^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: "#^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: "#^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: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php

26
phpstan.neon.dist Normal file
View File

@@ -0,0 +1,26 @@
parameters:
level: 1
paths:
- src/
excludePaths:
- docs/
- 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-baseline.neon
- phpstan-critical.neon
- phpstan-deprecations.neon
- phpstan-types.neon

View File

@@ -10,7 +10,7 @@
<php>
<ini name="error_reporting" value="-1" />
<server name="APP_ENV" value="test" force="true" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
<server name="SHELL_VERBOSITY" value="-1" />
</php>
@@ -31,6 +31,15 @@
<!-- temporarily removed, the time to find a fix -->
<exclude>src/Bundle/ChillPersonBundle/Tests/Controller/PersonDuplicateControllerViewTest.php</exclude>
</testsuite>
<testsuite name="AsideActivityBundle">
<directory suffix="Test.php">src/Bundle/ChillAsideActivityBundle/src/Tests/</directory>
</testsuite>
<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>

5
resource/header.txt Normal file
View File

@@ -0,0 +1,5 @@
Chill is a software for social workers
For the full copyright and license information, please view
the LICENSE file that was distributed with this source code.

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,5 +1,14 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;

View File

@@ -1,155 +1,290 @@
<?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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Controller;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\ActivityBundle\Entity\Activity;
use Chill\ActivityBundle\Entity\ActivityReason;
use Chill\ActivityBundle\Form\ActivityType;
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\Entity\Embeddable\CommentEmbeddable;
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 DateTime;
use Doctrine\ORM\EntityManagerInterface;
use InvalidArgumentException;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Role\Role;
use Chill\ActivityBundle\Entity\Activity;
use Chill\ActivityBundle\Form\ActivityType;
use Symfony\Component\Serializer\SerializerInterface;
use function array_key_exists;
/**
* Class ActivityController
*
* @package Chill\ActivityBundle\Controller
*/
class ActivityController extends AbstractController
final class ActivityController extends AbstractController
{
protected EventDispatcherInterface $eventDispatcher;
private AccompanyingPeriodRepository $accompanyingPeriodRepository;
protected AuthorizationHelper $authorizationHelper;
private ActivityACLAwareRepositoryInterface $activityACLAwareRepository;
protected LoggerInterface $logger;
private ActivityRepository $activityRepository;
protected SerializerInterface $serializer;
private ActivityTypeCategoryRepository $activityTypeCategoryRepository;
private ActivityTypeRepository $activityTypeRepository;
private EntityManagerInterface $entityManager;
private EventDispatcherInterface $eventDispatcher;
private LocationRepository $locationRepository;
private LoggerInterface $logger;
private PersonRepository $personRepository;
private SerializerInterface $serializer;
private ThirdPartyRepository $thirdPartyRepository;
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;
}
/**
* Deletes a Activity entity.
*
* @param mixed $id
*/
public function deleteAction(Request $request, $id)
{
$view = null;
[$person, $accompanyingPeriod] = $this->getEntity($request);
$activity = $this->activityRepository->find($id);
if (!$activity) {
throw $this->createNotFoundException('Unable to find Activity entity.');
}
if ($activity->getAccompanyingPeriod() instanceof AccompanyingPeriod) {
$view = 'ChillActivityBundle:Activity:confirm_deleteAccompanyingCourse.html.twig';
$accompanyingPeriod = $activity->getAccompanyingPeriod();
} else {
$view = 'ChillActivityBundle:Activity:confirm_deletePerson.html.twig';
}
// TODO
// $this->denyAccessUnlessGranted('CHILL_ACTIVITY_DELETE', $activity);
$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', [
'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(
static fn (ActivityReason $ar): int => $ar->getId()
)
->toArray(),
'type_id' => $activity->getActivityType()->getId(),
'duration' => $activity->getDurationTime() ? $activity->getDurationTime()->format('U') : null,
'date' => $activity->getDate()->format('Y-m-d'),
'attendee' => $activity->getAttendee(),
]);
$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);
}
}
if (null === $view) {
throw $this->createNotFoundException('Template not found');
}
return $this->render($view, [
'activity' => $activity,
'delete_form' => $form->createView(),
'person' => $person,
'accompanyingCourse' => $accompanyingPeriod,
]);
}
/**
* Displays a form to edit an existing Activity entity.
*/
public function editAction(int $id, Request $request): Response
{
$view = null;
[$person, $accompanyingPeriod] = $this->getEntity($request);
$entity = $this->activityRepository->find($id);
if (null === $entity) {
throw $this->createNotFoundException('Unable to find Activity entity.');
}
if ($entity->getAccompanyingPeriod() instanceof AccompanyingPeriod) {
$view = 'ChillActivityBundle:Activity:editAccompanyingCourse.html.twig';
$accompanyingPeriod = $entity->getAccompanyingPeriod();
} else {
$view = 'ChillActivityBundle:Activity:editPerson.html.twig';
}
// TODO
// $this->denyAccessUnlessGranted('CHILL_ACTIVITY_UPDATE', $entity);
$form = $this->createForm(ActivityType::class, $entity, [
'center' => $entity->getCenter(),
'role' => new Role('CHILL_ACTIVITY_UPDATE'),
'activityType' => $entity->getActivityType(),
'accompanyingPeriod' => $accompanyingPeriod,
])->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->entityManager->persist($entity);
$this->entityManager->flush();
$this->addFlash('success', $this->get('translator')->trans('Success : activity updated!'));
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
$params['id'] = $entity->getId();
return $this->redirectToRoute('chill_activity_activity_show', $params);
}
$deleteForm = $this->createDeleteForm($entity->getId(), $person, $accompanyingPeriod);
/*
* TODO
$event = new PrivacyEvent($person, array(
'element_class' => Activity::class,
'element_id' => $entity->getId(),
'action' => 'edit'
));
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
*/
if (null === $view) {
throw $this->createNotFoundException('Template not found');
}
$activity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
return $this->render($view, [
'entity' => $entity,
'edit_form' => $form->createView(),
'delete_form' => $deleteForm->createView(),
'person' => $person,
'accompanyingCourse' => $accompanyingPeriod,
'activity_json' => $activity_array,
]);
}
/**
* Lists all Activity entities.
*/
public function listAction(Request $request): Response
{
$em = $this->getDoctrine()->getManager();
$view = null;
$activities = [];
// TODO: add pagination
[$person, $accompanyingPeriod] = $this->getEntity($request);
if ($person instanceof Person) {
$reachableScopes = $this->authorizationHelper
->getReachableCircles($this->getUser(), new Role('CHILL_ACTIVITY_SEE'),
$person->getCenter());
$this->denyAccessUnlessGranted(ActivityVoter::SEE, $person);
$activities = $this->activityACLAwareRepository
->findByPerson($person, ActivityVoter::SEE, 0, null);
$activities = $em->getRepository(Activity::class)
->findByPersonImplied($person, $reachableScopes)
;
$event = new PrivacyEvent($person, array(
$event = new PrivacyEvent($person, [
'element_class' => Activity::class,
'action' => 'list'
));
'action' => 'list',
]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
$view = 'ChillActivityBundle:Activity:listPerson.html.twig';
} elseif ($accompanyingPeriod instanceof AccompanyingPeriod) {
$activities = $em->getRepository('ChillActivityBundle:Activity')->findBy(
['accompanyingPeriod' => $accompanyingPeriod],
['date' => 'DESC'],
);
$this->denyAccessUnlessGranted(ActivityVoter::SEE, $accompanyingPeriod);
$activities = $this->activityACLAwareRepository
->findByAccompanyingPeriod($accompanyingPeriod, ActivityVoter::SEE);
$view = 'ChillActivityBundle:Activity:listAccompanyingCourse.html.twig';
}
return $this->render($view, array(
'activities' => $activities,
'person' => $person,
'accompanyingCourse' => $accompanyingPeriod,
));
}
public function selectTypeAction(Request $request): Response
{
$em = $this->getDoctrine()->getManager();
$view = null;
[$person, $accompanyingPeriod] = $this->getEntity($request);
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
$view = 'ChillActivityBundle:Activity:selectTypeAccompanyingCourse.html.twig';
} elseif ($person instanceof Person) {
$view = 'ChillActivityBundle:Activity:selectTypePerson.html.twig';
}
$data = [];
$activityTypeCategories = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityTypeCategory::class)
->findBy(['active' => true], ['ordering' => 'ASC']);
foreach ($activityTypeCategories as $activityTypeCategory) {
$activityTypes = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityType::class)
->findBy(['active' => true, 'category' => $activityTypeCategory], ['ordering' => 'ASC']);
$data[] = [
'activityTypeCategory' => $activityTypeCategory,
'activityTypes' => $activityTypes,
];
}
if ($view === null) {
throw $this->createNotFoundException('Template not found');
}
return $this->render($view, [
'person' => $person,
'accompanyingCourse' => $accompanyingPeriod,
'data' => $data,
]);
return $this->render(
$view,
[
'activities' => $activities,
'person' => $person,
'accompanyingCourse' => $accompanyingPeriod,
]
);
}
public function newAction(Request $request): Response
{
$em = $this->getDoctrine()->getManager();
$view = null;
[$person, $accompanyingPeriod] = $this->getEntity($request);
@@ -160,13 +295,26 @@ 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 (!$activityType instanceof \Chill\ActivityBundle\Entity\ActivityType ||
!$activityType->isActive()) {
if (isset($activityType) && !$activityType->isActive()) {
throw new InvalidArgumentException('Activity type must be active');
}
$activityData = null;
if ($request->query->has('activityData')) {
$activityData = $request->query->get('activityData');
}
if (!$activityType instanceof \Chill\ActivityBundle\Entity\ActivityType
|| !$activityType->isActive()) {
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
if (null !== $activityData) {
$params['activityData'] = $activityData;
}
return $this->redirectToRoute('chill_activity_activity_select_type', $params);
}
@@ -181,49 +329,146 @@ class ActivityController extends AbstractController
$entity->setAccompanyingPeriod($accompanyingPeriod);
}
$entity->setType($activityType);
$entity->setDate(new \DateTime('now'));
$entity->setActivityType($activityType);
$entity->setDate(new DateTime('now'));
// TODO revoir le Voter de Activity pour tenir compte qu'une activité peut appartenir a une période
// $this->denyAccessUnlessGranted('CHILL_ACTIVITY_CREATE', $entity);
if ($request->query->has('activityData')) {
$activityData = $request->query->get('activityData');
if (array_key_exists('durationTime', $activityData)) {
$durationTimeInMinutes = $activityData['durationTime'];
$hours = floor($durationTimeInMinutes / 60);
$minutes = $durationTimeInMinutes % 60;
$duration = DateTime::createFromFormat('H:i', $hours . ':' . $minutes);
if ($duration) {
$entity->setDurationTime($duration);
}
}
if (array_key_exists('date', $activityData)) {
$date = DateTime::createFromFormat('Y-m-d', $activityData['date']);
if ($date) {
$entity->setDate($date);
}
}
if (array_key_exists('personsId', $activityData)) {
foreach ($activityData['personsId'] as $personId) {
$concernedPerson = $this->personRepository->find($personId);
$entity->addPerson($concernedPerson);
}
}
if (array_key_exists('professionalsId', $activityData)) {
foreach ($activityData['professionalsId'] as $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']);
$comment->setUserId($this->getUser()->getid());
$comment->setDate(new DateTime('now'));
$entity->setComment($comment);
}
}
$this->denyAccessUnlessGranted(ActivityVoter::CREATE, $entity);
$form = $this->createForm(ActivityType::class, $entity, [
'center' => $entity->getCenter(),
'role' => new Role('CHILL_ACTIVITY_CREATE'),
'activityType' => $entity->getType(),
'role' => new Role('CHILL_ACTIVITY_CREATE'),
'activityType' => $entity->getActivityType(),
'accompanyingPeriod' => $accompanyingPeriod,
])->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!'));
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
$params['id'] = $entity->getId();
return $this->redirectToRoute('chill_activity_activity_show', $params);
}
if ($view === null) {
if (null === $view) {
throw $this->createNotFoundException('Template not found');
}
$activity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
$defaultLocation = $this->getUser()->getCurrentLocation();
return $this->render($view, [
'person' => $person,
'person' => $person,
'accompanyingCourse' => $accompanyingPeriod,
'entity' => $entity,
'form' => $form->createView(),
'activity_json' => $activity_array
'activity_json' => $activity_array,
'default_location' => $defaultLocation,
]);
}
public function showAction(Request $request, $id): Response
public function selectTypeAction(Request $request): Response
{
$em = $this->getDoctrine()->getManager();
$view = null;
[$person, $accompanyingPeriod] = $this->getEntity($request);
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
$view = 'ChillActivityBundle:Activity:selectTypeAccompanyingCourse.html.twig';
} elseif ($person instanceof Person) {
$view = 'ChillActivityBundle:Activity:selectTypePerson.html.twig';
}
$data = [];
$activityTypeCategories = $this
->activityTypeCategoryRepository
->findBy(['active' => true], ['ordering' => 'ASC']);
foreach ($activityTypeCategories as $activityTypeCategory) {
$activityTypes = $this
->activityTypeRepository
->findBy(
['active' => true, 'category' => $activityTypeCategory],
['ordering' => 'ASC']
);
$data[] = [
'activityTypeCategory' => $activityTypeCategory,
'activityTypes' => $activityTypes,
];
}
if (null === $view) {
throw $this->createNotFoundException('Template not found');
}
return $this->render($view, [
'person' => $person,
'accompanyingCourse' => $accompanyingPeriod,
'data' => $data,
'activityData' => $request->query->get('activityData', []),
]);
}
public function showAction(Request $request, int $id): Response
{
$view = null;
[$person, $accompanyingPeriod] = $this->getEntity($request);
@@ -233,21 +478,22 @@ 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) {
$entity->personsAssociated = $entity->getPersonsAssociated();
$entity->personsNotAssociated = $entity->getPersonsNotAssociated();
// @TODO: Properties created dynamically.
$entity->personsAssociated = $entity->getPersonsAssociated();
$entity->personsNotAssociated = $entity->getPersonsNotAssociated();
}
// 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
/*
@@ -257,166 +503,39 @@ class ActivityController extends AbstractController
'action' => 'show'
));
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
*/
*/
if ($view === null) {
if (null === $view) {
throw $this->createNotFoundException('Template not found');
}
return $this->render($view, array(
'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();
[$person, $accompanyingPeriod] = $this->getEntity($request);
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
$view = 'ChillActivityBundle:Activity:editAccompanyingCourse.html.twig';
} elseif ($person instanceof Person) {
$view = 'ChillActivityBundle:Activity:editPerson.html.twig';
}
$entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Activity entity.');
}
// TODO
// $this->denyAccessUnlessGranted('CHILL_ACTIVITY_UPDATE', $entity);
$form = $this->createForm(ActivityType::class, $entity, [
'center' => $entity->getCenter(),
'role' => new Role('CHILL_ACTIVITY_UPDATE'),
'activityType' => $entity->getType(),
'accompanyingPeriod' => $accompanyingPeriod,
])->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em->persist($entity);
$em->flush();
$this->addFlash('success', $this->get('translator')->trans('Success : activity updated!'));
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
$params['id'] = $id;
return $this->redirectToRoute('chill_activity_activity_show', $params);
}
$deleteForm = $this->createDeleteForm($id, $person, $accompanyingPeriod);
/*
* TODO
$event = new PrivacyEvent($person, array(
'element_class' => Activity::class,
'element_id' => $entity->getId(),
'action' => 'edit'
));
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
*/
if ($view === null) {
throw $this->createNotFoundException('Template not found');
}
$activity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
return $this->render($view, array(
'entity' => $entity,
'edit_form' => $form->createView(),
'delete_form' => $deleteForm->createView(),
return $this->render($view, [
'person' => $person,
'accompanyingCourse' => $accompanyingPeriod,
'activity_json' => $activity_array
));
'entity' => $entity,
'delete_form' => $deleteForm->createView(),
]);
}
/**
* Deletes a Activity entity.
*
*/
public function deleteAction(Request $request, $id)
private function buildParamsToUrl(?Person $person, ?AccompanyingPeriod $accompanyingPeriod): array
{
$em = $this->getDoctrine()->getManager();
$params = [];
[$person, $accompanyingPeriod] = $this->getEntity($request);
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
$view = 'ChillActivityBundle:Activity:confirm_deleteAccompanyingCourse.html.twig';
} elseif ($person instanceof Person) {
$view = 'ChillActivityBundle:Activity:confirm_deletePerson.html.twig';
if (null !== $person) {
$params['person_id'] = $person->getId();
}
/* @var $activity Activity */
$activity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
if (!$activity) {
throw $this->createNotFoundException('Unable to find Activity entity.');
if (null !== $accompanyingPeriod) {
$params['accompanying_period_id'] = $accompanyingPeriod->getId();
}
// TODO
// $this->denyAccessUnlessGranted('CHILL_ACTIVITY_DELETE', $activity);
$form = $this->createDeleteForm($id, $person, $accompanyingPeriod);
if ($request->getMethod() === Request::METHOD_DELETE) {
$form->handleRequest($request);
if ($form->isValid()) {
$this->logger->notice("An activity has been removed", array(
'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(); })
->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->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);
}
}
if ($view === null) {
throw $this->createNotFoundException('Template not found');
}
return $this->render($view, array(
'activity' => $activity,
'delete_form' => $form->createView(),
'person' => $person,
'accompanyingCourse' => $accompanyingPeriod,
));
return $params;
}
/**
* 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;
@@ -424,58 +543,40 @@ 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;
$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) {
if (null === $person) {
throw $this->createNotFoundException('Person not found');
}
$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) {
if (null === $accompanyingPeriod) {
throw $this->createNotFoundException('Accompanying Period not found');
}
// TODO Add permission
// $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
} else {
throw $this->createNotFoundException("Person or Accompanying Period not found");
throw $this->createNotFoundException('Person or Accompanying Period not found');
}
return [
$person, $accompanyingPeriod
$person,
$accompanyingPeriod,
];
}
private function buildParamsToUrl(
?Person $person,
?AccompanyingPeriod $accompanyingPeriod
): array {
$params = [];
if ($person) {
$params['person_id'] = $person->getId();
}
if ($accompanyingPeriod) {
$params['accompanying_period_id'] = $accompanyingPeriod->getId();
}
return $params;
}
}

View File

@@ -1,38 +1,30 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Chill\ActivityBundle\Entity\ActivityReasonCategory;
use Chill\ActivityBundle\Form\ActivityReasonCategoryType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
/**
* ActivityReasonCategory controller.
*
*/
class ActivityReasonCategoryController extends AbstractController
{
/**
* Lists all ActivityReasonCategory entities.
*
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository('ChillActivityBundle:ActivityReasonCategory')->findAll();
return $this->render('ChillActivityBundle:ActivityReasonCategory:index.html.twig', array(
'entities' => $entities,
));
}
/**
* Creates a new ActivityReasonCategory entity.
*
*/
public function createAction(Request $request)
{
@@ -45,71 +37,19 @@ class ActivityReasonCategoryController extends AbstractController
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('chill_activity_activityreasoncategory_show', array('id' => $entity->getId())));
return $this->redirect($this->generateUrl('chill_activity_activityreasoncategory_show', ['id' => $entity->getId()]));
}
return $this->render('ChillActivityBundle:ActivityReasonCategory:new.html.twig', array(
return $this->render('ChillActivityBundle:ActivityReasonCategory:new.html.twig', [
'entity' => $entity,
'form' => $form->createView(),
));
}
/**
* Creates a form to create a ActivityReasonCategory entity.
*
* @param ActivityReasonCategory $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createCreateForm(ActivityReasonCategory $entity)
{
$form = $this->createForm(ActivityReasonCategoryType::class, $entity, array(
'action' => $this->generateUrl('chill_activity_activityreasoncategory_create'),
'method' => 'POST',
));
$form->add('submit', SubmitType::class, array('label' => 'Create'));
return $form;
}
/**
* Displays a form to create a new ActivityReasonCategory entity.
*
*/
public function newAction()
{
$entity = new ActivityReasonCategory();
$form = $this->createCreateForm($entity);
return $this->render('ChillActivityBundle:ActivityReasonCategory:new.html.twig', array(
'entity' => $entity,
'form' => $form->createView(),
));
}
/**
* Finds and displays a ActivityReasonCategory entity.
*
*/
public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillActivityBundle:ActivityReasonCategory')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.');
}
return $this->render('ChillActivityBundle:ActivityReasonCategory:show.html.twig', array(
'entity' => $entity,
));
'form' => $form->createView(),
]);
}
/**
* Displays a form to edit an existing ActivityReasonCategory entity.
*
* @param mixed $id
*/
public function editAction($id)
{
@@ -123,33 +63,64 @@ class ActivityReasonCategoryController extends AbstractController
$editForm = $this->createEditForm($entity);
return $this->render('ChillActivityBundle:ActivityReasonCategory:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
));
return $this->render('ChillActivityBundle:ActivityReasonCategory:edit.html.twig', [
'entity' => $entity,
'edit_form' => $editForm->createView(),
]);
}
/**
* Creates a form to edit a ActivityReasonCategory entity.
*
* @param ActivityReasonCategory $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createEditForm(ActivityReasonCategory $entity)
* Lists all ActivityReasonCategory entities.
*/
public function indexAction()
{
$form = $this->createForm(ActivityReasonCategoryType::class, $entity, array(
'action' => $this->generateUrl('chill_activity_activityreasoncategory_update', array('id' => $entity->getId())),
'method' => 'PUT',
));
$em = $this->getDoctrine()->getManager();
$form->add('submit', SubmitType::class, array('label' => 'Update'));
$entities = $em->getRepository('ChillActivityBundle:ActivityReasonCategory')->findAll();
return $form;
return $this->render('ChillActivityBundle:ActivityReasonCategory:index.html.twig', [
'entities' => $entities,
]);
}
/**
* Displays a form to create a new ActivityReasonCategory entity.
*/
public function newAction()
{
$entity = new ActivityReasonCategory();
$form = $this->createCreateForm($entity);
return $this->render('ChillActivityBundle:ActivityReasonCategory:new.html.twig', [
'entity' => $entity,
'form' => $form->createView(),
]);
}
/**
* Finds and displays a ActivityReasonCategory entity.
*
* @param mixed $id
*/
public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillActivityBundle:ActivityReasonCategory')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.');
}
return $this->render('ChillActivityBundle:ActivityReasonCategory:show.html.twig', [
'entity' => $entity,
]);
}
/**
* Edits an existing ActivityReasonCategory entity.
*
* @param mixed $id
*/
public function updateAction(Request $request, $id)
{
@@ -167,12 +138,50 @@ class ActivityReasonCategoryController extends AbstractController
if ($editForm->isValid()) {
$em->flush();
return $this->redirect($this->generateUrl('chill_activity_activityreasoncategory_edit', array('id' => $id)));
return $this->redirect($this->generateUrl('chill_activity_activityreasoncategory_edit', ['id' => $id]));
}
return $this->render('ChillActivityBundle:ActivityReasonCategory:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
));
return $this->render('ChillActivityBundle:ActivityReasonCategory:edit.html.twig', [
'entity' => $entity,
'edit_form' => $editForm->createView(),
]);
}
/**
* Creates a form to create a ActivityReasonCategory entity.
*
* @param ActivityReasonCategory $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createCreateForm(ActivityReasonCategory $entity)
{
$form = $this->createForm(ActivityReasonCategoryType::class, $entity, [
'action' => $this->generateUrl('chill_activity_activityreasoncategory_create'),
'method' => 'POST',
]);
$form->add('submit', SubmitType::class, ['label' => 'Create']);
return $form;
}
/**
* Creates a form to edit a ActivityReasonCategory entity.
*
* @param ActivityReasonCategory $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createEditForm(ActivityReasonCategory $entity)
{
$form = $this->createForm(ActivityReasonCategoryType::class, $entity, [
'action' => $this->generateUrl('chill_activity_activityreasoncategory_update', ['id' => $entity->getId()]),
'method' => 'PUT',
]);
$form->add('submit', SubmitType::class, ['label' => 'Update']);
return $form;
}
}

View File

@@ -1,38 +1,30 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Chill\ActivityBundle\Entity\ActivityReason;
use Chill\ActivityBundle\Form\ActivityReasonType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
/**
* ActivityReason controller.
*
*/
class ActivityReasonController extends AbstractController
{
/**
* Lists all ActivityReason entities.
*
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository('ChillActivityBundle:ActivityReason')->findAll();
return $this->render('ChillActivityBundle:ActivityReason:index.html.twig', array(
'entities' => $entities,
));
}
/**
* Creates a new ActivityReason entity.
*
*/
public function createAction(Request $request)
{
@@ -45,71 +37,19 @@ class ActivityReasonController extends AbstractController
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('chill_activity_activityreason', array('id' => $entity->getId())));
return $this->redirect($this->generateUrl('chill_activity_activityreason', ['id' => $entity->getId()]));
}
return $this->render('ChillActivityBundle:ActivityReason:new.html.twig', array(
return $this->render('ChillActivityBundle:ActivityReason:new.html.twig', [
'entity' => $entity,
'form' => $form->createView(),
));
}
/**
* Creates a form to create a ActivityReason entity.
*
* @param ActivityReason $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createCreateForm(ActivityReason $entity)
{
$form = $this->createForm(ActivityReasonType::class, $entity, array(
'action' => $this->generateUrl('chill_activity_activityreason_create'),
'method' => 'POST',
));
$form->add('submit', SubmitType::class, array('label' => 'Create'));
return $form;
}
/**
* Displays a form to create a new ActivityReason entity.
*
*/
public function newAction()
{
$entity = new ActivityReason();
$form = $this->createCreateForm($entity);
return $this->render('ChillActivityBundle:ActivityReason:new.html.twig', array(
'entity' => $entity,
'form' => $form->createView(),
));
}
/**
* Finds and displays a ActivityReason entity.
*
*/
public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillActivityBundle:ActivityReason')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find ActivityReason entity.');
}
return $this->render('ChillActivityBundle:ActivityReason:show.html.twig', array(
'entity' => $entity,
));
'form' => $form->createView(),
]);
}
/**
* Displays a form to edit an existing ActivityReason entity.
*
* @param mixed $id
*/
public function editAction($id)
{
@@ -123,33 +63,64 @@ class ActivityReasonController extends AbstractController
$editForm = $this->createEditForm($entity);
return $this->render('ChillActivityBundle:ActivityReason:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView()
));
return $this->render('ChillActivityBundle:ActivityReason:edit.html.twig', [
'entity' => $entity,
'edit_form' => $editForm->createView(),
]);
}
/**
* Creates a form to edit a ActivityReason entity.
*
* @param ActivityReason $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createEditForm(ActivityReason $entity)
* Lists all ActivityReason entities.
*/
public function indexAction()
{
$form = $this->createForm(ActivityReasonType::class, $entity, array(
'action' => $this->generateUrl('chill_activity_activityreason_update', array('id' => $entity->getId())),
'method' => 'PUT',
));
$em = $this->getDoctrine()->getManager();
$form->add('submit', SubmitType::class, array('label' => 'Update'));
$entities = $em->getRepository('ChillActivityBundle:ActivityReason')->findAll();
return $form;
return $this->render('ChillActivityBundle:ActivityReason:index.html.twig', [
'entities' => $entities,
]);
}
/**
* Displays a form to create a new ActivityReason entity.
*/
public function newAction()
{
$entity = new ActivityReason();
$form = $this->createCreateForm($entity);
return $this->render('ChillActivityBundle:ActivityReason:new.html.twig', [
'entity' => $entity,
'form' => $form->createView(),
]);
}
/**
* Finds and displays a ActivityReason entity.
*
* @param mixed $id
*/
public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillActivityBundle:ActivityReason')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find ActivityReason entity.');
}
return $this->render('ChillActivityBundle:ActivityReason:show.html.twig', [
'entity' => $entity,
]);
}
/**
* Edits an existing ActivityReason entity.
*
* @param mixed $id
*/
public function updateAction(Request $request, $id)
{
@@ -167,12 +138,50 @@ class ActivityReasonController extends AbstractController
if ($editForm->isValid()) {
$em->flush();
return $this->redirect($this->generateUrl('chill_activity_activityreason', array('id' => $id)));
return $this->redirect($this->generateUrl('chill_activity_activityreason', ['id' => $id]));
}
return $this->render('ChillActivityBundle:ActivityReason:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView()
));
return $this->render('ChillActivityBundle:ActivityReason:edit.html.twig', [
'entity' => $entity,
'edit_form' => $editForm->createView(),
]);
}
/**
* Creates a form to create a ActivityReason entity.
*
* @param ActivityReason $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createCreateForm(ActivityReason $entity)
{
$form = $this->createForm(ActivityReasonType::class, $entity, [
'action' => $this->generateUrl('chill_activity_activityreason_create'),
'method' => 'POST',
]);
$form->add('submit', SubmitType::class, ['label' => 'Create']);
return $form;
}
/**
* Creates a form to edit a ActivityReason entity.
*
* @param ActivityReason $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createEditForm(ActivityReason $entity)
{
$form = $this->createForm(ActivityReasonType::class, $entity, [
'action' => $this->generateUrl('chill_activity_activityreason_update', ['id' => $entity->getId()]),
'method' => 'PUT',
]);
$form->add('submit', SubmitType::class, ['label' => 'Update']);
return $form;
}
}

View File

@@ -1,5 +1,14 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
@@ -9,10 +18,8 @@ use Symfony\Component\HttpFoundation\Request;
class AdminActivityPresenceController extends CRUDController
{
/**
* @param string $action
* @param \Doctrine\ORM\QueryBuilder|mixed $query
* @param Request $request
* @param PaginatorInterface $paginator
*
* @return \Doctrine\ORM\QueryBuilder|mixed
*/
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)

View File

@@ -1,5 +1,14 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
@@ -9,10 +18,8 @@ use Symfony\Component\HttpFoundation\Request;
class AdminActivityTypeCategoryController extends CRUDController
{
/**
* @param string $action
* @param \Doctrine\ORM\QueryBuilder|mixed $query
* @param Request $request
* @param PaginatorInterface $paginator
*
* @return \Doctrine\ORM\QueryBuilder|mixed
*/
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)

View File

@@ -1,5 +1,14 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
@@ -9,15 +18,14 @@ use Symfony\Component\HttpFoundation\Request;
class AdminActivityTypeController extends CRUDController
{
/**
* @param string $action
* @param \Doctrine\ORM\QueryBuilder|mixed $query
* @param Request $request
* @param PaginatorInterface $paginator
*
* @return \Doctrine\ORM\QueryBuilder|mixed
*/
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{
/** @var \Doctrine\ORM\QueryBuilder $query */
return $query->orderBy('e.ordering', 'ASC');
return $query->orderBy('e.ordering', 'ASC')
->addOrderBy('e.id', 'ASC');
}
}

View File

@@ -1,33 +1,20 @@
<?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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
/**
* Controller for activity configuration
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
* @author Champs Libres <info@champs-libres.coop>
* Controller for activity configuration.
*/
class AdminController extends AbstractController
{
@@ -35,7 +22,7 @@ class AdminController extends AbstractController
{
return $this->render('ChillActivityBundle:Admin:layout_activity.html.twig');
}
public function redirectToAdminIndexAction()
{
return $this->redirectToRoute('chill_main_admin_central');

View File

@@ -1,55 +1,41 @@
<?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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\DataFixtures\ORM;
use Chill\ActivityBundle\Entity\Activity;
use Chill\MainBundle\DataFixtures\ORM\LoadScopes;
use Chill\MainBundle\DataFixtures\ORM\LoadUsers;
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;
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;
private EntityManagerInterface $em;
/**
* @var \Faker\Generator
*/
private $faker;
public function __construct()
public function __construct(EntityManagerInterface $em)
{
$this->faker = FakerFactory::create('fr_FR');
$this->em = $em;
}
public function getOrder()
@@ -57,57 +43,27 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, C
return 16400;
}
/**
* Return a random scope
*
* @return \Chill\MainBundle\Entity\Scope
*/
private function getRandomScope()
public function load(ObjectManager $manager)
{
$scopeRef = LoadScopes::$references[array_rand(LoadScopes::$references)];
return $this->getReference($scopeRef);
}
$persons = $this->em
->getRepository(Person::class)
->findAll();
/**
* Return a random activityType
*
* @return \Chill\ActivityBundle\Entity\ActivityType
*/
private function getRandomActivityType()
{
$typeRef = LoadActivityType::$references[array_rand(LoadActivityType::$references)];
return $this->getReference($typeRef);
}
foreach ($persons as $person) {
$activityNbr = mt_rand(0, 3);
/**
* Return a random activityReason
*
* @return \Chill\ActivityBundle\Entity\ActivityReason
*/
private function getRandomActivityReason(array $excludingIds)
{
$reasonRef = LoadActivityReason::$references[array_rand(LoadActivityReason::$references)];
for ($i = 0; $i < $activityNbr; ++$i) {
$activity = $this->newRandomActivity($person);
if (in_array($this->getReference($reasonRef)->getId(), $excludingIds)) {
// we have a reason which should be excluded. Find another...
return $this->getRandomActivityReason($excludingIds);
if (null !== $activity) {
$manager->persist($activity);
}
}
}
return $this->getReference($reasonRef);
$manager->flush();
}
/**
* Return a random user
*
* @return \Chill\MainBundle\Entity\User
*/
private function getRandomUser()
{
$userRef = array_rand(LoadUsers::$refs);
return $this->getReference($userRef);
}
public function newRandomActivity($person)
public function newRandomActivity($person): ?Activity
{
$activity = (new Activity())
->setUser($this->getRandomUser())
@@ -115,39 +71,68 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, C
->setDate($this->faker->dateTimeThisYear())
->setDurationTime($this->faker->dateTime(36000))
->setType($this->getRandomActivityType())
->setScope($this->getRandomScope())
;
->setScope($this->getRandomScope());
// ->setAttendee($this->faker->boolean())
$usedId = array();
for ($i = 0; $i < rand(0, 4); $i++) {
$reason = $this->getRandomActivityReason($usedId);
$usedId[] = $reason->getId();
$activity->addReason($reason);
for ($i = 0; mt_rand(0, 4) > $i; ++$i) {
$reason = $this->getRandomActivityReason();
if (null !== $reason) {
$activity->addReason($reason);
} else {
return null;
}
}
return $activity;
}
public function load(ObjectManager $manager)
/**
* Return a random activityReason.
*
* @return \Chill\ActivityBundle\Entity\ActivityReason
*/
private function getRandomActivityReason()
{
$persons = $this->container->get('doctrine.orm.entity_manager')
->getRepository('ChillPersonBundle:Person')
->findAll();
$reasonRef = LoadActivityReason::$references[array_rand(LoadActivityReason::$references)];
foreach($persons as $person) {
$activityNbr = rand(0,3);
$ref = 'activity_'.$person->getFullnameCanonical();
return $this->getReference($reasonRef);
}
for($i = 0; $i < $activityNbr; $i ++) {
print "Creating an activity type for : ".$person." (ref: ".$ref.") \n";
$activity = $this->newRandomActivity($person);
$manager->persist($activity);
}
/**
* Return a random activityType.
*
* @return \Chill\ActivityBundle\Entity\ActivityType
*/
private function getRandomActivityType()
{
$typeRef = LoadActivityType::$references[array_rand(LoadActivityType::$references)];
$this->setReference($ref, $activity);
}
$manager->flush();
return $this->getReference($typeRef);
}
/**
* Return a random scope.
*
* @return \Chill\MainBundle\Entity\Scope
*/
private function getRandomScope()
{
$scopeRef = LoadScopes::$references[array_rand(LoadScopes::$references)];
return $this->getReference($scopeRef);
}
/**
* Return a random user.
*
* @return \Chill\MainBundle\Entity\User
*/
private function getRandomUser()
{
$userRef = array_rand(LoadUsers::$refs);
return $this->getReference($userRef);
}
}

View File

@@ -1,15 +1,23 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Chill\ActivityBundle\Entity\Activity;
use Chill\MainBundle\DataFixtures\ORM\LoadAbstractNotificationsTrait;
use Chill\ActivityBundle\DataFixtures\ORM\LoadActivity;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
/**
* Load notififications into database
* Load notififications into database.
*/
class LoadActivityNotifications extends AbstractFixture implements DependentFixtureInterface
{
@@ -25,9 +33,9 @@ class LoadActivityNotifications extends AbstractFixture implements DependentFixt
'center a_social',
'center a_administrative',
'center a_direction',
'multi_center'
'multi_center',
],
]
],
];
public function getDependencies()

View File

@@ -1,81 +1,68 @@
<?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/>.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\DataFixtures\ORM;
use Chill\ActivityBundle\Entity\ActivityReason;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Chill\ActivityBundle\Entity\ActivityReason;
/**
* Description of LoadActivityReason
*
* @author Champs-Libres Coop
* Description of LoadActivityReason.
*/
class LoadActivityReason extends AbstractFixture implements OrderedFixtureInterface
{
public static $references = [];
public function getOrder()
{
return 16300;
}
public static $references = array();
public function load(ObjectManager $manager)
{
$reasons = [
[
'name' => ['fr' => 'Recherche logement', 'en' => 'Housing research', 'nl' => 'Woning zoektoch'],
'category' => 'cat_Housing'],
'category' => 'cat_Housing', ],
[
'name' => ['fr' => 'Problème avec propriétaire', 'en' => 'Landlord problems', 'nl' => 'Huisbaas problemen'],
'category' => 'cat_Housing'],
'category' => 'cat_Housing', ],
[
'name' => ['fr' => 'Retard de payement', 'en' => 'Payement problems', 'nl' => 'Betalings vertragingen'],
'category' => 'cat_Housing'],
'category' => 'cat_Housing', ],
[
'name' => ['fr' => 'Explication législation', 'en' => 'Legislation explanation', 'nl' => 'Legislative uitleg'],
'category' => 'cat_Unemployment procedure'],
'category' => 'cat_Unemployment procedure', ],
[
'name' => ['fr' => 'Coaching entretien d\'activation', 'en' => 'Interview coaching', 'nl' => 'Interview coaching'],
'category' => 'cat_Unemployment procedure'],
'category' => 'cat_Unemployment procedure', ],
[
'name' => ['fr' => 'Récupération des allocations', 'en' => 'Allowance recovery', 'nl' => 'Terugwinning van de uitkeringen'],
'category' => 'cat_Unemployment procedure']
'category' => 'cat_Unemployment procedure', ],
];
foreach ($reasons as $r) {
print "Creating activity reason : " . $r['name']['en'] . "\n";
echo 'Creating activity reason : ' . $r['name']['en'] . "\n";
$activityReason = (new ActivityReason())
->setName(($r['name']))
->setActive(true)
->setCategory($this->getReference($r['category']));
$manager->persist($activityReason);
$reference = 'activity_reason_'.$r['name']['en'];
$reference = 'activity_reason_' . $r['name']['en'];
$this->addReference($reference, $activityReason);
static::$references[] = $reference;
}
$manager->flush();
}
}

View File

@@ -1,35 +1,23 @@
<?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/>.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\DataFixtures\ORM;
use Chill\ActivityBundle\Entity\ActivityReasonCategory;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Chill\ActivityBundle\Entity\ActivityReasonCategory;
/**
* Description of LoadActivityReasonCategory
*
* @author Champs-Libres Coop
* Description of LoadActivityReasonCategory.
*/
class LoadActivityReasonCategory extends AbstractFixture implements OrderedFixtureInterface
{
@@ -37,27 +25,26 @@ class LoadActivityReasonCategory extends AbstractFixture implements OrderedFixtu
{
return 16200;
}
public function load(ObjectManager $manager)
{
$categs = [
['name' =>
['fr' => 'Logement', 'en' => 'Housing', 'nl' => 'Woning']],
['name' =>
['fr' => 'Démarches chômage', 'en' => 'Unemployment procedure', 'nl' => 'Werkloosheid werkwijze']],
['name' => ['fr' => 'Logement', 'en' => 'Housing', 'nl' => 'Woning']],
['name' => ['fr' => 'Démarches chômage', 'en' => 'Unemployment procedure', 'nl' => 'Werkloosheid werkwijze']],
];
foreach ($categs as $c) {
print "Creating activity reason category : " . $c['name']['en'] . "\n";
echo 'Creating activity reason category : ' . $c['name']['en'] . "\n";
$activityReasonCategory = (new ActivityReasonCategory())
->setName(($c['name']))
->setActive(true);
$manager->persist($activityReasonCategory);
$this->addReference(
'cat_'.$c['name']['en'],
$activityReasonCategory);
'cat_' . $c['name']['en'],
$activityReasonCategory
);
}
$manager->flush();
}
}

View File

@@ -1,86 +1,67 @@
<?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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\DataFixtures\ORM;
use Chill\ActivityBundle\Entity\ActivityType;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Chill\ActivityBundle\Entity\ActivityType;
/**
* Description of LoadActivityType
*
* @author Champs-Libres Coop
* Description of LoadActivityType.
*/
class LoadActivityType extends Fixture implements OrderedFixtureInterface
{
public static $references = [];
public function getOrder()
{
return 16100;
}
public static $references = array();
public function load(ObjectManager $manager)
{
$types = [
# Exange
// Exange
[
'name' =>
['fr' => 'Entretien physique avec l\'usager'],
'category' => 'exchange' ],
'name' => ['fr' => 'Entretien physique avec l\'usager'],
'category' => 'exchange', ],
[
'name' =>
['fr' => 'Appel téléphonique', 'en' => 'Telephone call', 'nl' => 'Telefoon appel'],
'category' => 'exchange' ],
'name' => ['fr' => 'Appel téléphonique', 'en' => 'Telephone call', 'nl' => 'Telefoon appel'],
'category' => 'exchange', ],
[
'name' =>
['fr' => 'Courriel', 'en' => 'Email', 'nl' => 'Email'],
'category' => 'exchange' ],
# Meeting
'name' => ['fr' => 'Courriel', 'en' => 'Email', 'nl' => 'Email'],
'category' => 'exchange', ],
// Meeting
[
'name' =>
['fr' => 'Point technique encadrant'],
'category' => 'meeting' ],
'name' => ['fr' => 'Point technique encadrant'],
'category' => 'meeting', ],
[
'name' =>
['fr' => 'Réunion avec des partenaires'],
'category' => 'meeting' ],
'name' => ['fr' => 'Réunion avec des partenaires'],
'category' => 'meeting', ],
[
'name' =>
['fr' => 'Commission pluridisciplinaire et pluri-institutionnelle'],
'category' => 'meeting' ],
'name' => ['fr' => 'Commission pluridisciplinaire et pluri-institutionnelle'],
'category' => 'meeting', ],
];
foreach ($types as $t) {
print "Creating activity type : " . $t['name']['fr'] . " (cat:". $t['category'] . " \n";
echo 'Creating activity type : ' . $t['name']['fr'] . ' (cat:' . $t['category'] . " \n";
$activityType = (new ActivityType())
->setName(($t['name']))
->setCategory($this->getReference('activity_type_cat_'.$t['category']))
->setCategory($this->getReference('activity_type_cat_' . $t['category']))
->setSocialIssuesVisible(1)
->setSocialActionsVisible(1);
$manager->persist($activityType);
$reference = 'activity_type_'.$t['name']['fr'];
$reference = 'activity_type_' . $t['name']['fr'];
$this->addReference($reference, $activityType);
static::$references[] = $reference;
}

View File

@@ -1,40 +1,27 @@
<?php
/*
/**
* Chill is a software for social workers
*
* Copyright (C) 2014-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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\DataFixtures\ORM;
use Chill\ActivityBundle\Entity\ActivityTypeCategory;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Chill\ActivityBundle\Entity\ActivityTypeCategory;
/**
* Fixtures for ActivityTypeCategory
*
* @author Champs-Libres Coop
* Fixtures for ActivityTypeCategory.
*/
class LoadActivityTypeCategory extends Fixture implements OrderedFixtureInterface
{
public static $references = array();
public static $references = [];
public function getOrder()
{
@@ -55,13 +42,13 @@ class LoadActivityTypeCategory extends Fixture implements OrderedFixtureInterfac
];
foreach ($categories as $cat) {
print "Creating activity type category : " . $cat['ref'] . "\n";
echo 'Creating activity type category : ' . $cat['ref'] . "\n";
$newCat = (new ActivityTypeCategory())
->setName(($cat['name']));
$manager->persist($newCat);
$reference = 'activity_type_cat_'.$cat['ref'];
$reference = 'activity_type_cat_' . $cat['ref'];
$this->addReference($reference, $newCat);
static::$references[] = $reference;

View File

@@ -1,37 +1,29 @@
<?php
/*
* Copyright (C) 2015 Julien Fastré <julien.fastre@champs-libres.coop>
/**
* Chill is a software for social workers
*
* 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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\DataFixtures\ORM;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
use Chill\MainBundle\DataFixtures\ORM\LoadPermissionsGroup;
use Chill\MainBundle\DataFixtures\ORM\LoadScopes;
use Chill\MainBundle\Entity\RoleScope;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Chill\MainBundle\DataFixtures\ORM\LoadPermissionsGroup;
use Chill\MainBundle\Entity\RoleScope;
use Chill\MainBundle\DataFixtures\ORM\LoadScopes;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use function in_array;
/**
* Add a role CHILL_ACTIVITY_UPDATE & CHILL_ACTIVITY_CREATE for all groups except administrative,
* and a role CHILL_ACTIVITY_SEE for administrative
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
* and a role CHILL_ACTIVITY_SEE for administrative.
*/
class LoadActivitytACL extends AbstractFixture implements OrderedFixtureInterface
{
@@ -40,12 +32,12 @@ class LoadActivitytACL extends AbstractFixture implements OrderedFixtureInterfac
return 16000;
}
public function load(ObjectManager $manager)
{
foreach (LoadPermissionsGroup::$refs as $permissionsGroupRef) {
$permissionsGroup = $this->getReference($permissionsGroupRef);
foreach (LoadScopes::$references as $scopeRef){
foreach (LoadScopes::$references as $scopeRef) {
$scope = $this->getReference($scopeRef);
//create permission group
switch ($permissionsGroup->getName()) {
@@ -53,47 +45,52 @@ class LoadActivitytACL extends AbstractFixture implements OrderedFixtureInterfac
if ($scope->getName()['en'] === 'administrative') {
break 2; // we do not want any power on administrative
}
break;
case 'administrative':
case 'direction':
if (in_array($scope->getName()['en'], array('administrative', 'social'))) {
if (in_array($scope->getName()['en'], ['administrative', 'social'], true)) {
break 2; // we do not want any power on social or administrative
}
}
break;
}
printf("Adding CHILL_ACTIVITY_UPDATE & CHILL_ACTIVITY_CREATE & CHILL_ACTIVITY_DELETE, and stats and list permissions to %s "
. "permission group, scope '%s' \n",
$permissionsGroup->getName(), $scope->getName()['en']);
printf(
'Adding CHILL_ACTIVITY_UPDATE & CHILL_ACTIVITY_CREATE & CHILL_ACTIVITY_DELETE, and stats and list permissions to %s '
. "permission group, scope '%s' \n",
$permissionsGroup->getName(),
$scope->getName()['en']
);
$roleScopeUpdate = (new RoleScope())
->setRole('CHILL_ACTIVITY_UPDATE')
->setScope($scope);
->setRole('CHILL_ACTIVITY_UPDATE')
->setScope($scope);
$permissionsGroup->addRoleScope($roleScopeUpdate);
$roleScopeCreate = (new RoleScope())
->setRole('CHILL_ACTIVITY_CREATE')
->setScope($scope);
->setRole(ActivityVoter::CREATE_ACCOMPANYING_COURSE)
->setScope($scope);
$roleScopeCreate = (new RoleScope())
->setRole(ActivityVoter::CREATE_PERSON)
->setScope($scope);
$permissionsGroup->addRoleScope($roleScopeCreate);
$roleScopeDelete = (new RoleScope())
->setRole('CHILL_ACTIVITY_DELETE')
->setScope($scope);
->setRole('CHILL_ACTIVITY_DELETE')
->setScope($scope);
$permissionsGroup->addRoleScope($roleScopeDelete);
$roleScopeList = (new RoleScope())
->setRole(ActivityStatsVoter::LISTS)
;
->setRole(ActivityStatsVoter::LISTS);
$permissionsGroup->addRoleScope($roleScopeList);
$roleScopeStat = (new RoleScope())
->setRole(ActivityStatsVoter::STATS)
;
->setRole(ActivityStatsVoter::STATS);
$permissionsGroup->addRoleScope($roleScopeStat);
$manager->persist($roleScopeUpdate);
$manager->persist($roleScopeCreate);
$manager->persist($roleScopeDelete);
}
}
$manager->flush();
}
}

View File

@@ -1,45 +1,30 @@
<?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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
/**
* This is the class that loads and manages your bundle configuration
* This is the class that loads and manages your bundle configuration.
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class ChillActivityExtension extends Extension implements PrependExtensionInterface
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
@@ -47,7 +32,7 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
$container->setParameter('chill_activity.form.time_duration', $config['form']['time_duration']);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../config'));
$loader->load('services.yaml');
$loader->load('services/export.yaml');
$loader->load('services/repositories.yaml');
@@ -55,6 +40,7 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
$loader->load('services/controller.yaml');
$loader->load('services/form.yaml');
$loader->load('services/templating.yaml');
$loader->load('services/accompanyingPeriodConsistency.yaml');
}
public function prepend(ContainerBuilder $container)
@@ -64,31 +50,38 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
$this->prependCruds($container);
}
/* (non-PHPdoc)
public function prependAuthorization(ContainerBuilder $container)
{
$container->prependExtensionConfig('security', [
'role_hierarchy' => [
ActivityVoter::UPDATE => [ActivityVoter::SEE_DETAILS],
ActivityVoter::CREATE_PERSON => [ActivityVoter::SEE_DETAILS],
ActivityVoter::CREATE_ACCOMPANYING_COURSE => [ActivityVoter::SEE_DETAILS],
ActivityVoter::DELETE => [ActivityVoter::SEE_DETAILS],
ActivityVoter::SEE_DETAILS => [ActivityVoter::SEE],
ActivityVoter::FULL => [
ActivityVoter::CREATE_PERSON,
ActivityVoter::CREATE_ACCOMPANYING_COURSE,
ActivityVoter::DELETE,
ActivityVoter::UPDATE,
],
],
]);
}
/** (non-PHPdoc).
* @see \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface::prepend()
*/
public function prependRoutes(ContainerBuilder $container)
{
//add routes for custom bundle
$container->prependExtensionConfig('chill_main', array(
'routing' => array(
'resources' => array(
'@ChillActivityBundle/config/routes.yaml'
)
)
));
}
public function prependAuthorization(ContainerBuilder $container)
{
$container->prependExtensionConfig('security', array(
'role_hierarchy' => array(
ActivityVoter::UPDATE => array(ActivityVoter::SEE_DETAILS),
ActivityVoter::CREATE => array(ActivityVoter::SEE_DETAILS),
ActivityVoter::DELETE => array(ActivityVoter::SEE_DETAILS),
ActivityVoter::SEE_DETAILS => array(ActivityVoter::SEE)
)
));
$container->prependExtensionConfig('chill_main', [
'routing' => [
'resources' => [
'@ChillActivityBundle/config/routes.yaml',
],
],
]);
}
protected function prependCruds(ContainerBuilder $container)
@@ -104,17 +97,17 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
'actions' => [
'index' => [
'template' => '@ChillActivity/ActivityType/index.html.twig',
'role' => 'ROLE_ADMIN'
'role' => 'ROLE_ADMIN',
],
'new' => [
'new' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillActivity/ActivityType/new.html.twig',
],
'edit' => [
'edit' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillActivity/ActivityType/edit.html.twig',
]
]
],
],
],
[
'class' => \Chill\ActivityBundle\Entity\ActivityTypeCategory::class,
@@ -125,17 +118,17 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
'actions' => [
'index' => [
'template' => '@ChillActivity/ActivityTypeCategory/index.html.twig',
'role' => 'ROLE_ADMIN'
'role' => 'ROLE_ADMIN',
],
'new' => [
'new' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillActivity/ActivityTypeCategory/new.html.twig',
],
'edit' => [
'edit' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillActivity/ActivityTypeCategory/edit.html.twig',
]
]
],
],
],
[
'class' => \Chill\ActivityBundle\Entity\ActivityPresence::class,
@@ -146,19 +139,19 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
'actions' => [
'index' => [
'template' => '@ChillActivity/ActivityPresence/index.html.twig',
'role' => 'ROLE_ADMIN'
'role' => 'ROLE_ADMIN',
],
'new' => [
'new' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillActivity/ActivityPresence/new.html.twig',
],
'edit' => [
'edit' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillActivity/ActivityPresence/edit.html.twig',
]
]
],
],
],
]
],
]);
}
}

View File

@@ -1,71 +1,76 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use function is_int;
/**
* This is the class that validates and merges configuration from your app/config files
* This is the class that validates and merges configuration from your app/config files.
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('chill_activity');
$rootNode = $treeBuilder->getRootNode('chill_activity');
$rootNode
->children()
->arrayNode('form')
->canBeEnabled()
->children()
->arrayNode('time_duration')
->isRequired()
->requiresAtLeastOneElement()
->defaultValue(
array(
[ 'label' => '5 minutes', 'seconds' => 300],
[ 'label' => '10 minutes', 'seconds' => 600],
[ 'label' => '15 minutes', 'seconds' => 900],
[ 'label' => '20 minutes', 'seconds' => 1200],
[ 'label' => '25 minutes', 'seconds' => 1500],
[ 'label' => '30 minutes', 'seconds' => 1800],
[ 'label' => '45 minutes', 'seconds' => 2700],
[ 'label' => '1 hour', 'seconds' => 3600],
[ 'label' => '1 hour 15', 'seconds' => 4500],
[ 'label' => '1 hour 30', 'seconds' => 5400],
[ 'label' => '1 hour 45', 'seconds' => 6300],
[ 'label' => '2 hours', 'seconds' => 7200],
)
)
->info('The intervals of time to show in activity form')
->prototype('array')
->children()
->scalarNode('seconds')
->info("The number of seconds of this duration. Must be an integer.")
->cannotBeEmpty()
->validate()
->ifTrue(function($data) {
return !is_int($data);
})->thenInvalid("The value %s is not a valid integer")
->end()
->end()
->scalarNode('label')
->cannotBeEmpty()
->info("The label to show into fields")
->end()
->end()
->end()
->children()
->arrayNode('form')
->canBeEnabled()
->children()
->arrayNode('time_duration')
->isRequired()
->requiresAtLeastOneElement()
->defaultValue(
[
['label' => '5 minutes', 'seconds' => 300],
['label' => '10 minutes', 'seconds' => 600],
['label' => '15 minutes', 'seconds' => 900],
['label' => '20 minutes', 'seconds' => 1200],
['label' => '25 minutes', 'seconds' => 1500],
['label' => '30 minutes', 'seconds' => 1800],
['label' => '45 minutes', 'seconds' => 2700],
['label' => '1 hour', 'seconds' => 3600],
['label' => '1 hour 15', 'seconds' => 4500],
['label' => '1 hour 30', 'seconds' => 5400],
['label' => '1 hour 45', 'seconds' => 6300],
['label' => '2 hours', 'seconds' => 7200],
]
)
->info('The intervals of time to show in activity form')
->prototype('array')
->children()
->scalarNode('seconds')
->info('The number of seconds of this duration. Must be an integer.')
->cannotBeEmpty()
->validate()
->ifTrue(static function ($data) {
return !is_int($data);
})->thenInvalid('The value %s is not a valid integer')
->end()
->end()
->scalarNode('label')
->cannotBeEmpty()
->info('The label to show into fields')
->end()
->end()
->end()
// ->validate()
//
//
// ->ifTrue(function ($data) {
// // test this is an array
// if (!is_array($data)) {
@@ -84,11 +89,10 @@ class Configuration implements ConfigurationInterface
// })
// ->thenInvalid("The data are invalid. The keys must be a string and the value integers")
// ->end()
->end()
->end()
->end()
->end();
->end()
->end()
->end()
->end();
return $treeBuilder;
}

View File

@@ -1,69 +1,106 @@
<?php
/*
/**
* Chill is a software for social workers
*
* 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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Entity;
use Chill\ActivityBundle\Validator\Constraints as ActivityValidator;
use Chill\DocStoreBundle\Entity\Document;
use Chill\DocStoreBundle\Entity\StoredObject;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Chill\MainBundle\Entity\HasCenterInterface;
use Chill\MainBundle\Entity\HasScopeInterface;
use Chill\MainBundle\Entity\Location;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency;
use Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodLinkedWithSocialIssuesEntityInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Doctrine\ORM\Mapping as ORM;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Entity\Center;
use Chill\PersonBundle\Entity\Person;
use Chill\MainBundle\Entity\HasCenterInterface;
use Chill\MainBundle\Entity\HasScopeInterface;
use Doctrine\Common\Collections\Collection;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency;
use Symfony\Component\Serializer\Annotation\Groups;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\SerializedName;
/**
* Class Activity
* Class Activity.
*
* @package Chill\ActivityBundle\Entity
* @ORM\Entity(repositoryClass="Chill\ActivityBundle\Repository\ActivityRepository")
* @ORM\Table(name="activity")
* @ORM\HasLifecycleCallbacks()
* @ORM\HasLifecycleCallbacks
* @DiscriminatorMap(typeProperty="type", mapping={
* "activity"=Activity::class
* })
*/
/*
* TODO : revoir
* "activity": Activity::class
* })
* @ActivityValidator\ActivityValidity
*
* @UserCircleConsistency(
* "CHILL_ACTIVITY_SEE_DETAILS",
* getUserFunction="getUser",
* path="scope")
* "CHILL_ACTIVITY_SEE_DETAILS",
* getUserFunction="getUser",
* path="scope")
*/
class Activity implements HasCenterInterface, HasScopeInterface
class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, HasCenterInterface, HasScopeInterface
{
const SENTRECEIVED_SENT = 'sent';
const SENTRECEIVED_RECEIVED = 'received';
public const SENTRECEIVED_RECEIVED = 'received';
public const SENTRECEIVED_SENT = 'sent';
/**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod")
* @Groups({"read"})
*/
private ?AccompanyingPeriod $accompanyingPeriod = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
* @Groups({"read"})
* @SerializedName("activityType")
* @ORM\JoinColumn(name="type_id")
*/
private ActivityType $activityType;
/**
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityPresence")
*/
private ?ActivityPresence $attendee = null;
/**
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
*/
private CommentEmbeddable $comment;
/**
* @ORM\Column(type="datetime")
*/
private DateTime $date;
/**
* @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject", cascade={"persist"})
*/
private Collection $documents;
/**
* @ORM\Column(type="time", nullable=true)
*/
private ?DateTime $durationTime = null;
/**
* @ORM\Column(type="boolean", options={"default": false})
*/
private bool $emergency = false;
/**
* @ORM\Id
@@ -74,29 +111,21 @@ class Activity implements HasCenterInterface, HasScopeInterface
private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location")
* @groups({"read"})
*/
private User $user;
private ?Location $location = null;
/**
* @ORM\Column(type="datetime")
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
*/
private \DateTime $date;
private ?Person $person = null;
/**
* @ORM\Column(type="time", nullable=true)
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
* @Groups({"read"})
*/
private ?\DateTime $durationTime = null;
/**
* @ORM\Column(type="time", nullable=true)
*/
private ?\DateTime $travelTime = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityPresence")
*/
private ?ActivityPresence $attendee = null;
private ?Collection $persons = null;
/**
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
@@ -104,11 +133,14 @@ class Activity implements HasCenterInterface, HasScopeInterface
private Collection $reasons;
/**
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialIssue")
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue")
* @Groups({"read"})
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
*/
private Collection $socialIssues;
private ?Scope $scope = null;
/**
* @ORM\Column(type="string", options={"default": ""})
*/
private string $sentReceived = '';
/**
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction")
@@ -118,36 +150,11 @@ class Activity implements HasCenterInterface, HasScopeInterface
private Collection $socialActions;
/**
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
*/
private ActivityType $type;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
*/
private ?Scope $scope = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
*/
private ?Person $person = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod")
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialIssue")
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue")
* @Groups({"read"})
*/
private ?AccompanyingPeriod $accompanyingPeriod = null;
/**
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
*/
private CommentEmbeddable $comment;
/**
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
* @Groups({"read"})
*/
private ?Collection $persons = null;
private Collection $socialIssues;
/**
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
@@ -156,9 +163,14 @@ class Activity implements HasCenterInterface, HasScopeInterface
private ?Collection $thirdParties = null;
/**
* @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject")
* @ORM\Column(type="time", nullable=true)
*/
private Collection $documents;
private ?DateTime $travelTime = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*/
private User $user;
/**
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User")
@@ -166,16 +178,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
*/
private ?Collection $users = null;
/**
* @ORM\Column(type="boolean", options={"default"=false})
*/
private bool $emergency = false;
/**
* @ORM\Column(type="string", options={"default"=""})
*/
private string $sentReceived = '';
public function __construct()
{
$this->reasons = new ArrayCollection();
@@ -188,71 +190,27 @@ class Activity implements HasCenterInterface, HasScopeInterface
$this->socialActions = new ArrayCollection();
}
public function getId(): ?int
public function addDocument(Document $document): self
{
return $this->id;
}
public function setUser(User $user): self
{
$this->user = $user;
$this->documents[] = $document;
return $this;
}
public function getUser(): User
/**
* Add a person to the person list.
*/
public function addPerson(?Person $person): self
{
return $this->user;
}
public function setDate(\DateTime $date): self
{
$this->date = $date;
if (null !== $person) {
if (!$this->persons->contains($person)) {
$this->persons[] = $person;
}
}
return $this;
}
public function getDate(): \DateTime
{
return $this->date;
}
public function setDurationTime(?\DateTime $durationTime): self
{
$this->durationTime = $durationTime;
return $this;
}
public function getDurationTime(): ?\DateTime
{
return $this->durationTime;
}
public function setTravelTime(\DateTime $travelTime): self
{
$this->travelTime = $travelTime;
return $this;
}
public function getTravelTime(): ?\DateTime
{
return $this->travelTime;
}
public function setAttendee(ActivityPresence $attendee): self
{
$this->attendee = $attendee;
return $this;
}
public function getAttendee(): ?ActivityPresence
{
return $this->attendee;
}
public function addReason(ActivityReason $reason): self
{
$this->reasons->add($reason);
@@ -260,49 +218,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this;
}
public function removeReason(ActivityReason $reason): void
{
$this->reasons->removeElement($reason);
}
public function getReasons(): Collection
{
return $this->reasons;
}
public function setReasons(?ArrayCollection $reasons): self
{
$this->reasons = $reasons;
return $this;
}
public function getSocialIssues(): Collection
{
return $this->socialIssues;
}
public function addSocialIssue(SocialIssue $socialIssue): self
{
if (!$this->socialIssues->contains($socialIssue)) {
$this->socialIssues[] = $socialIssue;
}
return $this;
}
public function removeSocialIssue(SocialIssue $socialIssue): self
{
$this->socialIssues->removeElement($socialIssue);
return $this;
}
public function getSocialActions(): Collection
{
return $this->socialActions;
}
public function addSocialAction(SocialAction $socialAction): self
{
if (!$this->socialActions->contains($socialAction)) {
@@ -312,67 +227,55 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this;
}
public function removeSocialAction(SocialAction $socialAction): self
public function addSocialIssue(SocialIssue $socialIssue): self
{
$this->socialActions->removeElement($socialAction);
if (!$this->socialIssues->contains($socialIssue)) {
$this->socialIssues[] = $socialIssue;
}
return $this;
}
public function setType(ActivityType $type): self
public function addThirdParty(?ThirdParty $thirdParty): self
{
$this->type = $type;
if (null !== $thirdParty) {
if (!$this->thirdParties->contains($thirdParty)) {
$this->thirdParties[] = $thirdParty;
}
}
return $this;
}
public function getType(): ActivityType
public function addUser(?User $user): self
{
return $this->type;
}
public function setScope(Scope $scope): self
{
$this->scope = $scope;
if (null !== $user) {
if (!$this->users->contains($user)) {
$this->users[] = $user;
}
}
return $this;
}
public function getScope(): ?Scope
{
return $this->scope;
}
public function setPerson(?Person $person): self
{
$this->person = $person;
return $this;
}
public function getPerson(): ?Person
{
return $this->person;
}
public function getAccompanyingPeriod(): ?AccompanyingPeriod
{
return $this->accompanyingPeriod;
}
public function setAccompanyingPeriod(?AccompanyingPeriod $accompanyingPeriod): self
public function getActivityType(): ActivityType
{
$this->accompanyingPeriod = $accompanyingPeriod;
return $this->activityType;
}
return $this;
public function getAttendee(): ?ActivityPresence
{
return $this->attendee;
}
/**
* get the center
* center is extracted from person
* center is extracted from person.
*/
public function getCenter(): ?Center
{
@@ -388,28 +291,39 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this->comment;
}
public function setComment(CommentEmbeddable $comment): self
public function getDate(): DateTime
{
$this->comment = $comment;
return $this;
return $this->date;
}
/**
* Add a person to the person list
*/
public function addPerson(?Person $person): self
public function getDocuments(): Collection
{
if (null !== $person) {
$this->persons[] = $person;
}
return $this;
return $this->documents;
}
public function removePerson(Person $person): void
public function getDurationTime(): ?DateTime
{
$this->persons->removeElement($person);
return $this->durationTime;
}
public function getEmergency(): bool
{
return $this->emergency;
}
public function getId(): ?int
{
return $this->id;
}
public function getLocation(): ?Location
{
return $this->location;
}
public function getPerson(): ?Person
{
return $this->person;
}
public function getPersons(): Collection
@@ -417,46 +331,125 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this->persons;
}
public function getPersonsAssociated(): array
public function getPersonsAssociated(): array
{
if (null !== $this->accompanyingPeriod) {
$personsAssociated = [];
foreach ($this->accompanyingPeriod->getParticipations() as $participation) {
if ($this->persons->contains($participation->getPerson())) {
$personsAssociated[] = $participation->getPerson();
}
}
return $personsAssociated;
return $personsAssociated;
}
return [];
}
public function getPersonsNotAssociated(): array
{
if (null !== $this->accompanyingPeriod) {
$personsNotAssociated = [];
// TODO better semantic with: return $this->persons->filter(...);
foreach ($this->persons as $person) {
if (!in_array($person, $this->getPersonsAssociated())) {
$personsNotAssociated[] = $person;
if ($this->accompanyingPeriod->getOpenParticipationContainsPerson($person) === null) {
$personsNotAssociated[] = $person;
}
}
return $personsNotAssociated;
}
return [];
}
public function setPersons(?Collection $persons): self
return [];
}
public function getReasons(): Collection
{
$this->persons = $persons;
return $this->reasons;
}
public function getScope(): ?Scope
{
return $this->scope;
}
public function getSentReceived(): string
{
return $this->sentReceived;
}
public function getSocialActions(): Collection
{
return $this->socialActions;
}
public function getSocialIssues(): Collection
{
return $this->socialIssues;
}
public function getThirdParties(): Collection
{
return $this->thirdParties;
}
public function getTravelTime(): ?DateTime
{
return $this->travelTime;
}
/**
* @deprecated
*/
public function getType(): ActivityType
{
return $this->activityType;
}
public function getUser(): User
{
return $this->user;
}
public function getUsers(): Collection
{
return $this->users;
}
public function isEmergency(): bool
{
return $this->getEmergency();
}
public function removeDocument(Document $document): void
{
$this->documents->removeElement($document);
}
public function removePerson(Person $person): void
{
$this->persons->removeElement($person);
}
public function removeReason(ActivityReason $reason): void
{
$this->reasons->removeElement($reason);
}
public function removeSocialAction(SocialAction $socialAction): self
{
$this->socialActions->removeElement($socialAction);
return $this;
}
public function addThirdParty(?ThirdParty $thirdParty): self
public function removeSocialIssue(SocialIssue $socialIssue): self
{
if (null !== $thirdParty) {
$this->thirdParties[] = $thirdParty;
}
$this->socialIssues->removeElement($socialIssue);
return $this;
}
@@ -465,33 +458,44 @@ class Activity implements HasCenterInterface, HasScopeInterface
$this->thirdParties->removeElement($thirdParty);
}
public function getThirdParties(): Collection
public function removeUser(User $user): void
{
return $this->thirdParties;
$this->users->removeElement($user);
}
public function setThirdParties(?Collection $thirdParties): self
public function setAccompanyingPeriod(?AccompanyingPeriod $accompanyingPeriod): self
{
$this->thirdParties = $thirdParties;
$this->accompanyingPeriod = $accompanyingPeriod;
return $this;
}
public function addDocument(Document $document): self
public function setActivityType(ActivityType $activityType): self
{
$this->documents[] = $document;
$this->activityType = $activityType;
return $this;
}
public function removeDocument(Document $document): void
public function setAttendee(ActivityPresence $attendee): self
{
$this->documents->removeElement($document);
$this->attendee = $attendee;
return $this;
}
public function getDocuments(): Collection
public function setComment(CommentEmbeddable $comment): self
{
return $this->documents;
$this->comment = $comment;
return $this;
}
public function setDate(DateTime $date): self
{
$this->date = $date;
return $this;
}
public function setDocuments(Collection $documents): self
@@ -501,41 +505,13 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this;
}
public function addUser(?User $user): self
public function setDurationTime(?DateTime $durationTime): self
{
if (null !== $user) {
$this->users[] = $user;
}
return $this;
}
public function removeUser(User $user): void
{
$this->users->removeElement($user);
}
public function getUsers(): Collection
{
return $this->users;
}
public function setUsers(?Collection $users): self
{
$this->users = $users;
$this->durationTime = $durationTime;
return $this;
}
public function isEmergency(): bool
{
return $this->getEmergency();
}
public function getEmergency(): bool
{
return $this->emergency;
}
public function setEmergency(bool $emergency): self
{
$this->emergency = $emergency;
@@ -543,9 +519,39 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this;
}
public function getSentReceived(): string
public function setLocation(?Location $location): Activity
{
return $this->sentReceived;
$this->location = $location;
return $this;
}
public function setPerson(?Person $person): self
{
$this->person = $person;
return $this;
}
public function setPersons(?Collection $persons): self
{
$this->persons = $persons;
return $this;
}
public function setReasons(?ArrayCollection $reasons): self
{
$this->reasons = $reasons;
return $this;
}
public function setScope(Scope $scope): self
{
$this->scope = $scope;
return $this;
}
public function setSentReceived(?string $sentReceived): self
@@ -554,4 +560,42 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this;
}
public function setThirdParties(?Collection $thirdParties): self
{
$this->thirdParties = $thirdParties;
return $this;
}
public function setTravelTime(DateTime $travelTime): self
{
$this->travelTime = $travelTime;
return $this;
}
/**
* @deprecated
*/
public function setType(ActivityType $activityType): self
{
$this->activityType = $activityType;
return $this;
}
public function setUser(UserInterface $user): self
{
$this->user = $user;
return $this;
}
public function setUsers(?Collection $users): self
{
$this->users = $users;
return $this;
}
}

View File

@@ -1,37 +1,32 @@
<?php
/*
/**
* Chill is a software for social workers
*
* 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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class ActivityPresence
* Class ActivityPresence.
*
* @package Chill\ActivityBundle\Entity
* @ORM\Entity()
* @ORM\Entity
* @ORM\Table(name="activitytpresence")
* @ORM\HasLifecycleCallbacks()
* @ORM\HasLifecycleCallbacks
*/
class ActivityPresence
{
/**
* @ORM\Column(type="boolean")
*/
private bool $active = true;
/**
* @ORM\Id
* @ORM\Column(name="id", type="integer")
@@ -44,28 +39,6 @@ class ActivityPresence
*/
private array $name = [];
/**
* @ORM\Column(type="boolean")
*/
private bool $active = true;
public function getId(): int
{
return $this->id;
}
public function setName(array $name): self
{
$this->name = $name;
return $this;
}
public function getName(): array
{
return $this->name;
}
/**
* Get active
* return true if the category type is active.
@@ -75,9 +48,19 @@ class ActivityPresence
return $this->active;
}
public function getId(): int
{
return $this->id;
}
public function getName(): array
{
return $this->name;
}
/**
* Is active
* return true if the category type is active
* return true if the category type is active.
*/
public function isActive(): bool
{
@@ -86,7 +69,7 @@ class ActivityPresence
/**
* Set active
* set to true if the category type is active
* set to true if the category type is active.
*/
public function setActive(bool $active): self
{
@@ -94,4 +77,11 @@ class ActivityPresence
return $this;
}
public function setName(array $name): self
{
$this->name = $name;
return $this;
}
}

View File

@@ -1,40 +1,43 @@
<?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/>.
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Chill\ActivityBundle\Entity\ActivityReasonCategory;
/**
* Class ActivityReason
* Class ActivityReason.
*
* @package Chill\ActivityBundle\Entity
* @ORM\Entity()
* @ORM\Entity
* @ORM\Table(name="activityreason")
* @ORM\HasLifecycleCallbacks()
* @ORM\HasLifecycleCallbacks
*/
class ActivityReason
{
/**
* @var integer
* @var bool
* @ORM\Column(type="boolean")
*/
private $active = true;
/**
* @var ActivityReasonCategory
* @ORM\ManyToOne(
* targetEntity="Chill\ActivityBundle\Entity\ActivityReasonCategory",
* inversedBy="reasons")
*/
private $category;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
@@ -44,91 +47,22 @@ class ActivityReason
/**
* @var array
* @ORM\Column(type="json_array")
* @ORM\Column(type="json")
*/
private $name;
/**
* @var ActivityReasonCategory
* @ORM\ManyToOne(
* targetEntity="Chill\ActivityBundle\Entity\ActivityReasonCategory",
* inversedBy="reasons")
*/
private $category;
/**
* @var boolean
* @ORM\Column(type="boolean")
*/
private $active = true;
/**
* Get id
* Get active.
*
* @return integer
* @return bool
*/
public function getId()
public function getActive()
{
return $this->id;
return $this->active;
}
/**
* Set name
*
* @param array $name
* @return ActivityReason
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return array | string
*/
public function getName($locale = null)
{
if ($locale) {
if (isset($this->name[$locale])) {
return $this->name[$locale];
} else {
foreach ($this->name as $name) {
if (!empty($name)) {
return $name;
}
}
}
return '';
} else {
return $this->name;
}
}
/**
* Set category of the reason. If you set to the reason an inactive
* category, the reason will become inactive
*
* @param ActivityReasonCategory $category
* @return ActivityReason
*/
public function setCategory(ActivityReasonCategory $category)
{
if($this->category !== $category && ! $category->getActive()) {
$this->setActive(False);
}
$this->category = $category;
return $this;
}
/**
* Get category
* Get category.
*
* @return ActivityReasonCategory
*/
@@ -138,9 +72,46 @@ class ActivityReason
}
/**
* Set active
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Get name.
*
* @param mixed|null $locale
*
* @return array | string
*/
public function getName($locale = null)
{
if ($locale) {
if (isset($this->name[$locale])) {
return $this->name[$locale];
}
foreach ($this->name as $name) {
if (!empty($name)) {
return $name;
}
}
return '';
}
return $this->name;
}
/**
* Set active.
*
* @param bool $active
*
* @param boolean $active
* @return ActivityReason
*/
public function setActive($active)
@@ -151,13 +122,33 @@ class ActivityReason
}
/**
* Get active
* Set category of the reason. If you set to the reason an inactive
* category, the reason will become inactive.
*
* @return boolean
* @return ActivityReason
*/
public function getActive()
public function setCategory(ActivityReasonCategory $category)
{
return $this->active;
if ($this->category !== $category && !$category->getActive()) {
$this->setActive(false);
}
$this->category = $category;
return $this;
}
/**
* Set name.
*
* @param array $name
*
* @return ActivityReason
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
}

View File

@@ -1,39 +1,36 @@
<?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/>.
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* Class ActivityReasonCategory
* Class ActivityReasonCategory.
*
* @package Chill\ActivityBundle\Entity
* @ORM\Entity()
* @ORM\Entity
* @ORM\Table(name="activityreasoncategory")
* @ORM\HasLifecycleCallbacks()
* @ORM\HasLifecycleCallbacks
*/
class ActivityReasonCategory
{
/**
* @var integer
* @var bool
* @ORM\Column(type="boolean")
*/
private $active = true;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
@@ -43,25 +40,20 @@ class ActivityReasonCategory
/**
* @var string
* @ORM\Column(type="json_array")
* @ORM\Column(type="json")
*/
private $name;
/**
* @var boolean
* @ORM\Column(type="boolean")
*/
private $active = true;
/**
* Array of ActivityReason
* Array of ActivityReason.
*
* @var ArrayCollection
* @ORM\OneToMany(
* targetEntity="Chill\ActivityBundle\Entity\ActivityReason",
* mappedBy="category")
* mappedBy="category")
*/
private $reasons;
/**
* ActivityReasonCategory constructor.
*/
@@ -69,19 +61,29 @@ class ActivityReasonCategory
{
$this->reasons = new ArrayCollection();
}
/**
* @return string
*/
public function __toString()
{
return 'ActivityReasonCategory('.$this->getName('x').')';
return 'ActivityReasonCategory(' . $this->getName('x') . ')';
}
/**
* Get id
* Get active.
*
* @return integer
* @return bool
*/
public function getActive()
{
return $this->active;
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
@@ -89,20 +91,9 @@ class ActivityReasonCategory
}
/**
* Set name
* Get name.
*
* @param array $name
* @return ActivityReasonCategory
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
* @param mixed|null $locale
*
* @return array
*/
@@ -111,48 +102,53 @@ class ActivityReasonCategory
if ($locale) {
if (isset($this->name[$locale])) {
return $this->name[$locale];
} else {
foreach ($this->name as $name) {
if (!empty($name)) {
return $name;
}
}
foreach ($this->name as $name) {
if (!empty($name)) {
return $name;
}
}
return '';
} else {
return $this->name;
}
return $this->name;
}
/**
* Declare a category as active (or not). When a category is set
* as unactive, all the reason have this entity as category is also
* set as unactive
* set as unactive.
*
* @param bool $active
*
* @param boolean $active
* @return ActivityReasonCategory
*/
public function setActive($active)
{
if($this->active !== $active && !$active) {
if ($this->active !== $active && !$active) {
foreach ($this->reasons as $reason) {
$reason->setActive($active);
}
}
$this->active = $active;
return $this;
}
/**
* Get active
* Set name.
*
* @return boolean
* @param array $name
*
* @return ActivityReasonCategory
*/
public function getActive()
public function setName($name)
{
return $this->active;
$this->name = $name;
return $this;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,85 +1,47 @@
<?php
/*
/**
* Chill is a software for social workers
*
* 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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class ActivityTypeCateogry
*
* @package Chill\ActivityBundle\Entity
* @ORM\Entity()
* @ORM\Entity
* @ORM\Table(name="activitytypecategory")
* @ORM\HasLifecycleCallbacks()
* @ORM\HasLifecycleCallbacks
*/
class ActivityTypeCategory
{
/**
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id;
/**
* @ORM\Column(type="json_array")
*/
private array $name = [];
/**
* @ORM\Column(type="boolean")
*/
private bool $active = true;
/**
* @ORM\Column(type="float", options={"default"="0.0"})
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null;
/**
* @ORM\Column(type="json")
*/
private array $name = [];
/**
* @ORM\Column(type="float", options={"default": "0.0"})
*/
private float $ordering = 0.0;
/**
* Get id
*/
public function getId(): int
{
return $this->id;
}
/**
* Set name
*/
public function setName(array $name): self
{
$this->name = $name;
return $this;
}
/**
* Get name
*/
public function getName(): array
{
return $this->name;
}
/**
* Get active
* return true if the category type is active.
@@ -89,9 +51,27 @@ class ActivityTypeCategory
return $this->active;
}
public function getId(): ?int
{
return $this->id;
}
/**
* Get name.
*/
public function getName(): array
{
return $this->name;
}
public function getOrdering(): float
{
return $this->ordering;
}
/**
* Is active
* return true if the category type is active
* return true if the category type is active.
*/
public function isActive(): bool
{
@@ -100,7 +80,7 @@ class ActivityTypeCategory
/**
* Set active
* set to true if the category type is active
* set to true if the category type is active.
*/
public function setActive(bool $active): self
{
@@ -109,9 +89,14 @@ class ActivityTypeCategory
return $this;
}
public function getOrdering(): float
/**
* Set name.
*/
public function setName(array $name): self
{
return $this->ordering;
$this->name = $name;
return $this;
}
public function setOrdering(float $ordering): self

View File

@@ -1,107 +1,92 @@
<?php
/*
* Copyright (C) 2016 Champs-Libres <info@champs-libres.coop>
/**
* Chill is a software for social workers
*
* 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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Aggregator;
use Symfony\Component\Form\FormBuilderInterface;
use Doctrine\ORM\QueryBuilder;
use Chill\MainBundle\Export\AggregatorInterface;
use Symfony\Component\Security\Core\Role\Role;
use Chill\ActivityBundle\Repository\ActivityReasonCategoryRepository;
use Chill\ActivityBundle\Repository\ActivityReasonRepository;
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\AggregatorInterface;
use Chill\MainBundle\Export\ExportElementValidatedInterface;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Doctrine\ORM\Query\Expr\Join;
use Doctrine\ORM\QueryBuilder;
use RuntimeException;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use function array_key_exists;
use function count;
/**
*
*
* @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 addRole()
{
return new Role(ActivityStatsVoter::STATS);
}
public function alterQuery(QueryBuilder $qb, $data)
{
// add select element
if ($data['level'] === 'reasons') {
if ('reasons' === $data['level']) {
$elem = 'reasons.id';
$alias = 'activity_reasons_id';
} elseif ($data['level'] === 'categories') {
} elseif ('categories' === $data['level']) {
$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);
$qb->addSelect($elem . ' as ' . $alias);
// make a jointure only if needed
$join = $qb->getDQLPart('join');
if (
(array_key_exists('activity', $join)
&&
!$this->checkJoinAlreadyDefined($join['activity'], 'reasons')
(
array_key_exists('activity', $join)
&& !$this->checkJoinAlreadyDefined($join['activity'], 'reasons')
)
OR
(! array_key_exists('activity', $join))
|| (!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
if ($alias === 'activity_categories_id') {
if ('activity_categories_id' === $alias) {
// add join only if needed
if (!$this->checkJoinAlreadyDefined($qb->getDQLPart('join')['activity'], 'category')) {
$qb->join('reasons.category', 'category');
@@ -118,12 +103,104 @@ class ActivityReasonAggregator implements AggregatorInterface,
}
}
public function applyOn()
{
return 'activity';
}
public function buildForm(FormBuilderInterface $builder)
{
$builder->add(
'level',
ChoiceType::class,
[
'choices' => [
'By reason' => 'reasons',
'By category of reason' => 'categories',
],
'multiple' => false,
'expanded' => true,
'label' => "Reason's level",
]
);
}
public function getLabels($key, array $values, $data)
{
// for performance reason, we load data from db only once
switch ($data['level']) {
case 'reasons':
$this->activityReasonRepository->findBy(['id' => $values]);
break;
case 'categories':
$this->activityReasonCategoryRepository->findBy(['id' => $values]);
break;
default:
throw new RuntimeException(sprintf("The level data '%s' is invalid.", $data['level']));
}
return function ($value) use ($data) {
if ('_header' === $value) {
return 'reasons' === $data['level'] ? 'Group by reasons' : 'Group by categories of reason';
}
switch ($data['level']) {
case 'reasons':
$r = $this->activityReasonRepository->find($value);
return sprintf(
'%s > %s',
$this->translatableStringHelper->localize($r->getCategory()->getName()),
$this->translatableStringHelper->localize($r->getName())
);
case 'categories':
$c = $this->activityReasonCategoryRepository->find($value);
return $this->translatableStringHelper->localize($c->getName());
}
};
}
public function getQueryKeys($data)
{
// add select element
if ('reasons' === $data['level']) {
return ['activity_reasons_id'];
}
if ('categories' === $data['level']) {
return ['activity_categories_id'];
}
throw new RuntimeException('The data provided are not recognised.');
}
public function getTitle()
{
return 'Aggregate by activity reason';
}
public function validateForm($data, ExecutionContextInterface $context)
{
if (null === $data['level']) {
$context
->buildViolation("The reasons's level should not be empty.")
->addViolation();
}
}
/**
* Check if a join between Activity and another alias
* Check if a join between Activity and another alias.
*
* @param Join[] $joins
* @param string $alias the alias to search for
* @return boolean
*
* @return bool
*/
private function checkJoinAlreadyDefined(array $joins, $alias)
{
@@ -135,99 +212,4 @@ class ActivityReasonAggregator implements AggregatorInterface,
return false;
}
public function applyOn()
{
return 'activity';
}
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'
));
}
public function validateForm($data, ExecutionContextInterface $context)
{
if ($data['level'] === null) {
$context->buildViolation("The reasons's level should not be empty")
->addViolation();
}
}
public function getTitle()
{
return "Aggregate by activity reason";
}
public function addRole()
{
return new Role(ActivityStatsVoter::STATS);
}
public function getLabels($key, array $values, $data)
{
// for performance reason, we load data from db only once
switch ($data['level']) {
case 'reasons':
$this->reasonRepository->findBy(array('id' => $values));
break;
case 'categories':
$this->categoryRepository->findBy(array('id' => $values));
break;
default:
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'
;
}
switch ($data['level']) {
case 'reasons':
/* @var $r \Chill\ActivityBundle\Entity\ActivityReason */
$r = $this->reasonRepository->find($value);
return $this->stringHelper->localize($r->getCategory()->getName())
." > "
. $this->stringHelper->localize($r->getName());
;
break;
case 'categories':
$c = $this->categoryRepository->find($value);
return $this->stringHelper->localize($c->getName());
break;
// no need for a default : the default was already set above
}
};
}
public function getQueryKeys($data)
{
// 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');
}
}
}

View File

@@ -1,88 +1,54 @@
<?php
/*
* Copyright (C) 2016 Champs-Libres <info@champs-libres.coop>
/**
* Chill is a software for social workers
*
* 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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Aggregator;
use Symfony\Component\Form\FormBuilderInterface;
use Doctrine\ORM\QueryBuilder;
use Chill\MainBundle\Export\AggregatorInterface;
use Symfony\Component\Security\Core\Role\Role;
use Chill\ActivityBundle\Repository\ActivityTypeRepository;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Doctrine\ORM\EntityRepository;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Closure;
use Doctrine\ORM\Query\Expr\Join;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Role\Role;
/**
*
*
* @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';
public const KEY = 'activity_type_aggregator';
protected ActivityTypeRepository $activityTypeRepository;
protected TranslatableStringHelperInterface $translatableStringHelper;
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 addRole()
{
return new Role(ActivityStatsVoter::STATS);
}
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);
}
/**
* Check if a join between Activity and another alias
*
* @param Join[] $joins
* @param string $alias the alias to search for
* @return boolean
*/
private function checkJoinAlreadyDefined(array $joins, $alias)
{
foreach ($joins as $join) {
if ($join->getAlias() === $alias) {
return true;
}
}
return false;
$qb->addGroupBy(self::KEY);
}
public function applyOn()
@@ -95,37 +61,48 @@ class ActivityTypeAggregator implements AggregatorInterface
// no form required for this aggregator
}
public function getTitle()
{
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) {
if ($value === '_header') {
$this->activityTypeRepository->findBy(['id' => $values]);
return function ($value): string {
if ('_header' === $value) {
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];
}
public function getTitle()
{
return 'Aggregate by activity type';
}
/**
* Check if a join between Activity and another alias.
*
* @param Join[] $joins
* @param string $alias the alias to search for
*
* @return bool
*/
private function checkJoinAlreadyDefined(array $joins, $alias)
{
foreach ($joins as $join) {
if ($join->getAlias() === $alias) {
return true;
}
}
return false;
}
}

View File

@@ -1,51 +1,36 @@
<?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 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;
/**
*
* Chill is a software for social workers
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Aggregator;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Repository\UserRepository;
use Closure;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Role\Role;
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 +38,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);
}
@@ -70,30 +55,27 @@ class ActivityUserAggregator implements AggregatorInterface
// nothing to add
}
public function getLabels($key, $values, $data): \Closure
public function getLabels($key, $values, $data): Closure
{
// preload users at once
$this->em->getRepository(User::class)
->findBy(['id' => $values]);
return function($value) {
switch ($value) {
case '_header':
return 'activity user';
default:
return $this->em->getRepository(User::class)->find($value)
->getUsername();
$this->userRepository->findBy(['id' => $values]);
return function ($value) {
if ('_header' === $value) {
return 'activity user';
}
return $this->userRepository->find($value)->getUsername();
};
}
public function getQueryKeys($data)
{
return [ self::KEY ];
return [self::KEY];
}
public function getTitle(): string
{
return "Aggregate by activity user";
return 'Aggregate by activity user';
}
}

View File

@@ -1,121 +1,61 @@
<?php
/*
* Copyright (C) 2015 Champs-Libres <info@champs-libres.coop>
/**
* Chill is a software for social workers
*
* 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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Export;
use Chill\MainBundle\Export\ExportInterface;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Security\Core\Role\Role;
use Doctrine\ORM\Query;
use Chill\ActivityBundle\Repository\ActivityRepository;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Doctrine\ORM\EntityManagerInterface;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Doctrine\ORM\Query;
use LogicException;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Role\Role;
/**
*
*
* @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;
}
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder)
{
ActivityRepository $activityRepository
) {
$this->activityRepository = $activityRepository;
}
public function getDescription()
public function buildForm(FormBuilderInterface $builder)
{
return "Count activities by various parameters.";
}
public function getTitle()
{
return "Count activities";
}
public function getType()
{
return 'activity';
}
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)
;
return $qb;
}
public function supportsModifiers()
{
return array('person', 'activity');
}
public function requiredRole()
{
return new Role(ActivityStatsVoter::STATS);
}
public function getAllowedFormattersTypes()
{
return array(\Chill\MainBundle\Export\FormatterInterface::TYPE_TABULAR);
return [FormatterInterface::TYPE_TABULAR];
}
public function getDescription()
{
return 'Count activities by various parameters.';
}
public function getLabels($key, array $values, $data)
{
if ($key !== 'export_count_activity') {
throw new \LogicException("the key $key is not used by this export");
if ('export_count_activity' !== $key) {
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) => '_header' === $value ? 'Number of activities' : $value;
}
public function getQueryKeys($data)
{
return array('export_count_activity');
return ['export_count_activity'];
}
public function getResult($qb, $data)
@@ -123,4 +63,40 @@ class CountActivity implements ExportInterface
return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR);
}
public function getTitle()
{
return 'Count activities';
}
public function getType()
{
return 'activity';
}
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$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 requiredRole()
{
return new Role(ActivityStatsVoter::STATS);
}
public function supportsModifiers()
{
return ['person', 'activity'];
}
}

View File

@@ -1,69 +1,41 @@
<?php
/*
* Copyright (C) 2017 Champs-Libres <info@champs-libres.coop>
/**
* Chill is a software for social workers
*
* 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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Export;
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 Symfony\Component\Security\Core\Role\Role;
use Chill\ActivityBundle\Repository\ActivityRepository;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Symfony\Component\Form\FormBuilderInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\ListInterface;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use DateTime;
use Doctrine\DBAL\Exception\InvalidArgumentException;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Validator\Constraints\Callback;
use Doctrine\ORM\Query;
use Chill\MainBundle\Export\FormatterInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use function array_key_exists;
use function count;
use function in_array;
/**
* Create a list for all activities
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class ListActivity implements ListInterface
{
protected EntityManagerInterface $entityManager;
/**
*
* @var EntityManagerInterface
*/
protected $entityManager;
/**
*
* @var TranslatorInterface
*/
protected $translator;
/**
*
* @var TranslatableStringHelper
*/
protected $translatableStringHelper;
protected $fields = array(
protected array $fields = [
'id',
'date',
'durationTime',
@@ -74,115 +46,121 @@ class ListActivity implements ListInterface
'type_name',
'person_firstname',
'person_lastname',
'person_id'
);
'person_id',
];
protected TranslatableStringHelperInterface $translatableStringHelper;
protected TranslatorInterface $translator;
private ActivityRepository $activityRepository;
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(
'callback' => function($selected, ExecutionContextInterface $context) {
'label' => 'Fields to include in export',
'constraints' => [new Callback([
'callback' => static function ($selected, ExecutionContextInterface $context) {
if (count($selected) === 0) {
$context->buildViolation('You must select at least one element')
->atPath('fields')
->addViolation();
}
}
))]
));
},
])],
]);
}
/**
* {@inheritDoc}
*
* @return type
*/
public function getAllowedFormattersTypes()
{
return array(FormatterInterface::TYPE_LIST);
return [FormatterInterface::TYPE_LIST];
}
public function getDescription()
{
return "List activities";
return 'List activities';
}
public function getLabels($key, array $values, $data)
{
switch ($key)
{
case 'date' :
return function($value) {
if ($value === '_header') return 'date';
switch ($key) {
case 'date':
return static function ($value) {
if ('_header' === $value) {
return 'date';
}
$date = \DateTime::createFromFormat('Y-m-d H:i:s', $value);
$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 ('_header' === $value) {
return 'attendee';
}
return $value ? 1 : 0;
};
case 'list_reasons' :
/* @var $activityReasonsRepository EntityRepository */
$activityRepository = $this->entityManager
->getRepository('ChillActivityBundle:Activity');
return function($value) use ($activityRepository) {
if ($value === '_header') return 'activity reasons';
case 'list_reasons':
$activityRepository = $this->activityRepository;
$activity = $activityRepository
->find($value);
return function ($value) use ($activityRepository): string {
if ('_header' === $value) {
return 'activity reasons';
}
return implode(", ", array_map(function(ActivityReason $r) {
$activity = $activityRepository->find($value);
return '"'.
return implode(', ', array_map(function (ActivityReason $r) {
return '"' .
$this->translatableStringHelper->localize($r->getCategory()->getName())
.' > '.
. ' > ' .
$this->translatableStringHelper->localize($r->getName())
.'"';
. '"';
}, $activity->getReasons()->toArray()));
};
case 'circle_name' :
return function($value) {
if ($value === '_header') return 'circle';
return $this->translatableStringHelper
->localize(json_decode($value, true));
};
case 'type_name' :
return function($value) {
if ($value === '_header') return 'activity type';
case 'circle_name':
return function ($value) {
if ('_header' === $value) {
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 ('_header' === $value) {
return 'activity type';
}
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 ('_header' === $value) {
return $key;
}
return $value;
};
@@ -209,68 +187,80 @@ 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);
$centers = array_map(static 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");
if (!array_key_exists('fields', $data)) {
throw new InvalidArgumentException('Any fields have been checked.');
}
$qb = $this->entityManager->createQueryBuilder();
$qb
->from('ChillActivityBundle:Activity', 'activity')
->join('activity.person', 'person')
->join('person.center', 'center')
->andWhere('center IN (:authorized_centers)')
->setParameter('authorized_centers', $centers);
;
->from('ChillActivityBundle:Activity', 'activity')
->join('activity.person', 'person')
->join('person.center', 'center')
->andWhere('center IN (:authorized_centers)')
->setParameter('authorized_centers', $centers);
foreach ($this->fields as $f) {
if (in_array($f, $data['fields'])) {
if (in_array($f, $data['fields'], true)) {
switch ($f) {
case 'id':
$qb->addSelect('activity.id AS id');
break;
case 'person_firstname':
$qb->addSelect('person.firstName AS person_firstname');
break;
case 'person_lastname':
$qb->addSelect('person.lastName AS person_lastname');
break;
case 'person_id':
$qb->addSelect('person.id AS person_id');
break;
case 'user_username':
$qb->join('activity.user', 'user');
$qb->addSelect('user.username AS user_username');
break;
case 'circle_name':
$qb->join('activity.scope', 'circle');
$qb->addSelect('circle.name AS circle_name');
break;
case 'type_name':
$qb->join('activity.type', 'type');
$qb->addSelect('type.name AS type_name');
break;
case 'list_reasons':
// this is a trick... The reasons is filled with the
// activity id which will be used to load reasons
$qb->addSelect('activity.id AS list_reasons');
break;
default:
$qb->addSelect(sprintf('activity.%s as %s', $f, $f));
break;
}
}
}
return $qb;
}
@@ -281,7 +271,6 @@ class ListActivity implements ListInterface
public function supportsModifiers()
{
return array('activity', 'person');
return ['activity', 'person'];
}
}

View File

@@ -1,154 +1,82 @@
<?php
/*
* Copyright (C) 2015 Champs-Libres <info@champs-libres.coop>
/**
* Chill is a software for social workers
*
* 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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Export;
use Chill\MainBundle\Export\ExportInterface;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Security\Core\Role\Role;
use Doctrine\ORM\Query;
use Chill\ActivityBundle\Repository\ActivityRepository;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Doctrine\ORM\EntityManagerInterface;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Doctrine\ORM\Query;
use LogicException;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Role\Role;
/**
* 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';
public const SUM = 'sum';
/**
* The action for this report.
*
* @var string
*/
protected $action;
protected string $action;
private ActivityRepository $activityRepository;
/**
* 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;
}
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder)
{
$this->activityRepository = $activityRepository;
}
public function getDescription()
public function buildForm(FormBuilderInterface $builder)
{
if ($this->action === self::SUM) {
return "Sum activities duration by various parameters.";
}
}
public function getTitle()
{
if ($this->action === self::SUM) {
return "Sum activity duration";
}
}
public function getType()
{
return 'activity';
}
public function initiateQuery(array $requiredModifiers, array $acl, array $data = array())
{
$centers = array_map(function($el) { return $el['center']; }, $acl);
$qb = $this->entityManager->createQueryBuilder();
if ($this->action === self::SUM) {
$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;
}
public function supportsModifiers()
{
return array('person', 'activity');
}
public function requiredRole()
{
return new Role(ActivityStatsVoter::STATS);
}
public function getAllowedFormattersTypes()
{
return array(\Chill\MainBundle\Export\FormatterInterface::TYPE_TABULAR);
return [FormatterInterface::TYPE_TABULAR];
}
public function getDescription()
{
if (self::SUM === $this->action) {
return 'Sum activities duration by various parameters.';
}
}
public function getLabels($key, array $values, $data)
{
if ($key !== 'export_stat_activity') {
throw new \LogicException("the key $key is not used by this export");
if ('export_stat_activity' !== $key) {
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 = self::SUM === $this->action ? 'Sum of activities duration' : false;
return static fn (string $value) => '_header' === $value ? $header : $value;
}
public function getQueryKeys($data)
{
return array('export_stat_activity');
return ['export_stat_activity'];
}
public function getResult($qb, $data)
@@ -156,4 +84,47 @@ class StatActivityDuration implements ExportInterface
return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR);
}
public function getTitle()
{
if (self::SUM === $this->action) {
return 'Sum activity duration';
}
}
public function getType()
{
return 'activity';
}
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$centers = array_map(
static fn (array $el): string => $el['center'],
$acl
);
$qb = $this->activityRepository->createQueryBuilder('activity');
$select = null;
if (self::SUM === $this->action) {
$select = 'SUM(activity.durationTime) AS export_stat_activity';
}
return $qb->select($select)
->join('activity.person', 'person')
->join('person.center', 'center')
->where($qb->expr()->in('center', ':centers'))
->setParameter(':centers', $centers);
}
public function requiredRole()
{
return new Role(ActivityStatsVoter::STATS);
}
public function supportsModifiers()
{
return ['person', 'activity'];
}
}

View File

@@ -1,69 +1,57 @@
<?php
/*
* Copyright (C) 2017 Champs-Libres <info@champs-libres.coop>
/**
* Chill is a software for social workers
*
* 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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Filter;
use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Form\Type\Export\FilterType;
use DateTime;
use Doctrine\ORM\Query\Expr;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\FormError;
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;
function __construct(TranslatorInterface $translator)
protected TranslatorInterface $translator;
public 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',
':date_to');
$clause = $qb->expr()->between(
'activity.date',
':date_from',
':date_to'
);
if ($where instanceof Expr\Andx) {
$where->add($clause);
} 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,57 +62,68 @@ 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->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) {
/* @var $filterForm \Symfony\Component\Form\FormInterface */
$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 \Symfony\Component\Form\FormInterface $filterForm */
$filterForm = $event->getForm()->getParent();
$enabled = $filterForm->get(FilterType::ENABLED_FIELD)->getData();
if ($enabled === true) {
if (true === $enabled) {
// if the filter is enabled, add some validation
$form = $event->getForm();
$form = $event->getForm();
$date_from = $form->get('date_from')->getData();
$date_to = $form->get('date_to')->getData();
$date_to = $form->get('date_to')->getData();
// check that fields are not empty
if ($date_from === null) {
if (null === $date_from) {
$form->get('date_from')->addError(new FormError(
$this->translator->trans('This field '
. 'should not be empty')));
. 'should not be empty')
));
}
if ($date_to === null) {
if (null === $date_to) {
$form->get('date_to')->addError(new FormError(
$this->translator->trans('This field '
. 'should not be empty')));
}
. 'should not be empty')
));
}
// check that date_from is before date_to
if (
($date_from !== null && $date_to !== null)
&&
$date_from >= $date_to
(null !== $date_from && null !== $date_to)
&& $date_from >= $date_to
) {
$form->get('date_to')->addError(new FormError(
$this->translator->trans('This date should be after '
. 'the date given in "Implied in an activity after '
. 'this date" field')));
. 'this date" field')
));
}
}
});
@@ -132,17 +131,17 @@ 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,88 +1,71 @@
<?php
/*
* Copyright (C) 2016 Champs-Libres <info@champs-libres.coop>
/**
* Chill is a software for social workers
*
* 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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
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\Bridge\Doctrine\Form\Type\EntityType;
use Chill\ActivityBundle\Entity\ActivityReason;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Doctrine\ORM\Query\Expr;
use Symfony\Component\Security\Core\Role\Role;
use Chill\ActivityBundle\Repository\ActivityReasonRepository;
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\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Doctrine\ORM\Query\Expr;
use Doctrine\ORM\Query\Expr\Join;
use Doctrine\ORM\QueryBuilder;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use function array_key_exists;
use function count;
/**
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class ActivityReasonFilter implements FilterInterface,
ExportElementValidatedInterface
class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInterface
{
/**
*
* @var TranslatableStringHelper
*/
protected $translatableStringHelper;
/**
* The repository for activity reasons
*
* @var EntityRepository
*/
protected $reasonRepository;
protected ActivityReasonRepository $activityReasonRepository;
protected TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
TranslatableStringHelper $helper,
EntityRepository $reasonRepository
TranslatableStringHelper $helper,
ActivityReasonRepository $activityReasonRepository
) {
$this->translatableStringHelper = $helper;
$this->reasonRepository = $reasonRepository;
$this->activityReasonRepository = $activityReasonRepository;
}
public function addRole()
{
return new Role(ActivityStatsVoter::STATS);
}
public function alterQuery(QueryBuilder $qb, $data)
{
$where = $qb->getDQLPart('where');
$join = $qb->getDQLPart('join');
$join = $qb->getDQLPart('join');
$clause = $qb->expr()->in('reasons', ':selected_activity_reasons');
//dump($join);
// add a join to reasons only if needed
if (
(array_key_exists('activity', $join)
&&
!$this->checkJoinAlreadyDefined($join['activity'], 'reasons')
(
array_key_exists('activity', $join)
&& !$this->checkJoinAlreadyDefined($join['activity'], 'reasons')
)
OR
(! array_key_exists('activity', $join))
|| (!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
);
}
if ($where instanceof Expr\Andx) {
@@ -90,27 +73,10 @@ 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)
{
foreach ($joins as $join) {
if ($join->getAlias() === $alias) {
return true;
}
}
return false;
}
public function applyOn()
{
@@ -119,51 +85,59 @@ 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")
->addViolation();
}
'expanded' => false,
]);
}
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(['id' => $data['reasons']->toArray()])
);
return [
'Filtered by reasons: only %list%',
[
'%list%' => implode(', ', $reasonsNames),
],
];
}
public function getTitle()
{
return 'Filter by reason';
}
public function validateForm($data, ExecutionContextInterface $context)
{
if (null === $data['reasons'] || count($data['reasons']) === 0) {
$context
->buildViolation('At least one reason must be chosen')
->addViolation();
}
}
/**
* Check if a join between Activity and Reason is already defined.
*
* @param Join[] $joins
* @param mixed $alias
*/
private function checkJoinAlreadyDefined(array $joins, $alias): bool
{
foreach ($joins as $join) {
if ($join->getAlias() === $alias) {
return true;
}
}
return false;
}
}

View File

@@ -1,67 +1,50 @@
<?php
/*
* Copyright (C) 2018 Champs-Libres <info@champs-libres.coop>
/**
* Chill is a software for social workers
*
* 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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
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\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;
use Chill\ActivityBundle\Repository\ActivityTypeRepository;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Chill\MainBundle\Export\ExportElementValidatedInterface;
use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Doctrine\ORM\Query\Expr;
use Doctrine\ORM\Query\Expr\Join;
use Doctrine\ORM\QueryBuilder;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use function count;
/**
*
*
*/
class ActivityTypeFilter implements FilterInterface,
ExportElementValidatedInterface
class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInterface
{
/**
*
* @var TranslatableStringHelper
*/
protected $translatableStringHelper;
/**
* The repository for activity reasons
*
* @var EntityRepository
*/
protected $typeRepository;
protected ActivityTypeRepository $activityTypeRepository;
protected TranslatableStringHelperInterface $translatableStringHelper;
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 addRole()
{
return new Role(ActivityStatsVoter::STATS);
}
public function alterQuery(QueryBuilder $qb, $data)
{
$where = $qb->getDQLPart('where');
@@ -72,27 +55,10 @@ 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
*/
private function checkJoinAlreadyDefined(array $joins, $alias)
{
foreach ($joins as $join) {
if ($join->getAlias() === $alias) {
return true;
}
}
return false;
}
public function applyOn()
{
@@ -101,48 +67,64 @@ 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
));
}
public function validateForm($data, ExecutionContextInterface $context)
{
if ($data['types'] === null || count($data['types']) === 0) {
$context->buildViolation("At least one type must be choosen")
->addViolation();
}
$builder->add(
'types',
EntityType::class,
[
'class' => ActivityType::class,
'choice_label' => fn (ActivityType $type) => $this->translatableStringHelper->localize($type->getName()),
'multiple' => true,
'expanded' => false,
]
);
}
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),
],
];
}
public function getTitle()
{
return 'Filter by activity type';
}
public function validateForm($data, ExecutionContextInterface $context)
{
if (null === $data['types'] || count($data['types']) === 0) {
$context
->buildViolation('At least one type must be chosen')
->addViolation();
}
}
/**
* Check if a join between Activity and Reason is already defined.
*
* @param Join[] $joins
* @param mixed $alias
*
* @return bool
*/
private function checkJoinAlreadyDefined(array $joins, $alias)
{
foreach ($joins as $join) {
if ($join->getAlias() === $alias) {
return true;
}
}
return false;
}
}

View File

@@ -1,106 +1,85 @@
<?php
/*
* Copyright (C) 2017 Champs-Libres <info@champs-libres.coop>
/**
* Chill is a software for social workers
*
* 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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Filter;
use Chill\ActivityBundle\Entity\ActivityReason;
use Chill\ActivityBundle\Repository\ActivityReasonRepository;
use Chill\MainBundle\Export\ExportElementValidatedInterface;
use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Form\Type\Export\FilterType;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Chill\PersonBundle\Export\Declarations;
use DateTime;
use Doctrine\ORM\Query\Expr;
use Doctrine\ORM\QueryBuilder;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\FormError;
use Chill\MainBundle\Form\Type\Export\FilterType;
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;
use function count;
/**
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class PersonHavingActivityBetweenDateFilter implements FilterInterface,
ExportElementValidatedInterface
class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInterface, FilterInterface
{
/**
*
* @var TranslatableStringHelper
*/
protected $translatableStringHelper;
/**
*
* @var EntityRepository
*/
protected $activityReasonRepository;
/**
*
* @var TranslatorInterface
*/
protected $translator;
protected ActivityReasonRepository $activityReasonRepository;
protected TranslatableStringHelperInterface $translatableStringHelper;
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,12 +88,16 @@ class PersonHavingActivityBetweenDateFilter implements FilterInterface,
} else {
$where = $qb->expr()->andX($clause);
}
$qb->add('where', $where);
$qb->setParameter('person_having_activity_between_date_from',
$data['date_from']);
$qb->setParameter('person_having_activity_between_date_to',
$data['date_to']);
$qb->setParameter(
'person_having_activity_between_date_from',
$data['date_from']
);
$qb->setParameter(
'person_having_activity_between_date_to',
$data['date_to']
);
$qb->setParameter('person_having_activity_reasons', $data['reasons']);
}
@@ -123,106 +106,104 @@ 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",
'data' => new \DateTime(),
'attr' => array('class' => 'datepicker'),
'widget'=> 'single_text',
$builder->add('date_from', DateType::class, [
'label' => 'Implied in an activity after this date',
'data' => new DateTime(),
'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",
'data' => new \DateTime(),
'attr' => array('class' => 'datepicker'),
'widget'=> 'single_text',
]);
$builder->add('date_to', DateType::class, [
'label' => 'Implied in an activity before this date',
'data' => new DateTime(),
'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"
));
$builder->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) {
/* @var $filterForm \Symfony\Component\Form\FormInterface */
'label' => 'Activity reasons for those activities',
]);
$builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
/** @var FormInterface $filterForm */
$filterForm = $event->getForm()->getParent();
$enabled = $filterForm->get(FilterType::ENABLED_FIELD)->getData();
if ($enabled === true) {
if (true === $enabled) {
// if the filter is enabled, add some validation
$form = $event->getForm();
$form = $event->getForm();
$date_from = $form->get('date_from')->getData();
$date_to = $form->get('date_to')->getData();
$date_to = $form->get('date_to')->getData();
// check that fields are not empty
if ($date_from === null) {
if (null === $date_from) {
$form->get('date_from')->addError(new FormError(
$this->translator->trans('This field '
. 'should not be empty')));
. 'should not be empty')
));
}
if ($date_to === null) {
if (null === $date_to) {
$form->get('date_to')->addError(new FormError(
$this->translator->trans('This field '
. 'should not be empty')));
}
. 'should not be empty')
));
}
// check that date_from is before date_to
if (
($date_from !== null && $date_to !== null)
&&
$date_from >= $date_to
(null !== $date_from && null !== $date_to)
&& $date_from >= $date_to
) {
$form->get('date_to')->addError(new FormError(
$this->translator->trans('This date '
. 'should be after the date given in "Implied in an '
. 'activity after this date" field')));
. 'activity after this date" field')
));
}
}
});
}
public function validateForm($data, ExecutionContextInterface $context)
{
if ($data['reasons'] === null || count($data['reasons']) === 0) {
$context->buildViolation("At least one reason must be choosen")
->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'),
'%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']))
));
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(
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';
}
public function validateForm($data, ExecutionContextInterface $context)
{
if (null === $data['reasons'] || count($data['reasons']) === 0) {
$context->buildViolation('At least one reason must be chosen')
->addViolation();
}
}
}

View File

@@ -1,13 +1,22 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Form;
use Chill\ActivityBundle\Entity\ActivityPresence;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
class ActivityPresenceType extends AbstractType
{
@@ -15,19 +24,19 @@ class ActivityPresenceType extends AbstractType
{
$builder
->add('name', TranslatableStringFormType::class)
->add('active', ChoiceType::class, array(
'choices' => array(
->add('active', ChoiceType::class, [
'choices' => [
'Yes' => true,
'No' => false
),
'expanded' => true
));
'No' => false,
],
'expanded' => true,
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults(array(
'data_class' => ActivityPresence::class
));
$resolver->setDefaults([
'data_class' => ActivityPresence::class,
]);
}
}

View File

@@ -1,25 +1,29 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Form;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
class ActivityReasonCategoryType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', TranslatableStringFormType::class)
->add('active', CheckboxType::class, array('required' => false))
;
->add('active', CheckboxType::class, ['required' => false]);
}
/**
@@ -27,9 +31,9 @@ class ActivityReasonCategoryType extends AbstractType
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Chill\ActivityBundle\Entity\ActivityReasonCategory'
));
$resolver->setDefaults([
'data_class' => 'Chill\ActivityBundle\Entity\ActivityReasonCategory',
]);
}
/**

View File

@@ -1,37 +1,38 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Form;
use Chill\ActivityBundle\Form\Type\TranslatableActivityReasonCategory;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Chill\ActivityBundle\Form\Type\TranslatableActivityReasonCategory;
class ActivityReasonType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', TranslatableStringFormType::class)
->add('active', CheckboxType::class, array('required' => false))
->add('category', TranslatableActivityReasonCategory::class)
;
->add('active', CheckboxType::class, ['required' => false])
->add('category', TranslatableActivityReasonCategory::class);
}
/**
* @param OptionsResolver $resolver
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Chill\ActivityBundle\Entity\ActivityReason'
));
$resolver->setDefaults([
'data_class' => 'Chill\ActivityBundle\Entity\ActivityReason',
]);
}
/**

View File

@@ -1,59 +1,72 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Form;
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\Entity\User;
use Chill\MainBundle\Form\Type\ChillCollectionType;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\CommentType;
use Chill\MainBundle\Form\Type\ScopePickerType;
use Chill\MainBundle\Form\Type\UserPickerType;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use DateInterval;
use DateTime;
use DateTimeZone;
use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ObjectManager;
use RuntimeException;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Doctrine\Persistence\ObjectManager;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Chill\MainBundle\Entity\User;
use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Chill\MainBundle\Form\Type\UserPickerType;
use Chill\MainBundle\Form\Type\ScopePickerType;
use Chill\MainBundle\Form\Type\ChillDateType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\CallbackTransformer;
use Chill\PersonBundle\Form\DataTransformer\PersonToIdTransformer;
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use function in_array;
class ActivityType extends AbstractType
{
protected User $user;
protected AuthorizationHelper $authorizationHelper;
protected ObjectManager $om;
protected TranslatableStringHelper $translatableStringHelper;
protected SocialActionRender $socialActionRender;
protected SocialIssueRender $socialIssueRender;
protected SocialActionRender $socialActionRender;
protected array $timeChoices;
public function __construct (
protected TranslatableStringHelper $translatableStringHelper;
protected User $user;
public function __construct(
TokenStorageInterface $tokenStorage,
AuthorizationHelper $authorizationHelper,
ObjectManager $om,
@@ -63,7 +76,7 @@ class ActivityType extends AbstractType
SocialActionRender $socialActionRender
) {
if (!$tokenStorage->getToken()->getUser() instanceof User) {
throw new \RuntimeException("you should have a valid user");
throw new RuntimeException('you should have a valid user');
}
$this->user = $tokenStorage->getToken()->getUser();
@@ -93,20 +106,19 @@ 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,
]);
}
/** @var ? \Chill\PersonBundle\Entity\AccompanyingPeriod $accompanyingPeriod */
$accompanyingPeriod = NULL;
$accompanyingPeriod = null;
if ($options['accompanyingPeriod']) {
$accompanyingPeriod = $options['accompanyingPeriod'];
}
@@ -114,49 +126,53 @@ class ActivityType extends AbstractType
if ($activityType->isVisible('socialIssues') && $accompanyingPeriod) {
$builder->add('socialIssues', HiddenType::class);
$builder->get('socialIssues')
->addModelTransformer(new CallbackTransformer(
function (iterable $socialIssuesAsIterable): string {
$socialIssueIds = [];
foreach ($socialIssuesAsIterable as $value) {
$socialIssueIds[] = $value->getId();
}
return implode(',', $socialIssueIds);
},
function (?string $socialIssuesAsString): array {
if (null === $socialIssuesAsString) {
return [];
}
return array_map(
fn(string $id): ?SocialIssue => $this->om->getRepository(SocialIssue::class)->findOneBy(['id' => (int) $id]),
explode(',', $socialIssuesAsString)
);
}
))
;
->addModelTransformer(new CallbackTransformer(
static function (iterable $socialIssuesAsIterable): string {
$socialIssueIds = [];
foreach ($socialIssuesAsIterable as $value) {
$socialIssueIds[] = $value->getId();
}
return implode(',', $socialIssueIds);
},
function (?string $socialIssuesAsString): array {
if (null === $socialIssuesAsString) {
return [];
}
return array_map(
fn (string $id): ?SocialIssue => $this->om->getRepository(SocialIssue::class)->findOneBy(['id' => (int) $id]),
explode(',', $socialIssuesAsString)
);
}
));
}
if ($activityType->isVisible('socialActions') && $accompanyingPeriod) {
$builder->add('socialActions', HiddenType::class);
$builder->get('socialActions')
->addModelTransformer(new CallbackTransformer(
function (iterable $socialActionsAsIterable): string {
$socialActionIds = [];
foreach ($socialActionsAsIterable as $value) {
$socialActionIds[] = $value->getId();
}
return implode(',', $socialActionIds);
},
function (?string $socialActionsAsString): array {
if (null === $socialActionsAsString) {
return [];
}
return array_map(
fn(string $id): ?SocialAction => $this->om->getRepository(SocialAction::class)->findOneBy(['id' => (int) $id]),
explode(',', $socialActionsAsString)
);
}
))
;
->addModelTransformer(new CallbackTransformer(
static function (iterable $socialActionsAsIterable): string {
$socialActionIds = [];
foreach ($socialActionsAsIterable as $value) {
$socialActionIds[] = $value->getId();
}
return implode(',', $socialActionIds);
},
function (?string $socialActionsAsString): array {
if (null === $socialActionsAsString) {
return [];
}
return array_map(
fn (string $id): ?SocialAction => $this->om->getRepository(SocialAction::class)->findOneBy(['id' => (int) $id]),
explode(',', $socialActionsAsString)
);
}
));
}
if ($activityType->isVisible('date')) {
@@ -189,7 +205,7 @@ class ActivityType extends AbstractType
'choice_label' => function (ActivityPresence $activityPresence) {
return $this->translatableStringHelper->localize($activityPresence->getName());
},
'query_builder' => function (EntityRepository $er) {
'query_builder' => static function (EntityRepository $er) {
return $er->createQueryBuilder('a')
->where('a.active = true');
},
@@ -201,7 +217,7 @@ class ActivityType extends AbstractType
'label' => $activityType->getLabel('user'),
'required' => $activityType->isRequired('user'),
'center' => $options['center'],
'role' => $options['role']
'role' => $options['role'],
]);
}
@@ -214,8 +230,8 @@ class ActivityType extends AbstractType
'choice_label' => function (ActivityReason $activityReason) {
return $this->translatableStringHelper->localize($activityReason->getName());
},
'attr' => array('class' => 'select2 '),
'query_builder' => function (EntityRepository $er) {
'attr' => ['class' => 'select2 '],
'query_builder' => static function (EntityRepository $er) {
return $er->createQueryBuilder('a')
->where('a.active = true');
},
@@ -224,7 +240,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'),
]);
@@ -233,43 +249,45 @@ class ActivityType extends AbstractType
if ($activityType->isVisible('persons')) {
$builder->add('persons', HiddenType::class);
$builder->get('persons')
->addModelTransformer(new CallbackTransformer(
function (iterable $personsAsIterable): string {
$personIds = [];
foreach ($personsAsIterable as $value) {
$personIds[] = $value->getId();
}
return implode(',', $personIds);
},
function (?string $personsAsString): array {
return array_map(
fn(string $id): ?Person => $this->om->getRepository(Person::class)->findOneBy(['id' => (int) $id]),
explode(',', $personsAsString)
);
}
))
;
->addModelTransformer(new CallbackTransformer(
static function (iterable $personsAsIterable): string {
$personIds = [];
foreach ($personsAsIterable as $value) {
$personIds[] = $value->getId();
}
return implode(',', $personIds);
},
function (?string $personsAsString): array {
return array_map(
fn (string $id): ?Person => $this->om->getRepository(Person::class)->findOneBy(['id' => (int) $id]),
explode(',', $personsAsString)
);
}
));
}
if ($activityType->isVisible('thirdParties')) {
$builder->add('thirdParties', HiddenType::class);
$builder->get('thirdParties')
->addModelTransformer(new CallbackTransformer(
function (iterable $thirdpartyAsIterable): string {
$thirdpartyIds = [];
foreach ($thirdpartyAsIterable as $value) {
$thirdpartyIds[] = $value->getId();
}
return implode(',', $thirdpartyIds);
},
function (?string $thirdpartyAsString): array {
return array_map(
fn(string $id): ?ThirdParty => $this->om->getRepository(ThirdParty::class)->findOneBy(['id' => (int) $id]),
explode(',', $thirdpartyAsString)
);
}
))
;
->addModelTransformer(new CallbackTransformer(
static function (iterable $thirdpartyAsIterable): string {
$thirdpartyIds = [];
foreach ($thirdpartyAsIterable as $value) {
$thirdpartyIds[] = $value->getId();
}
return implode(',', $thirdpartyIds);
},
function (?string $thirdpartyAsString): array {
return array_map(
fn (string $id): ?ThirdParty => $this->om->getRepository(ThirdParty::class)->findOneBy(['id' => (int) $id]),
explode(',', $thirdpartyAsString)
);
}
));
}
if ($activityType->isVisible('documents')) {
@@ -279,29 +297,47 @@ class ActivityType extends AbstractType
'required' => $activityType->isRequired('documents'),
'allow_add' => true,
'button_add_label' => 'activity.Insert a document',
'button_remove_label' => 'activity.Remove a document'
'button_remove_label' => 'activity.Remove a document',
]);
}
if ($activityType->isVisible('users')) {
$builder->add('users', HiddenType::class);
$builder->get('users')
->addModelTransformer(new CallbackTransformer(
function (iterable $usersAsIterable): string {
$userIds = [];
foreach ($usersAsIterable as $value) {
$userIds[] = $value->getId();
}
return implode(',', $userIds);
},
function (?string $usersAsString): array {
return array_map(
fn(string $id): ?User => $this->om->getRepository(User::class)->findOneBy(['id' => (int) $id]),
explode(',', $usersAsString)
);
}
))
;
->addModelTransformer(new CallbackTransformer(
static function (iterable $usersAsIterable): string {
$userIds = [];
foreach ($usersAsIterable as $value) {
$userIds[] = $value->getId();
}
return implode(',', $userIds);
},
function (?string $usersAsString): array {
return array_map(
fn (string $id): ?User => $this->om->getRepository(User::class)->findOneBy(['id' => (int) $id]),
explode(',', $usersAsString)
);
}
));
}
if ($activityType->isVisible('location')) {
$builder->add('location', HiddenType::class)
->get('location')
->addModelTransformer(new CallbackTransformer(
static 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')) {
@@ -331,7 +367,7 @@ class ActivityType extends AbstractType
->addModelTransformer($durationTimeTransformer);
$builder->get($fieldName)
->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $formEvent) use (
->addEventListener(FormEvents::PRE_SET_DATA, static function (FormEvent $formEvent) use (
$timeChoices,
$builder,
$durationTimeTransformer,
@@ -340,24 +376,25 @@ class ActivityType extends AbstractType
) {
// set the timezone to GMT, and fix the difference between current and GMT
// the datetimetransformer will then handle timezone as GMT
$timezoneUTC = new \DateTimeZone('GMT');
/* @var $data \DateTime */
$data = $formEvent->getData() === NULL ?
\DateTime::createFromFormat('U', 300) :
$timezoneUTC = new DateTimeZone('GMT');
/** @var DateTime $data */
$data = $formEvent->getData() === null ?
DateTime::createFromFormat('U', 300) :
$formEvent->getData();
$seconds = $data->getTimezone()->getOffset($data);
$data->setTimeZone($timezoneUTC);
$data->add(new \DateInterval('PT'.$seconds.'S'));
$data->add(new DateInterval('PT' . $seconds . 'S'));
// test if the timestamp is in the choices.
// If not, recreate the field with the new timestamp
if (!in_array($data->getTimestamp(), $timeChoices)) {
if (!in_array($data->getTimestamp(), $timeChoices, true)) {
// the data are not in the possible values. add them
$timeChoices[$data->format('H:i')] = $data->getTimestamp();
$form = $builder->create($fieldName, ChoiceType::class, array_merge(
$durationTimeOptions, [
$durationTimeOptions,
[
'choices' => $timeChoices,
'auto_initialize' => false
'auto_initialize' => false,
]
));
$form->addModelTransformer($durationTimeTransformer);
@@ -367,12 +404,10 @@ class ActivityType extends AbstractType
}
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Activity::class
'data_class' => Activity::class,
]);
$resolver
@@ -380,8 +415,7 @@ class ActivityType extends AbstractType
->setAllowedTypes('center', ['null', 'Chill\MainBundle\Entity\Center'])
->setAllowedTypes('role', 'Symfony\Component\Security\Core\Role\Role')
->setAllowedTypes('activityType', \Chill\ActivityBundle\Entity\ActivityType::class)
->setAllowedTypes('accompanyingPeriod', [\Chill\PersonBundle\Entity\AccompanyingPeriod::class, 'null'])
;
->setAllowedTypes('accompanyingPeriod', [\Chill\PersonBundle\Entity\AccompanyingPeriod::class, 'null']);
}
public function getBlockPrefix(): string

View File

@@ -1,14 +1,23 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Form;
use Chill\ActivityBundle\Entity\ActivityTypeCategory;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
class ActivityTypeCategoryType extends AbstractType
{
@@ -16,24 +25,23 @@ class ActivityTypeCategoryType extends AbstractType
{
$builder
->add('name', TranslatableStringFormType::class)
->add('active', ChoiceType::class, array(
'choices' => array(
->add('active', ChoiceType::class, [
'choices' => [
'Yes' => true,
'No' => false
),
'expanded' => true
))
'No' => false,
],
'expanded' => true,
])
->add('ordering', NumberType::class, [
'required' => true,
'scale' => 5
])
;
'scale' => 5,
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults(array(
'data_class' => ActivityTypeCategory::class
));
$resolver->setDefaults([
'data_class' => ActivityTypeCategory::class,
]);
}
}

View File

@@ -1,18 +1,27 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Form;
use Chill\ActivityBundle\Entity\ActivityTypeCategory;
use Chill\ActivityBundle\Form\Type\ActivityFieldPresence;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
class ActivityTypeType extends AbstractType
{
@@ -30,9 +39,9 @@ class ActivityTypeType extends AbstractType
->add('active', ChoiceType::class, [
'choices' => [
'Yes' => true,
'No' => false
'No' => false,
],
'expanded' => true
'expanded' => true,
])
->add('category', EntityType::class, [
'class' => ActivityTypeCategory::class,
@@ -42,20 +51,20 @@ class ActivityTypeType extends AbstractType
])
->add('ordering', NumberType::class, [
'required' => true,
'scale' => 5
])
;
'scale' => 5,
]);
$fields = [
'persons', 'user', 'date', 'place', 'persons',
'thirdParties', 'durationTime', 'travelTime', 'attendee',
'reasons', 'comment', 'sentReceived', 'documents',
'emergency', 'accompanyingPeriod', 'socialData', 'users'
'emergency', 'socialIssues', 'socialActions', 'users',
];
foreach ($fields as $field) {
$builder
->add($field.'Visible', ActivityFieldPresence::class)
->add($field.'Label', TextType::class, [
->add($field . 'Visible', ActivityFieldPresence::class)
->add($field . 'Label', TextType::class, [
'required' => false,
'empty_data' => '',
]);
@@ -64,8 +73,8 @@ class ActivityTypeType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => \Chill\ActivityBundle\Entity\ActivityType::class
));
$resolver->setDefaults([
'data_class' => \Chill\ActivityBundle\Entity\ActivityType::class,
]);
}
}

View File

@@ -1,5 +1,14 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Form\Type;
use Chill\ActivityBundle\Entity\ActivityType;
@@ -9,21 +18,21 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class ActivityFieldPresence extends AbstractType
{
public function getParent()
{
return ChoiceType::class;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
array(
[
'choices' => [
'Invisible' => ActivityType::FIELD_INVISIBLE,
'Optional' => ActivityType::FIELD_OPTIONAL,
'Required' => ActivityType::FIELD_REQUIRED,
],
)
]
);
}
public function getParent()
{
return ChoiceType::class;
}
}

View File

@@ -1,54 +1,39 @@
<?php
/*
/**
* Chill is a software for social workers
*
* Copyright (C) 2014-2020, 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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Doctrine\ORM\EntityRepository;
use Chill\ActivityBundle\Entity\ActivityReason;
use Chill\ActivityBundle\Templating\Entity\ActivityReasonRender;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* FormType to choose amongst activity reasons
*
* FormType to choose amongst activity reasons.
*/
class TranslatableActivityReason extends AbstractType
{
/**
*
* @var TranslatableStringHelper
*/
protected $translatableStringHelper;
/**
*
* @var ActivityReasonRender
*/
protected $reasonRender;
/**
* @var TranslatableStringHelper
*/
protected $translatableStringHelper;
public function __construct(
TranslatableStringHelper $translatableStringHelper,
ActivityReasonRender $reasonRender
@@ -57,6 +42,30 @@ class TranslatableActivityReason extends AbstractType
$this->reasonRender = $reasonRender;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
[
'class' => 'ChillActivityBundle:ActivityReason',
'choice_label' => function (ActivityReason $choice) {
return $this->reasonRender->renderString($choice, []);
},
'group_by' => function (ActivityReason $choice): ?string {
if (null !== $category = $choice->getCategory()) {
return $this->translatableStringHelper->localize($category->getName());
}
return null;
},
'query_builder' => static function (EntityRepository $er) {
return $er->createQueryBuilder('r')
->where('r.active = true');
},
'attr' => ['class' => ' select2 '],
]
);
}
public function getBlockPrefix()
{
return 'translatable_activity_reason';
@@ -66,28 +75,4 @@ class TranslatableActivityReason extends AbstractType
{
return EntityType::class;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
array(
'class' => 'ChillActivityBundle:ActivityReason',
'choice_label' => function(ActivityReason $choice) {
return $this->reasonRender->renderString($choice, []);
},
'group_by' => function(ActivityReason $choice): ?string {
if (null !== $category = $choice->getCategory()) {
return $this->translatableStringHelper->localize($category->getName());
}
return null;
},
'query_builder' => function (EntityRepository $er) {
return $er->createQueryBuilder('r')
->where('r.active = true');
},
'attr' => [ 'class' => ' select2 ']
)
);
}
}

View File

@@ -1,40 +1,25 @@
<?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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* Description of TranslatableActivityReasonCategory
*
* @author Champs-Libres Coop
* Description of TranslatableActivityReasonCategory.
*/
class TranslatableActivityReasonCategory extends AbstractType
{
/**
@@ -47,6 +32,21 @@ class TranslatableActivityReasonCategory extends AbstractType
$this->requestStack = $requestStack;
}
public function configureOptions(OptionsResolver $resolver)
{
$locale = $this->requestStack->getCurrentRequest()->getLocale();
$resolver->setDefaults(
[
'class' => 'ChillActivityBundle:ActivityReasonCategory',
'choice_label' => 'name[' . $locale . ']',
'query_builder' => static function (EntityRepository $er) {
return $er->createQueryBuilder('c')
->where('c.active = true');
},
]
);
}
public function getBlockPrefix()
{
return 'translatable_activity_reason_category';
@@ -56,19 +56,4 @@ class TranslatableActivityReasonCategory extends AbstractType
{
return EntityType::class;
}
public function configureOptions(OptionsResolver $resolver)
{
$locale = $this->requestStack->getCurrentRequest()->getLocale();
$resolver->setDefaults(
array(
'class' => 'ChillActivityBundle:ActivityReasonCategory',
'choice_label' => 'name['.$locale.']',
'query_builder' => function (EntityRepository $er) {
return $er->createQueryBuilder('c')
->where('c.active = true');
}
)
);
}
}

View File

@@ -1,60 +1,66 @@
<?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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
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;
use Chill\ActivityBundle\Repository\ActivityTypeRepository;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\QueryBuilder;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* Description of TranslatableActivityType
*
* @author Champs-Libres Coop
*/
class TranslatableActivityType extends AbstractType
{
protected ActivityTypeRepository $activityTypeRepository;
/**
*
* @var TranslatableStringHelper
*/
protected $translatableStringHelper;
protected $activityTypeRepository;
protected TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
TranslatableStringHelper $helper,
EntityRepository $activityTypeRepository
)
{
TranslatableStringHelperInterface $helper,
ActivityTypeRepository $activityTypeRepository
) {
$this->translatableStringHelper = $helper;
$this->activityTypeRepository = $activityTypeRepository;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
/** @var QueryBuilder $qb */
$qb = $options['query_builder'];
if (true === $options['active_only']) {
$qb->where($qb->expr()->eq('at.active', ':active'));
$qb->setParameter('active', true, Types::BOOLEAN);
}
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
[
'class' => ActivityType::class,
'active_only' => true,
'query_builder' => $this->activityTypeRepository
->createQueryBuilder('at'),
'choice_label' => function (ActivityType $type) {
return $this->translatableStringHelper->localize($type->getName());
},
]
);
}
public function getBlockPrefix()
{
return 'translatable_activity_type';
@@ -64,30 +70,4 @@ class TranslatableActivityType extends AbstractType
{
return EntityType::class;
}
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder, array $options) {
/* @var $qb \Doctrine\ORM\QueryBuilder */
$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);
}
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
array(
'class' => 'ChillActivityBundle:ActivityType',
'active_only' => true,
'query_builder' => $this->activityTypeRepository
->createQueryBuilder('at'),
'choice_label' => function (ActivityType $type) {
return $this->translatableStringHelper->localize($type->getName());
}
)
);
}
}

View File

@@ -1,47 +1,54 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
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 Security $security;
protected TranslatorInterface $translator;
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
{
return ['accompanyingCourse'];
}
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
$period = $parameters['accompanyingCourse'];
if (AccompanyingPeriod::STEP_DRAFT !== $period->getStep()) {
$menu->addChild($this->translator->trans('Activity list'), [
if (AccompanyingPeriod::STEP_DRAFT !== $period->getStep()
&& $this->security->isGranted(ActivityVoter::SEE, $period)) {
$menu->addChild($this->translator->trans('Activity'), [
'route' => 'chill_activity_activity_list',
'routeParameters' => [
'accompanying_period_id' => $period->getId(),
]])
], ])
->setExtras(['order' => 40]);
}
}
public static function getMenuIds(): array
{
return ['accompanyingCourse'];
}
}

View File

@@ -0,0 +1,57 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Security;
use function in_array;
final class AdminMenuBuilder implements LocalMenuBuilderInterface
{
private Security $security;
public function __construct(Security $security)
{
$this->security = $security;
}
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
if (!$this->security->isGranted('ROLE_ADMIN')) {
return;
}
if (in_array($menuId, ['admin_index', 'admin_section'], true)) {
$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',
]);
}
}
public static function getMenuIds(): array
{
return ['admin_index', 'admin_section', 'admin_activity'];
}
}

View File

@@ -1,68 +1,56 @@
<?php
/*
* Copyright (C) 2018 Julien Fastré <julien.fastre@champs-libres.coop>
/**
* Chill is a software for social workers
*
* 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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\ActivityBundle\Menu;
declare(strict_types=1);
namespace Chill\ActivityBundle\Menu;
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
use Symfony\Component\Translation\TranslatorInterface;
/**
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class PersonMenuBuilder implements LocalMenuBuilderInterface
{
/**
*
* @var TranslatorInterface
*/
protected $translator;
/**
*
* @var AuthorizationCheckerInterface
*/
protected $authorizationChecker;
/**
* @var TranslatorInterface
*/
protected $translator;
public function __construct(
AuthorizationCheckerInterface $authorizationChecker,
TranslatorInterface $translator)
{
TranslatorInterface $translator
) {
$this->translator = $translator;
$this->authorizationChecker = $authorizationChecker;
}
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
/* @var $person \Chill\PersonBundle\Entity\Person */
/** @var \Chill\PersonBundle\Entity\Person $person */
$person = $parameters['person'];
if ($this->authorizationChecker->isGranted(ActivityVoter::SEE, $person)) {
$menu->addChild(
$this->translator->trans('Activity list'), [
$this->translator->trans('Activity list'),
[
'route' => 'chill_activity_activity_list',
'routeParameters' => [ 'person_id' => $person->getId() ],
])
->setExtra('order', 201)
;
'routeParameters' => ['person_id' => $person->getId()],
]
)
->setExtra('order', 201);
}
}

View File

@@ -1,17 +1,21 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Notification;
use Chill\MainBundle\Entity\Notification;
use Chill\ActivityBundle\Entity\Activity;
use Chill\MainBundle\Entity\Notification;
final class ActivityNotificationRenderer
{
public function supports(Notification $notification, array $options = []): bool
{
return $notification->getRelatedEntityClass() == Activity::class;
}
public function getTemplate()
{
return '@ChillActivity/Activity/showInNotification.html.twig';
@@ -21,4 +25,9 @@ final class ActivityNotificationRenderer
{
return ['notification' => $notification];
}
public function supports(Notification $notification, array $options = []): bool
{
return $notification->getRelatedEntityClass() === Activity::class;
}
}

View File

@@ -1,60 +1,95 @@
<?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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Repository;
use Chill\ActivityBundle\Entity\Activity;
use Chill\PersonBundle\Entity\Person;
use Chill\ActivityBundle\Repository\ActivityRepository;
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
use Chill\MainBundle\Entity\Scope;
use Doctrine\ORM\QueryBuilder;
use Doctrine\ORM\Query\Expr\Orx;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Role\Role;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Security\Core\Security;
use function count;
use function in_array;
final class ActivityACLAwareRepository
final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInterface
{
private AuthorizationHelper $authorizationHelper;
private TokenStorageInterface $tokenStorage;
private ActivityRepository $repository;
private CenterResolverDispatcherInterface $centerResolverDispatcher;
private EntityManagerInterface $em;
private ActivityRepository $repository;
private Security $security;
private TokenStorageInterface $tokenStorage;
public function __construct(
AuthorizationHelper $authorizationHelper,
CenterResolverDispatcherInterface $centerResolverDispatcher,
TokenStorageInterface $tokenStorage,
ActivityRepository $repository,
EntityManagerInterface $em
EntityManagerInterface $em,
Security $security
) {
$this->authorizationHelper = $authorizationHelper;
$this->centerResolverDispatcher = $centerResolverDispatcher;
$this->tokenStorage = $tokenStorage;
$this->repository = $repository;
$this->em = $em;
$this->security = $security;
}
public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array
{
$user = $this->security->getUser();
$center = $this->centerResolverDispatcher->resolveCenter($period);
if (0 === count($orderBy)) {
$orderBy = ['date' => 'DESC'];
}
$scopes = $this->authorizationHelper
->getReachableCircles($user, $role, $center);
return $this->em->getRepository(Activity::class)
->findByAccompanyingPeriod($period, $scopes, true, $limit, $start, $orderBy);
}
/**
* @param array $orderBy
*
* @return Activity[]|array
*/
public function findByPerson(Person $person, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array
{
$user = $this->security->getUser();
$center = $this->centerResolverDispatcher->resolveCenter($person);
if (0 === count($orderBy)) {
$orderBy = ['date' => 'DESC'];
}
$reachableScopes = $this->authorizationHelper
->getReachableCircles($user, $role, $center);
return $this->em->getRepository(Activity::class)
->findByPersonImplied($person, $reachableScopes, $orderBy, $limit, $start);
}
public function queryTimelineIndexer(string $context, array $args = []): array
@@ -65,15 +100,15 @@ final class ActivityACLAwareRepository
[$where, $parameters] = $this->getWhereClause($context, $args);
return [
'id' => $metadataActivity->getTableName()
.'.'.$metadataActivity->getColumnName('id'),
'type' => 'activity',
'date' => $metadataActivity->getTableName()
.'.'.$metadataActivity->getColumnName('date'),
'FROM' => $from,
'WHERE' => $where,
'parameters' => $parameters
];
'id' => $metadataActivity->getTableName()
. '.' . $metadataActivity->getColumnName('id'),
'type' => 'activity',
'date' => $metadataActivity->getTableName()
. '.' . $metadataActivity->getColumnName('date'),
'FROM' => $from,
'WHERE' => $where,
'parameters' => $parameters,
];
}
private function getFromClauseCenter(array $args): string
@@ -81,62 +116,63 @@ final class ActivityACLAwareRepository
$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().'.'.
return $metadataActivity->getTableName() . ' JOIN '
. $metadataPerson->getTableName() . ' ON '
. $metadataPerson->getTableName() . '.' .
$associationMapping['joinColumns'][0]['referencedColumnName']
.' = '
.$associationMapping['joinColumns'][0]['name']
;
. ' = '
. $associationMapping['joinColumns'][0]['name'];
}
private function getWhereClause(string $context, array $args): array
{
$where = '';
$parameters = [];
$metadataActivity = $this->em->getClassMetadata(Activity::class);
$metadataPerson = $this->em->getClassMetadata(Person::class);
$activityToPerson = $metadataActivity->getAssociationMapping('person')['joinColumns'][0]['name'];
$activityToScope = $metadataActivity->getAssociationMapping('scope')['joinColumns'][0]['name'];
$activityToScope = $metadataActivity->getAssociationMapping('scope')['joinColumns'][0]['name'];
$personToCenter = $metadataPerson->getAssociationMapping('center')['joinColumns'][0]['name'];
// acls:
$role = new Role(ActivityVoter::SEE);
$reachableCenters = $this->authorizationHelper->getReachableCenters($this->tokenStorage->getToken()->getUser(),
$role);
$reachableCenters = $this->authorizationHelper->getReachableCenters(
$this->tokenStorage->getToken()->getUser(),
$role
);
if (count($reachableCenters) === 0) {
// insert a dummy condition
return 'FALSE = TRUE';
}
if ($context === 'person') {
// we start with activities having the person_id linked to person
if ('person' === $context) {
// we start with activities having the person_id linked to person
$where .= sprintf('%s = ? AND ', $activityToPerson);
$parameters[] = $person->getId();
}
// we add acl (reachable center and scopes)
$where .= '('; // first loop for the for centers
$centersI = 0; // like centers#i
foreach ($reachableCenters as $center) {
// we pass if not in centers
if (!\in_array($center, $args['centers'])) {
if (!in_array($center, $args['centers'], true)) {
continue;
}
// we get all the reachable scopes for this center
$reachableScopes = $this->authorizationHelper->getReachableScopes($this->tokenStorage->getToken()->getUser(), $role, $center);
// we get the ids for those scopes
$reachablesScopesId = array_map(
function(Scope $scope) { return $scope->getId(); },
static function (Scope $scope) { return $scope->getId(); },
$reachableScopes
);
// if not the first center
if ($centersI > 0) {
if (0 < $centersI) {
$where .= ') OR (';
}
@@ -149,21 +185,20 @@ final class ActivityACLAwareRepository
$scopesI = 0; //like scope#i
foreach ($reachablesScopesId as $scopeId) {
if ($scopesI > 0) {
if (0 < $scopesI) {
$where .= ' OR ';
}
$where .= sprintf(' %s.%s = ? ', $metadataActivity->getTableName(), $activityToScope);
$parameters[] = $scopeId;
$scopesI ++;
++$scopesI;
}
// close loop for scopes
$where .= ') ';
$centersI++;
++$centersI;
}
// close loop for centers
$where .= ')';
return [$where, $parameters];
}
}

View File

@@ -0,0 +1,28 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Repository;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
interface ActivityACLAwareRepositoryInterface
{
/**
* @return Activity[]|array
*/
public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array;
/**
* @return Activity[]|array
*/
public function findByPerson(Person $person, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array;
}

View File

@@ -0,0 +1,30 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
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,30 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
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,36 +1,27 @@
<?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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Repository;
use Chill\ActivityBundle\Entity\Activity;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
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
{
@@ -39,29 +30,69 @@ class ActivityRepository extends ServiceEntityRepository
parent::__construct($registry, Activity::class);
}
public function findByPersonImplied($person, array $scopes, $orderBy = [ 'date' => 'DESC'], $limit = 100, $offset = 0)
/**
* @return Activity[]
*/
public function findByAccompanyingPeriod(AccompanyingPeriod $period, array $scopes, ?bool $allowNullScope = false, ?int $limit = 100, ?int $offset = 0, array $orderBy = ['date' => 'desc']): array
{
$qb = $this->createQueryBuilder('a');
$qb->select('a');
if (!$allowNullScope) {
$qb
->where($qb->expr()->in('a.scope', ':scopes'))
->setParameter('scopes', $scopes);
} else {
$qb
->where(
$qb->expr()->orX(
$qb->expr()->in('a.scope', ':scopes'),
$qb->expr()->isNull('a.scope')
)
)
->setParameter('scopes', $scopes);
}
$qb
->andWhere(
$qb->expr()->eq('a.accompanyingPeriod', ':period')
)
->setParameter('period', $period);
foreach ($orderBy as $k => $dir) {
$qb->addOrderBy('a.' . $k, $dir);
}
$qb->setMaxResults($limit)->setFirstResult($offset);
return $qb->getQuery()->getResult();
}
/**
* @return Activity[]
*/
public function findByPersonImplied(Person $person, array $scopes, ?array $orderBy = ['date' => 'DESC'], ?int $limit = 100, ?int $offset = 0): array
{
$qb = $this->createQueryBuilder('a');
$qb->select('a');
$qb
// TODO add acl
//->where($qb->expr()->in('a.scope', ':scopes'))
//->setParameter('scopes', $scopes)
->where($qb->expr()->in('a.scope', ':scopes'))
->setParameter('scopes', $scopes)
->andWhere(
$qb->expr()->orX(
$qb->expr()->eq('a.person', ':person'),
':person MEMBER OF a.persons'
)
)
->setParameter('person', $person)
;
->setParameter('person', $person);
foreach ($orderBy as $k => $dir) {
$qb->addOrderBy('a.'.$k, $dir);
$qb->addOrderBy('a.' . $k, $dir);
}
return $qb->getQuery()
->getResult();
}
$qb->setMaxResults($limit)->setFirstResult($offset);
return $qb->getQuery()->getResult();
}
}

View File

@@ -0,0 +1,30 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
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,30 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
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,88 +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: 27%;
}
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.details {
flex-direction: row;
& > div.item-col {
justify-content: flex-start;
align-self: center;
&:nth-child(1) {
flex-grow: 1; flex-shrink: 0; flex-basis: 30%;
}
&:nth-child(2) {
flex-grow: 0; flex-shrink: 1; flex-basis: 70%;
}
//// ACTIVITY LIST PAGE
// precise badge-title specific details
&:only-child {
flex-grow: 0; flex-shrink: 0; flex-basis: 100%;
& > div.concerned-groups {
flex-grow: 0; flex-shrink: 0; flex-basis: 100%;
display: flex;
flex-direction: column; // TODO pas fini
div.group {
flex-grow: 1; flex-shrink: 0; flex-basis: 30%;
h4 {}
ul.list-content {
li {
display: inline;
}
}
}
}
}
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;
}
div.concerned-groups {
font-size: 85%;
h4 {
text-transform: uppercase;
}
}
}
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 {
@@ -127,3 +77,12 @@ div.flex-bloc.concerned-groups {
}
}
/// CHILL ENTITY RENDER BOX
.chill-entity {
/// ACTIVITY-REASON
&.entity-activity-reason {
margin-right: 0.3em;
font-size: 120%;
}
}

View File

@@ -1,17 +1,21 @@
<template>
<concerned-groups></concerned-groups>
<social-issues-acc></social-issues-acc>
<concerned-groups v-if="hasPerson"></concerned-groups>
<social-issues-acc v-if="hasSocialIssues"></social-issues-acc>
<location v-if="hasLocation"></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",
props: ['hasSocialIssues', 'hasLocation', 'hasPerson'],
components: {
ConcernedGroups,
SocialIssuesAcc
SocialIssuesAcc,
Location
}
}
</script>

View File

@@ -1,18 +1,52 @@
import { getSocialIssues } from 'ChillPersonAssets/vuejs/AccompanyingCourse/api.js';
import { fetchResults } from 'ChillMainAssets/lib/api/apiMethods';
/*
* 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');
});
};
const getLocations = () => fetchResults('/api/1.0/main/location.json');
const getLocationTypes = () => fetchResults('/api/1.0/main/location-type.json');
/*
* Load Location Type by defaultFor
* @param {string} entity - can be "person" or "thirdparty"
*/
const getLocationTypeByDefaultFor = (entity) => {
return getLocationTypes().then(results =>
results.filter(t => t.defaultFor === entity)[0]
);
};
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,
getLocationTypeByDefaultFor,
postLocation
};

View File

@@ -1,29 +1,37 @@
<template>
<teleport to="#add-persons">
<teleport to="#add-persons" v-if="isComponentVisible">
<div class="flex-bloc concerned-groups" :class="getContext">
<persons-bloc
v-for="bloc in contextPersonsBlocs"
v-bind:key="bloc.key"
v-bind:bloc="bloc"
v-bind:setPersonsInBloc="setPersonsInBloc">
</persons-bloc>
</div>
<div class="flex-bloc concerned-groups" :class="getContext">
<persons-bloc
v-for="bloc in contextPersonsBlocs"
v-bind:key="bloc.key"
v-bind:bloc="bloc"
v-bind:blocWidth="getBlocWidth"
v-bind:setPersonsInBloc="setPersonsInBloc">
</persons-bloc>
</div>
<div v-if="getContext === 'accompanyingCourse' && suggestedEntities.length > 0">
<ul class="list-suggest add-items">
<li v-for="p in suggestedEntities" @click="addSuggestedEntity(p)">
<span>{{ p.text }}</span>
</li>
</ul>
</div>
<add-persons
buttonTitle="activity.add_persons"
modalTitle="activity.add_persons"
v-bind:key="addPersons.key"
v-bind:options="addPersons.options"
@addNewPersons="addNewPersons"
ref="addPersons">
</add-persons>
</teleport>
<add-persons
buttonTitle="activity.add_persons"
modalTitle="activity.add_persons"
v-bind:key="addPersons.key"
v-bind:options="addPersonsOptions"
@addNewPersons="addNewPersons"
ref="addPersons">
</add-persons>
</teleport>
</template>
<script>
import { mapState } from 'vuex';
import { mapState, mapGetters } from 'vuex';
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
import PersonsBloc from './ConcernedGroups/PersonsBloc.vue';
@@ -36,65 +44,95 @@ export default {
data() {
return {
personsBlocs: [
{ key: 'persons',
title: 'activity.bloc_persons',
persons: [],
included: false
{ key: 'persons',
title: 'activity.bloc_persons',
persons: [],
included: false
},
{ key: 'personsAssociated',
title: 'activity.bloc_persons_associated',
persons: [],
included: false
{ key: 'personsAssociated',
title: 'activity.bloc_persons_associated',
persons: [],
included: window.activity ? window.activity.activityType.personsVisible !== 0 : true
},
{ key: 'personsNotAssociated',
title: 'activity.bloc_persons_not_associated',
persons: [],
included: false
{ key: 'personsNotAssociated',
title: 'activity.bloc_persons_not_associated',
persons: [],
included: window.activity ? window.activity.activityType.personsVisible !== 0 : true
},
{ key: 'thirdparty',
title: 'activity.bloc_thirdparty',
persons: [],
included: true
{ key: 'thirdparty',
title: 'activity.bloc_thirdparty',
persons: [],
included: window.activity ? window.activity.activityType.thirdPartiesVisible !== 0 : true
},
{ key: 'users',
title: 'activity.bloc_users',
persons: [],
included: true
{ key: 'users',
title: 'activity.bloc_users',
persons: [],
included: window.activity ? window.activity.activityType.usersVisible !== 0 : true
},
],
addPersons: {
key: 'activity',
options: {
type: ['person', 'thirdparty', 'user'], // TODO add 'user'
priority: null,
uniq: false,
}
key: 'activity'
}
}
},
computed: {
isComponentVisible() {
return window.activity
? (window.activity.activityType.personsVisible !== 0 || window.activity.activityType.thirdPartiesVisible !== 0 || window.activity.activityType.usersVisible !== 0)
: true
},
...mapState({
persons: state => state.activity.persons,
thirdParties: state => state.activity.thirdParties,
users: state => state.activity.users,
accompanyingCourse: state => state.activity.accompanyingPeriod
}),
...mapGetters([
'suggestedEntities'
]),
getContext() {
return (this.accompanyingCourse) ? "accompanyingCourse" : "person";
},
contextPersonsBlocs() {
return this.personsBlocs.filter(bloc => bloc.included !== false);
}
},
addPersonsOptions() {
let optionsType = [];
if (window.activity) {
if (window.activity.activityType.personsVisible !== 0) {
optionsType.push('person')
}
if (window.activity.activityType.thirdPartiesVisible !== 0) {
optionsType.push('thirdparty')
}
if (window.activity.activityType.usersVisible !== 0) {
optionsType.push('user')
}
} else {
optionsType = ['person', 'thirdparty', 'user'];
}
return {
type: optionsType,
priority: null,
uniq: false,
button: {
size: 'btn-sm'
}
}
},
getBlocWidth() {
return Math.round(100/(this.contextPersonsBlocs.length)) + '%';
}
},
mounted() {
this.setPersonsInBloc();
},
methods: {
setPersonsInBloc() {
let groups;
let groups;
if (this.accompanyingCourse) {
groups = this.splitPersonsInGroups();
}
}
this.personsBlocs.forEach(bloc => {
if (this.accompanyingCourse) {
switch (bloc.key) {
@@ -109,7 +147,7 @@ export default {
}
} else {
switch (bloc.key) {
case 'persons':
case 'persons':
bloc.persons = this.persons;
bloc.included = true;
break;
@@ -128,7 +166,7 @@ export default {
splitPersonsInGroups() {
let personsAssociated = [];
let personsNotAssociated = this.persons;
let participations = this.getCourseParticipations();
let participations = this.getCourseParticipations();
this.persons.forEach(person => {
participations.forEach(participation => {
if (person.id === participation.id) {
@@ -138,9 +176,9 @@ export default {
}
});
});
return {
'personsAssociated': personsAssociated,
'personsNotAssociated': personsNotAssociated
return {
'personsAssociated': personsAssociated,
'personsNotAssociated': personsNotAssociated
};
},
getCourseParticipations() {
@@ -154,14 +192,18 @@ export default {
},
addNewPersons({ selected, modal }) {
console.log('@@@ CLICK button addNewPersons', selected);
selected.forEach(function(item) {
selected.forEach((item) => {
this.$store.dispatch('addPersonsInvolved', item);
}, this
);
this.$refs.addPersons.resetSearch(); // to cast child method
modal.showModal = false;
this.setPersonsInBloc();
}
},
addSuggestedEntity(person) {
this.$store.dispatch('addPersonsInvolved', { result: person, type: 'person' });
this.setPersonsInBloc();
},
}
}
</script>

View File

@@ -1,12 +1,8 @@
<template>
<li>
<span class="badge bg-primary" :title="person.text">
<span class="chill_denomination">
{{ textCutted }}
</span>
<a class="fa fa-fw fa-times"
@click.prevent="$emit('remove', person)">
</a>
<span :title="person.text">
<span class="chill_denomination">{{ textCutted }}</span>
<a @click.prevent="$emit('remove', person)"></a>
</span>
</li>
</template>

View File

@@ -1,11 +1,11 @@
<template>
<div class="item-bloc">
<div class="item-bloc" :style="{ 'flex-basis': blocWidth }">
<div class="item-row">
<div class="item-col">
<h4>{{ $t(bloc.title) }}</h4>
</div>
<div class="item-col">
<ul class="list-content">
<ul class="list-suggest remove-items">
<person-badge
v-for="person in bloc.persons"
v-bind:key="person.id"
@@ -25,7 +25,7 @@ export default {
components: {
PersonBadge
},
props: ['bloc', 'setPersonsInBloc'],
props: ['bloc', 'setPersonsInBloc', 'blocWidth'],
methods: {
removePerson(item) {
console.log('@@ CLICK remove person: item', item);

View File

@@ -0,0 +1,174 @@
<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"
group-values="locations"
group-label="locationGroup"
v-model="location"
>
</VueMultiselect>
<new-location v-bind:locations="locations"></new-location>
</div>
</div>
</teleport>
</template>
<script>
import { mapState, mapGetters } from "vuex";
import VueMultiselect from "vue-multiselect";
import NewLocation from "./Location/NewLocation.vue";
import { getLocations, getLocationTypeByDefaultFor } from "../api.js";
export default {
name: "Location",
components: {
NewLocation,
VueMultiselect,
},
data() {
return {
locations: [],
};
},
computed: {
...mapState(["activity"]),
...mapGetters(["suggestedEntities"]),
location: {
get() {
return this.activity.location;
},
set(value) {
this.$store.dispatch("updateLocation", value);
},
},
},
mounted() {
getLocations().then(
(results) => {
getLocationTypeByDefaultFor('person').then(
(personLocationType) => {
if (personLocationType) {
const personLocation = this.makeAccompanyingPeriodLocation(personLocationType);
const concernedPersonsLocation =
this.makeConcernedPersonsLocation(personLocationType);
getLocationTypeByDefaultFor('thirdparty').then(
thirdpartyLocationType => {
const concernedThirdPartiesLocation =
this.makeConcernedThirdPartiesLocation(thirdpartyLocationType);
this.locations = [
{
locationGroup: 'Localisation du parcours',
locations: [personLocation]
},
{
locationGroup: 'Parties concernées',
locations: [...concernedPersonsLocation, ...concernedThirdPartiesLocation]
},
{
locationGroup: 'Autres localisations',
locations: results
}
];
}
)
} else {
this.locations = [
{
locationGroup: 'Localisations',
locations: response.results
}
];
}
if (window.default_location_id) {
let location = this.locations.filter(
(l) => l.id === window.default_location_id
);
this.$store.dispatch("updateLocation", location);
}
}
)
})
},
methods: {
labelAccompanyingCourseLocation(value) {
return `${value.address.text} (${value.locationType.title.fr})`
},
customLabel(value) {
return value.locationType
? value.name
? value.name === '__AccompanyingCourseLocation__'
? this.labelAccompanyingCourseLocation(value)
: `${value.name} (${value.locationType.title.fr})`
: value.locationType.title.fr
: '';
},
makeConcernedPersonsLocation(locationType) {
let locations = [];
this.suggestedEntities.forEach(
(e) => {
if (e.type === 'person' && e.current_household_address !== null){
locations.push({
type: 'location',
id: -this.suggestedEntities.indexOf(e)*10,
onthefly: true,
name: e.text,
address: {
id: e.current_household_address.address_id,
},
locationType: locationType
});
}
}
)
return locations;
},
makeConcernedThirdPartiesLocation(locationType) {
let locations = [];
this.suggestedEntities.forEach(
(e) => {
if (e.type === 'thirdparty' && e.address !== null){
locations.push({
type: 'location',
id: -this.suggestedEntities.indexOf(e)*10,
onthefly: true,
name: e.text,
address: { id: e.address.address_id },
locationType: locationType
});
}
}
)
return locations;
},
makeAccompanyingPeriodLocation(locationType) {
const accPeriodLocation = this.activity.accompanyingPeriod.location;
return {
type: 'location',
id: -1,
onthefly: true,
name: '__AccompanyingCourseLocation__',
address: {
id: accPeriodLocation.address_id,
text: `${accPeriodLocation.text} - ${accPeriodLocation.postcode.code} ${accPeriodLocation.postcode.name}`
},
locationType: locationType
}
}
},
};
</script>

View File

@@ -0,0 +1,268 @@
<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(results => {
this.locationTypes = results.filter(t => t.availableForUsers === true);
})
},
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 => {
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,32 +45,38 @@
<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"
v-bind:key="action.id"
v-bind:action="action"
v-bind:selection="socialActionsSelected"
@updateSelected="updateActionsSelected">
</check-social-action>
<span v-else class="inline-choice chill-no-data-statement mt-3">
<span v-else-if="socialIssuesSelected.length === 0" class="inline-choice chill-no-data-statement mt-3">
{{ $t('activity.select_first_a_social_issue') }}
</span>
<template v-else-if="socialActionsList.length > 0">
<check-social-action
v-if="socialIssuesSelected.length || socialActionsSelected.length"
v-for="action in socialActionsList"
v-bind:key="action.id"
v-bind:action="action"
v-bind:selection="socialActionsSelected"
@updateSelected="updateActionsSelected">
</check-social-action>
</template>
<span v-else-if="actionAreLoaded && socialActionsList.length === 0" class="inline-choice chill-no-data-statement mt-3">
{{ $t('activity.social_action_list_empty') }}
</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';
@@ -87,7 +92,8 @@ export default {
data() {
return {
issueIsLoading: false,
actionIsLoading: false
actionIsLoading: false,
actionAreLoaded: false,
}
},
computed: {
@@ -111,9 +117,10 @@ export default {
/* Load others issues in multiselect
*/
this.issueIsLoading = true;
this.actionAreLoaded = false;
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 +128,36 @@ 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;
this.actionAreLoaded = true;
this.updateActionsList();
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,33 +180,34 @@ 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;
this.actionAreLoaded = true;
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');
this.actionAreLoaded = false;
this.socialActionsSelected.forEach(item => {
this.$store.commit('addActionInList', item);
}, this);
@@ -207,7 +217,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,18 +1,18 @@
<template>
<span class="inline-choice">
<div class="form-check">
<input class="form-check-input"
type="checkbox"
type="checkbox"
v-model="selected"
name="action"
v-bind:id="action.id"
v-bind:id="action.id"
v-bind:value="action"
/>
<label class="form-check-label" v-bind:for="action.id">
{{ action.text }}
<span class="badge bg-light text-dark">{{ action.text }}</span>
</label>
</div>
</span>
</template>
@@ -34,3 +34,15 @@ export default {
}
}
</script>
<style lang="scss" scoped>
@import 'ChillMainAssets/module/bootstrap/shared';
@import 'ChillPersonAssets/chill/scss/mixins';
@import 'ChillMainAssets/chill/scss/chill_variables';
span.badge {
@include badge_social($social-action-color);
font-size: 95%;
margin-bottom: 5px;
margin-right: 1em;
}
</style>

View File

@@ -1,18 +1,18 @@
<template>
<span class="inline-choice">
<div class="form-check">
<input class="form-check-input"
type="checkbox"
type="checkbox"
v-model="selected"
name="issue"
v-bind:id="issue.id"
v-bind:id="issue.id"
v-bind:value="issue"
/>
<label class="form-check-label" v-bind:for="issue.id">
{{ issue.text }}
<span class="badge bg-chill-l-gray text-dark">{{ issue.text }}</span>
</label>
</div>
</span>
</template>
@@ -34,3 +34,15 @@ export default {
}
}
</script>
<style lang="scss" scoped>
@import 'ChillMainAssets/module/bootstrap/shared';
@import 'ChillPersonAssets/chill/scss/mixins';
@import 'ChillMainAssets/chill/scss/chill_variables';
span.badge {
@include badge_social($social-issue-color);
font-size: 95%;
margin-bottom: 5px;
margin-right: 1em;
}
</style>

View File

@@ -1,14 +1,16 @@
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",
social_action_list_empty: "Aucune action sociale disponible",
//
add_persons: "Ajouter des personnes concernées",
bloc_persons: "Usagers",
@@ -16,12 +18,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,14 +1,25 @@
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 hasSocialIssues = document.querySelector('#social-issues-acc') !== null;
const hasLocation = document.querySelector('#location') !== null;
const hasPerson = document.querySelector('#add-persons') !== null;
const app = createApp({
template: `<app></app>`,
template: `<app :hasSocialIssues="hasSocialIssues", :hasLocation="hasLocation", :hasPerson="hasPerson"></app>`,
data() {
return {
hasSocialIssues,
hasLocation,
hasPerson,
};
}
})
.use(store)
.use(i18n)

View File

@@ -1,170 +1,338 @@
import 'es6-promise/auto';
import { createStore } from 'vuex';
import { postLocation } from './api';
const debug = process.env.NODE_ENV !== 'production';
//console.log('window.activity', window.activity);
const addIdToValue = (string, id) => {
let array = string ? string.split(',') : [];
array.push(id.toString());
let str = array.join();
return str;
let array = string ? string.split(',') : [];
array.push(id.toString());
let str = array.join();
return str;
};
const removeIdFromValue = (string, id) => {
let array = string.split(',');
array = array.filter(el => el !== id.toString());
let str = array.join();
return str;
let array = string.split(',');
array = array.filter(el => el !== id.toString());
let str = array.join();
return str;
};
const store = createStore({
strict: debug,
state: {
activity: window.activity,
socialIssuesOther: [],
socialActionsList: [],
},
mutations: {
// SocialIssueAcc
addIssueInList(state, issue) {
//console.log('add issue list', issue.id);
state.activity.accompanyingPeriod.socialIssues.push(issue);
},
addIssueSelected(state, issue) {
//console.log('add issue selected', issue.id);
state.activity.socialIssues.push(issue);
},
updateIssuesSelected(state, issues) {
//console.log('update issues selected', issues);
state.activity.socialIssues = issues;
},
updateIssuesOther(state, payload) {
//console.log('update issues other');
state.socialIssuesOther = payload;
},
removeIssueInOther(state, issue) {
//console.log('remove issue other', issue.id);
state.socialIssuesOther = state.socialIssuesOther.filter(i => i.id !== issue.id);
},
resetActionsList(state) {
//console.log('reset list actions');
state.socialActionsList = [];
},
addActionInList(state, action) {
//console.log('add action list', action.id);
state.socialActionsList.push(action);
},
updateActionsSelected(state, actions) {
//console.log('update actions selected', actions);
state.activity.socialActions = actions;
},
filterList(state, list) {
const filterList = (list) => {
// remove duplicates entries
list = list.filter((value, index) => list.findIndex(array => array.id === value.id) === index);
// alpha sort
list.sort((a,b) => (a.text > b.text) ? 1 : ((b.text > a.text) ? -1 : 0));
return list;
};
if (list === 'issues') {
state.activity.accompanyingPeriod.socialIssues = filterList(state.activity.accompanyingPeriod.socialIssues);
}
if (list === 'actions') {
state.socialActionsList = filterList(state.socialActionsList);
}
},
// ConcernedGroups
addPersonsInvolved(state, payload) {
//console.log('### mutation addPersonsInvolved', payload.result.type);
switch (payload.result.type) {
case 'person':
state.activity.persons.push(payload.result);
break;
case 'thirdparty':
state.activity.thirdParties.push(payload.result);
break;
case 'user':
state.activity.users.push(payload.result);
break;
};
},
removePersonInvolved(state, payload) {
//console.log('### mutation removePersonInvolved', payload.type);
switch (payload.type) {
case 'person':
state.activity.persons = state.activity.persons.filter(person => person !== payload);
break;
case 'thirdparty':
state.activity.thirdParties = state.activity.thirdParties.filter(thirdparty => thirdparty !== payload);
break;
case 'user':
state.activity.users = state.activity.users.filter(user => user !== payload);
break;
};
}
},
actions: {
addIssueSelected({ commit }, issue) {
let aSocialIssues = document.getElementById("chill_activitybundle_activity_socialIssues");
aSocialIssues.value = addIdToValue(aSocialIssues.value, issue.id);
commit('addIssueSelected', issue);
},
updateIssuesSelected({ commit }, payload) {
let aSocialIssues = document.getElementById("chill_activitybundle_activity_socialIssues");
aSocialIssues.value = '';
payload.forEach(item => {
aSocialIssues.value = addIdToValue(aSocialIssues.value, item.id);
});
commit('updateIssuesSelected', payload);
},
updateActionsSelected({ commit }, payload) {
let aSocialActions = document.getElementById("chill_activitybundle_activity_socialActions");
aSocialActions.value = '';
payload.forEach(item => {
aSocialActions.value = addIdToValue(aSocialActions.value, item.id);
});
commit('updateActionsSelected', payload);
},
addPersonsInvolved({ commit }, payload) {
//console.log('### action addPersonsInvolved', payload.result.type);
switch (payload.result.type) {
case 'person':
let aPersons = document.getElementById("chill_activitybundle_activity_persons");
aPersons.value = addIdToValue(aPersons.value, payload.result.id);
break;
case 'thirdparty':
let aThirdParties = document.getElementById("chill_activitybundle_activity_thirdParties");
aThirdParties.value = addIdToValue(aThirdParties.value, payload.result.id);
break;
case 'user':
let aUsers = document.getElementById("chill_activitybundle_activity_users");
aUsers.value = addIdToValue(aUsers.value, payload.result.id);
break;
};
commit('addPersonsInvolved', payload);
},
removePersonInvolved({ commit }, payload) {
//console.log('### action removePersonInvolved', payload);
switch (payload.type) {
case 'person':
let aPersons = document.getElementById("chill_activitybundle_activity_persons");
aPersons.value = removeIdFromValue(aPersons.value, payload.id);
break;
case 'thirdparty':
let aThirdParties = document.getElementById("chill_activitybundle_activity_thirdParties");
aThirdParties.value = removeIdFromValue(aThirdParties.value, payload.id);
break;
case 'user':
let aUsers = document.getElementById("chill_activitybundle_activity_users");
aUsers.value = removeIdFromValue(aUsers.value, payload.id);
break;
};
commit('removePersonInvolved', payload);
}
}
strict: debug,
state: {
activity: window.activity,
socialIssuesOther: [],
socialActionsList: [],
},
getters: {
suggestedEntities(state) {
if (typeof state.activity.accompanyingPeriod === "undefined") {
return [];
}
const allEntities = [
...store.getters.suggestedPersons,
...store.getters.suggestedRequestor,
...store.getters.suggestedUser,
...store.getters.suggestedResources,
];
const uniqueIds = [
...new Set(allEntities.map((i) => `${i.type}-${i.id}`)),
];
return Array.from(
uniqueIds,
(id) => allEntities.filter((r) => `${r.type}-${r.id}` === id)[0]
);
},
suggestedPersons(state) {
const existingPersonIds = state.activity.persons.map((p) => p.id);
return state.activity.activityType.personsVisible === 0
? []
: state.activity.accompanyingPeriod.participations
.filter((p) => p.endDate === null)
.map((p) => p.person)
.filter((p) => !existingPersonIds.includes(p.id));
},
suggestedRequestor(state) {
if (state.activity.accompanyingPeriod.requestor === null) {
return [];
}
const existingPersonIds = state.activity.persons.map((p) => p.id);
const existingThirdPartyIds = state.activity.thirdParties.map(
(p) => p.id
);
return [state.activity.accompanyingPeriod.requestor].filter(
(r) =>
(r.type === "person" &&
!existingPersonIds.includes(r.id) &&
state.activity.activityType.personsVisible !== 0) ||
(r.type === "thirdparty" &&
!existingThirdPartyIds.includes(r.id) &&
state.activity.activityType.thirdPartiesVisible !== 0)
);
},
suggestedUser(state) {
const existingUserIds = state.activity.users.map((p) => p.id);
return state.activity.activityType.usersVisible === 0
? []
: [state.activity.accompanyingPeriod.user].filter(
(u) => u !== null && !existingUserIds.includes(u.id)
);
},
suggestedResources(state) {
const resources = state.activity.accompanyingPeriod.resources;
const existingPersonIds = state.activity.persons.map((p) => p.id);
const existingThirdPartyIds = state.activity.thirdParties.map(
(p) => p.id
);
return state.activity.accompanyingPeriod.resources
.map((r) => r.resource)
.filter(
(r) =>
(r.type === "person" &&
!existingPersonIds.includes(r.id) &&
state.activity.activityType.personsVisible !== 0) ||
(r.type === "thirdparty" &&
!existingThirdPartyIds.includes(r.id) &&
state.activity.activityType.thirdPartiesVisible !== 0)
);
},
},
mutations: {
// SocialIssueAcc
addIssueInList(state, issue) {
//console.log('add issue list', issue.id);
state.activity.accompanyingPeriod.socialIssues.push(issue);
},
addIssueSelected(state, issue) {
//console.log('add issue selected', issue.id);
state.activity.socialIssues.push(issue);
},
updateIssuesSelected(state, issues) {
//console.log('update issues selected', issues);
state.activity.socialIssues = issues;
},
updateIssuesOther(state, payload) {
//console.log('update issues other');
state.socialIssuesOther = payload;
},
removeIssueInOther(state, issue) {
//console.log('remove issue other', issue.id);
state.socialIssuesOther = state.socialIssuesOther.filter(
(i) => i.id !== issue.id
);
},
resetActionsList(state) {
//console.log('reset list actions');
state.socialActionsList = [];
},
addActionInList(state, action) {
//console.log('add action list', action.id);
state.socialActionsList.push(action);
},
updateActionsSelected(state, actions) {
//console.log('update actions selected', actions);
state.activity.socialActions = actions;
},
filterList(state, list) {
const filterList = (list) => {
// remove duplicates entries
list = list.filter(
(value, index) =>
list.findIndex((array) => array.id === value.id) ===
index
);
// alpha sort
list.sort((a, b) =>
a.text > b.text ? 1 : b.text > a.text ? -1 : 0
);
return list;
};
if (list === "issues") {
state.activity.accompanyingPeriod.socialIssues = filterList(
state.activity.accompanyingPeriod.socialIssues
);
}
if (list === "actions") {
state.socialActionsList = filterList(state.socialActionsList);
}
},
// ConcernedGroups
addPersonsInvolved(state, payload) {
console.log("### mutation addPersonsInvolved", payload);
switch (payload.result.type) {
case "person":
state.activity.persons.push(payload.result);
break;
case "thirdparty":
state.activity.thirdParties.push(payload.result);
break;
case "user":
state.activity.users.push(payload.result);
break;
}
},
removePersonInvolved(state, payload) {
//console.log('### mutation removePersonInvolved', payload.type);
switch (payload.type) {
case "person":
state.activity.persons = state.activity.persons.filter(
(person) => person !== payload
);
break;
case "thirdparty":
state.activity.thirdParties =
state.activity.thirdParties.filter(
(thirdparty) => thirdparty !== payload
);
break;
case "user":
state.activity.users = state.activity.users.filter(
(user) => user !== payload
);
break;
}
},
updateLocation(state, value) {
console.log("### mutation: updateLocation", value);
state.activity.location = value;
},
},
actions: {
addIssueSelected({ commit }, issue) {
let aSocialIssues = document.getElementById(
"chill_activitybundle_activity_socialIssues"
);
aSocialIssues.value = addIdToValue(aSocialIssues.value, issue.id);
commit("addIssueSelected", issue);
},
updateIssuesSelected({ commit }, payload) {
let aSocialIssues = document.getElementById(
"chill_activitybundle_activity_socialIssues"
);
aSocialIssues.value = "";
payload.forEach((item) => {
aSocialIssues.value = addIdToValue(
aSocialIssues.value,
item.id
);
});
commit("updateIssuesSelected", payload);
},
updateActionsSelected({ commit }, payload) {
let aSocialActions = document.getElementById(
"chill_activitybundle_activity_socialActions"
);
aSocialActions.value = "";
payload.forEach((item) => {
aSocialActions.value = addIdToValue(
aSocialActions.value,
item.id
);
});
commit("updateActionsSelected", payload);
},
addPersonsInvolved({ commit }, payload) {
//console.log('### action addPersonsInvolved', payload.result.type);
switch (payload.result.type) {
case "person":
let aPersons = document.getElementById(
"chill_activitybundle_activity_persons"
);
aPersons.value = addIdToValue(
aPersons.value,
payload.result.id
);
break;
case "thirdparty":
let aThirdParties = document.getElementById(
"chill_activitybundle_activity_thirdParties"
);
aThirdParties.value = addIdToValue(
aThirdParties.value,
payload.result.id
);
break;
case "user":
let aUsers = document.getElementById(
"chill_activitybundle_activity_users"
);
aUsers.value = addIdToValue(
aUsers.value,
payload.result.id
);
break;
}
commit("addPersonsInvolved", payload);
},
removePersonInvolved({ commit }, payload) {
//console.log('### action removePersonInvolved', payload);
switch (payload.type) {
case "person":
let aPersons = document.getElementById(
"chill_activitybundle_activity_persons"
);
aPersons.value = removeIdFromValue(
aPersons.value,
payload.id
);
break;
case "thirdparty":
let aThirdParties = document.getElementById(
"chill_activitybundle_activity_thirdParties"
);
aThirdParties.value = removeIdFromValue(
aThirdParties.value,
payload.id
);
break;
case "user":
let aUsers = document.getElementById(
"chill_activitybundle_activity_users"
);
aUsers.value = removeIdFromValue(aUsers.value, payload.id);
break;
}
commit("removePersonInvolved", payload);
},
updateLocation({ commit }, value) {
console.log("### action: updateLocation", value);
let hiddenLocation = document.getElementById(
"chill_activitybundle_activity_location"
);
if (value.onthefly) {
const body = {
"type": "location",
"name": value.name === '__AccompanyingCourseLocation__' ? null : value.name,
"locationType": {
"id": value.locationType.id,
"type": "location-type"
}
};
if (value.address.id) {
Object.assign(body, {
"address": {
"id": value.address.id
},
})
}
postLocation(body)
.then(
location => hiddenLocation.value = location.id
).catch(
err => {
console.log(err.message);
}
);
} else {
hiddenLocation.value = value.id;
}
commit("updateLocation", value);
},
},
});
export default store;

View File

@@ -1,13 +1,38 @@
<?php
use Symfony\Component\HttpKernel\Kernel;
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;
class AppKernel extends Kernel
{
/**
* @return string
*/
public function getCacheDir()
{
return sys_get_temp_dir() . '/ActivityBundle/cache';
}
/**
* @return string
*/
public function getLogDir()
{
return sys_get_temp_dir() . '/ActivityBundle/logs';
}
public function registerBundles()
{
return array(
return [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Chill\CustomFieldsBundle\ChillCustomFieldsBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
@@ -20,28 +45,12 @@ class AppKernel extends Kernel
new \Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
#add here all the required bundle (some bundle are not required)
);
//add here all the required bundle (some bundle are not required)
];
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
}
/**
* @return string
*/
public function getCacheDir()
{
return sys_get_temp_dir().'/ActivityBundle/cache';
}
/**
* @return string
*/
public function getLogDir()
{
return sys_get_temp_dir().'/ActivityBundle/logs';
$loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
}
}

View File

@@ -1,11 +1,20 @@
<?php
use Doctrine\Common\Annotations\AnnotationRegistry;
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
use Composer\Autoload\ClassLoader;
use Doctrine\Common\Annotations\AnnotationRegistry;
/** @var ClassLoader $loader */
$loader = require __DIR__.'/../../../../../vendor/autoload.php';
$loader = require __DIR__ . '/../../../../../vendor/autoload.php';
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
AnnotationRegistry::registerLoader([$loader, 'loadClass']);
return $loader;

File diff suppressed because one or more lines are too long

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