Compare commits

..

306 Commits

Author SHA1 Message Date
5774c8fbb6 deps: force doctrine/orm on 2.13.5 2022-12-30 00:56:42 +01:00
b41cd1429c deps: restrict doctrine/orm below 2.14 2022-12-30 00:52:39 +01:00
a1b36107c0 Deps: prevent upgrading to new version of doctrine/orm 2022-12-30 00:51:26 +01:00
bbd2599e7e Fixed: [cron] store the last store of executed tasks correctly 2022-12-27 00:09:45 +01:00
5aa59aa0ff Deploy: upgrade chill bundles and adapt skeleton 2022-12-24 15:40:17 +01:00
351df930a1 DX: Fix CS 2022-12-23 13:36:32 +01:00
c8127a1d9d Fixed: ensure to execute Refresh Address To Geographical Unit Cronjob even during the day 2022-12-23 13:36:23 +01:00
f12f640cb4 Fixed: use correct comparison of body in makeFetch 2022-12-23 11:32:31 +01:00
4da9b6587d DX: remove console comment in file Person.vue 2022-12-23 11:30:40 +01:00
0fec753118 Merge branch 'cire16' into 'master'
Cire issue #16 : fix some stuffs for staging cire instance

See merge request Chill-Projet/chill-bundles!467
2022-12-22 18:51:33 +00:00
4d3d9db1b3 Fixed: Fix map center on opening or editing address 2022-12-22 19:29:56 +01:00
ce17f5f5c0 Fixed: [vue][add-address] fix map center when editing existing address (corrections post review)
52512e45fc (note_1205935758)
2022-12-22 11:31:44 +01:00
6a14c2b9b3 Fixed: [vue][add-address] fix map center when editing existing address
https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/674
2022-12-22 11:31:27 +01:00
ad94c7bcb7 DX: Fix CS and type hinting 2022-12-22 11:22:49 +01:00
3ca2811494 Feature: set parameters for add_address as global
The parameter `window.addaddress` is now global and can be reached to all page. This ensure backward compatibility.
2022-12-22 11:22:24 +01:00
1bc7221315 Feature: Set defaults values for add_address configuration
The default values were not set at the root of the array config. This create a default value to the array config
2022-12-22 11:21:05 +01:00
7a1cc9b076 Merge remote-tracking branch 'origin/master' into cire16 2022-12-22 10:22:58 +01:00
f7fa9c31f3 Merge branch '29-person-modal-on-the-fly-add-center' into 'master'
Resolve "La modale "on the fly" pour créer une personne ne fonctionne pas: il manque le centre"

Closes #29

See merge request Chill-Projet/chill-bundles!468
2022-12-21 16:34:52 +00:00
fa237bf27b Fix: missing translation of validation of center 2022-12-21 17:27:15 +01:00
64e65d08fe Fix: [center denormalizer] do not throw an error if deserializing a null center 2022-12-21 17:27:14 +01:00
1f58acd871 Feature: [person][creation] Add center field to OnTheFly/Person 2022-12-21 17:27:11 +01:00
b06a76784a Feature: [person][creation] api for listing availables centers for person creation 2022-12-21 17:25:23 +01:00
1585a73974 DX: [authorization helper] Create an authorization helper with current user already available
See https://gitlab.com/Chill-Projet/chill-bundles/-/issues/14
2022-12-21 17:25:22 +01:00
ba261ddeb9 Fixed: show list of workflow, event if some accompanying course document associated to a workflow are deleted 2022-12-14 13:52:37 +01:00
58ede06dfe Fixed: show list of workflow, event if some social action associated to a workflow are deleted 2022-12-14 13:46:31 +01:00
2dec6a017d Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles 2022-12-13 14:43:03 +01:00
fb42cb1baf Merge branch '25-bug-composition' 2022-12-13 14:42:10 +01:00
ae1df1f47a Fixed: [zone admin] fix edit link in composition index template 2022-12-13 14:41:54 +01:00
f2cbd7f4a3 Merge branch '30-add-cron-system' into 'master'
Handle cron within chill-bundle code

Closes #30

See merge request Chill-Projet/chill-bundles!472
2022-12-13 12:45:49 +00:00
d41dc7035c Doc: doc for CronJobManagerInterface 2022-12-12 23:29:03 +01:00
23d7d1c8f0 Doc: doc for installation and cronjob, and addresses 2022-12-12 22:49:50 +01:00
acfa3d6849 Fixed: [cronjob command] force command name 2022-12-12 22:49:30 +01:00
0bfb5c617e Doc: [cronjob manager] Doc for implementing cronjob 2022-12-12 22:48:57 +01:00
17461aa21e Fixed: [cronjob manager] Fix execution of one single job 2022-12-12 22:21:46 +01:00
7d469df62a Feature: CronJob for refreshing materialized view association between address and geographical unit 2022-12-12 21:17:03 +01:00
204ebd4415 Feature: bootstrap dependency injection for CronJobManager and create a command 2022-12-12 21:16:27 +01:00
b789250b8d Feature: bootstrap dependency injection for CronJobManager 2022-12-12 21:15:58 +01:00
1ebdcd1530 Feature: create table for CronJobExecution 2022-12-12 21:15:32 +01:00
e93458f943 Fixes: Fix doctrine annotation and repository for CronJobExecution 2022-12-12 21:15:05 +01:00
ceee5e7eea Feature: [cron] Create an interface for CronManagerInterface 2022-12-12 21:14:33 +01:00
e0c9e12008 Feature: [cron] Create a cron job to refresh materialized view address - geographical unit association 2022-12-12 14:35:46 +01:00
4fcfe3f5d2 Feature: [cron] Create a cron manager 2022-12-12 14:02:19 +01:00
333e524136 Merge branch 'calendar/finalization' into testing 2022-12-12 13:50:58 +01:00
3c85b5ca92 Fixed: a bug for range generatoion during week-end
The range generator failed during week-end, because no range is selected (lastStart and endDate is null).

with this commit, the rangeGenerator may return null instead of an array, which means no sms will be send.
2022-12-12 13:09:31 +01:00
aca81122d5 Merge branch 'calendar/finalization' into testing 2022-12-08 13:42:25 +01:00
efe494d61f handle package version from within chill bundles 2022-12-07 15:42:39 +01:00
c050c42a27 Fixed: [My Calendar Ranges] fix use of legacy mode in vue createI18n 2022-12-07 14:15:52 +01:00
6309877a14 Fixed: [relationship graph] fix layout of button to add a link (upgrade bootstrap) 2022-12-07 12:18:35 +01:00
8d19e8d7af Fixed: Fix padding inside top right menus 2022-12-07 12:00:31 +01:00
34c97769a6 Fixed: Fix modal layout with bootstrap upgrade 2022-12-07 12:00:14 +01:00
a10aae2100 Deploy: update webpack config for postcss loader and ckeditor 2022-12-06 22:27:27 +01:00
516e4e5f47 Fixed: fix the loading of bootstrap
See https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/690
2022-12-06 21:25:35 +01:00
531b49a536 Merge branch '111_exports_suite' into calendar/finalization 2022-12-06 21:21:01 +01:00
5328bee262 Fixed: [SocialAction] Fix the loading of evaluations associated to a SocialActions 2022-12-06 10:17:49 +01:00
060d5d5ca3 Merge remote-tracking branch 'origin/master' into 111_exports_suite 2022-12-05 20:52:33 +01:00
368136ea57 Feature: [activity][list] Fix list for activities and refactor list with an helper 2022-12-05 18:26:01 +01:00
d080dfda9a DX: Fix CS 2022-12-05 18:26:01 +01:00
88fb48e2be Fixed: let the aggregator "Activity by type" be shown again 2022-12-05 18:26:01 +01:00
feb760a97b Merge branch 'calendar/finalization' into testing 2022-11-29 16:08:05 +01:00
e97a04ab54 Feature: [Calendar doc] Pick document to generate inside the edit/new form 2022-11-29 15:27:36 +01:00
c16454214d Merge branch 'calendar/finalization' into testing 2022-11-28 21:38:35 +01:00
be5f87348b Feature: [CalendarDoc] pick template for generating calendar directly in list 2022-11-28 21:37:17 +01:00
e71bb5d77b Merge branch 'calendar/finalization' into testing 2022-11-28 14:54:26 +01:00
6cac298724 Feature: [Calendar doc] show an alert when document is linked to a previous datetime version of the calendar 2022-11-28 14:40:33 +01:00
39f410dc8f Feature: [Calendar doc] complete CRUD for associating documents within Calendar 2022-11-28 14:33:06 +01:00
fc15b85d11 DX: [accompanying period] refactor the getCenters method
Use more portable spl_object_hash for listing different centers
2022-11-28 12:24:10 +01:00
74673380aa Fixed: [calendar] refactor ACL on calendar 2022-11-28 12:22:58 +01:00
72ae6fb2cd merge calendar/finalization into testing: fix conflicts 2022-11-28 09:33:24 +01:00
a73dca5efe Feature: [calendar] show the number of calendars ignored by the date filter, in the list 2022-11-25 17:27:42 +01:00
8cbfe16c24 DX: Fix cs 2022-11-25 17:02:57 +01:00
9b32ce53c8 Fixed: [calendar] add a return path to calendar doc
See https://gitlab.com/Chill-Projet/chill-bundles/-/issues/23
2022-11-25 17:02:12 +01:00
788b1e9eeb Fixed: [calendar] Fix picking calendar document templating, when adding document in person context 2022-11-25 16:51:41 +01:00
57e1786b99 Fixed: [calendar] Always show filter of calendars in list 2022-11-25 16:50:56 +01:00
6eb23c6073 Feature: [calendar] add proper location on short message text for next rendez-vous 2022-11-25 16:28:00 +01:00
b6e3baa5dc DX: fix cs 2022-11-25 16:04:40 +01:00
02a7074218 Fixed: [calendar] Do not require scope when adding calendar roles 2022-11-25 15:57:50 +01:00
593caec851 Merge remote-tracking branch 'origin/111_exports_suite' into calendar/finalization 2022-11-25 15:29:17 +01:00
9913938c1b show x instead of 1 or 0 for boolean field in export 2022-11-25 14:19:22 +01:00
7c8ac8cfcb Merge branch '111_exports_suite' into testing 2022-11-25 14:17:16 +01:00
3ebf3ae148 fix activity list export for linked with person 2022-11-25 14:16:44 +01:00
24833be681 take into account null value in formatter 2022-11-25 14:15:56 +01:00
6777cf7225 household can be null in budget abstractElement 2022-11-24 13:01:55 +01:00
3b9e6d2742 fix z-index of dropdown menus 2022-11-24 11:12:01 +01:00
390da7c641 Merge branch 'testing' of gitlab.com:Chill-Projet/chill-bundles into testing 2022-11-21 11:11:57 +01:00
d3e784de15 DX: fix cs 2022-11-20 21:28:07 +01:00
d35dacf562 Fixed: [budget] Fix voter on household's budget 2022-11-20 21:27:19 +01:00
cd54fdd13f Feature: [activity] automatically add a person to an activity, if
created in the person context

See https://gitlab.com/Chill-Projet/chill-bundles/-/issues/28
2022-11-18 16:12:49 +01:00
448d93cd02 Fixed: [address] Add missing window.addaddress in person create page, and third party create and update page 2022-11-18 16:11:03 +01:00
8894491dac #16 fix error with vue_activity component in person context (when accompanyingPeriod is null) 2022-11-17 21:43:03 +01:00
999e9e8553 Feature: [workflow] do not subscribe user on notification for each step
automatically
2022-11-17 19:17:30 +01:00
3ca46efd2c #16 pass default variables to add-address component when it is called from another vue component 2022-11-17 19:02:07 +01:00
e90782500b #16 add default value for config variables 2022-11-16 23:10:11 +01:00
0f159281ba Merge branch '111_exports_suite' into testing 2022-11-16 22:53:38 +01:00
15c304b1d1 Feature: [rolling date] do not show the fixed date input, unless the fixed date value is picked 2022-11-16 22:52:30 +01:00
53980dd757 #16 replace hardcoded country and map_center in vue add-address by symfony config yaml variables 2022-11-16 22:30:05 +01:00
c1261f63e7 Merge branch 'testing' of gitlab.com:Chill-Projet/chill-bundles into testing 2022-11-16 18:41:42 +01:00
80f6b7d330 cs fix 2022-11-16 18:41:26 +01:00
56a7833858 #16 Fix html5 widget for ChillDateTimeType 2022-11-16 17:44:48 +01:00
318d6b6d4e Fixed: remaining options not linked with PickRollingDateType 2022-11-16 14:58:08 +01:00
d0e1f31ec7 Fixed: [saved exports] Fix a test in list when no export ungrouped 2022-11-16 14:58:08 +01:00
15871db7fd Fixed: [saved exports] Transform null strings into blank strings, and add validation 2022-11-16 14:58:08 +01:00
00bf7bf299 DX: fix construct of ReferrerScopeAggregator in test 2022-11-16 14:58:07 +01:00
dafd715efd Merge branch '111_exports_suite' into testing 2022-11-16 14:32:54 +01:00
928869666c #16 fix errors and some design regressions in eventBundle 2022-11-16 13:09:59 +01:00
9623a35e6f #16 EventBundle participation (fix errors and improve ux) 2022-11-16 10:57:06 +01:00
d58aad4624 improve savedExport translation 2022-11-15 22:08:15 +01:00
a39f547907 fix flex-bloc look in exports list and saved exports 2022-11-15 22:01:35 +01:00
0e661784b0 DX: fix construct of ReferrerScopeAggregator in test 2022-11-15 18:17:58 +01:00
fc607d6a0e DX: improve import command + help for address-ref-from-best-addresses 2022-11-15 16:16:52 +01:00
2f765a3aa5 Merge branch 'testing' of gitlab.com:Chill-Projet/chill-bundles into testing 2022-11-15 13:44:14 +01:00
9ad3bbc1b4 Fixed: fix typo in workflows 2022-11-15 11:58:26 +00:00
f144663877 Fixed: Fix typo in message for activity 2022-11-15 11:46:32 +00:00
434ef075da Feature: Add geographical unit name and ref ids in list, associated to address 2022-11-14 17:06:39 +01:00
2db778c4a4 fix chill-bundles#25 RollingDate bad expression 2022-11-14 16:18:04 +01:00
2178485e5e Merge branch '111_exports_suite' of gitlab.com:Chill-Projet/chill-bundles into 111_exports_suite 2022-11-14 16:12:30 +01:00
e767557216 csfixer 2022-11-14 16:03:04 +01:00
68bfb082fc chill-bundles#25: replace ChillDateType by PickRollingDateType
batch/serial replacing
untested
2022-11-14 15:43:02 +01:00
1f3dd00d81 improve flex positionning for list exports cards 2022-11-14 15:43:02 +01:00
f633fabf79 Merge branch '111_exports_suite' into testing 2022-11-14 14:23:49 +01:00
cf6430ae9b Feature: Adapt geographical unit filters and aggregator to use the materialized view, instead of geographical computation (improve performance) 2022-11-14 14:22:48 +01:00
d3ba11f521 Feature: Store location of each address contained in geographical units in a materialized view 2022-11-14 14:21:03 +01:00
f3401faea1 Merge branch '111_exports_suite' into testing 2022-11-14 11:29:26 +01:00
ec9555ec84 Merge branch 'exports/apply-person-modifier-on-course' into '111_exports_suite'
Apply persons filters and aggregators on accompanying course

See merge request Chill-Projet/chill-bundles!466
2022-11-14 10:22:48 +00:00
a68422e0e8 Features: [export] Apply person filters and aggreators on Count Household 2022-11-14 11:21:16 +01:00
400770123a Features: [export] Apply person filters and aggreators on Count Evaluation 2022-11-14 10:46:13 +01:00
91e3588e76 Features: [export] Show also SocialIssue in the By Social Action aggregator 2022-11-10 21:17:48 +01:00
61f44396c5 Features: [export] Apply person filters and aggreators on Count Social Works export 2022-11-10 15:51:46 +01:00
8e44f20535 Features: [export] Remove old unnecessary filters for person with accompanying period
Those filters applyed on persons and allowed to select person which has a new, closing, or active accompanying period. But this is deprecated: there are now a dedicated Export for that ( CountPersonWithAccompanyingCourse)
2022-11-10 15:21:56 +01:00
a7c44830d2 Features: [export] Filter "persons who do not have a household composition" 2022-11-10 15:11:45 +01:00
a942a24596 Fixes: [export] fixes filters by household composition, and apply them on persons directly 2022-11-09 20:46:15 +01:00
826a975fbe Features: apply all the filters and aggregators concerning person on accompanying courses 2022-11-09 16:20:24 +01:00
c1df8084a6 DX: Add DQL function LEAST and GREATEST 2022-11-09 15:48:20 +01:00
c22135f101 Feature: [export] apply all filters valid for person on accompanying course 2022-11-09 14:50:22 +01:00
a2e1228c09 Merge branch 'testing' of gitlab.com:Chill-Projet/chill-bundles into testing 2022-11-09 11:39:28 +01:00
11f0cac86e Merge branch '111_exports_suite' into testing 2022-11-09 10:47:07 +01:00
9dba5965f6 Merge branch '21-save-exports' into '111_exports_suite'
Allow to save exports

See merge request Chill-Projet/chill-bundles!465
2022-11-09 09:44:07 +00:00
be38251a13 Feature: [saved export] Switch between list of export and saved export thanks to nav at the list's top 2022-11-08 19:59:43 +01:00
43791badd5 Feature: [saved export] Edit and delete saved exports 2022-11-08 19:24:22 +01:00
79e9906a05 Feature: [saved export] Générate a report from a saved export 2022-11-08 18:02:26 +01:00
aec4c52567 Feature: [saved export] First list of saved exports 2022-11-08 16:57:49 +01:00
ccb2cd0295 Feature: [saved export] Create a "saved export" 2022-11-08 10:20:38 +01:00
8aeeab9e6b Feature: Apply rolling "open between dates filters" (accompanying period) 2022-11-07 21:18:56 +01:00
48da6d0a92 Feature: Apply rolling date on StepAggregator 2022-11-07 21:11:20 +01:00
50db96ffbc Fix validation of fixed date 2022-11-07 18:20:34 +01:00
86be95ac43 Feature: [export] Add a rolling date on Acp "by step" filter 2022-11-07 18:20:22 +01:00
8159f91e25 DX: create interface for RollingDateConverterInterface 2022-11-07 18:19:35 +01:00
0756bec580 DX: fix cs 2022-11-07 18:07:26 +01:00
4e3c93cdd3 DX: Add validation to PickRolingDateType
It is not possible to pick a fixed date when not setting a fixed date
2022-11-07 17:56:30 +01:00
c7f740d5d7 DX: Add rolling date converter + unit test 2022-11-07 17:42:00 +01:00
5489178e4b DX: Create a RollingDate data transfer object and Form type 2022-11-07 14:06:47 +01:00
3b96ac3ef3 DX: fixed double declaration of AsideActivity 2022-11-07 11:43:21 +01:00
df4f5e7cf8 Fixed: [export] improve memory footprint for filter by Geographical Unit 2022-11-07 11:31:23 +01:00
82d9ab8ca6 DX: [export] review on CreatorFilter, CreatorJobAggregator, CreatorJobFilter 2022-11-07 11:31:23 +01:00
c05637bc72 evaluations aggregators 2022-11-07 11:31:23 +01:00
d450f06286 filters and aggregator aside activity 2022-11-07 11:31:23 +01:00
3b68997c69 Feature: [export][evaluation] Group evaluation by start date 2022-11-07 11:31:23 +01:00
17e8e1964d Feature: [export][evaluation] Adding group by evaluation having end date 2022-11-07 11:31:23 +01:00
bf5ecd25de Feature: [export][evaluation] filter by current evaluation (without any end date) 2022-11-07 11:31:23 +01:00
9fa3a72cb4 Feature: [export][evaluation] add by end date filter 2022-11-07 11:31:23 +01:00
f10a448ae9 DX: prevent collision in parameter name in evaluation / by start date filter 2022-11-07 11:31:23 +01:00
9bfc184f70 Feature: [export][work] Group by current action 2022-11-07 11:31:23 +01:00
2e60b6735a DX: more cs 2022-11-07 11:31:23 +01:00
2ee362bfd5 Feature: [export][action] Filter 'active' action: which does not have an end date 2022-11-07 11:31:23 +01:00
b42e1a9a05 Feature: [export][activity] Add an aggregator to group by sent / received 2022-11-07 11:31:21 +01:00
055acbf43c DX: more code style fixes 2022-11-07 11:30:51 +01:00
5655f953d7 Feature: [export] group accompanying period by number of actions 2022-11-07 11:30:51 +01:00
e6553e71ee Feature: [export] filter accompanying period which has no action - work 2022-11-07 11:30:51 +01:00
7f9e8c5a7b Feature: [export] add aggregator by "number of activity" for acp 2022-11-07 11:30:51 +01:00
f3a3cab801 DX: review for hasNoActivityFilter 2022-11-07 11:30:51 +01:00
d6b358cfa1 Fixed: fix date's type in DateType input, and prevent collision on
parameter name
2022-11-07 11:30:51 +01:00
abd79df8cd count aside activity 2022-11-07 11:30:51 +01:00
dc38e5927c voter aside activity created 2022-11-07 11:30:51 +01:00
18406e83a1 creator job aggregator 2022-11-07 11:30:51 +01:00
6687742e23 DX: simplify creatorJobFilter 2022-11-07 11:30:51 +01:00
2767075be7 Feature: [export] Finalize HasTemporaryLocation filter on accompanying
course
2022-11-07 11:30:51 +01:00
371a7dc05c Fixed: handle null value in SentReceivedAggregator 2022-11-07 11:30:51 +01:00
63129a3b8c setup aside activity export 2022-11-07 11:30:14 +01:00
8ea29e8ec4 add translations creator filters 2022-11-07 11:30:14 +01:00
2bdc06397e creator job filter 2022-11-07 11:30:14 +01:00
edd9aaa475 comment out builder method 2022-11-07 11:30:14 +01:00
5695564723 fix code style 2022-11-07 11:30:13 +01:00
fc9689e881 DX: repairs code style, and psalm types 2022-11-07 11:29:09 +01:00
75f69859e6 fix psalm errors 2022-11-07 11:29:09 +01:00
b5a9dac62e Feature: [export] Add a list of accompanying periods 2022-11-07 11:29:09 +01:00
bf58c5d59c Feature: [export] add a list of people having an accompanying period 2022-11-07 11:29:09 +01:00
8a395bf108 DX: ensure that the return type is correct in ListPersonHelper 2022-11-07 11:29:09 +01:00
1ed367e079 Fixed: [export][acl][Social issue filter] fix type for retrieving data from form 2022-11-07 11:29:09 +01:00
e3801d54b4 DX: Refactor ListPerson to extract methods linked to label and select 2022-11-07 11:29:09 +01:00
4c9cdb7b8c Fixed: [list person] fix list person and add new fields 2022-11-07 11:29:09 +01:00
2096e175d4 Fixed: [export][list person] use address from household for person list 2022-11-07 11:29:09 +01:00
781253a854 Fixed: correctly show datetime in spreadsheet list 2022-11-07 11:29:09 +01:00
c396635163 acp creator filter 2022-11-07 11:29:09 +01:00
eeb84d5cfb php csfixes 2022-11-07 11:29:09 +01:00
fc2f8d33e1 correct namespace and use statements 2022-11-07 11:29:09 +01:00
a69965345f correct config file 2022-11-07 11:29:09 +01:00
226f172970 SentReceivedAggregator (in activity) 2022-11-07 11:29:09 +01:00
6d0622aa38 HasNoActivityFilter (in activity) 2022-11-07 11:29:09 +01:00
0e553594a0 CurrentEvaluationsFilter 2022-11-07 11:29:09 +01:00
f714c7206c ByEndDateFilter evaluation 2022-11-07 11:29:09 +01:00
42012dbad2 ByStartDateFilter evaluation 2022-11-07 11:29:09 +01:00
bc41910a39 HasNoReferrer filter 2022-11-07 11:29:09 +01:00
a18870c91e Evaluation HavingEndDate Aggregator 2022-11-07 11:29:09 +01:00
68ebf8303c remove ByMaxDateFilter (evaluation) 2022-11-07 11:29:09 +01:00
9e89302aa4 SocialWork: Current actions filter + aggregator 2022-11-07 11:29:09 +01:00
2e52729806 acp HasNoAction Filter (UNTESTED) 2022-11-07 11:29:09 +01:00
afb5ebc077 define queryKey in 11 aggregators 2022-11-07 11:29:09 +01:00
f751d2e9ab create 13 new export/filters/aggregators in Person and AsideActivity Bundles
* minor corrections on last commit
* modify related files (declaration, messages.fr, repository)
* yaml service declaration
2022-11-07 11:29:09 +01:00
13d6e4587a Create 16 new filters/aggregators in Bundles: Vendée, Person, Activity
Basic file creation, with methods, namespace, and title translation
2022-11-07 11:29:09 +01:00
6fd75a175f Fixed: [export] improve memory footprint for filter by Geographical Unit 2022-11-03 13:59:16 +01:00
03e765f811 DX: [export] review on CreatorFilter, CreatorJobAggregator, CreatorJobFilter 2022-11-03 12:39:19 +01:00
d3f03fb27c evaluations aggregators 2022-11-02 20:06:03 +01:00
481be32997 filters and aggregator aside activity 2022-11-02 20:02:46 +01:00
4524240ad8 Merge branch '111_exports_suite' of gitlab.com:Chill-Projet/chill-bundles into 111_exports_suite 2022-11-02 18:39:11 +01:00
0255f12fa9 Feature: [export][evaluation] Group evaluation by start date 2022-11-02 16:42:23 +01:00
4ca10ce38d Feature: [export][evaluation] Adding group by evaluation having end date 2022-11-02 16:26:56 +01:00
f0b2ec1348 Feature: [export][evaluation] filter by current evaluation (without any end date) 2022-11-02 16:17:10 +01:00
2d40c38c88 Feature: [export][evaluation] add by end date filter 2022-11-02 15:56:48 +01:00
d8104c4443 DX: prevent collision in parameter name in evaluation / by start date filter 2022-11-02 15:08:04 +01:00
63d38e35f7 Feature: [export][work] Group by current action 2022-11-02 14:55:12 +01:00
9c3533d106 count aside activity 2022-11-02 14:42:44 +01:00
e07d2ab467 voter aside activity created 2022-11-02 14:41:59 +01:00
cda25d3459 DX: more cs 2022-11-02 14:40:17 +01:00
1bf7f9945c Feature: [export][action] Filter 'active' action: which does not have an end date 2022-11-02 14:39:36 +01:00
9cf06c147f Feature: [export][activity] Add an aggregator to group by sent / received 2022-11-02 14:25:52 +01:00
60f93f7f12 DX: more code style fixes 2022-11-02 14:06:10 +01:00
c872ca7204 Feature: [export] group accompanying period by number of actions 2022-11-02 14:05:16 +01:00
51ac4e0938 Feature: [export] filter accompanying period which has no action - work 2022-11-02 13:44:04 +01:00
24873f0cc2 Feature: [export] add aggregator by "number of activity" for acp 2022-11-02 13:33:33 +01:00
84e5be6a60 DX: review for hasNoActivityFilter 2022-11-02 13:21:26 +01:00
5acf2a1986 creator job aggregator 2022-11-02 13:17:03 +01:00
094a912e42 Fixed: fix date's type in DateType input, and prevent collision on
parameter name
2022-11-02 13:15:40 +01:00
f40aa89d08 Merge branch '111_exports_suite' of gitlab.com:Chill-Projet/chill-bundles into 111_exports_suite 2022-11-02 13:14:50 +01:00
50e2f4a147 setup aside activity export 2022-11-02 13:14:38 +01:00
be215bd135 DX: simplify creatorJobFilter 2022-11-02 13:05:12 +01:00
be75cdce55 Feature: [export] Finalize HasTemporaryLocation filter on accompanying
course
2022-11-02 12:56:13 +01:00
e46b285d3e Fixed: handle null value in SentReceivedAggregator 2022-11-02 12:56:13 +01:00
17a7b053cf DX: remove unused variable 2022-11-02 12:56:13 +01:00
32cdf56fbd add translations creator filters 2022-11-02 12:00:29 +01:00
749facb9b0 creator job filter 2022-11-02 11:55:36 +01:00
edd1557f35 comment out builder method 2022-11-02 11:32:55 +01:00
3059935305 merge conflict fixed 2022-11-02 11:20:11 +01:00
355436aa82 acp creator filter 2022-11-02 11:15:54 +01:00
8d4ec5d675 fix code style 2022-11-02 11:12:55 +01:00
c20b561de5 Merge branch 'exports/listes_2022' into '111_exports_suite'
Repairs and add new lists in exports

See merge request Chill-Projet/chill-bundles!464
2022-11-02 09:54:13 +00:00
acc9523ff5 DX: repairs code style, and psalm types 2022-11-02 10:52:49 +01:00
afa6dfd77c fix psalm errors 2022-11-02 10:52:49 +01:00
c331f94201 fix cs 2022-11-02 10:52:49 +01:00
6ffe99a2be Feature: [export] Add a list of accompanying periods 2022-11-02 10:52:49 +01:00
d75ec92417 Feature: [export] add a list of people having an accompanying period 2022-11-02 10:52:49 +01:00
4e55f1ede7 DX: ensure that the return type is correct in ListPersonHelper 2022-11-02 10:52:49 +01:00
cf7d0c1bdb Fixed: [export][acl][Social issue filter] fix type for retrieving data from form 2022-11-02 10:52:49 +01:00
f4c3997e55 DX: Refactor ListPerson to extract methods linked to label and select 2022-11-02 10:52:49 +01:00
f434cc5c02 Fixed: [list person] fix list person and add new fields 2022-11-02 10:52:49 +01:00
333c305eef Fixed: [export][list person] use address from household for person list 2022-11-02 10:52:49 +01:00
4af261a366 Fixed: correctly show datetime in spreadsheet list 2022-11-02 10:52:49 +01:00
1228a0323c php csfixes 2022-11-02 10:28:52 +01:00
dc149c7fd5 correct namespace and use statements 2022-11-02 10:26:44 +01:00
7dc34cb357 correct config file 2022-11-02 10:15:08 +01:00
ed04c276c2 SentReceivedAggregator (in activity) 2022-10-31 16:18:10 +01:00
f8b5078997 HasNoActivityFilter (in activity) 2022-10-31 16:10:24 +01:00
68b9c171a6 CurrentEvaluationsFilter 2022-10-31 15:54:41 +01:00
791ea25e4f ByEndDateFilter evaluation 2022-10-31 15:51:35 +01:00
e3846829e1 ByStartDateFilter evaluation 2022-10-31 15:46:29 +01:00
d48474bbc9 HasNoReferrer filter 2022-10-31 15:32:34 +01:00
05f9a83bed Evaluation HavingEndDate Aggregator 2022-10-31 15:15:35 +01:00
441c5c8da7 remove ByMaxDateFilter (evaluation) 2022-10-31 14:58:25 +01:00
a0fc9d4de5 SocialWork: Current actions filter + aggregator 2022-10-31 11:43:41 +01:00
8527c19073 acp HasNoAction Filter (UNTESTED) 2022-10-31 11:19:21 +01:00
fe120086c7 define queryKey in 11 aggregators 2022-10-28 16:59:11 +02:00
f1fb77187f create 13 new export/filters/aggregators in Person and AsideActivity Bundles
* minor corrections on last commit
* modify related files (declaration, messages.fr, repository)
* yaml service declaration
2022-10-28 16:48:09 +02:00
43d9ba1ba5 Create 16 new filters/aggregators in Bundles: Vendée, Person, Activity
Basic file creation, with methods, namespace, and title translation
2022-10-28 13:07:24 +02:00
77a6e92f69 fix if condition in CalendarController + phpStan error 2022-10-26 11:08:37 +02:00
e1b6fb2db1 Merge branch 'master' into testing 2022-10-25 10:17:25 +02:00
2a4a4a80b1 change name of échange to activité 2022-10-25 10:11:42 +02:00
2e44689549 Merge branch 'calendar/finalization' into testing 2022-10-24 11:12:49 +02:00
eb404404f9 Merge remote-tracking branch 'origin/111_exports_suite' into testing 2022-10-17 09:16:39 +02:00
a26029999f Merge branch '111_exports_suite' into testing 2022-10-12 11:30:52 +02:00
dbf3780593 Merge branch '111_exports_suite' into testing 2022-10-05 15:47:25 +02:00
b20a75c2ee Merge branch '111_exports_suite' into testing 2022-10-05 15:28:51 +02:00
71db287ded Merge branch '111_exports_suite' into testing 2022-10-05 14:57:55 +02:00
5f0a6f37b0 Merge branch '111_exports_suite' into testing 2022-10-05 10:43:35 +02:00
fa1b5c4a02 Merge branch 'workflow-show-link' into testing 2022-10-05 10:23:08 +02:00
4388331b2f Merge branch '111_exports_suite' into testing 2022-10-05 10:21:42 +02:00
9d1c38e978 Merge remote-tracking branch 'origin/testing' into testing 2022-10-03 09:31:44 +02:00
a95f0c538d Merge remote-tracking branch 'origin/master' into testing 2022-10-03 09:31:15 +02:00
ffd1145cd0 [apimethods] Fixed: prevent makeFetch to add a null body on GET and HEAD
requests
2022-09-30 17:35:43 +02:00
d1b9400257 [person][relations] Fixed: GET request had a body, this prevented to
load files
2022-09-30 17:31:30 +02:00
fdd537b18e Merge branch 'master' into testing 2022-09-29 10:53:48 +02:00
1786fa838f Merge branch '111_exports_suite' into testing 2022-09-28 09:49:33 +02:00
7fe8d0837f [export][person] fix alias name for person in CountPersonWithAccompanyingCourse export 2022-09-23 21:55:00 +02:00
753d6ea481 [export][person] Fixed: filter per person's age: use calculatio non year interval 2022-09-23 21:51:26 +02:00
8cf25415ab Merge branch '111_exports_suite' into testing 2022-09-22 18:16:15 +02:00
743e0b9403 Merge branch '111_exports_suite' into testing 2022-09-22 16:58:47 +02:00
97d6f35605 Merge branch '111_exports_suite' into testing 2022-09-21 17:31:13 +02:00
5af492b2db Merge remote-tracking branch 'origin/111_exports_suite' into testing 2022-09-20 12:18:00 +02:00
70c631b612 Merge remote-tracking branch 'origin/master' into testing 2022-09-20 12:15:29 +02:00
e550d64fd4 change class reference 2022-09-08 10:17:22 +02:00
4aaf75a1a4 merge 111_exports_suite into testing branch 2022-09-08 10:03:21 +02:00
9db43f1de3 remove trailing dumps 2022-09-07 10:37:22 +02:00
674629e2bf comment out exports that are not yet ready 2022-09-07 10:37:01 +02:00
e42d6c2d77 Merge branch 'master' into testing 2022-09-06 15:33:27 +02:00
3782cf35ff Merge branch 'master' into testing 2022-07-11 20:03:37 +02:00
68c1833584 fixed: CS 2022-07-11 12:56:48 +02:00
191b8ecf81 fixed: query for index in PersonDocumentACLAwareRepository 2022-07-11 12:56:34 +02:00
e7ba42de1f fixed: voter and permissions in accompanying course document 2022-07-11 12:55:02 +02:00
8b145ebc11 fixed: migration of databse with address on same day fails 2022-07-11 03:32:15 +02:00
310 changed files with 11210 additions and 2062 deletions

2
.gitignore vendored
View File

@@ -24,3 +24,5 @@ docs/build/
/.php-cs-fixer.cache
/.idea/
/.psalm/
node_modules/*

View File

@@ -14,7 +14,7 @@
"champs-libres/wopi-lib": "dev-master#8615f4a45a39fc2b6a98765ea835fcfd39618787",
"doctrine/doctrine-bundle": "^2.1",
"doctrine/doctrine-migrations-bundle": "^3.0",
"doctrine/orm": "^2.7",
"doctrine/orm": "2.13.5",
"erusev/parsedown": "^1.7",
"graylog2/gelf-php": "^1.5",
"knplabs/knp-menu-bundle": "^3.0",

View File

@@ -0,0 +1,93 @@
.. Copyright (C) 2014-2023 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
.. _cronjob:
Cron jobs
*********
Some tasks must be executed regularly: refresh some materialized views, remove old data, ...
For this purpose, one can programmatically implements a "cron job", which will be scheduled by a specific command.
The command :code:`chill:cron-job:execute`
==========================================
The command :code:`chill:cron-job:execute` will schedule a task, one by one. In a classical implementation, it should
be executed every 15 minutes (more or less), to ensure that every task can be executed.
.. warning::
This command should not be executed in parallel. The installer should ensure that two job are executed concurrently.
How to implements a cron job ?
==============================
Implements a :code:`Chill\MainBundle\Cron\CronJobInterface`. Here is an example:
.. code-block:: php
namespace Chill\MainBundle\Service\Something;
use Chill\MainBundle\Cron\CronJobInterface;
use Chill\MainBundle\Entity\CronJobExecution;
use DateInterval;
use DateTimeImmutable;
class MyCronJob implements CronJobInterface
{
public function canRun(?CronJobExecution $cronJobExecution): bool
{
// the parameter $cronJobExecution contains data about the last execution of the cronjob
// if it is null, it should be executed immediatly
if (null === $cronJobExecution) {
return true;
}
if ($cronJobExecution->getKey() !== $this->getKey()) {
throw new UnexpectedValueException();
}
// this cron job should be executed if the last execution is greater than one day, but only during the night
$now = new DateTimeImmutable('now');
return $cronJobExecution->getLastStart() < $now->sub(new DateInterval('P1D'))
&& in_array($now->format('H'), self::ACCEPTED_HOURS, true)
// introduce a random component to ensure a roll of task execution when multiple instances are hosted on same machines
&& mt_rand(0, 5) === 0;
}
public function getKey(): string
{
return 'arbitrary-and-unique-key';
}
public function run(): void
{
// here, we execute the command
}
}
How are cron job scheduled ?
============================
If the command :code:`chill:cron-job:execute` is run with one or more :code:`job` argument, those jobs are run, **without checking that the job can run** (the method :code:`canRun` is not executed).
If any :code:`job` argument is given, the :code:`CronManager` schedule job with those steps:
* the tasks are ordered, with:
* a priority is given for tasks that weren't never executed;
* then, the tasks are ordered, the last executed are the first in the list
* then, for each tasks, and in the given order, the first task where :code:`canRun` return :code:`TRUE` will be executed.
The command :code:`chill:cron-job:execute` execute **only one** task.

View File

@@ -34,6 +34,7 @@ As Chill rely on the `symfony <http://symfony.com>`_ framework, reading the fram
Useful snippets <useful-snippets.rst>
manual/index.rst
Assets <assets.rst>
Cron Jobs <cronjob.rst>
Layout and UI
**************

View File

@@ -18,6 +18,7 @@ Installation & Usage
:maxdepth: 2
prod.rst
load-addresses.rst
prod-calendar-sms-sending.rst
msgraph-configure.rst
@@ -170,7 +171,7 @@ There are several users available:
The password is always ``password``.
Now, read `Operations` below.
Now, read `Operations` below. For running in production, read `prod_`.
Operations

View File

@@ -0,0 +1,50 @@
.. _addresses:
Addresses
*********
Chill can store a list of geolocated address references, which are used to suggest address and ensure that the data is correctly stored.
Those addresses may be load from a dedicated source.
In France
=========
The address are loaded from the `BANO <https://bano.openstreetmap.fr/>`_. The postal codes are loaded from `the official list of
postal codes <https://datanova.laposte.fr/explore/dataset/laposte_hexasmal/information/>`_
.. code-block:: bash
# first, load postal codes
bin/console chill:main:postal-code:load:FR
# then, load all addresses, by departement (multiple departement can be loaded by repeating the departement code
bin/console chill:main:address-ref-from-bano 57 54 51
In Belgium
==========
Addresses are prepared from the `BeST Address data <https://www.geo.be/catalog/details/ca0fd5c0-8146-11e9-9012-482ae30f98d9>`_.
Postal code are loaded from this database. There is no need to load postal codes from another source (actually, this is strongly discouraged).
The data are prepared for Chill (`See this repository <https://gitea.champs-libres.be/Chill-project/belgian-bestaddresses-transform/releases>`_).
One can select postal code by his first number (:code:`1xxx` for postal codes from 1000 to 1999), or a limited list for development purpose.
.. code-block:: bash
# load postal code from 1000 to 3999:
bin/console chill:main:address-ref-from-best-addresse 1xxx 2xxx 3xxx
# load only an extract (for dev purposes)
bin/console chill:main:address-ref-from-best-addresse extract
# load full addresses (discouraged)
bin/console chill:main:address-ref-from-best-addresse full
.. note::
There is a possibility to load the full list of addresses is discouraged: the loading is optimized with smaller extracts.
Once you load the full list, it is not possible to load smaller extract: each extract loaded **after** will not
delete the addresses loaded with the full extract (and some addresses will be present twice).

View File

@@ -1,10 +1,12 @@
.. Copyright (C) 2014-2019 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
.. _prod:
Installation for production
###########################
@@ -36,6 +38,19 @@ This should be adapted to your needs:
* Think about how you will backup your database. Some adminsys find easier to store database outside of docker, which might be easier to administrate or replicate.
Cron jobs
=========
The command :code:`chill:cron-job:execute` should be executed every 15 minutes (more or less).
This command should never be executed concurrently. It should be not have more than one process for a single instance.
Post-install tasks
==================
- import addresses. See :ref:`addresses`.
Tweak symfony messenger
=======================

View File

@@ -5,69 +5,70 @@ Add condition with distinct alias on each export join clauses (Indicators + Filt
These are alias conventions :
| Entity | Join | Attribute | Alias |
|:----------------------------------------|:----------------------------------------|:-------------------------------------------|:----------------------------------|
| AccompanyingPeriod::class | | | acp |
| | AccompanyingPeriodWork::class | acp.works | acpw |
| | AccompanyingPeriodParticipation::class | acp.participations | acppart |
| | Location::class | acp.administrativeLocation | acploc |
| | ClosingMotive::class | acp.closingMotive | acpmotive |
| | UserJob::class | acp.job | acpjob |
| | Origin::class | acp.origin | acporigin |
| | Scope::class | acp.scopes | acpscope |
| | SocialIssue::class | acp.socialIssues | acpsocialissue |
| | User::class | acp.user | acpuser |
| | AccompanyingPeriopStepHistory::class | acp.stepHistories | acpstephistories |
| AccompanyingPeriodWork::class | | | acpw |
| | AccompanyingPeriodWorkEvaluation::class | acpw.accompanyingPeriodWorkEvaluations | workeval |
| | User::class | acpw.referrers | acpwuser |
| | SocialAction::class | acpw.socialAction | acpwsocialaction |
| | Goal::class | acpw.goals | goal |
| | Result::class | acpw.results | result |
| AccompanyingPeriodParticipation::class | | | acppart |
| | Person::class | acppart.person | partperson |
| AccompanyingPeriodWorkEvaluation::class | | | workeval |
| | Evaluation::class | workeval.evaluation | eval |
| Goal::class | | | goal |
| | Result::class | goal.results | goalresult |
| Person::class | | | person |
| | Center::class | person.center | center |
| | HouseholdMember::class | partperson.householdParticipations | householdmember |
| | MaritalStatus::class | person.maritalStatus | personmarital |
| | VendeePerson::class | | vp |
| | VendeePersonMineur::class | | vpm |
| ResidentialAddress::class | | | resaddr |
| | ThirdParty::class | resaddr.hostThirdParty | tparty |
| ThirdParty::class | | | tparty |
| | ThirdPartyCategory::class | tparty.categories | tpartycat |
| HouseholdMember::class | | | householdmember |
| | Household::class | householdmember.household | household |
| | Person::class | householdmember.person | memberperson |
| | | memberperson.center | membercenter |
| Household::class | | | household |
| | HouseholdComposition::class | household.compositions | composition |
| Activity::class | | | activity |
| | Person::class | activity.person | actperson |
| | AccompanyingPeriod::class | activity.accompanyingPeriod | acp |
| | Person::class | activity\_person\_having\_activity.person | person\_person\_having\_activity |
| | ActivityReason::class | activity\_person\_having\_activity.reasons | reasons\_person\_having\_activity |
| | ActivityType::class | activity.activityType | acttype |
| | Location::class | activity.location | actloc |
| | SocialAction::class | activity.socialActions | actsocialaction |
| | SocialIssue::class | activity.socialIssues | actsocialssue |
| | ThirdParty::class | activity.thirdParties | acttparty |
| | User::class | activity.user | actuser |
| | User::class | activity.users | actusers |
| | ActivityReason::class | activity.reasons | actreasons |
| | Center::class | actperson.center | actcenter |
| | Person::class | activity.createdBy | actcreator |
| ActivityReason::class | | | actreasons |
| | ActivityReasonCategory::class | actreason.category | actreasoncat |
| Calendar::class | | | cal |
| | CancelReason::class | cal.cancelReason | calcancel |
| | Location::class | cal.location | calloc |
| | User::class | cal.user | caluser |
| VendeePerson::class | | | vp |
| | SituationProfessionelle::class | vp.situationProfessionelle | vpprof |
| | StatutLogement::class | vp.statutLogement | vplog |
| | TempsDeTravail::class | vp.tempsDeTravail | vptt |
| Entity | Join | Attribute | Alias |
|:----------------------------------------|:----------------------------------------|:-------------------------------------------|:---------------------------------------|
| AccompanyingPeriod::class | | | acp |
| | AccompanyingPeriodWork::class | acp.works | acpw |
| | AccompanyingPeriodParticipation::class | acp.participations | acppart |
| | Location::class | acp.administrativeLocation | acploc |
| | ClosingMotive::class | acp.closingMotive | acpmotive |
| | UserJob::class | acp.job | acpjob |
| | Origin::class | acp.origin | acporigin |
| | Scope::class | acp.scopes | acpscope |
| | SocialIssue::class | acp.socialIssues | acpsocialissue |
| | User::class | acp.user | acpuser |
| | AccompanyingPeriopStepHistory::class | acp.stepHistories | acpstephistories |
| AccompanyingPeriodWork::class | | | acpw |
| | AccompanyingPeriodWorkEvaluation::class | acpw.accompanyingPeriodWorkEvaluations | workeval |
| | User::class | acpw.referrers | acpwuser |
| | SocialAction::class | acpw.socialAction | acpwsocialaction |
| | Goal::class | acpw.goals | goal |
| | Result::class | acpw.results | result |
| AccompanyingPeriodParticipation::class | | | acppart |
| | Person::class | acppart.person | partperson |
| AccompanyingPeriodWorkEvaluation::class | | | workeval |
| | Evaluation::class | workeval.evaluation | eval |
| Goal::class | | | goal |
| | Result::class | goal.results | goalresult |
| Person::class | | | person |
| | Center::class | person.center | center |
| | HouseholdMember::class | partperson.householdParticipations | householdmember |
| | MaritalStatus::class | person.maritalStatus | personmarital |
| | VendeePerson::class | | vp |
| | VendeePersonMineur::class | | vpm |
| | CurrentPersonAddress::class | person.currentPersonAddress | currentPersonAddress (on a given date) |
| ResidentialAddress::class | | | resaddr |
| | ThirdParty::class | resaddr.hostThirdParty | tparty |
| ThirdParty::class | | | tparty |
| | ThirdPartyCategory::class | tparty.categories | tpartycat |
| HouseholdMember::class | | | householdmember |
| | Household::class | householdmember.household | household |
| | Person::class | householdmember.person | memberperson |
| | | memberperson.center | membercenter |
| Household::class | | | household |
| | HouseholdComposition::class | household.compositions | composition |
| Activity::class | | | activity |
| | Person::class | activity.person | actperson |
| | AccompanyingPeriod::class | activity.accompanyingPeriod | acp |
| | Person::class | activity\_person\_having\_activity.person | person\_person\_having\_activity |
| | ActivityReason::class | activity\_person\_having\_activity.reasons | reasons\_person\_having\_activity |
| | ActivityType::class | activity.activityType | acttype |
| | Location::class | activity.location | actloc |
| | SocialAction::class | activity.socialActions | actsocialaction |
| | SocialIssue::class | activity.socialIssues | actsocialssue |
| | ThirdParty::class | activity.thirdParties | acttparty |
| | User::class | activity.user | actuser |
| | User::class | activity.users | actusers |
| | ActivityReason::class | activity.reasons | actreasons |
| | Center::class | actperson.center | actcenter |
| | Person::class | activity.createdBy | actcreator |
| ActivityReason::class | | | actreasons |
| | ActivityReasonCategory::class | actreason.category | actreasoncat |
| Calendar::class | | | cal |
| | CancelReason::class | cal.cancelReason | calcancel |
| | Location::class | cal.location | calloc |
| | User::class | cal.user | caluser |
| VendeePerson::class | | | vp |
| | SituationProfessionelle::class | vp.situationProfessionelle | vpprof |
| | StatutLogement::class | vp.statutLogement | vplog |
| | TempsDeTravail::class | vp.tempsDeTravail | vptt |

67
package.json Normal file
View File

@@ -0,0 +1,67 @@
{
"name": "chill",
"version": "2.0.0",
"devDependencies": {
"@alexlafroscia/yaml-merge": "^4.0.0",
"@apidevtools/swagger-cli": "^4.0.4",
"@babel/core": "^7.20.5",
"@babel/preset-env": "^7.20.2",
"@ckeditor/ckeditor5-build-classic": "^35.3.2",
"@ckeditor/ckeditor5-dev-utils": "^31.1.13",
"@ckeditor/ckeditor5-dev-webpack-plugin": "^31.1.13",
"@ckeditor/ckeditor5-markdown-gfm": "^35.3.2",
"@ckeditor/ckeditor5-theme-lark": "^35.3.2",
"@ckeditor/ckeditor5-vue": "^4.0.1",
"@symfony/webpack-encore": "^4.1.0",
"@tsconfig/node14": "^1.0.1",
"bindings": "^1.5.0",
"bootstrap": "^5.0.1",
"chokidar": "^3.5.1",
"fork-awesome": "^1.1.7",
"jquery": "^3.6.0",
"node-sass": "^8.0.0",
"popper.js": "^1.16.1",
"postcss-loader": "^7.0.2",
"raw-loader": "^4.0.2",
"sass-loader": "^13.0.0",
"select2": "^4.0.13",
"select2-bootstrap-theme": "0.1.0-beta.10",
"style-loader": "^3.3.1",
"ts-loader": "^9.3.1",
"typescript": "^4.7.2",
"vue-loader": "^17.0.0",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1"
},
"dependencies": {
"@fullcalendar/core": "^5.11.0",
"@fullcalendar/daygrid": "^5.11.0",
"@fullcalendar/interaction": "^5.11.0",
"@fullcalendar/list": "^5.11.0",
"@fullcalendar/timegrid": "^5.11.0",
"@fullcalendar/vue3": "^5.11.1",
"@popperjs/core": "^2.9.2",
"dropzone": "^5.7.6",
"es6-promise": "^4.2.8",
"leaflet": "^1.7.1",
"masonry-layout": "^4.2.2",
"mime": "^3.0.0",
"swagger-ui": "^4.15.5",
"vis-network": "^9.1.0",
"vue": "^3.2.37",
"vue-i18n": "^9.1.6",
"vue-multiselect": "3.0.0-alpha.2",
"vue-toast-notification": "^2.0",
"vuex": "^4.0.0"
},
"browserslist": [
"Firefox ESR"
],
"scripts": {
"dev-server": "encore dev-server",
"dev": "encore dev",
"watch": "encore dev --watch",
"build": "encore production --progress"
},
"private": true
}

View File

@@ -5,11 +5,6 @@ parameters:
count: 1
path: src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.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
@@ -30,11 +25,6 @@ parameters:
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

View File

@@ -10,16 +10,6 @@ parameters:
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
@@ -330,21 +320,6 @@ parameters:
count: 6
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.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

View File

@@ -363,6 +363,7 @@ final class ActivityController extends AbstractController
if ($person instanceof Person) {
$entity->setPerson($person);
$entity->getPersons()->add($person);
}
if ($accompanyingPeriod instanceof AccompanyingPeriod) {

View File

@@ -0,0 +1,68 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\ActivityBundle\Export\Aggregator\ACPAggregators;
use Chill\ActivityBundle\Entity\Activity;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
class ByActivityNumberAggregator implements AggregatorInterface
{
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data): void
{
$qb
->addSelect('(SELECT COUNT(activity.id) FROM ' . Activity::class . ' activity WHERE activity.accompanyingPeriod = acp) AS activity_by_number_aggregator')
->addGroupBy('activity_by_number_aggregator');
}
public function applyOn(): string
{
return Declarations::ACP_TYPE;
}
public function buildForm(FormBuilderInterface $builder): void
{
// No form needed
}
public function getLabels($key, array $values, $data)
{
return static function ($value) {
if ('_header' === $value) {
return '';
}
if (null === $value) {
return '';
}
return $value;
};
}
public function getQueryKeys($data): array
{
return ['activity_by_number_aggregator'];
}
public function getTitle(): string
{
return 'Group acp by activity number';
}
}

View File

@@ -44,7 +44,7 @@ class ActivityTypeAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
if (!in_array('acttype', $qb->getAllAliases(), true)) {
$qb->join('activity.activityType', 'acttype');
$qb->leftJoin('activity.activityType', 'acttype');
}
$qb->addSelect(sprintf('IDENTITY(activity.activityType) AS %s', self::KEY));

View File

@@ -0,0 +1,83 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\ActivityBundle\Export\Aggregator;
use Chill\ActivityBundle\Export\Declarations;
use Chill\MainBundle\Export\AggregatorInterface;
use Doctrine\ORM\QueryBuilder;
use LogicException;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
class SentReceivedAggregator implements AggregatorInterface
{
private TranslatorInterface $translator;
public function __construct(TranslatorInterface $translator)
{
$this->translator = $translator;
}
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data): void
{
$qb->addSelect('activity.sentReceived AS activity_sentreceived_aggregator')
->addGroupBy('activity_sentreceived_aggregator');
}
public function applyOn(): string
{
return Declarations::ACTIVITY;
}
public function buildForm(FormBuilderInterface $builder): void
{
// No form needed
}
public function getLabels($key, array $values, $data): callable
{
return function (?string $value): string {
if ('_header' === $value) {
return 'export.aggregator.activity.by_sent_received.Sent or received';
}
switch ($value) {
case null:
return '';
case 'sent':
return $this->translator->trans('export.aggregator.activity.by_sent_received.is sent');
case 'received':
return $this->translator->trans('export.aggregator.activity.by_sent_received.is received');
default:
throw new LogicException(sprintf('The value %s is not valid', $value));
}
};
}
public function getQueryKeys($data): array
{
return ['activity_sentreceived_aggregator'];
}
public function getTitle(): string
{
return 'export.aggregator.activity.by_sent_received.Group activity by sentreceived';
}
}

View File

@@ -0,0 +1,165 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\ActivityBundle\Export\Export\LinkedToACP;
use Chill\ActivityBundle\Entity\Activity;
use Chill\ActivityBundle\Export\Export\ListActivityHelper;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Export\GroupedExportInterface;
use Chill\MainBundle\Export\Helper\TranslatableStringExportLabelHelper;
use Chill\MainBundle\Export\ListInterface;
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\FormBuilderInterface;
class ListActivity implements ListInterface, GroupedExportInterface
{
private EntityManagerInterface $entityManager;
private ListActivityHelper $helper;
private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper;
public function __construct(
ListActivityHelper $helper,
EntityManagerInterface $entityManager,
TranslatableStringExportLabelHelper $translatableStringExportLabelHelper
) {
$this->helper = $helper;
$this->entityManager = $entityManager;
$this->translatableStringExportLabelHelper = $translatableStringExportLabelHelper;
}
public function buildForm(FormBuilderInterface $builder)
{
$this->helper->buildForm($builder);
}
public function getAllowedFormattersTypes()
{
return $this->helper->getAllowedFormattersTypes();
}
public function getDescription()
{
return ListActivityHelper::MSG_KEY . 'List activities linked to an accompanying course';
}
public function getGroup(): string
{
return 'Exports of activities linked to an accompanying period';
}
public function getLabels($key, array $values, $data)
{
switch ($key) {
case 'acpId':
return static function ($value) {
if ('_header' === $value) {
return ListActivityHelper::MSG_KEY . 'accompanying course id';
}
return $value ?? '';
};
case 'scopesNames':
return $this->translatableStringExportLabelHelper->getLabelMulti($key, $values, ListActivityHelper::MSG_KEY . 'course circles');
default:
return $this->helper->getLabels($key, $values, $data);
}
}
public function getQueryKeys($data)
{
return
array_merge(
$this->helper->getQueryKeys($data),
[
'acpId',
'scopesNames',
]
);
}
public function getResult($query, $data)
{
return $this->helper->getResult($query, $data);
}
public function getTitle()
{
return ListActivityHelper::MSG_KEY . 'List activity linked to a course';
}
public function getType()
{
return $this->helper->getType();
}
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$centers = array_map(static function ($el) {
return $el['center'];
}, $acl);
$qb = $this->entityManager->createQueryBuilder();
$qb
->distinct()
->from(Activity::class, 'activity')
->join('activity.accompanyingPeriod', 'acp')
->leftJoin('acp.participations', 'acppart')
->leftJoin('acppart.person', 'person')
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
->andWhere(
$qb->expr()->exists(
'SELECT 1
FROM ' . PersonCenterHistory::class . ' acl_count_person_history
WHERE acl_count_person_history.person = person
AND acl_count_person_history.center IN (:authorized_centers)
'
)
)
// some grouping are necessary
->addGroupBy('acp.id')
->addOrderBy('activity.date')
->addOrderBy('activity.id')
->setParameter('authorized_centers', $centers);
$this->helper->addSelect($qb);
// add select for this step
$qb
->addSelect('acp.id AS acpId')
->addSelect('(SELECT AGGREGATE(acpScope.name) FROM ' . Scope::class . ' acpScope WHERE acpScope MEMBER OF acp.scopes) AS scopesNames')
->addGroupBy('scopesNames');
return $qb;
}
public function requiredRole(): string
{
return ActivityStatsVoter::LISTS;
}
public function supportsModifiers()
{
return array_merge(
$this->helper->supportsModifiers(),
[
\Chill\PersonBundle\Export\Declarations::ACP_TYPE,
]
);
}
}

View File

@@ -124,7 +124,7 @@ class ListActivity implements ListInterface, GroupedExportInterface
return 'attendee';
}
return $value ? 1 : 0;
return $value ? 'X' : '';
};
case 'list_reasons':
@@ -210,10 +210,20 @@ class ListActivity implements ListInterface, GroupedExportInterface
$qb
->from('ChillActivityBundle:Activity', 'activity')
->join('activity.person', 'person')
->join('actperson.center', 'actcenter')
->andWhere('actcenter IN (:authorized_centers)')
->setParameter('authorized_centers', $centers);
->join('activity.person', 'actperson')
->join('actperson.centerHistory', 'centerHistory');
$qb->where(
$qb->expr()->andX(
$qb->expr()->lte('centerHistory.startDate', 'activity.date'),
$qb->expr()->orX(
$qb->expr()->isNull('centerHistory.endDate'),
$qb->expr()->gt('centerHistory.endDate', 'activity.date')
)
)
)
->andWhere($qb->expr()->in('centerHistory.center', ':centers'))
->setParameter('centers', $centers);
foreach ($this->fields as $f) {
if (in_array($f, $data['fields'], true)) {
@@ -224,17 +234,17 @@ class ListActivity implements ListInterface, GroupedExportInterface
break;
case 'person_firstname':
$qb->addSelect('person.firstName AS person_firstname');
$qb->addSelect('actperson.firstName AS person_firstname');
break;
case 'person_lastname':
$qb->addSelect('person.lastName AS person_lastname');
$qb->addSelect('actperson.lastName AS person_lastname');
break;
case 'person_id':
$qb->addSelect('person.id AS person_id');
$qb->addSelect('actperson.id AS person_id');
break;
@@ -251,7 +261,7 @@ class ListActivity implements ListInterface, GroupedExportInterface
break;
case 'type_name':
$qb->join('activity.type', 'type');
$qb->join('activity.activityType', 'type');
$qb->addSelect('type.name AS type_name');
break;
@@ -263,6 +273,11 @@ class ListActivity implements ListInterface, GroupedExportInterface
break;
case 'attendee':
$qb->addSelect('IDENTITY(activity.attendee) AS attendee');
break;
default:
$qb->addSelect(sprintf('activity.%s as %s', $f, $f));

View File

@@ -0,0 +1,269 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\ActivityBundle\Export\Export;
use Chill\ActivityBundle\Export\Declarations;
use Chill\ActivityBundle\Repository\ActivityPresenceRepositoryInterface;
use Chill\ActivityBundle\Repository\ActivityTypeRepositoryInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\Helper\DateTimeHelper;
use Chill\MainBundle\Export\Helper\TranslatableStringExportLabelHelper;
use Chill\MainBundle\Export\Helper\UserHelper;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Chill\PersonBundle\Export\Helper\LabelPersonHelper;
use Chill\ThirdPartyBundle\Export\Helper\LabelThirdPartyHelper;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\QueryBuilder;
use LogicException;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use const SORT_NUMERIC;
class ListActivityHelper
{
public const MSG_KEY = 'export.list.activity.';
private ActivityPresenceRepositoryInterface $activityPresenceRepository;
private ActivityTypeRepositoryInterface $activityTypeRepository;
private DateTimeHelper $dateTimeHelper;
private LabelPersonHelper $labelPersonHelper;
private LabelThirdPartyHelper $labelThirdPartyHelper;
private TranslatableStringHelperInterface $translatableStringHelper;
private TranslatableStringExportLabelHelper $translatableStringLabelHelper;
private TranslatorInterface $translator;
private UserHelper $userHelper;
public function __construct(
ActivityPresenceRepositoryInterface $activityPresenceRepository,
ActivityTypeRepositoryInterface $activityTypeRepository,
DateTimeHelper $dateTimeHelper,
LabelPersonHelper $labelPersonHelper,
LabelThirdPartyHelper $labelThirdPartyHelper,
TranslatorInterface $translator,
TranslatableStringHelperInterface $translatableStringHelper,
TranslatableStringExportLabelHelper $translatableStringLabelHelper,
UserHelper $userHelper
) {
$this->activityPresenceRepository = $activityPresenceRepository;
$this->activityTypeRepository = $activityTypeRepository;
$this->dateTimeHelper = $dateTimeHelper;
$this->labelPersonHelper = $labelPersonHelper;
$this->labelThirdPartyHelper = $labelThirdPartyHelper;
$this->translator = $translator;
$this->translatableStringHelper = $translatableStringHelper;
$this->translatableStringLabelHelper = $translatableStringLabelHelper;
$this->userHelper = $userHelper;
}
public function addSelect(QueryBuilder $qb): void
{
$qb
->addSelect('activity.id AS id')
->addSelect('activity.date')
->addSelect('IDENTITY(activity.activityType) AS typeName')
->leftJoin('activity.reasons', 'reasons')
->addSelect('AGGREGATE(reasons.name) AS listReasons')
->leftJoin('activity.persons', 'actPerson')
->addSelect('AGGREGATE(actPerson.id) AS personsIds')
->addSelect('AGGREGATE(actPerson.id) AS personsNames')
->leftJoin('activity.users', 'users_u')
->addSelect('AGGREGATE(users_u.id) AS usersIds')
->addSelect('AGGREGATE(users_u.id) AS usersNames')
->leftJoin('activity.thirdParties', 'thirdparty')
->addSelect('AGGREGATE(thirdparty.id) AS thirdPartiesIds')
->addSelect('AGGREGATE(thirdparty.id) AS thirdPartiesNames')
->addSelect('IDENTITY(activity.attendee) AS attendeeName')
->addSelect('activity.durationTime')
->addSelect('activity.travelTime')
->addSelect('activity.emergency')
->leftJoin('activity.location', 'location')
->addSelect('location.name AS locationName')
->addSelect('activity.sentReceived')
->addSelect('IDENTITY(activity.createdBy) AS createdBy')
->addSelect('activity.createdAt')
->addSelect('IDENTITY(activity.updatedBy) AS updatedBy')
->addSelect('activity.updatedAt')
->addGroupBy('activity.id')
->addGroupBy('location.id');
}
public function buildForm(FormBuilderInterface $builder)
{
}
public function getAllowedFormattersTypes()
{
return [FormatterInterface::TYPE_LIST];
}
public function getLabels($key, array $values, $data)
{
switch ($key) {
case 'createdAt':
case 'updatedAt':
return $this->dateTimeHelper->getLabel($key);
case 'createdBy':
case 'updatedBy':
return $this->userHelper->getLabel($key, $values, $key);
case 'date':
return $this->dateTimeHelper->getLabel(self::MSG_KEY . $key);
case 'attendeeName':
return function ($value) {
if ('_header' === $value) {
return 'Attendee';
}
if (null === $value || null === $presence = $this->activityPresenceRepository->find($value)) {
return '';
}
return $this->translatableStringHelper->localize($presence->getName());
};
case 'listReasons':
return $this->translatableStringLabelHelper->getLabelMulti($key, $values, 'Activity Reasons');
case 'typeName':
return function ($value) {
if ('_header' === $value) {
return 'Activity type';
}
if (null === $value || null === $type = $this->activityTypeRepository->find($value)) {
return '';
}
return $this->translatableStringHelper->localize($type->getName());
};
case 'usersNames':
return $this->userHelper->getLabelMulti($key, $values, self::MSG_KEY . 'users name');
case 'usersIds':
case 'thirdPartiesIds':
case 'personsIds':
return static function ($value) use ($key) {
if ('_header' === $value) {
switch ($key) {
case 'usersIds':
return self::MSG_KEY . 'users ids';
case 'thirdPartiesIds':
return self::MSG_KEY . 'third parties ids';
case 'personsIds':
return self::MSG_KEY . 'persons ids';
default:
throw new LogicException('key not supported');
}
}
$decoded = json_decode($value);
return implode(
'|',
array_unique(
array_filter($decoded, static fn (?int $id) => null !== $id),
SORT_NUMERIC
)
);
};
case 'personsNames':
return $this->labelPersonHelper->getLabelMulti($key, $values, self::MSG_KEY . 'persons name');
case 'thirdPartiesNames':
return $this->labelThirdPartyHelper->getLabelMulti($key, $values, self::MSG_KEY . 'thirds parties');
case 'sentReceived':
return function ($value) {
if ('_header' === $value) {
return self::MSG_KEY . 'sent received';
}
if (null === $value) {
return '';
}
return $this->translator->trans($value);
};
default:
return function ($value) use ($key) {
if ('_header' === $value) {
return self::MSG_KEY . $key;
}
if (null === $value) {
return '';
}
return $this->translator->trans($value);
};
}
}
public function getQueryKeys($data)
{
return [
'id',
'date',
'typeName',
'listReasons',
'attendeeName',
'durationTime',
'travelTime',
'emergency',
'locationName',
'sentReceived',
'personsIds',
'personsNames',
'usersIds',
'usersNames',
'thirdPartiesIds',
'thirdPartiesNames',
'createdBy',
'createdAt',
'updatedBy',
'updatedAt',
];
}
public function getResult($query, $data)
{
return $query->getQuery()->getResult(AbstractQuery::HYDRATE_SCALAR);
}
public function getType(): string
{
return Declarations::ACTIVITY;
}
public function supportsModifiers()
{
return [
Declarations::ACTIVITY,
];
}
}

View File

@@ -0,0 +1,57 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
use Chill\ActivityBundle\Entity\Activity;
use Chill\MainBundle\Export\FilterInterface;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
class HasNoActivityFilter implements FilterInterface
{
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$qb
->andWhere('
NOT EXISTS (
SELECT 1 FROM ' . Activity::class . ' activity
WHERE activity.accompanyingPeriod = acp
)
');
}
public function applyOn(): string
{
return Declarations::ACP_TYPE;
}
public function buildForm(FormBuilderInterface $builder)
{
//no form needed
}
public function describeAction($data, $format = 'string'): array
{
return ['Filtered acp which has no activities', []];
}
public function getTitle(): string
{
return 'Filter acp which has no activity';
}
}

View File

@@ -13,9 +13,10 @@ namespace Chill\ActivityBundle\Export\Filter;
use Chill\ActivityBundle\Export\Declarations;
use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\Export\FilterType;
use DateTime;
use Chill\MainBundle\Form\Type\PickRollingDateType;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
use Doctrine\ORM\Query\Expr;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
@@ -28,9 +29,14 @@ class ActivityDateFilter implements FilterInterface
{
protected TranslatorInterface $translator;
public function __construct(TranslatorInterface $translator)
{
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(
TranslatorInterface $translator,
RollingDateConverterInterface $rollingDateConverter
) {
$this->translator = $translator;
$this->rollingDateConverter = $rollingDateConverter;
}
public function addRole(): ?string
@@ -54,8 +60,14 @@ class ActivityDateFilter implements FilterInterface
}
$qb->add('where', $where);
$qb->setParameter('date_from', $data['date_from']);
$qb->setParameter('date_to', $data['date_to']);
$qb->setParameter(
'date_from',
$this->rollingDateConverter->convert($data['date_from'])
);
$qb->setParameter(
'date_to',
$this->rollingDateConverter->convert($data['date_to'])
);
}
public function applyOn(): string
@@ -66,13 +78,13 @@ class ActivityDateFilter implements FilterInterface
public function buildForm(FormBuilderInterface $builder)
{
$builder
->add('date_from', ChillDateType::class, [
->add('date_from', PickRollingDateType::class, [
'label' => 'Activities after this date',
'data' => new DateTime(),
'data' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START),
])
->add('date_to', ChillDateType::class, [
->add('date_to', PickRollingDateType::class, [
'label' => 'Activities before this date',
'data' => new DateTime(),
'data' => new RollingDate(RollingDate::T_TODAY),
]);
$builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
@@ -121,8 +133,8 @@ class ActivityDateFilter implements FilterInterface
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'),
'%date_from%' => $this->rollingDateConverter->convert($data['date_from'])->format('d-m-Y'),
'%date_to%' => $this->rollingDateConverter->convert($data['date_to'])->format('d-m-Y'),
],
];
}

View File

@@ -39,9 +39,9 @@ class UsersJobFilter implements FilterInterface
$qb
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM ' . Activity::class . ' activity_users_job_filter_act
'SELECT 1 FROM ' . Activity::class . ' activity_users_job_filter_act
JOIN activity_users_job_filter_act.users users WHERE users.userJob IN (:activity_users_job_filter_jobs) AND activity_users_job_filter_act = activity '
)
)
)
->setParameter('activity_users_job_filter_jobs', $data['jobs']);
}

View File

@@ -0,0 +1,51 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\ActivityBundle\Repository;
use Chill\ActivityBundle\Entity\ActivityPresence;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
class ActivityPresenceRepository implements ActivityPresenceRepositoryInterface
{
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{
$this->repository = $entityManager->getRepository($this->getClassName());
}
public function find($id): ?ActivityPresence
{
return $this->repository->find($id);
}
public function findAll(): array
{
return $this->repository->findAll();
}
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
{
return $this->findBy($criteria, $orderBy, $limit, $offset);
}
public function findOneBy(array $criteria): ?ActivityPresence
{
return $this->findOneBy($criteria);
}
public function getClassName(): string
{
return ActivityPresence::class;
}
}

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\ActivityBundle\Repository;
use Chill\ActivityBundle\Entity\ActivityPresence;
interface ActivityPresenceRepositoryInterface
{
public function find($id): ?ActivityPresence;
/**
* @return array|ActivityPresence[]
*/
public function findAll(): array;
/**
* @return array|ActivityPresence[]
*/
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array;
public function findOneBy(array $criteria): ?ActivityPresence;
public function getClassName(): string;
}

View File

@@ -117,7 +117,8 @@ export default {
target: { //name, id
},
edit: false,
addressId: null
addressId: null,
defaults: window.addaddress
}
}
}

View File

@@ -30,7 +30,7 @@ const store = createStore({
},
getters: {
suggestedEntities(state) {
if (typeof state.activity.accompanyingPeriod === "undefined") {
if (typeof state.activity.accompanyingPeriod === "undefined" || state.activity.accompanyingPeriod === null) {
return [];
}
const allEntities = [

View File

@@ -39,6 +39,9 @@ const makeConcernedThirdPartiesLocation = (locationType, store) => {
return locations;
};
const makeAccompanyingPeriodLocation = (locationType, store) => {
if (store.state.activity.accompanyingPeriod === null) {
return {};
}
const accPeriodLocation = store.state.activity.accompanyingPeriod.location;
return {
type: 'location',

View File

@@ -369,8 +369,12 @@ final class ActivityControllerTest extends WebTestCase
$center
);
$reachableScopesId = array_intersect(
array_map(static function ($s) { return $s->getId(); }, $reachableScopesDelete),
array_map(static function ($s) { return $s->getId(); }, $reachableScopesUpdate)
array_map(static function ($s) {
return $s->getId();
}, $reachableScopesDelete),
array_map(static function ($s) {
return $s->getId();
}, $reachableScopesUpdate)
);
if (count($reachableScopesId) === 0) {

View File

@@ -188,7 +188,9 @@ final class ActivityTypeTest extends KernelTestCase
// map all the values in an array
$values = array_map(
static function ($choice) { return $choice->value; },
static function ($choice) {
return $choice->value;
},
$view['activity']['durationTime']->vars['choices']
);

View File

@@ -41,6 +41,12 @@ services:
tags:
- { name: chill.export, alias: 'avg_activity_visit_duration_linked_to_acp' }
Chill\ActivityBundle\Export\Export\LinkedToACP\ListActivity:
tags:
- { name: chill.export, alias: 'list_activity_acp'}
Chill\ActivityBundle\Export\Export\ListActivityHelper: ~
## Filters
chill.activity.export.type_filter:
class: Chill\ActivityBundle\Export\Filter\ActivityTypeFilter
@@ -120,15 +126,18 @@ services:
tags:
- { name: chill.export_filter, alias: 'activity_usersscope_filter' }
Chill\ActivityBundle\Export\Filter\ACPFilters\HasNoActivityFilter:
tags:
- { name: chill.export_filter, alias: 'accompanyingcourse_has_no_activity_filter' }
## Aggregators
Chill\ActivityBundle\Export\Aggregator\PersonAggregators\ActivityReasonAggregator:
tags:
- { name: chill.export_aggregator, alias: activity_reason_aggregator }
chill.activity.export.type_aggregator:
class: Chill\ActivityBundle\Export\Aggregator\ActivityTypeAggregator
Chill\ActivityBundle\Export\Aggregator\ActivityTypeAggregator:
tags:
- { name: chill.export_aggregator, alias: activity_type_aggregator }
- { name: chill.export_aggregator, alias: activity_common_type_aggregator }
chill.activity.export.user_aggregator:
class: Chill\ActivityBundle\Export\Aggregator\ActivityUserAggregator
@@ -179,3 +188,11 @@ services:
Chill\ActivityBundle\Export\Aggregator\ActivityUsersJobAggregator:
tags:
- { name: chill.export_aggregator, alias: activity_users_job_aggregator }
Chill\ActivityBundle\Export\Aggregator\ACPAggregators\ByActivityNumberAggregator:
tags:
- { name: chill.export_aggregator, alias: accompanyingcourse_by_activity_number_aggregator }
Chill\ActivityBundle\Export\Aggregator\SentReceivedAggregator:
tags:
- { name: chill.export_aggregator, alias: activity_sentreceived_aggregator }

View File

@@ -45,6 +45,8 @@ by: 'Par '
location: Lieu
Reasons: Sujets
Private comment: Commentaire privé
sent: Envoyé
received: Reçu
#forms
@@ -260,8 +262,6 @@ activity is not emergency: l'activité n'est pas urgente
Filter activity by sentreceived: Filtrer les activités par envoyé/reçu
'Filtered activity by sentreceived: only %sentreceived%': "Filtré par envoyé/reçu: uniquement %sentreceived%"
Accepted sentreceived: ''
is sent: envoyé
is received: reçu
Filter activity by linked socialaction: Filtrer les activités par action liée
'Filtered activity by linked socialaction: only %actions%': "Filtré par action liée: uniquement %actions%"
Filter activity by linked socialissue: Filtrer les activités par problématique liée
@@ -277,6 +277,10 @@ Filter activity by userscope: Filtrer les activités par service du créateur
'Filtered activity by userscope: only %scopes%': "Filtré par service du créateur: uniquement %scopes%"
Accepted userscope: Services
Filter acp which has no activity: Filtrer les parcours qui nont pas dactivité
Filtered acp which has no activities: Filtrer les parcours sans activité associée
Group acp by activity number: Grouper les parcours par nombre dactivité
#aggregators
Activity type: Type d'activité
Activity user: Utilisateur lié à l'activité
@@ -319,11 +323,32 @@ This is the minimal activity data: Activité n°
docgen:
Activity basic: Echange
A basic context for activity: Contexte pour les échanges
Accompanying period with a list of activities: Parcours d'accompagnement avec liste des échanges
Accompanying period with a list of activities description: Ce contexte reprend les informations du parcours, et tous les échanges pour un parcours. Les échanges ne sont pas filtrés.
A basic context for activity: Contexte pour les activités
Accompanying period with a list of activities: Parcours d'accompagnement avec liste des activités
Accompanying period with a list of activities description: Ce contexte reprend les informations du parcours, et tous les activités pour un parcours. Les activités ne sont pas filtrés.
export:
list:
activity:
users name: Nom des utilisateurs
users ids: Identifiant des utilisateurs
third parties ids: Identifiant des tiers
persons ids: Identifiant des personnes
persons name: Nom des personnes
thirds parties: Tiers
date: Date de l'activité
locationName: Localisation
sent received: Envoyé ou reçu
emergency: Urgence
accompanying course id: Identifiant du parcours
course circles: Cercles du parcours
travelTime: Durée de déplacement
durationTime: Durée
id: Identifiant
List activities linked to an accompanying course: Liste les activités liées à un parcours en fonction de différents filtres.
List activity linked to a course: Liste des activités liées à un parcours
filter:
activity:
by_usersjob:
@@ -332,3 +357,10 @@ export:
by_usersscope:
Filter by users scope: Filtrer les activités par services d'au moins un utilisateur participant
'Filtered activity by users scope: only %scopes%': 'Filtré par service d''au moins un utilisateur participant: seulement %scopes%'
aggregator:
activity:
by_sent_received:
Sent or received: Envoyé ou reçu
is sent: envoyé
is received: reçu
Group activity by sentreceived: Grouper les activités par envoyé / reçu

View File

@@ -231,4 +231,4 @@ This is the minimal activity data: Activité n°
docgen:
Activity basic: Echange
A basic context for activity: Contexte pour les échanges
A basic context for activity: Contexte pour les activités

View File

@@ -16,7 +16,7 @@ For this type of activity, document is required: Pour ce type d'activité, un do
For this type of activity, emergency is required: Pour ce type d'activité, le champ "Urgent" est requis
For this type of activity, accompanying period is required: Pour ce type d'activité, le parcours d'accompagnement est requis
For this type of activity, you must add at least one social issue: Pour ce type d'activité, vous devez ajouter au moins une problématique sociale
For this type of activity, you must add at least one social action: Pour ce type d'activité, vous devez indiquez au moins une action sociale
For this type of activity, you must add at least one social action: Pour ce type d'activité, vous devez indiquer au moins une action sociale
# admin
This parameter must be equal to social issue parameter: Ce paramètre doit être égal au paramètre "Visibilité du champs Problématiques sociales"

View File

@@ -30,6 +30,8 @@ final class ChillAsideActivityExtension extends Extension implements PrependExte
$loader->load('services.yaml');
$loader->load('services/form.yaml');
$loader->load('services/menu.yaml');
$loader->load('services/security.yaml');
$loader->load('services/export.yaml');
}
public function prepend(ContainerBuilder $container)

View File

@@ -0,0 +1,82 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\AsideActivityBundle\Export\Aggregator;
use Chill\AsideActivityBundle\Export\Declarations;
use Chill\AsideActivityBundle\Repository\AsideActivityCategoryRepository;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
class ByActivityTypeAggregator implements AggregatorInterface
{
private AsideActivityCategoryRepository $asideActivityCategoryRepository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(AsideActivityCategoryRepository $asideActivityCategoryRepository, TranslatableStringHelper $translatableStringHelper)
{
$this->asideActivityCategoryRepository = $asideActivityCategoryRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->addSelect('IDENTITY(aside.type) AS by_aside_activity_type_aggregator')
->addGroupBy('by_aside_activity_type_aggregator');
}
public function applyOn(): string
{
return Declarations::ASIDE_ACTIVITY_TYPE;
}
public function buildForm(FormBuilderInterface $builder)
{
// No form needed
}
public function getLabels($key, array $values, $data)
{
$this->asideActivityCategoryRepository->findBy(['id' => $values]);
return function ($value): string {
if ('_header' === $value) {
return 'export.aggregator.Aside activity type';
}
if (null === $value) {
return '';
}
$t = $this->asideActivityCategoryRepository->find($value);
return $this->translatableStringHelper->localize($t->getTitle());
};
}
public function getQueryKeys($data): array
{
return ['by_aside_activity_type_aggregator'];
}
public function getTitle(): string
{
return 'export.aggregator.Group by aside activity type';
}
}

View File

@@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\AsideActivityBundle\Export;
/**
* This class declare constants used for the export framework.
*/
abstract class Declarations
{
public const ASIDE_ACTIVITY_TYPE = 'aside_activity';
}

View File

@@ -0,0 +1,105 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\AsideActivityBundle\Export\Export;
use Chill\AsideActivityBundle\Repository\AsideActivityRepository;
use Chill\AsideActivityBundle\Security\AsideActivityVoter;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
use ChillAsideActivityBundle\Export\Declarations;
use Doctrine\ORM\Query;
use LogicException;
use Symfony\Component\Form\FormBuilderInterface;
class CountAsideActivity implements ExportInterface, GroupedExportInterface
{
private AsideActivityRepository $repository;
public function __construct(
AsideActivityRepository $repository
) {
$this->repository = $repository;
}
public function buildForm(FormBuilderInterface $builder)
{
}
public function getAllowedFormattersTypes(): array
{
return [FormatterInterface::TYPE_TABULAR];
}
public function getDescription(): string
{
return 'export.Count aside activities by various parameters.';
}
public function getGroup(): string
{
return 'export.Exports of aside activities';
}
public function getLabels($key, array $values, $data)
{
if ('export_result' !== $key) {
throw new LogicException("the key {$key} is not used by this export");
}
$labels = array_combine($values, $values);
$labels['_header'] = $this->getTitle();
return static function ($value) use ($labels) {
return $labels[$value];
};
}
public function getQueryKeys($data): array
{
return ['export_result'];
}
public function getResult($query, $data)
{
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
}
public function getTitle(): string
{
return 'export.Count aside activities';
}
public function getType(): string
{
return Declarations::ASIDE_ACTIVITY_TYPE;
}
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$qb = $this->repository->createQueryBuilder('aside');
$qb->select('COUNT(DISTINCT aside.id) AS export_result');
return $qb;
}
public function requiredRole(): string
{
return AsideActivityVoter::STATS;
}
public function supportsModifiers(): array
{
return [];
}
}

View File

@@ -0,0 +1,96 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\AsideActivityBundle\Export\Filter;
use Chill\AsideActivityBundle\Entity\AsideActivityCategory;
use Chill\AsideActivityBundle\Export\Declarations;
use Chill\AsideActivityBundle\Repository\AsideActivityCategoryRepository;
use Chill\AsideActivityBundle\Templating\Entity\CategoryRender;
use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Doctrine\ORM\QueryBuilder;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\FormBuilderInterface;
class ByActivityTypeFilter implements FilterInterface
{
private AsideActivityCategoryRepository $asideActivityTypeRepository;
private CategoryRender $categoryRender;
private TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
CategoryRender $categoryRender,
TranslatableStringHelperInterface $translatableStringHelper,
AsideActivityCategoryRepository $asideActivityTypeRepository
) {
$this->categoryRender = $categoryRender;
$this->asideActivityTypeRepository = $asideActivityTypeRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$clause = $qb->expr()->in('aside.type', ':types');
$qb->andWhere($clause);
$qb->setParameter('types', $data['types']);
}
public function applyOn(): string
{
return Declarations::ASIDE_ACTIVITY_TYPE;
}
public function buildForm(FormBuilderInterface $builder)
{
$builder
->add('types', EntityType::class, [
'class' => AsideActivityCategory::class,
'choices' => $this->asideActivityTypeRepository->findAllActive(),
'required' => false,
'multiple' => true,
'expanded' => false,
'attr' => [
'class' => 'select2',
],
'choice_label' => function (AsideActivityCategory $category) {
$options = [];
return $this->categoryRender->renderString($category, $options);
},
]);
}
public function describeAction($data, $format = 'string'): array
{
$types = array_map(
fn (AsideActivityCategory $t): string => $this->translatableStringHelper->localize($t->getName()),
$this->asideActivityTypeRepository->findBy(['id' => $data['types']->toArray()])
);
return ['export.filter.Filtered by aside activity type: only %type%', [
'%type%' => implode(', ', $types),
]];
}
public function getTitle(): string
{
return 'export.filter.Filter by aside activity type';
}
}

View File

@@ -0,0 +1,143 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\AsideActivityBundle\Export\Filter;
use Chill\AsideActivityBundle\Export\Declarations;
use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Form\Type\Export\FilterType;
use Chill\MainBundle\Form\Type\PickRollingDateType;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
use Doctrine\ORM\Query\Expr\Andx;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Contracts\Translation\TranslatorInterface;
class ByDateFilter implements FilterInterface
{
protected TranslatorInterface $translator;
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(
RollingDateConverterInterface $rollingDateConverter,
TranslatorInterface $translator
) {
$this->translator = $translator;
$this->rollingDateConverter = $rollingDateConverter;
}
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$where = $qb->getDQLPart('where');
$clause = $qb->expr()->between(
'aside.date',
':date_from',
':date_to'
);
if ($where instanceof Andx) {
$where->add($clause);
} else {
$where = $qb->expr()->andX($clause);
}
$qb->add('where', $where);
$qb->setParameter(
'date_from',
$this->rollingDateConverter->convert($data['date_from'])
);
$qb->setParameter(
'date_to',
$this->rollingDateConverter->convert($data['date_to'])
);
}
public function applyOn(): string
{
return Declarations::ASIDE_ACTIVITY_TYPE;
}
public function buildForm(FormBuilderInterface $builder)
{
$builder
->add('date_from', PickRollingDateType::class, [
'label' => 'export.filter.Aside activities after this date',
'data' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START),
])
->add('date_to', PickRollingDateType::class, [
'label' => 'export.filter.Aside activities before this date',
'data' => new RollingDate(RollingDate::T_TODAY),
]);
$builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
/** @var \Symfony\Component\Form\FormInterface $filterForm */
$filterForm = $event->getForm()->getParent();
$enabled = $filterForm->get(FilterType::ENABLED_FIELD)->getData();
if (true === $enabled) {
// if the filter is enabled, add some validation
$form = $event->getForm();
$date_from = $form->get('date_from')->getData();
$date_to = $form->get('date_to')->getData();
// check that fields are not empty
if (null === $date_from) {
$form->get('date_from')->addError(new FormError(
$this->translator->trans('This field '
. 'should not be empty')
));
}
if (null === $date_to) {
$form->get('date_to')->addError(new FormError(
$this->translator->trans('This field '
. 'should not be empty')
));
}
// check that date_from is before date_to
if (
(null !== $date_from && null !== $date_to)
&& $date_from >= $date_to
) {
$form->get('date_to')->addError(new FormError(
$this->translator->trans('export.filter.This date should be after '
. 'the date given in "Implied in an aside activity after '
. 'this date" field')
));
}
}
});
}
public function describeAction($data, $format = 'string'): array
{
return ['export.filter.Filtered by aside activities between %dateFrom% and %dateTo%', [
'%dateFrom%' => $this->rollingDateConverter->convert($data['date_from'])->format('d-m-Y'),
'%dateTo%' => $this->rollingDateConverter->convert($data['date_to'])->format('d-m-Y'),
]];
}
public function getTitle(): string
{
return 'export.filter.Filter by aside activity date';
}
}

View File

@@ -38,6 +38,11 @@ class AsideActivityCategoryRepository implements ObjectRepository
return $this->repository->findAll();
}
public function findAllActive(): array
{
return $this->repository->findBy(['isActive' => true]);
}
/**
* @param mixed|null $limit
* @param mixed|null $offset

View File

@@ -12,46 +12,20 @@ declare(strict_types=1);
namespace Chill\AsideActivityBundle\Repository;
use Chill\AsideActivityBundle\Entity\AsideActivity;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ObjectRepository;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
final class AsideActivityRepository implements ObjectRepository
/**
* @method AsideActivity|null find($id, $lockMode = null, $lockVersion = null)
* @method AsideActivity|null findOneBy(array $criteria, array $orderBy = null)
* @method AsideActivity[] findAll()
* @method AsideActivity[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
final class AsideActivityRepository extends ServiceEntityRepository
{
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
public function __construct(ManagerRegistry $registry)
{
$this->repository = $entityManager->getRepository(AsideActivity::class);
}
public function find($id): ?AsideActivity
{
return $this->repository->find($id);
}
/**
* @return AsideActivity[]
*/
public function findAll(): array
{
return $this->repository->findAll();
}
/**
* @param mixed|null $limit
* @param mixed|null $offset
*
* @return AsideActivity[]
*/
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
public function findOneBy(array $criteria): ?AsideActivity
{
return $this->repository->findOneBy($criteria);
parent::__construct($registry, AsideActivity::class);
}
public function getClassName(): string

View File

@@ -0,0 +1,79 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\AsideActivityBundle\Security;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
use Chill\MainBundle\Security\Authorization\VoterHelperFactoryInterface;
use Chill\MainBundle\Security\Authorization\VoterHelperInterface;
use Chill\MainBundle\Security\ProvideRoleHierarchyInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
class AsideActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
{
public const STATS = 'CHILL_ASIDE_ACTIVITY_STATS';
private VoterHelperInterface $voterHelper;
public function __construct(
VoterHelperFactoryInterface $voterHelperFactory
) {
$this->voterHelper = $voterHelperFactory
->generate(self::class)
->addCheckFor(Center::class, [self::STATS])
->build();
}
/**
* @return string[]
*/
public function getRoles(): array
{
return $this->getAttributes();
}
/**
* @return string[][]
*/
public function getRolesWithHierarchy(): array
{
return ['Aside activity' => $this->getRoles()];
}
/**
* @return string[]
*/
public function getRolesWithoutScope(): array
{
return $this->getAttributes();
}
protected function supports($attribute, $subject)
{
return $this->voterHelper->supports($attribute, $subject);
}
protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
{
if (!$token->getUser() instanceof User) {
return false;
}
return $this->voterHelper->voteOnAttribute($attribute, $subject, $token);
}
private function getAttributes(): array
{
return [self::STATS];
}
}

View File

@@ -20,3 +20,33 @@ services:
resource: "../Controller"
autowire: true
autoconfigure: true
## Exports
# indicators
Chill\AsideActivityBundle\Export\Export\CountAsideActivity:
autowire: true
autoconfigure: true
tags:
- { name: chill.export, alias: count_asideactivity }
# filters
Chill\AsideActivityBundle\Export\Filter\ByDateFilter:
autowire: true
autoconfigure: true
tags:
- { name: chill.export_filter, alias: asideactivity_bydate_filter }
Chill\AsideActivityBundle\Export\Filter\ByActivityTypeFilter:
autowire: true
autoconfigure: true
tags:
- { name: chill.export_filter, alias: asideactivity_activitytype_filter }
# aggregators
Chill\AsideActivityBundle\Export\Aggregator\ByActivityTypeAggregator:
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: asideactivity_activitytype_aggregator }

View File

@@ -0,0 +1,27 @@
services:
_defaults:
autowire: true
autoconfigure: true
## Indicators
Chill\AsideActivityBundle\Export\Export\CountAsideActivity:
tags:
- { name: chill.export, alias: 'count_aside_activity' }
## Filters
chill.aside_activity.export.date_filter:
class: Chill\AsideActivityBundle\Export\Filter\ByDateFilter
tags:
- { name: chill.export_filter, alias: 'aside_activity_date_filter' }
chill.aside_activity.export.type_filter:
class: Chill\AsideActivityBundle\Export\Filter\ByActivityTypeFilter
tags:
- { name: chill.export_filter, alias: 'aside_activity_type_filter' }
## Aggregators
chill.aside_activity.export.type_aggregator:
class: Chill\AsideActivityBundle\Export\Aggregator\ByActivityTypeAggregator
tags:
- { name: chill.export_aggregator, alias: activity_type_aggregator }

View File

@@ -0,0 +1,7 @@
services:
Chill\AsideActivityBundle\Security\AsideActivityVoter:
autowire: true
autoconfigure: true
tags:
- { name: security.voter }
- { name: chill.role }

View File

@@ -166,3 +166,21 @@ Aside activities: Activités annexes
Aside activity types: Types d'activités annexes
Aside activity type configuration: Configuration des categories d'activités annexes
Aside activity configuration: Configuration des activités annexes
# exports
export:
Exports of aside activities: Exports des activités annexes
Count aside activities: Nombre d'activités annexes
Count aside activities by various parameters.: Compte le nombre d'activités annexes selon divers critères
filter:
Filter by aside activity date: Filtrer les activités annexes par date
Filter by aside activity type: Filtrer les activités annexes par type d'activité
'Filtered by aside activity type: only %type%': "Filtré par type d'activité annexe: uniquement %type%"
This date should be after the date given in "Implied in an aside activity after this date" field: Cette date devrait être postérieure à la date donnée dans le champ "activités annexes après cette date"
Aside activities after this date: Actvitités annexes après cette date
Aside activities before this date: Actvitités annexes avant cette date
aggregator:
Group by aside activity type: Grouper les activités annexes par type d'activité
Aside activity type: Type d'activité annexe

View File

@@ -31,7 +31,9 @@ class ConfigRepository
public function getChargesKeys(bool $onlyActive = false): array
{
return array_map(static function ($element) { return $element['key']; }, $this->getCharges($onlyActive));
return array_map(static function ($element) {
return $element['key'];
}, $this->getCharges($onlyActive));
}
/**
@@ -50,7 +52,9 @@ class ConfigRepository
public function getResourcesKeys(bool $onlyActive = false): array
{
return array_map(static function ($element) { return $element['key']; }, $this->getResources($onlyActive));
return array_map(static function ($element) {
return $element['key'];
}, $this->getResources($onlyActive));
}
/**
@@ -70,14 +74,18 @@ class ConfigRepository
private function getCharges(bool $onlyActive = false): array
{
return $onlyActive ?
array_filter($this->charges, static function ($el) { return $el['active']; })
array_filter($this->charges, static function ($el) {
return $el['active'];
})
: $this->charges;
}
private function getResources(bool $onlyActive = false): array
{
return $onlyActive ?
array_filter($this->resources, static function ($el) { return $el['active']; })
array_filter($this->resources, static function ($el) {
return $el['active'];
})
: $this->resources;
}

View File

@@ -150,7 +150,7 @@ abstract class AbstractElement
return $this;
}
public function setHousehold(Household $household): self
public function setHousehold(?Household $household): self
{
$this->household = $household;

View File

@@ -11,8 +11,8 @@ declare(strict_types=1);
namespace Chill\BudgetBundle\Entity;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\HasCenterInterface;
use Chill\MainBundle\Entity\HasCentersInterface;
use Chill\PersonBundle\Entity\Person;
use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;
@@ -22,7 +22,7 @@ use Doctrine\ORM\Mapping as ORM;
* @ORM\Table(name="chill_budget.charge")
* @ORM\Entity(repositoryClass="Chill\BudgetBundle\Repository\ChargeRepository")
*/
class Charge extends AbstractElement implements HasCenterInterface
class Charge extends AbstractElement implements HasCentersInterface
{
public const HELP_ASKED = 'running';
@@ -46,22 +46,24 @@ class Charge extends AbstractElement implements HasCenterInterface
private $help = self::HELP_NOT_RELEVANT;
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
private ?int $id = null;
public function __construct()
{
$this->setStartDate(new DateTimeImmutable('today'));
}
public function getCenter(): ?Center
public function getCenters(): array
{
return $this->getPerson()->getCenter();
if (null !== $this->getPerson()) {
return [$this->getPerson()->getCenter()];
}
return $this->getHousehold()->getCurrentPersons()->map(static fn (Person $p) => $p->getCenter())->toArray();
}
public function getHelp()

View File

@@ -11,8 +11,8 @@ declare(strict_types=1);
namespace Chill\BudgetBundle\Entity;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\HasCenterInterface;
use Chill\MainBundle\Entity\HasCentersInterface;
use Chill\PersonBundle\Entity\Person;
use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;
@@ -22,25 +22,27 @@ use Doctrine\ORM\Mapping as ORM;
* @ORM\Table(name="chill_budget.resource")
* @ORM\Entity(repositoryClass="Chill\BudgetBundle\Repository\ResourceRepository")
*/
class Resource extends AbstractElement implements HasCenterInterface
class Resource extends AbstractElement implements HasCentersInterface
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
private ?int $id = null;
public function __construct()
{
$this->setStartDate(new DateTimeImmutable('today'));
}
public function getCenter(): ?Center
public function getCenters(): array
{
return $this->getPerson()->getCenter();
if (null !== $this->getPerson()) {
return [$this->getPerson()->getCenter()];
}
return $this->getHousehold()->getCurrentPersons()->map(static fn (Person $p) => $p->getCenter())->toArray();
}
/**

View File

@@ -20,7 +20,7 @@ use Chill\PersonBundle\Entity\Household\Household;
use Chill\PersonBundle\Entity\Person;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use function in_array;
use UnexpectedValueException;
class BudgetElementVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
{
@@ -68,12 +68,29 @@ class BudgetElementVoter extends AbstractChillVoter implements ProvideRoleHierar
protected function supports($attribute, $subject)
{
return (in_array($attribute, self::ROLES, true) && $subject instanceof AbstractElement)
|| (($subject instanceof Person || $subject instanceof Household) && in_array($attribute, [self::SEE, self::CREATE], true));
return $this->voter->supports($attribute, $subject);
}
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
{
return $this->voter->voteOnAttribute($attribute, $subject, $token);
if (
$subject instanceof Person
|| ($subject instanceof AbstractElement && null !== $person = $subject->getPerson())) {
return $this->voter->voteOnAttribute($attribute, $person ?? $subject, $token);
}
if (
$subject instanceof Household
|| ($subject instanceof AbstractElement && null !== $household = $subject->getHousehold())) {
foreach (($household ?? $subject)->getCurrentPersons() as $person) {
if ($this->voter->voteOnAttribute($attribute, $person, $token)) {
return true;
}
}
return false;
}
throw new UnexpectedValueException('This subject is not supported, or is an element not associated with person or household');
}
}

View File

@@ -61,7 +61,9 @@ class SummaryBudget implements SummaryBudgetInterface
];
}
$personIds = $household->getCurrentPersons()->map(static function (Person $p) { return $p->getId(); });
$personIds = $household->getCurrentPersons()->map(static function (Person $p) {
return $p->getId();
});
$ids = implode(', ', array_fill(0, count($personIds), '?'));
$parameters = [...$personIds, $household->getId()];

View File

@@ -15,12 +15,14 @@ use Chill\CalendarBundle\Entity\Calendar;
use Chill\CalendarBundle\Form\CalendarType;
use Chill\CalendarBundle\RemoteCalendar\Connector\RemoteCalendarConnectorInterface;
use Chill\CalendarBundle\Repository\CalendarACLAwareRepositoryInterface;
use Chill\CalendarBundle\Security\Voter\CalendarVoter;
use Chill\DocGeneratorBundle\Repository\DocGeneratorTemplateRepository;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Pagination\PaginatorFactory;
use Chill\MainBundle\Repository\UserRepositoryInterface;
use Chill\MainBundle\Templating\Listing\FilterOrderHelper;
use Chill\MainBundle\Templating\Listing\FilterOrderHelperFactoryInterface;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Repository\AccompanyingPeriodRepository;
@@ -30,6 +32,7 @@ use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use DateTimeImmutable;
use Exception;
use http\Exception\UnexpectedValueException;
use Psr\Log\LoggerInterface;
use RuntimeException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@@ -63,6 +66,8 @@ class CalendarController extends AbstractController
private SerializerInterface $serializer;
private TranslatableStringHelperInterface $translatableStringHelper;
private UserRepositoryInterface $userRepository;
public function __construct(
@@ -73,6 +78,7 @@ class CalendarController extends AbstractController
PaginatorFactory $paginator,
RemoteCalendarConnectorInterface $remoteCalendarConnector,
SerializerInterface $serializer,
TranslatableStringHelperInterface $translatableStringHelper,
PersonRepository $personRepository,
AccompanyingPeriodRepository $accompanyingPeriodRepository,
UserRepositoryInterface $userRepository
@@ -84,6 +90,7 @@ class CalendarController extends AbstractController
$this->paginator = $paginator;
$this->remoteCalendarConnector = $remoteCalendarConnector;
$this->serializer = $serializer;
$this->translatableStringHelper = $translatableStringHelper;
$this->personRepository = $personRepository;
$this->accompanyingPeriodRepository = $accompanyingPeriodRepository;
$this->userRepository = $userRepository;
@@ -146,6 +153,8 @@ class CalendarController extends AbstractController
*/
public function editAction(Calendar $entity, Request $request): Response
{
$this->denyAccessUnlessGranted(CalendarVoter::EDIT, $entity);
if (!$this->remoteCalendarConnector->isReady()) {
return $this->remoteCalendarConnector->getMakeReadyResponse($request->getUri());
}
@@ -167,8 +176,13 @@ class CalendarController extends AbstractController
$form = $this->createForm(CalendarType::class, $entity)
->add('save', SubmitType::class);
if (0 < $this->docGeneratorTemplateRepository->countByEntity(Calendar::class)) {
$form->add('save_and_create_doc', SubmitType::class);
$form->add('save_and_upload_doc', SubmitType::class);
$templates = $this->docGeneratorTemplateRepository->findByEntity(Calendar::class);
foreach ($templates as $template) {
$form->add('save_and_generate_doc_' . $template->getId(), SubmitType::class, [
'label' => $this->translatableStringHelper->localize($template->getName()),
]);
}
$form->handleRequest($request);
@@ -178,8 +192,18 @@ class CalendarController extends AbstractController
$this->addFlash('success', $this->get('translator')->trans('Success : calendar item updated!'));
if ($form->get('save_and_create_doc')->isClicked()) {
return $this->redirectToRoute('chill_calendar_calendardoc_pick_template', ['id' => $entity->getId()]);
if ($form->get('save_and_upload_doc')->isClicked()) {
return $this->redirectToRoute('chill_calendar_calendardoc_new', ['id' => $entity->getId()]);
}
foreach ($templates as $template) {
if ($form->get('save_and_generate_doc_' . $template->getId())->isClicked()) {
return $this->redirectToRoute('chill_docgenerator_generate_from_template', [
'entityClassName' => Calendar::class,
'entityId' => $entity->getId(),
'template' => $template->getId(),
]);
}
}
return new RedirectResponse($redirectRoute);
@@ -197,6 +221,7 @@ class CalendarController extends AbstractController
'accompanyingCourse' => $entity->getAccompanyingPeriod(),
'person' => $entity->getPerson(),
'entity_json' => $entity_array,
'templates' => $templates,
]);
}
@@ -207,6 +232,8 @@ class CalendarController extends AbstractController
*/
public function listActionByCourse(AccompanyingPeriod $accompanyingPeriod): Response
{
$this->denyAccessUnlessGranted(CalendarVoter::SEE, $accompanyingPeriod);
$filterOrder = $this->buildListFilterOrder();
['from' => $from, 'to' => $to] = $filterOrder->getDateRangeData('startDate');
@@ -227,7 +254,8 @@ class CalendarController extends AbstractController
'accompanyingCourse' => $accompanyingPeriod,
'paginator' => $paginator,
'filterOrder' => $filterOrder,
'hasDocs' => 0 < $this->docGeneratorTemplateRepository->countByEntity(Calendar::class),
'nbIgnored' => $this->calendarACLAwareRepository->countIgnoredByAccompanyingPeriod($accompanyingPeriod, $from, $to),
'templates' => $this->docGeneratorTemplateRepository->findByEntity(Calendar::class),
]);
}
@@ -238,6 +266,8 @@ class CalendarController extends AbstractController
*/
public function listActionByPerson(Person $person): Response
{
$this->denyAccessUnlessGranted(CalendarVoter::SEE, $person);
$filterOrder = $this->buildListFilterOrder();
['from' => $from, 'to' => $to] = $filterOrder->getDateRangeData('startDate');
@@ -258,7 +288,8 @@ class CalendarController extends AbstractController
'person' => $person,
'paginator' => $paginator,
'filterOrder' => $filterOrder,
'hasDocs' => 0 < $this->docGeneratorTemplateRepository->countByEntity(Calendar::class),
'nbIgnored' => $this->calendarACLAwareRepository->countIgnoredByPerson($person, $from, $to),
'templates' => $this->docGeneratorTemplateRepository->findByEntity(Calendar::class),
]);
}
@@ -302,11 +333,13 @@ class CalendarController extends AbstractController
$entity = new Calendar();
$redirectRoute = '';
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
$view = '@ChillCalendar/Calendar/newByAccompanyingCourse.html.twig';
$entity->setAccompanyingPeriod($accompanyingPeriod);
$redirectRoute = $this->generateUrl('chill_calendar_calendar_list_by_period', ['id' => $accompanyingPeriod->getId()]);
} elseif ($person) {
} elseif (null !== $person) {
$view = '@ChillCalendar/Calendar/newByPerson.html.twig';
$entity->setPerson($person)->addPerson($person);
$redirectRoute = $this->generateUrl('chill_calendar_calendar_list_by_person', ['id' => $person->getId()]);
@@ -316,11 +349,18 @@ class CalendarController extends AbstractController
$entity->setMainUser($this->userRepository->find($request->query->getInt('mainUser')));
}
$this->denyAccessUnlessGranted(CalendarVoter::CREATE, $entity);
$form = $this->createForm(CalendarType::class, $entity)
->add('save', SubmitType::class);
if (0 < $this->docGeneratorTemplateRepository->countByEntity(Calendar::class)) {
$form->add('save_and_create_doc', SubmitType::class);
$templates = $this->docGeneratorTemplateRepository->findByEntity(Calendar::class);
$form->add('save_and_upload_doc', SubmitType::class);
foreach ($templates as $template) {
$form->add('save_and_generate_doc_' . $template->getId(), SubmitType::class, [
'label' => $this->translatableStringHelper->localize($template->getName()),
]);
}
$form->handleRequest($request);
@@ -331,11 +371,25 @@ class CalendarController extends AbstractController
$this->addFlash('success', $this->get('translator')->trans('Success : calendar item created!'));
if ($form->get('save_and_create_doc')->isClicked()) {
return $this->redirectToRoute('chill_calendar_calendardoc_pick_template', ['id' => $entity->getId()]);
if ($form->get('save_and_upload_doc')->isClicked()) {
return $this->redirectToRoute('chill_calendar_calendardoc_new', ['id' => $entity->getId()]);
}
return new RedirectResponse($redirectRoute);
foreach ($templates as $template) {
if ($form->get('save_and_generate_doc_' . $template->getId())->isClicked()) {
return $this->redirectToRoute('chill_docgenerator_generate_from_template', [
'entityClassName' => Calendar::class,
'entityId' => $entity->getId(),
'template' => $template->getId(),
]);
}
}
if ('' !== $redirectRoute) {
return new RedirectResponse($redirectRoute);
}
throw new UnexpectedValueException('No person id or accompanying period id was given');
}
if ($form->isSubmitted() && !$form->isValid()) {
@@ -355,6 +409,7 @@ class CalendarController extends AbstractController
'entity' => $entity,
'form' => $form->createView(),
'entity_json' => $entity_array,
'templates' => $templates,
]);
}
@@ -435,6 +490,8 @@ class CalendarController extends AbstractController
*/
public function toActivity(Request $request, Calendar $calendar): RedirectResponse
{
$this->denyAccessUnlessGranted(CalendarVoter::SEE, $calendar);
$personsId = array_map(
static fn (Person $p): int => $p->getId(),
$calendar->getPersons()->toArray()

View File

@@ -12,17 +12,24 @@ declare(strict_types=1);
namespace Chill\CalendarBundle\Controller;
use Chill\CalendarBundle\Entity\Calendar;
use Chill\CalendarBundle\Security\Voter\CalendarVoter;
use Chill\CalendarBundle\Entity\CalendarDoc;
use Chill\CalendarBundle\Form\CalendarDocCreateType;
use Chill\CalendarBundle\Form\CalendarDocEditType;
use Chill\CalendarBundle\Security\Voter\CalendarDocVoter;
use Chill\DocGeneratorBundle\Repository\DocGeneratorTemplateRepository;
use RuntimeException;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Component\Templating\EngineInterface;
use UnexpectedValueException;
class CalendarDocController
{
@@ -30,53 +37,201 @@ class CalendarDocController
private EngineInterface $engine;
private EntityManagerInterface $entityManager;
private FormFactoryInterface $formFactory;
private Security $security;
private SerializerInterface $serializer;
private UrlGeneratorInterface $urlGenerator;
public function __construct(Security $security, DocGeneratorTemplateRepository $docGeneratorTemplateRepository, UrlGeneratorInterface $urlGenerator, EngineInterface $engine)
{
$this->security = $security;
public function __construct(
DocGeneratorTemplateRepository $docGeneratorTemplateRepository,
EngineInterface $engine,
EntityManagerInterface $entityManager,
FormFactoryInterface $formFactory,
Security $security,
UrlGeneratorInterface $urlGenerator
) {
$this->docGeneratorTemplateRepository = $docGeneratorTemplateRepository;
$this->urlGenerator = $urlGenerator;
$this->engine = $engine;
$this->entityManager = $entityManager;
$this->formFactory = $formFactory;
$this->security = $security;
$this->urlGenerator = $urlGenerator;
}
/**
* @Route("/{_locale}/calendar/docgen/pick/{id}", name="chill_calendar_calendardoc_pick_template")
* @Route("/{_locale}/calendar/calendar-doc/{id}/new", name="chill_calendar_calendardoc_new")
*/
public function pickTemplate(Calendar $calendar): Response
public function create(Calendar $calendar, Request $request): Response
{
if (!$this->security->isGranted(CalendarVoter::SEE, $calendar)) {
throw new AccessDeniedException('Not authorized to see this calendar');
$calendarDoc = (new CalendarDoc($calendar, null))->setCalendar($calendar);
if (!$this->security->isGranted(CalendarDocVoter::EDIT, $calendarDoc)) {
throw new AccessDeniedHttpException();
}
if (0 === $number = $this->docGeneratorTemplateRepository->countByEntity(Calendar::class)) {
throw new RuntimeException('should not be redirected to this page if no template');
// set variables
switch ($calendarDoc->getCalendar()->getContext()) {
case 'accompanying_period':
$view = '@ChillCalendar/CalendarDoc/new_accompanying_period.html.twig';
$returnRoute = 'chill_calendar_calendar_list_by_period';
$returnParams = ['id' => $calendarDoc->getCalendar()->getAccompanyingPeriod()->getId()];
break;
case 'person':
$view = '@ChillCalendar/CalendarDoc/new_person.html.twig';
$returnRoute = 'chill_calendar_calendar_list_by_person';
$returnParams = ['id' => $calendarDoc->getCalendar()->getPerson()->getId()];
break;
default:
throw new UnexpectedValueException('Unsupported context');
}
if (1 === $number) {
$templates = $this->docGeneratorTemplateRepository->findByEntity(Calendar::class);
$calendarDocDTO = new CalendarDoc\CalendarDocCreateDTO();
$form = $this->formFactory->create(CalendarDocCreateType::class, $calendarDocDTO);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$calendarDoc->createFromDTO($calendarDocDTO);
$this->entityManager->persist($calendarDoc);
$this->entityManager->flush();
if ($request->query->has('returnPath')) {
return new RedirectResponse($request->query->get('returnPath'));
}
return new RedirectResponse(
$this->urlGenerator->generate(
'chill_docgenerator_generate_from_template',
[
'template' => $templates[0]->getId(),
'entityClassName' => Calendar::class,
'entityId' => $calendar->getId(),
]
)
$this->urlGenerator->generate($returnRoute, $returnParams)
);
}
return new Response(
$this->engine->render('@ChillCalendar/CalendarDoc/pick_template.html.twig', [
'calendar' => $calendar,
'accompanyingCourse' => $calendar->getAccompanyingPeriod(),
$this->engine->render(
$view,
['calendar_doc' => $calendarDoc, 'form' => $form->createView()]
)
);
}
/**
* @Route("/{_locale}/calendar/calendar-doc/{id}/delete", name="chill_calendar_calendardoc_delete")
*/
public function delete(CalendarDoc $calendarDoc, Request $request): Response
{
if (!$this->security->isGranted(CalendarDocVoter::EDIT, $calendarDoc)) {
throw new AccessDeniedHttpException('Not authorized to delete document');
}
switch ($calendarDoc->getCalendar()->getContext()) {
case 'accompanying_period':
$view = '@ChillCalendar/CalendarDoc/delete_accompanying_period.html.twig';
$returnRoute = 'chill_calendar_calendar_list_by_period';
$returnParams = ['id' => $calendarDoc->getCalendar()->getAccompanyingPeriod()->getId()];
break;
case 'person':
$view = '@ChillCalendar/CalendarDoc/delete_person.html.twig';
$returnRoute = 'chill_calendar_calendar_list_by_person';
$returnParams = ['id' => $calendarDoc->getCalendar()->getPerson()->getId()];
break;
}
$form = $this->formFactory->createBuilder()
->add('submit', SubmitType::class, [
'label' => 'Delete',
])
->getForm();
$form->handleRequest($request);
if ($form->isSubmitted()) {
$this->entityManager->remove($calendarDoc);
$this->entityManager->flush();
if ($request->query->has('returnPath')) {
return new RedirectResponse($request->query->get('returnPath'));
}
return new RedirectResponse(
$this->urlGenerator->generate($returnRoute, $returnParams)
);
}
return new Response(
$this->engine->render(
$view,
[
'calendar_doc' => $calendarDoc,
'form' => $form->createView(),
]
)
);
}
/**
* @Route("/{_locale}/calendar/calendar-doc/{id}/edit", name="chill_calendar_calendardoc_edit")
*/
public function edit(CalendarDoc $calendarDoc, Request $request): Response
{
if (!$this->security->isGranted(CalendarDocVoter::EDIT, $calendarDoc)) {
throw new AccessDeniedHttpException();
}
// set variables
switch ($calendarDoc->getCalendar()->getContext()) {
case 'accompanying_period':
$view = '@ChillCalendar/CalendarDoc/edit_accompanying_period.html.twig';
$returnRoute = 'chill_calendar_calendar_list_by_period';
$returnParams = ['id' => $calendarDoc->getCalendar()->getAccompanyingPeriod()->getId()];
break;
case 'person':
$view = '@ChillCalendar/CalendarDoc/edit_person.html.twig';
$returnRoute = 'chill_calendar_calendar_list_by_person';
$returnParams = ['id' => $calendarDoc->getCalendar()->getPerson()->getId()];
break;
default:
throw new UnexpectedValueException('Unsupported context');
}
$calendarDocEditDTO = new CalendarDoc\CalendarDocEditDTO($calendarDoc);
$form = $this->formFactory->create(CalendarDocEditType::class, $calendarDocEditDTO);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$calendarDoc->editFromDTO($calendarDocEditDTO);
$this->entityManager->flush();
if ($request->query->has('returnPath')) {
return new RedirectResponse($request->query->get('returnPath'));
}
return new RedirectResponse(
$this->urlGenerator->generate($returnRoute, $returnParams)
);
}
return new Response(
$this->engine->render(
$view,
['calendar_doc' => $calendarDoc, 'form' => $form->createView()]
)
);
}
}

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\CalendarBundle\DependencyInjection;
use Chill\CalendarBundle\Security\Voter\CalendarVoter;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
@@ -52,9 +53,10 @@ class ChillCalendarExtension extends Extension implements PrependExtensionInterf
{
$this->preprendRoutes($container);
$this->prependCruds($container);
$this->prependRoleHierarchy($container);
}
protected function prependCruds(ContainerBuilder $container)
private function prependCruds(ContainerBuilder $container)
{
$container->prependExtensionConfig('chill_main', [
'cruds' => [
@@ -130,7 +132,18 @@ class ChillCalendarExtension extends Extension implements PrependExtensionInterf
]);
}
protected function preprendRoutes(ContainerBuilder $container)
private function prependRoleHierarchy(ContainerBuilder $container): void
{
$container->prependExtensionConfig('security', [
'role_hierarchy' => [
CalendarVoter::CREATE => [CalendarVoter::SEE],
CalendarVoter::EDIT => [CalendarVoter::SEE],
CalendarVoter::DELETE => [CalendarVoter::SEE],
],
]);
}
private function preprendRoutes(ContainerBuilder $container)
{
$container->prependExtensionConfig('chill_main', [
'routing' => [

View File

@@ -18,6 +18,7 @@ use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable;
use Chill\MainBundle\Entity\HasCentersInterface;
use Chill\MainBundle\Entity\Location;
use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
@@ -48,7 +49,7 @@ use function in_array;
* "chill_calendar_calendar": Calendar::class
* })
*/
class Calendar implements TrackCreationInterface, TrackUpdateInterface
class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCentersInterface
{
use RemoteCalendarTrait;
@@ -312,6 +313,20 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
return $this->cancelReason;
}
public function getCenters(): ?iterable
{
switch ($this->getContext()) {
case 'person':
return [$this->getPerson()->getCenter()];
case 'accompanying_period':
return $this->getAccompanyingPeriod()->getCenters();
default:
throw new LogicException('context not supported: ' . $this->getContext());
}
}
public function getComment(): CommentEmbeddable
{
return $this->comment;

View File

@@ -11,6 +11,8 @@ declare(strict_types=1);
namespace Chill\CalendarBundle\Entity;
use Chill\CalendarBundle\Entity\CalendarDoc\CalendarDocCreateDTO;
use Chill\CalendarBundle\Entity\CalendarDoc\CalendarDocEditDTO;
use Chill\DocStoreBundle\Entity\StoredObject;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
@@ -52,14 +54,14 @@ class CalendarDoc implements TrackCreationInterface, TrackUpdateInterface
* @ORM\ManyToOne(targetEntity=StoredObject::class, cascade={"persist"})
* @ORM\JoinColumn(nullable=false)
*/
private StoredObject $storedObject;
private ?StoredObject $storedObject;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default": false})
*/
private bool $trackDateTimeVersion = false;
public function __construct(Calendar $calendar, StoredObject $storedObject)
public function __construct(Calendar $calendar, ?StoredObject $storedObject)
{
$this->setCalendar($calendar);
@@ -67,6 +69,22 @@ class CalendarDoc implements TrackCreationInterface, TrackUpdateInterface
$this->datetimeVersion = $calendar->getDateTimeVersion();
}
public function createFromDTO(CalendarDocCreateDTO $calendarDocCreateDTO): void
{
$this->storedObject = $calendarDocCreateDTO->doc;
$this->storedObject->setTitle($calendarDocCreateDTO->title);
}
public function editFromDTO(CalendarDocEditDTO $calendarDocEditDTO): void
{
if (null !== $calendarDocEditDTO->doc) {
$calendarDocEditDTO->doc->setTitle($this->getStoredObject()->getTitle());
$this->setStoredObject($calendarDocEditDTO->doc);
}
$this->getStoredObject()->setTitle($calendarDocEditDTO->title);
}
public function getCalendar(): Calendar
{
return $this->calendar;

View File

@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CalendarBundle\Entity\CalendarDoc;
use Chill\DocStoreBundle\Entity\StoredObject;
use Symfony\Component\Validator\Constraints as Assert;
class CalendarDocCreateDTO
{
/**
* @Assert\NotNull
* @Assert\Valid
*/
public ?StoredObject $doc = null;
/**
* @Assert\NotBlank
* @Assert\NotNull
*/
public ?string $title = '';
}

View File

@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CalendarBundle\Entity\CalendarDoc;
use Chill\CalendarBundle\Entity\CalendarDoc;
use Chill\DocStoreBundle\Entity\StoredObject;
use Symfony\Component\Validator\Constraints as Assert;
class CalendarDocEditDTO
{
/**
* @Assert\Valid
*/
public ?StoredObject $doc = null;
/**
* @Assert\NotBlank
* @Assert\NotNull
*/
public ?string $title = '';
public function __construct(CalendarDoc $calendarDoc)
{
$this->title = $calendarDoc->getStoredObject()->getTitle();
}
}

View File

@@ -13,15 +13,21 @@ namespace Chill\CalendarBundle\Export\Filter;
use Chill\CalendarBundle\Export\Declarations;
use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Form\Type\ChillDateType;
use DateTime;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Query\Expr\Andx;
use Chill\MainBundle\Form\Type\PickRollingDateType;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
class BetweenDatesFilter implements FilterInterface
{
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(RollingDateConverterInterface $rollingDateConverter)
{
$this->rollingDateConverter = $rollingDateConverter;
}
public function addRole(): ?string
{
return null;
@@ -29,23 +35,21 @@ class BetweenDatesFilter implements FilterInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$where = $qb->getDQLPart('where');
$clause = $qb->expr()->andX(
$qb->expr()->gte('cal.startDate', ':dateFrom'),
$qb->expr()->lte('cal.endDate', ':dateTo')
);
if ($where instanceof Andx) {
$where->add($clause);
} else {
$where = $qb->expr()->andX($clause);
}
$qb->add('where', $where);
$qb->setParameter('dateFrom', $data['date_from'], Types::DATE_MUTABLE);
$qb->andWhere($clause);
$qb->setParameter(
'dateFrom',
$this->rollingDateConverter->convert($data['date_from'])
);
// modify dateTo so that entire day is also taken into account up until the beginning of the next day.
$qb->setParameter('dateTo', $data['date_to']->modify('+1 day'), Types::DATE_MUTABLE);
$qb->setParameter(
'dateTo',
$this->rollingDateConverter->convert($data['date_to'])->modify('+1 day')
);
}
public function applyOn(): string
@@ -56,19 +60,19 @@ class BetweenDatesFilter implements FilterInterface
public function buildForm(FormBuilderInterface $builder)
{
$builder
->add('date_from', ChillDateType::class, [
'data' => new DateTime(),
->add('date_from', PickRollingDateType::class, [
'data' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START),
])
->add('date_to', ChillDateType::class, [
'data' => new DateTime(),
->add('date_to', PickRollingDateType::class, [
'data' => new RollingDate(RollingDate::T_TODAY),
]);
}
public function describeAction($data, $format = 'string'): array
{
return ['Filtered by calendars between %dateFrom% and %dateTo%', [
'%dateFrom%' => $data['date_from']->format('d-m-Y'),
'%dateTo%' => $data['date_to']->format('d-m-Y'),
'%dateFrom%' => $this->rollingDateConverter->convert($data['date_from'])->format('d-m-Y'),
'%dateTo%' => $this->rollingDateConverter->convert($data['date_to'])->format('d-m-Y'),
]];
}

View File

@@ -0,0 +1,42 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CalendarBundle\Form;
use Chill\CalendarBundle\Entity\CalendarDoc\CalendarDocCreateDTO;
use Chill\DocStoreBundle\Form\StoredObjectType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class CalendarDocCreateType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('title', TextType::class, [
'label' => 'chill_calendar.Document title',
'required' => true,
])
->add('doc', StoredObjectType::class, [
'label' => 'chill_calendar.Document object',
'required' => true,
]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => CalendarDocCreateDTO::class,
]);
}
}

View File

@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CalendarBundle\Form;
use Chill\CalendarBundle\Entity\CalendarDoc\CalendarDocEditDTO;
use Chill\DocStoreBundle\Form\StoredObjectType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class CalendarDocEditType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('title', TextType::class, [
'label' => 'chill_calendar.Document title',
'required' => true,
])
->add('doc', StoredObjectType::class, [
'label' => 'chill_calendar.Document object',
]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => CalendarDocEditDTO::class,
]);
}
}

View File

@@ -64,31 +64,38 @@ class CalendarACLAwareRepository implements CalendarACLAwareRepositoryInterface
return $qb;
}
public function buildQueryByAccompanyingPeriodIgnoredByDates(AccompanyingPeriod $period, ?DateTimeImmutable $startDate, ?DateTimeImmutable $endDate): QueryBuilder
{
$qb = $this->em->createQueryBuilder();
$qb->from(Calendar::class, 'c');
$andX = $qb->expr()->andX($qb->expr()->eq('c.accompanyingPeriod', ':period'));
$qb->setParameter('period', $period);
if (null !== $startDate) {
$andX->add($qb->expr()->lt('c.startDate', ':startDate'));
$qb->setParameter('startDate', $startDate);
}
if (null !== $endDate) {
$andX->add($qb->expr()->gt('c.endDate', ':endDate'));
$qb->setParameter('endDate', $endDate);
}
$qb->where($andX);
return $qb;
}
/**
* Base implementation. The list of allowed accompanying period is retrieved "manually" from @see{AccompanyingPeriodACLAwareRepository}.
*/
public function buildQueryByPerson(Person $person, ?DateTimeImmutable $startDate, ?DateTimeImmutable $endDate): QueryBuilder
{
// find the reachable accompanying periods for person
$periods = $this->accompanyingPeriodACLAwareRepository->findByPerson($person, AccompanyingPeriodVoter::SEE);
$qb = $this->em->createQueryBuilder()
->from(Calendar::class, 'c');
$qb
->where(
$qb->expr()->orX(
// the calendar where the person is the main person:
$qb->expr()->eq('c.person', ':person'),
// when the calendar is in a reachable period, and contains person
$qb->expr()->andX(
$qb->expr()->in('c.accompanyingPeriod', ':periods'),
$qb->expr()->isMemberOf(':person', 'c.persons')
)
)
)
->setParameter('person', $person)
->setParameter('periods', $periods);
$this->addQueryByPersonWithoutDate($qb, $person);
// filter by date
if (null !== $startDate) {
@@ -104,6 +111,30 @@ class CalendarACLAwareRepository implements CalendarACLAwareRepositoryInterface
return $qb;
}
/**
* Base implementation. The list of allowed accompanying period is retrieved "manually" from @see{AccompanyingPeriodACLAwareRepository}.
*/
public function buildQueryByPersonIgnoredByDates(Person $person, ?DateTimeImmutable $startDate, ?DateTimeImmutable $endDate): QueryBuilder
{
$qb = $this->em->createQueryBuilder()
->from(Calendar::class, 'c');
$this->addQueryByPersonWithoutDate($qb, $person);
// filter by date
if (null !== $startDate) {
$qb->andWhere($qb->expr()->lt('c.startDate', ':startDate'))
->setParameter('startDate', $startDate);
}
if (null !== $endDate) {
$qb->andWhere($qb->expr()->gt('c.endDate', ':endDate'))
->setParameter('endDate', $endDate);
}
return $qb;
}
public function countByAccompanyingPeriod(AccompanyingPeriod $period, ?DateTimeImmutable $startDate, ?DateTimeImmutable $endDate): int
{
$qb = $this->buildQueryByAccompanyingPeriod($period, $startDate, $endDate)->select('count(c)');
@@ -119,6 +150,21 @@ class CalendarACLAwareRepository implements CalendarACLAwareRepositoryInterface
->getSingleScalarResult();
}
public function countIgnoredByAccompanyingPeriod(AccompanyingPeriod $period, ?DateTimeImmutable $startDate, ?DateTimeImmutable $endDate): int
{
$qb = $this->buildQueryByAccompanyingPeriodIgnoredByDates($period, $startDate, $endDate)->select('count(c)');
return $qb->getQuery()->getSingleScalarResult();
}
public function countIgnoredByPerson(Person $person, ?DateTimeImmutable $startDate, ?DateTimeImmutable $endDate): int
{
return $this->buildQueryByPersonIgnoredByDates($person, $startDate, $endDate)
->select('COUNT(c)')
->getQuery()
->getSingleScalarResult();
}
/**
* @return array|Calendar[]
*/
@@ -160,4 +206,25 @@ class CalendarACLAwareRepository implements CalendarACLAwareRepositoryInterface
return $qb->getQuery()->getResult();
}
private function addQueryByPersonWithoutDate(QueryBuilder $qb, Person $person): void
{
// find the reachable accompanying periods for person
$periods = $this->accompanyingPeriodACLAwareRepository->findByPerson($person, AccompanyingPeriodVoter::SEE);
$qb
->where(
$qb->expr()->orX(
// the calendar where the person is the main person:
$qb->expr()->eq('c.person', ':person'),
// when the calendar is in a reachable period, and contains person
$qb->expr()->andX(
$qb->expr()->in('c.accompanyingPeriod', ':periods'),
$qb->expr()->isMemberOf(':person', 'c.persons')
)
)
)
->setParameter('person', $person)
->setParameter('periods', $periods);
}
}

View File

@@ -32,6 +32,18 @@ interface CalendarACLAwareRepositoryInterface
*/
public function countByPerson(Person $person, ?DateTimeImmutable $startDate, ?DateTimeImmutable $endDate): int;
/**
* Return the number or calendars associated with an accompanyign period which **does not** match the date conditions.
*/
public function countIgnoredByAccompanyingPeriod(AccompanyingPeriod $period, ?DateTimeImmutable $startDate, ?DateTimeImmutable $endDate): int;
/**
* Return the number or calendars associated with a person which **does not** match the date conditions.
*
* See condition on @see{self::findByPerson}.
*/
public function countIgnoredByPerson(Person $person, ?DateTimeImmutable $startDate, ?DateTimeImmutable $endDate): int;
/**
* @return array|Calendar[]
*/

View File

@@ -70,7 +70,7 @@
</div>
</div>
<FullCalendar :options="calendarOptions" ref="calendarRef">
<template v-slot:eventContent="arg">
<template v-slot:eventContent="arg: EventApi">
<span :class="eventClasses(arg.event)">
<b v-if="arg.event.extendedProps.is === 'remote'">{{ arg.event.title}}</b>
<b v-else-if="arg.event.extendedProps.is === 'range'">{{ arg.timeText }} - {{ arg.event.extendedProps.locationName }}</b>
@@ -138,7 +138,6 @@ const store = useStore(key);
const {t} = useI18n();
const calendarRef = ref();
const showWeekends = ref(false);
const slotDuration = ref('00:05:00');
const slotMinTime = ref('09:00:00');
@@ -164,41 +163,10 @@ const baseOptions = ref<CalendarOptions>({
eventDrop: onEventDropOrResize,
// when an event si clicked
eventClick: onEventClick,
/* eventContent: function(arg) {
let spanEvent = document.createElement('span')
let rangeEvent = document.createElement('b')
// spanEvent.classList.add(eventClasses(arg.event))
if (arg.event.extendedProps.is === 'remote') {
spanEvent.innerHTML = `<b>${arg.event.title}</b>`
} else if(arg.event.extendedProps.is === 'range') {
spanEvent.innerHTML = `<b>${arg.timeText} - ${arg.event.extendedProps.locationName}</b>
<a class="fa fa-fw fa-times delete"></a>`
} else if(arg.event.extendedProps.is === 'local') {
spanEvent.innerHTML = `<b>${arg.event.title}</b>`
}
let arrayOfDomNodes = [ spanEvent ]
return { domNodes: arrayOfDomNodes }
},*/
selectMirror: false,
editable: true,
customButtons: {
prevWeek: {
text: '<',
click: function() {
navigate('prev')
}
},
nextWeek: {
text: '>',
click: function() {
navigate('next')
}
}
},
headerToolbar: {
left: 'prevWeek,nextWeek today',
left: 'prev,next today',
center: 'title',
right: 'timeGridWeek,timeGridDay'
},
@@ -277,43 +245,16 @@ function onDateSelect(event: DateSelectArg): void {
store.dispatch('calendarRanges/createRange', {start: event.start, end: event.end, location: pickedLocation.value});
}
function navigate(direction: string) {
const viewType = calendarRef.value.getApi().view.type;
const currentStart = store.state.fullCalendar.currentView.start;
const currentEnd = store.state.fullCalendar.currentView.end;
let newDates = {};
if (currentStart != null && currentEnd != null) {
let daysBetween = (currentEnd?.getTime() - currentStart?.getTime())/(1000 * 60 * 60 * 24);
if (daysBetween === 5) {
daysBetween = 7;
}
if (direction === 'prev') {
newDates = {
start: new Date(new Date(currentStart).setDate(currentStart.getDate() - daysBetween)),
end: new Date(new Date(currentEnd).setDate(currentEnd.getDate() - daysBetween))
}
} else if (direction === 'next') {
console.log(daysBetween);
newDates = {
start: new Date(new Date(currentStart).setDate(currentStart.getDate() + daysBetween)),
end: new Date(new Date(currentEnd).setDate(currentEnd.getDate() + daysBetween))
}
console.log(newDates);
}
}
store.dispatch('fullCalendar/setCurrentDatesView', newDates);
calendarRef.value.getApi().changeView('timeGrid', newDates);
}
/**
* When a calendar range is deleted
*/
function onClickDelete(event: EventApi): void {
console.log('onClickDelete', event);
if (event.extendedProps.is !== 'range') {
return;
}
store.dispatch('calendarRanges/deleteRange', event.extendedProps.calendarRangeId);
}

View File

@@ -7,7 +7,7 @@ import App2 from './App2.vue';
import {useI18n} from "vue-i18n";
futureStore().then((store) => {
const i18n = _createI18n(appMessages, true);
const i18n = _createI18n(appMessages, false);
const app = createApp({
template: `<app></app>`,

View File

@@ -31,6 +31,7 @@ export default {
},
actions: {
setCurrentDatesView(ctx: Context, {start, end}: {start: Date|null, end: Date|null}): Promise<null> {
console.log('dispatch setCurrentDatesView', {start, end});
if (ctx.state.currentView.start !== start || ctx.state.currentView.end !== end) {
ctx.commit('setCurrentDatesView', {start, end});

View File

@@ -3,11 +3,6 @@
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
<style lang="css">
--bs-btn-padding-y: .25rem; --bs-btn-padding-x: .5rem; --bs-btn-font-size: .75rem;
</style>
<div class="accompanying_course_work-list">
<table class="obj-res-eval my-3">
<thead>
@@ -17,27 +12,40 @@
</thead>
<tbody>
{% for d in calendar.documents %}
<tr>
<td class="eval">
<ul class="eval_title">
<li>
{{ mm.mimeIcon(d.storedObject.type) }}
{{ d.storedObject.title }}
<ul class="record_actions small inline">
{% if chill_document_is_editable(d.storedObject) %}
<li>
{{ d.storedObject|chill_document_edit_button }}
</li>
{% endif %}
{% if is_granted('CHILL_CALENDAR_DOC_SEE', d) %}
<tr>
<td class="eval">
<ul class="eval_title">
<li>
{{ m.download_button(d.storedObject, d.storedObject.title) }}
{{ mm.mimeIcon(d.storedObject.type) }}
{{ d.storedObject.title }}
{% if d.dateTimeVersion < d.calendar.dateTimeVersion %}
<span class="badge bg-danger">{{ 'chill_calendar.Document outdated'|trans }}</span>
{% endif %}
<ul class="record_actions small inline">
{% if chill_document_is_editable(d.storedObject) and is_granted('CHILL_CALENDAR_DOC_EDIT', d) %}
<li>
<a href="{{ chill_path_add_return_path('chill_calendar_calendardoc_delete', {'id': d.id})}}" class="btn btn-delete"></a>
</li>
<li>
{{ d.storedObject|chill_document_edit_button }}
</li>
{% endif %}
{% if is_granted('CHILL_CALENDAR_DOC_EDIT', d) %}
<li>
<a href="{{ chill_path_add_return_path('chill_calendar_calendardoc_edit', {'id': d.id})}}" class="btn btn-edit"></a>
</li>
{% endif %}
<li>
{{ m.download_button(d.storedObject, d.storedObject.title) }}
</li>
</ul>
</li>
</ul>
</li>
</ul>
</td>
</tr>
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>

View File

@@ -1,7 +1,5 @@
{# list used in context of person or accompanyingPeriod #}
{{ filterOrder|chill_render_filter_order_helper }}
{% if calendarItems|length > 0 %}
<div class="flex-table list-records context-accompanyingCourse">
@@ -114,13 +112,40 @@
<div class="item-row">
<ul class="record_actions">
{% if is_granted('CHILL_CALENDAR_CALENDAR_SEE', calendar) and hasDocs %}
<li>
<a class="btn btn-create"
href="{{ chill_path_add_return_path('chill_calendar_calendardoc_pick_template', {'id': calendar.id }) }}">
{{ 'chill_calendar.Add a document'|trans }}
</a>
</li>
{% if is_granted('CHILL_CALENDAR_CALENDAR_SEE', calendar) %}
{% if templates|length == 0 %}
<li>
<a class="btn btn-create"
href="{{ chill_path_add_return_path('chill_calendar_calendardoc_new', {'id': calendar.id }) }}">
{{ 'chill_calendar.Add a document'|trans }}
</a>
</li>
{% else %}
<li>
<div class="dropdown">
<button class="btn btn-create dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
{{ 'chill_calendar.Add a document'|trans }}
</button>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item"
href="{{ chill_path_add_return_path('chill_calendar_calendardoc_new', {'id': calendar.id }) }}">
{{ 'chill_calendar.Upload a document'|trans }}
</a>
</li>
{% for template in templates %}
<li>
<a class="dropdown-item"
href="{{ chill_path_add_return_path('chill_docgenerator_generate_from_template', {'template': template.id, 'entityClassName': 'Chill\\CalendarBundle\\Entity\\Calendar', 'entityId': calendar.id}) }}"
>
{{ template.name|localize_translatable_string }}
</a>
</li>
{% endfor %}
</ul>
</div>
</li>
{% endif %}
{% endif %}
{% if accompanyingCourse is defined and is_granted('CHILL_ACTIVITY_CREATE', accompanyingCourse) and calendar.activity is null %}
<li>

View File

@@ -77,9 +77,26 @@
{{ 'Cancel'|trans|chill_return_path_label }}
</a>
</li>
{% if form.save_and_create_doc is defined %}
{% if templates|length == 0 %}
<li>
{{ form_widget(form.save_and_create_doc, { 'attr' : { 'class' : 'btn btn-create' }, 'label': 'chill_calendar.Save and add a document'|trans }) }}
{{ form_widget(form.save_and_upload_doc, { 'attr' : { 'class' : 'btn btn-create' }, 'label': 'chill_calendar.Create and add a document'|trans }) }}
</li>
{% else %}
<li>
<div class="dropdown">
<button class="btn btn-create dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
{{ 'chill_calendar.Add a document'|trans }}
</button>
<ul class="dropdown-menu">
<li>
{{ form_widget(form.save_and_upload_doc, { 'attr' : { 'class' : 'dropdown-item' }, 'label': 'chill_calendar.Upload a document'|trans }) }}
</li>
{% for template in templates %}
{{ form_widget(form['save_and_generate_doc_' ~ template.id ], {'attr' : { 'class' : 'dropdown-item'}}) }}
{% endfor %}
</ul>
</div>
</li>
{% endif %}
<li>

View File

@@ -23,11 +23,15 @@
<h1>{{ 'Calendar list' |trans }}</h1>
{{ filterOrder|chill_render_filter_order_helper }}
{% if calendarItems|length == 0 %}
<p class="chill-no-data-statement">
{{ "There is no calendar items."|trans }}
<a href="{{ path('chill_calendar_calendar_new', {'user_id': user_id, 'accompanying_period_id': accompanying_course_id}) }}"
class="btn btn-create button-small"></a>
{% if nbIgnored == 0 %}
{{ "There is no calendar items."|trans }}
{% else %}
{{ 'chill_calendar.There are count ignored calendars by date filter'|trans({'nbIgnored': nbIgnored}) }}
{% endif %}
</p>
{% else %}
{{ include('@ChillCalendar/Calendar/_list.html.twig', {context: 'accompanying_course'}) }}

View File

@@ -22,13 +22,15 @@
<h1>{{ 'Calendar list' |trans }}</h1>
{{ filterOrder|chill_render_filter_order_helper }}
{% if calendarItems|length == 0 %}
<p class="chill-no-data-statement">
{{ "There is no calendar items."|trans }}
<a href="{{ path('chill_calendar_calendar_new', {'user_id': user_id, 'person_id': person.id}) }}"
class="btn btn-create btn-sm">
{{ 'Create'|trans }}
</a>
{% if nbIgnored == 0 %}
{{ "There is no calendar items."|trans }}
{% else %}
{{ 'chill_calendar.There are count ignored calendars by date filter'|trans({'nbIgnored': nbIgnored}) }}
{% endif %}
</p>
{% else %}
{{ include ('@ChillCalendar/Calendar/_list.html.twig', {context: 'person'}) }}

View File

@@ -77,10 +77,27 @@
{{ 'Cancel'|trans|chill_return_path_label }}
</a>
</li>
{% if form.save_and_create_doc is defined %}
{% if templates|length == 0 %}
<li>
{{ form_widget(form.save_and_create_doc, { 'attr' : { 'class' : 'btn btn-create' }, 'label': 'chill_calendar.Create and add a document'|trans }) }}
{{ form_widget(form.save_and_upload_doc, { 'attr' : { 'class' : 'btn btn-create' }, 'label': 'chill_calendar.Create and add a document'|trans }) }}
</li>
{% else %}
<li>
<div class="dropdown">
<button class="btn btn-create dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
{{ 'chill_calendar.Add a document'|trans }}
</button>
<ul class="dropdown-menu">
<li>
{{ form_widget(form.save_and_upload_doc, { 'attr' : { 'class' : 'dropdown-item' }, 'label': 'chill_calendar.Upload a document'|trans }) }}
</li>
{% for template in templates %}
{{ form_widget(form['save_and_generate_doc_' ~ template.id ], {'attr' : { 'class' : 'dropdown-item'}}) }}
{% endfor %}
</ul>
</div>
</li>
{% endif %}
<li>
{{ form_widget(form.save, { 'attr' : { 'class' : 'btn btn-create' }, 'label': 'Create'|trans }) }}

View File

@@ -0,0 +1,19 @@
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
{% set activeRouteKey = 'chill_calendar_calendar_list' %}
{% block title %}{{ 'chill_calendar.Remove a calendar document' |trans }}{% endblock title %}
{% set accompanyingCourse = calendar_doc.calendar.accompanyingPeriod %}
{% set accompanyingCourseId = accompanyingCourse.id %}
{% block content %}
{{ include('@ChillMain/Util/confirmation_template.html.twig',
{
'title' : 'chill_calendar.Remove a calendar document'|trans,
'confirm_question' : 'chill_calendar.Are you sure you want to remove the doc?'|trans,
'cancel_route' : 'chill_calendar_calendar_list_by_period',
'cancel_parameters' : { 'id' : accompanyingCourse.id },
'form' : form
} ) }}
{% endblock %}

View File

@@ -0,0 +1,18 @@
{% extends "@ChillPerson/Person/layout.html.twig" %}
{% set activeRouteKey = 'chill_calendar_calendar_list' %}
{% block title %}{{ 'chill_calendar.Edit a document' |trans }}{% endblock title %}
{% set person = calendar_doc.calendar.person %}
{% block content %}
{{ include('@ChillMain/Util/confirmation_template.html.twig',
{
'title' : 'chill_calendar.Remove a calendar document'|trans,
'confirm_question' : 'chill_calendar.Are you sure you want to remove the doc?'|trans,
'cancel_route' : 'chill_calendar_calendar_list_by_person',
'cancel_parameters' : { 'id' : person.id },
'form' : form
} ) }}
{% endblock %}

View File

@@ -0,0 +1,40 @@
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
{% set activeRouteKey = 'chill_calendar_calendar_list' %}
{% block title %}{{ 'chill_calendar.Edit a document' |trans }}{% endblock title %}
{% set accompanyingCourse = calendar_doc.calendar.accompanyingPeriod %}
{% set accompanyingCourseId = accompanyingCourse.id %}
{% block js %}
{{ parent() }}
{{ encore_entry_script_tags('mod_async_upload') }}
{% endblock %}
{% block css %}
{{ parent() }}
{{ encore_entry_link_tags('mod_async_upload') }}
{% endblock %}
{% block content %}
<h1>{{ 'chill_calendar.Edit a document'|trans }}</h1>
{{ form_start(form) }}
{{ form_row(form.title) }}
{{ form_row(form.doc) }}
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_calendar_calendar_list_by_accompanying_period', {'id': accompanyingCourse.id }) }}">{{ 'Cancel'|trans|chill_return_path_label }}</a>
</li>
<li>
<button class="btn btn-save" type="submit">{{ 'Save'|trans }}</button>
</li>
</ul>
{{ form_end(form) }}
{% endblock %}

View File

@@ -0,0 +1,39 @@
{% extends "@ChillPerson/Person/layout.html.twig" %}
{% set activeRouteKey = 'chill_calendar_calendar_list' %}
{% block title %}{{ 'chill_calendar.Edit a document' |trans }}{% endblock title %}
{% set person = calendar_doc.calendar.person %}
{% block js %}
{{ parent() }}
{{ encore_entry_script_tags('mod_async_upload') }}
{% endblock %}
{% block css %}
{{ parent() }}
{{ encore_entry_link_tags('mod_async_upload') }}
{% endblock %}
{% block content %}
<h1>{{ 'chill_calendar.Edit a document'|trans }}</h1>
{{ form_start(form) }}
{{ form_row(form.title) }}
{{ form_row(form.doc) }}
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_calendar_calendar_list_by_person', {'id': person.id }) }}">{{ 'Cancel'|trans|chill_return_path_label }}</a>
</li>
<li>
<button class="btn btn-save" type="submit">{{ 'Save'|trans }}</button>
</li>
</ul>
{{ form_end(form) }}
{% endblock %}

View File

@@ -0,0 +1,40 @@
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
{% set activeRouteKey = 'chill_calendar_calendar_list' %}
{% block title %}{{ 'chill_calendar.Add a document' |trans }}{% endblock title %}
{% set accompanyingCourse = calendar_doc.calendar.accompanyingPeriod %}
{% set accompanyingCourseId = accompanyingCourse.id %}
{% block js %}
{{ parent() }}
{{ encore_entry_script_tags('mod_async_upload') }}
{% endblock %}
{% block css %}
{{ parent() }}
{{ encore_entry_link_tags('mod_async_upload') }}
{% endblock %}
{% block content %}
<h1>{{ 'chill_calendar.Add a document'|trans }}</h1>
{{ form_start(form) }}
{{ form_row(form.title) }}
{{ form_row(form.doc) }}
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_calendar_calendar_list_by_accompanying_period', {'id': accompanyingCourse.id }) }}">{{ 'Cancel'|trans|chill_return_path_label }}</a>
</li>
<li>
<button class="btn btn-save" type="submit">{{ 'Save'|trans }}</button>
</li>
</ul>
{{ form_end(form) }}
{% endblock %}

View File

@@ -0,0 +1,39 @@
{% extends "@ChillPerson/Person/layout.html.twig" %}
{% set activeRouteKey = 'chill_calendar_calendar_list' %}
{% block title %}{{ 'chill_calendar.Add a document' |trans }}{% endblock title %}
{% set person = calendar_doc.calendar.person %}
{% block js %}
{{ parent() }}
{{ encore_entry_script_tags('mod_async_upload') }}
{% endblock %}
{% block css %}
{{ parent() }}
{{ encore_entry_link_tags('mod_async_upload') }}
{% endblock %}
{% block content %}
<h1>{{ 'chill_calendar.Add a document'|trans }}</h1>
{{ form_start(form) }}
{{ form_row(form.title) }}
{{ form_row(form.doc) }}
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_calendar_calendar_list_by_person', {'id': person.id }) }}">{{ 'Cancel'|trans|chill_return_path_label }}</a>
</li>
<li>
<button class="btn btn-save" type="submit">{{ 'Save'|trans }}</button>
</li>
</ul>
{{ form_end(form) }}
{% endblock %}

View File

@@ -1,24 +0,0 @@
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
{% set activeRouteKey = 'chill_calendar_calendar_list' %}
{% block title %}{{ 'chill_calendar.Add a document' |trans }}{% endblock title %}
{% set user_id = null %}
{% set accompanying_course_id = accompanyingCourse.id %}
{% block js %}
{{ parent() }}
{{ encore_entry_script_tags('mod_docgen_picktemplate') }}
{% endblock %}
{% block css %}
{{ parent() }}
{{ encore_entry_link_tags('mod_docgen_picktemplate') }}
{% endblock %}
{% block content %}
<div data-docgen-template-picker="data-docgen-template-picker" data-entity-id="{{ calendar.id }}" data-entity-class="{{ 'Chill\\CalendarBundle\\Entity\\Calendar'|e('html_attr') }}"></div>
{% endblock %}

View File

@@ -1 +1 @@
Votre travailleur social {{ calendar.mainUser.label }} vous rencontrera le {{ calendar.startDate|format_date('short', locale='fr') }} à {{ calendar.startDate|format_time('short', locale='fr') }} - LIEU.{% if calendar.mainUser.mainLocation is not null and calendar.mainUser.mainLocation.phonenumber1 is not null %} En cas d'indisponibilité, appelez-nous au {{ calendar.mainUser.mainLocation.phonenumber1|chill_format_phonenumber }}.{% endif %}
Votre travailleur social {{ calendar.mainUser.label }} vous rencontrera le {{ calendar.startDate|format_date('short', locale='fr') }} à {{ calendar.startDate|format_time('short', locale='fr') }} - {% if calendar.location is not null%}{{ calendar.location.name }}{% endif %}{% if calendar.mainUser.mainLocation is not null and calendar.mainUser.mainLocation.phonenumber1 is not null %} En cas d'indisponibilité, appelez-nous au {{ calendar.mainUser.mainLocation.phonenumber1|chill_format_phonenumber }}.{% endif %}

View File

@@ -0,0 +1,61 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CalendarBundle\Security\Voter;
use Chill\CalendarBundle\Entity\CalendarDoc;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
use Symfony\Component\Security\Core\Security;
use UnexpectedValueException;
use function in_array;
class CalendarDocVoter extends Voter
{
public const EDIT = 'CHILL_CALENDAR_DOC_EDIT';
public const SEE = 'CHILL_CALENDAR_DOC_SEE';
private const ALL = [
'CHILL_CALENDAR_DOC_EDIT',
'CHILL_CALENDAR_DOC_SEE',
];
private Security $security;
public function __construct(Security $security)
{
$this->security = $security;
}
protected function supports($attribute, $subject): bool
{
return in_array($attribute, self::ALL, true) && $subject instanceof CalendarDoc;
}
/**
* @param CalendarDoc $subject
* @param mixed $attribute
*/
protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
{
switch ($attribute) {
case self::EDIT:
return $this->security->isGranted(CalendarVoter::EDIT, $subject->getCalendar());
case self::SEE:
return $this->security->isGranted(CalendarVoter::SEE, $subject->getCalendar());
default:
throw new UnexpectedValueException('Attribute not supported: ' . $attribute);
}
}
}

View File

@@ -20,13 +20,14 @@ namespace Chill\CalendarBundle\Security\Voter;
use Chill\CalendarBundle\Entity\Calendar;
use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
use Chill\MainBundle\Security\Authorization\VoterHelperFactoryInterface;
use Chill\MainBundle\Security\Authorization\VoterHelperInterface;
use Chill\MainBundle\Security\ProvideRoleHierarchyInterface;
use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use LogicException;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Security;
@@ -41,6 +42,10 @@ class CalendarVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
public const SEE = 'CHILL_CALENDAR_CALENDAR_SEE';
private AuthorizationHelperInterface $authorizationHelper;
private CenterResolverManagerInterface $centerResolverManager;
private Security $security;
private VoterHelperInterface $voterHelper;
@@ -52,8 +57,8 @@ class CalendarVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
$this->security = $security;
$this->voterHelper = $voterHelperFactory
->generate(self::class)
->addCheckFor(AccompanyingPeriod::class, [self::SEE])
->addCheckFor(Person::class, [self::SEE])
->addCheckFor(AccompanyingPeriod::class, [self::SEE, self::CREATE])
->addCheckFor(Person::class, [self::SEE, self::CREATE])
->addCheckFor(Calendar::class, [self::SEE, self::CREATE, self::EDIT, self::DELETE])
->build();
}
@@ -61,6 +66,9 @@ class CalendarVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
public function getRoles(): array
{
return [
self::CREATE,
self::DELETE,
self::EDIT,
self::SEE,
];
}
@@ -72,7 +80,12 @@ class CalendarVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
public function getRolesWithoutScope(): array
{
return [];
return [
self::CREATE,
self::DELETE,
self::EDIT,
self::SEE,
];
}
protected function supports($attribute, $subject): bool
@@ -85,48 +98,37 @@ class CalendarVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
if ($subject instanceof AccompanyingPeriod) {
switch ($attribute) {
case self::SEE:
case self::CREATE:
if ($subject->getStep() === AccompanyingPeriod::STEP_DRAFT) {
return false;
}
// we first check here that the user has read access to the period
return $this->security->isGranted(AccompanyingPeriodVoter::SEE, $subject);
if (!$this->security->isGranted(AccompanyingPeriodVoter::SEE, $subject)) {
return false;
}
default:
throw new LogicException('subject not implemented');
// There is no scope on Calendar, but there are some on accompanying period
// so, to ignore AccompanyingPeriod's scopes, we create a blank Calendar
// linked with an accompanying period.
return $this->voterHelper->voteOnAttribute($attribute, (new Calendar())->setAccompanyingPeriod($subject), $token);
}
} elseif ($subject instanceof Person) {
switch ($attribute) {
case self::SEE:
return $this->security->isGranted(PersonVoter::SEE, $subject);
default:
throw new LogicException('subject not implemented');
case self::CREATE:
return $this->voterHelper->voteOnAttribute($attribute, $subject, $token);
}
} elseif ($subject instanceof Calendar) {
if (null !== $period = $subject->getAccompanyingPeriod()) {
switch ($attribute) {
case self::SEE:
case self::EDIT:
case self::CREATE:
return $this->security->isGranted(AccompanyingPeriodVoter::SEE, $period);
case self::DELETE:
return $this->security->isGranted(AccompanyingPeriodVoter::EDIT, $period);
}
} elseif (null !== $person = $subject->getPerson()) {
switch ($attribute) {
case self::SEE:
case self::EDIT:
case self::CREATE:
return $this->security->isGranted(PersonVoter::SEE, $person);
case self::DELETE:
return $this->security->isGranted(PersonVoter::UPDATE, $person);
}
switch ($attribute) {
case self::SEE:
case self::EDIT:
case self::CREATE:
case self::DELETE:
return $this->voterHelper->voteOnAttribute($attribute, $subject, $token);
}
}
throw new LogicException('attribute not implemented');
throw new LogicException('attribute or not implemented');
}
}

View File

@@ -51,8 +51,13 @@ class CalendarForShortMessageProvider
*/
public function getCalendars(DateTimeImmutable $at): iterable
{
['startDate' => $startDate, 'endDate' => $endDate] = $this->rangeGenerator
->generateRange($at);
$range = $this->rangeGenerator->generateRange($at);
if (null === $range) {
return;
}
['startDate' => $startDate, 'endDate' => $endDate] = $range;
$offset = 0;
$batchSize = 10;

View File

@@ -31,14 +31,14 @@ use UnexpectedValueException;
*/
class DefaultRangeGenerator implements RangeGeneratorInterface
{
public function generateRange(\DateTimeImmutable $date): array
public function generateRange(\DateTimeImmutable $date): ?array
{
$onMidnight = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $date->format('Y-m-d') . ' 00:00:00');
switch ($dow = (int) $onMidnight->format('w')) {
case 6: // Saturday
case 0: // Sunday
return ['startDate' => null, 'endDate' => null];
return null;
case 1: // Monday
// send for Tuesday and Wednesday

View File

@@ -23,7 +23,7 @@ use DateTimeImmutable;
interface RangeGeneratorInterface
{
/**
* @return array<startDate: \DateTimeImmutable, endDate: \DateTimeImmutable>
* @return ?array{startDate: DateTimeImmutable, endDate: DateTimeImmutable} when return is null, then no ShortMessage must be send
*/
public function generateRange(DateTimeImmutable $date): array;
public function generateRange(DateTimeImmutable $date): ?array;
}

View File

@@ -0,0 +1,63 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CalendarBundle\Tests\Entity;
use Chill\CalendarBundle\Entity\Calendar;
use Chill\CalendarBundle\Entity\CalendarDoc;
use Chill\DocStoreBundle\Entity\StoredObject;
use PHPUnit\Framework\TestCase;
/**
* @internal
* @coversNothing
*/
final class CalendarDocTest extends TestCase
{
public function testCreateEditFromDTO(): void
{
$doc = new CalendarDoc(new Calendar(), null);
$create = new CalendarDoc\CalendarDocCreateDTO();
$create->title = 'tagada';
$create->doc = $obj1 = new StoredObject();
$doc->createFromDTO($create);
$this->assertSame($obj1, $doc->getStoredObject());
$this->assertEquals('tagada', $doc->getStoredObject()->getTitle());
$edit = new CalendarDoc\CalendarDocEditDTO($doc);
$edit->title = 'tsointsoin';
$doc->editFromDTO($edit);
$this->assertSame($obj1, $doc->getStoredObject());
$this->assertEquals('tsointsoin', $doc->getStoredObject()->getTitle());
$edit2 = new CalendarDoc\CalendarDocEditDTO($doc);
$edit2->doc = $obj2 = new StoredObject();
$doc->editFromDTO($edit2);
$this->assertSame($obj2, $doc->getStoredObject());
$this->assertEquals('tsointsoin', $doc->getStoredObject()->getTitle());
$edit3 = new CalendarDoc\CalendarDocEditDTO($doc);
$edit3->doc = $obj3 = new StoredObject();
$edit3->title = 'tagada';
$doc->editFromDTO($edit3);
$this->assertSame($obj3, $doc->getStoredObject());
$this->assertEquals('tagada', $doc->getStoredObject()->getTitle());
}
}

View File

@@ -22,6 +22,7 @@ use Chill\CalendarBundle\Entity\Calendar;
use Chill\CalendarBundle\Repository\CalendarRepository;
use Chill\CalendarBundle\Service\ShortMessageNotification\CalendarForShortMessageProvider;
use Chill\CalendarBundle\Service\ShortMessageNotification\DefaultRangeGenerator;
use Chill\CalendarBundle\Service\ShortMessageNotification\RangeGeneratorInterface;
use DateTimeImmutable;
use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\Framework\TestCase;
@@ -37,6 +38,32 @@ final class CalendarForShortMessageProviderTest extends TestCase
{
use ProphecyTrait;
public function testGenerateRangeIsNull()
{
$calendarRepository = $this->prophesize(CalendarRepository::class);
$calendarRepository->findByNotificationAvailable(
Argument::type(DateTimeImmutable::class),
Argument::type(DateTimeImmutable::class),
Argument::type('int'),
Argument::exact(0)
)->shouldBeCalledTimes(0);
$rangeGenerator = $this->prophesize(RangeGeneratorInterface::class);
$rangeGenerator->generateRange(Argument::type(DateTimeImmutable::class))->willReturn(null);
$em = $this->prophesize(EntityManagerInterface::class);
$em->clear()->shouldNotBeCalled();
$provider = new CalendarForShortMessageProvider(
$calendarRepository->reveal(),
$em->reveal(),
$rangeGenerator->reveal()
);
$calendars = iterator_to_array($provider->getCalendars(new DateTimeImmutable('now')));
$this->assertEquals(0, count($calendars));
}
public function testGetCalendars()
{
$calendarRepository = $this->prophesize(CalendarRepository::class);

View File

@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\Migrations\Calendar;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20221125144205 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->throwIrreversibleMigrationException();
}
public function getDescription(): string
{
return 'Calendar: remove association between scope and calendar';
}
public function up(Schema $schema): void
{
$this->addSql(
sprintf(
'UPDATE role_scopes SET scope_id=NULL WHERE role IN (\'%s\', \'%s\', \'%s\', \'%s\')',
'CHILL_CALENDAR_CALENDAR_CREATE',
'CHILL_CALENDAR_CALENDAR_DELETE',
'CHILL_CALENDAR_CALENDAR_EDIT',
'CHILL_CALENDAR_CALENDAR_SEE'
)
);
}
}

View File

@@ -0,0 +1,8 @@
chill_calendar:
There are count ignored calendars by date filter: >-
{nbIgnored, plural,
=0 {Il n'y a aucun rendez-vous ignoré par le filtre de date.}
one {Il y a un rendez-vous ignoré par le filtre de date. Modifiez le filtre de date pour le voir apparaitre.}
few {# rendez-vous sont ignorés par le filtre de date. Modifiez le filtre de date pour les voir apparaitre.}
other {# rendez-vous sont ignorés par le filtre de date. Modifiez le filtre de date pour les voir apparaitre.}
}

View File

@@ -55,6 +55,14 @@ chill_calendar:
Create and add a document: Créer et ajouter un document
Save and add a document: Enregistrer et ajouter un document
Create for me: Créer un rendez-vous pour moi-même
Edit a document: Modifier un document
Document title: Titre
Document object: Document
Add a document from template: Ajouter un document depuis un gabarit
Upload a document: Téléverser un document
Remove a calendar document: Supprimer un document d'un rendez-vous
Are you sure you want to remove the doc?: Êtes-vous sûr·e de vouloir supprimer le document associé ?
Document outdated: La date et l'heure du rendez-vous ont été modifiés après la création du document
remote_ms_graph:
@@ -112,6 +120,7 @@ Job: Métier
Location type: Type de localisation
Location: Lieu de rendez-vous
by month and year: Par mois et année
is urgent: Urgent
is not urgent: Pas urgent
has calendar range: Dans une plage de disponibilité?
@@ -130,3 +139,9 @@ docgen:
Destinee: Destinataire
None: Aucun choix
title of the generated document: Titre du document généré
CHILL_CALENDAR_CALENDAR_CREATE: Créer les rendez-vous
CHILL_CALENDAR_CALENDAR_EDIT: Modifier les rendez-vous
CHILL_CALENDAR_CALENDAR_DELETE: Supprimer les rendez-vous
CHILL_CALENDAR_CALENDAR_SEE: Voir les rendez-vous

View File

@@ -1,64 +1,72 @@
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
<div class="flex-table accompanying_course_work-list">
<div class="item-bloc document-item bg-chill-llight-gray">
<div class="row justify-content-center my-4">
<div class="col-2">
<i class="fa fa-4x fa-file-text-o text-success"></i>
</div>
<div class="col-8">
<h3>{{ document.title }}</h3>
{% if document is null %}
<div class="alert alert-warning">
{{ 'workflow.Document deleted'|trans }}
</div>
{% else %}
<div class="flex-table accompanying_course_work-list">
<div class="item-bloc document-item bg-chill-llight-gray">
<div class="row justify-content-center my-4">
<div class="col-2">
<i class="fa fa-4x fa-file-text-o text-success"></i>
</div>
<div class="col-8">
<h3>{{ document.title }}</h3>
{{ mm.mimeIcon(document.object.type) }}
{{ mm.mimeIcon(document.object.type) }}
{% if document.description is not empty %}
<blockquote class="chill-user-quote mt-4">
{{ document.description }}
</blockquote>
{% endif %}
{% if document.description is not empty %}
<blockquote class="chill-user-quote mt-4">
{{ document.description }}
</blockquote>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% set freezed = false %}
{% for step in entity_workflow.stepsChained %}
{% if loop.last %}
{% if step.previous is not null and step.previous.freezeAfter == true %}
{% set freezed = true %}
{% endif %}
{% endif %}
{% endfor %}
{% if display_action is defined and display_action == true %}
<ul class="record_actions">
{% if document.course != null and is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', document.course) %}
<li>
<a href="{{ path('chill_person_accompanying_course_index', {'accompanying_period_id': document.course.id}) }}" class="btn btn-show change-icon">
<i class="fa fa-random"></i> {{ 'Course number'|trans }} {{ document.course.id }}
</a>
</li>
{% endif %}
<li>
{{ m.download_button(document.object, document.title) }}
</li>
<li>
{% if chill_document_is_editable(document.object) %}
{% if not freezed %}
{{ document.object|chill_document_edit_button({'title': document.title|e('html') }) }}
{% else %}
<a class="btn btn-wopilink disabled" href="#" title="{{ 'workflow.freezed document'|trans }}">
{{ 'Update document'|trans }}
</a>
{% set freezed = false %}
{% for step in entity_workflow.stepsChained %}
{% if loop.last %}
{% if step.previous is not null and step.previous.freezeAfter == true %}
{% set freezed = true %}
{% endif %}
{% endif %}
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE', document) and document.course != null %}
{% endfor %}
{% if display_action is defined and display_action == true %}
<ul class="record_actions">
{% if document.course != null and is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', document.course) %}
<li>
<a href="{{ path('chill_person_accompanying_course_index', {'accompanying_period_id': document.course.id}) }}" class="btn btn-show change-icon">
<i class="fa fa-random"></i> {{ 'Course number'|trans }} {{ document.course.id }}
</a>
</li>
{% endif %}
<li>
<a href="{{ chill_path_add_return_path('accompanying_course_document_show', {'course': document.course.id, 'id': document.id}) }}" class="btn btn-show"></a>
{{ m.download_button(document.object, document.title) }}
</li>
{% endif %}
</li>
</ul>
{% if chill_document_is_editable(document.object) %}
{% if not freezed %}
<li>
{{ document.object|chill_document_edit_button({'title': document.title|e('html') }) }}
</li>
{% else %}
<li>
<a class="btn btn-wopilink disabled" href="#" title="{{ 'workflow.freezed document'|trans }}">
{{ 'Update document'|trans }}
</a>
</li>
{% endif %}
{% endif %}
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE', document) and document.course != null %}
<li>
<a href="{{ chill_path_add_return_path('accompanying_course_document_show', {'course': document.course.id, 'id': document.id}) }}" class="btn btn-show"></a>
</li>
{% endif %}
</ul>
{% endif %}
{% endif %}

View File

@@ -65,6 +65,10 @@ class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandler
{
$doc = $this->getRelatedEntity($entityWorkflow);
if (null === $doc) {
return $this->translator->trans('workflow.Document deleted');
}
return $this->translator->trans('workflow.Document (n°%doc%)', ['%doc%' => $entityWorkflow->getRelatedEntityId()])
. ' - ' . $doc->getTitle();
}

View File

@@ -63,3 +63,6 @@ Create new DocumentCategory: Créer une nouvelle catégorie de document
# WOPI EDIT
online_edit_document: Éditer en ligne
workflow:
Document deleted: Document supprimé

View File

@@ -151,7 +151,7 @@ class PickEventType extends AbstractType
} else {
$centers = $this->authorizationHelper->getReachableCenters(
$this->user,
(string) $options['role']
(string) $options['role']->getRole()
);
}

View File

@@ -5,6 +5,7 @@
{% block title 'Delete event'|trans %}
{% block event_content %}
<div class="col-10">
{{ include('@ChillMain/Util/confirmation_template.html.twig',
{
@@ -15,6 +16,6 @@
'form' : delete_form
}
) }}
</div>
{% endblock %}

View File

@@ -3,6 +3,7 @@
{% block title 'Event edit'|trans %}
{% block event_content -%}
<div class="col-10">
<h1>{{ 'Event edit'|trans }}</h1>
{{ form_start(edit_form) }}
@@ -30,4 +31,6 @@
</ul>
{{ form_end(edit_form) }}
</div>
{% endblock %}

View File

@@ -6,39 +6,39 @@
<p>{{ 'Results %start%-%end% of %total%'|trans({ '%start%' : start, '%end%': start + events|length, '%total%' : total } ) }}</p>
<table class="events">
<table class="table events">
<thead>
<tr>
<th class="chill-red">{{ 'Name'|trans }}</th>
<th class="chill-green">{{ 'Date'|trans }}</th>
<th class="chill-orange">{{ 'Event type'|trans }}</th>
<th>&nbsp;</th>
</tr>
<tr>
<th class="chill-red">{{ 'Name'|trans }}</th>
<th class="chill-green">{{ 'Date'|trans }}</th>
<th class="chill-orange">{{ 'Event type'|trans }}</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{% for event in events %}
<tr>
<td>{{ event.name }}</td>
<td>{{ event.date|format_date('long') }}</td>
<td>{{ event.type.name|localize_translatable_string }}</td>
<td>
<ul class="record_actions">
<li>
{# {% if is_granted('CHILL_EVENT_SEE_DETAILS', event) %} #}
<a href="{{ path('chill_event__event_show', { 'event_id' : event.id } ) }}" class="btn btn-dark">
{{ 'See'|trans }}
</a>
{# {% endif %} #}
{% if is_granted('CHILL_EVENT_UPDATE', event) %}
{% for event in events %}
<tr>
<td>{{ event.name }}</td>
<td>{{ event.date|format_date('long') }}</td>
<td>{{ event.type.name|localize_translatable_string }}</td>
<td>
<ul class="record_actions">
<li>
{# {% if is_granted('CHILL_EVENT_SEE_DETAILS', event) %} #}
<a href="{{ path('chill_event__event_show', { 'event_id' : event.id } ) }}" class="btn btn-dark">
{{ 'See'|trans }}
</a>
{# {% endif %} #}
{% if is_granted('CHILL_EVENT_UPDATE', event) %}
<a href="{{ path('chill_event__event_edit', { 'event_id' : event.id } ) }}" class="btn btn-update">
{{ 'Edit'|trans }}
</a>
{% endif %}
</li>
</ul>
</td>
</tr>
{% endfor %}
{% endif %}
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
@@ -51,15 +51,16 @@
</a>
</li>
{% if preview == true and events|length < total %}
<li>
<a href="{{ path('chill_main_search', { "name": search_name, "q" : pattern }) }}" class="btn btn-next">
{{ 'See all results'|trans }}
</a>
</li>
<li>
<a href="{{ path('chill_main_search', { "name": search_name, "q" : pattern }) }}" class="btn btn-misc">
{{ 'See all results'|trans }}
</a>
</li>
{% endif %}
</ul>
{% if preview == false %}
{{ chill_pagination(paginator) }}
{{ chill_pagination(paginator) }}
{% endif %}

View File

@@ -44,59 +44,59 @@
<td>{{ participation.role.name|localize_translatable_string }}</td>
<td>{{ participation.status.name|localize_translatable_string }}</td>
<td>
<ul class="list-inline">
<div class="btn-group" role="group" aria-label="Button group actions">
{% set currentPath = path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) %}
{% set returnLabel = 'Back to %person% events'|trans({ '%person%' : currentPerson } ) %}
{% if is_granted('CHILL_EVENT_SEE_DETAILS', participation.event) %}
<li class="list-inline-item">
<a href="{{ path('chill_event__event_show', { 'event_id' : participation.event.id, 'return_path' : currentPath, 'return_label' : returnLabel } ) }}"
class="btn btn-primary btn-sm" title="{{ 'See details of the event'|trans }}"><i class="fa fa-fw fa-eye"></i></a>
</li>
class="btn btn-primary btn-sm" title="{{ 'See details of the event'|trans }}">
<i class="fa fa-fw fa-eye"></i>
</a>
{% endif %}
{% if is_granted('CHILL_EVENT_UPDATE', participation.event)
and is_granted('CHILL_EVENT_PARTICIPATION_UPDATE', participation) %}
<li class="list-inline-item">
<div class="btn dropdown-toggle">
<a href="" class="btn btn-warning btn-sm"><i class="fa fa-fw fa-pencil"></i></a>
<div class="dropdown-menu">
<div class="btn-group" role="group">
<button class="btn btn-sm btn-warning dropdown-toggle" type="button" id="dropdownEdit" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa fa-pencil"></i>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownEdit">
<li>
<a href="{{ path('chill_event__event_edit', { 'event_id' : participation.event.id, 'return_path' : currentPath, 'return_label' : returnLabel }) }}"
class="btn btn-warning btn-sm">
class="dropdown-item">
{{ 'Edit the event'|trans }}
</a>
</li>
<li>
<a href="{{ path('chill_event_participation_edit', { 'participation_id' : participation.id, 'return_path' : currentPath, 'return_label' : returnLabel }) }}"
class="btn btn-warning btn-sm">
class="dropdown-item">
{{ 'Edit the participation'|trans }}
</a>
</div>
</div>
</li>
</li>
</ul>
</div>
{% else %}
<li class="list-inline-item">
{% if is_granted('CHILL_EVENT_UPDATE', participation.event) %}
<a href="{{ path('chill_event__event_edit', { 'event_id' : participation.event.id, 'return_path' : currentPath, 'return_label' : returnLabel }) }}"
class="btn btn-warning btn-sm">
{{ 'Edit the event'|trans }}
</a>
<a href="{{ path('chill_event__event_edit', { 'event_id' : participation.event.id, 'return_path' : currentPath, 'return_label' : returnLabel }) }}"
class="btn btn-warning btn-sm">
{{ 'Edit the event'|trans }}
</a>
{% endif %}
{% if is_granted('CHILL_EVENT_PARTICIPATION_UPDATE', participation) %}
<a href="{{ path('chill_event_participation_edit', { 'participation_id' : participation.id, 'return_path' : currentPath, 'return_label' : returnLabel }) }}"
class="btn btn-warning btn-sm">
{{ 'Edit the participation'|trans }}
</a>
<a href="{{ path('chill_event_participation_edit', { 'participation_id' : participation.id, 'return_path' : currentPath, 'return_label' : returnLabel }) }}"
class="btn btn-warning btn-sm">
{{ 'Edit the participation'|trans }}
</a>
{% endif %}
</li>
{% endif %}
</ul>
</div>
</td>
</tr>
{% endfor %}
@@ -108,31 +108,17 @@
{{ chill_pagination(paginator) }}
{% endif %}
<div class="input-group mb-3">
<div class="input-group mt-5">
{{ form_start(form_add_event_participation_by_person) }}
{#
<input type="text" class="form-control" placeholder="Recipient's username" aria-label="Recipient's username" aria-describedby="button-addon2">
#}
{{ form_widget(form_add_event_participation_by_person.event_id, { 'attr' : { 'class' : 'form-control' } } ) }}
<div class="input-group-append input-group-btn">
{#
<button class="btn btn-outline-secondary" type="button" id="button-addon2">Button</button>
#}
{{ form_widget(form_add_event_participation_by_person.submit, { 'attr' : { 'class' : 'btn btn-success' } } ) }}
{{ form_widget(form_add_event_participation_by_person.event_id, { 'attr' : {
'class' : 'custom-select',
'style': 'min-width: 15em; max-width: 18em; display: inline-block;'
}}) }}
<div class="input-group-append">
{{ form_widget(form_add_event_participation_by_person.submit, { 'attr' : { 'class' : 'btn btn-sm btn-save' } } ) }}
</div>
{{ form_rest(form_add_event_participation_by_person) }}
{{ form_end(form_add_event_participation_by_person) }}
</div>
{#
{{ form(form_add_event_participation_by_person) }}
#}
<div class="input-group mb-3">
<input class="form-control" placeholder="Recipient's username">
<div class="input-group-append">
<button class="btn btn-success">Button</button>
</div>
</div>
{% endblock %}

View File

@@ -3,6 +3,7 @@
{% block title 'Event creation'|trans %}
{% block event_content -%}
<div class="col-10">
<h1>{{ 'Event creation'|trans }}</h1>
{{ form_start(form) }}
@@ -26,4 +27,5 @@
</ul>
{{ form_end(form) }}
</div>
{% endblock %}

View File

@@ -3,6 +3,7 @@
{% block title 'Event creation'|trans %}
{% block event_content -%}
<div class="col-10">
<h1>{{ 'Event creation'|trans }}</h1>
{{ form_start(form) }}
@@ -22,5 +23,5 @@
</ul>
{{ form_end(form) }}
</div>
{% endblock %}

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