Compare commits

...

574 Commits

Author SHA1 Message Date
246ee58d8b fix type for condition in ParticipationController 2022-04-27 08:44:49 +02:00
c2061110dd fix cs 2022-04-26 21:16:55 +02:00
b2fb86111d fix social action consistency 2022-04-26 21:12:31 +02:00
db6c4f15f8 Merge remote-tracking branch 'origin/master' into issue471_activity_socialissue-action 2022-04-26 20:29:07 +02:00
12231912d6 remove dead code 2022-04-26 20:27:24 +02:00
7b0c8d21ee sort properties alphabetically 2022-04-26 20:27:08 +02:00
f713b1ddc8 allow to edit encrypted documents 2022-04-26 17:46:25 +02:00
faf1559770 Merge branch 'master' into feat/add-document-encrypter-service 2022-04-26 14:52:13 +02:00
5a1ce399f6 fix creation of evaluation in js 2022-04-26 14:26:51 +02:00
505384c2a0 fix generation of document 2022-04-26 14:11:59 +02:00
a7654edefa add missing services 2022-04-26 14:11:28 +02:00
81689e3507 fix catching response 400 in relatorio driver 2022-04-26 14:11:04 +02:00
b891ba842d update changelog 2022-04-26 12:03:06 +02:00
3ceae0473d Merge remote-tracking branch 'origin/master' 2022-04-26 11:57:37 +02:00
795a8e9daf Merge remote-tracking branch 'origin/master' 2022-04-26 11:54:01 +02:00
Pol Dellaiera
81edaef062 Fix: Route name change. 2022-04-26 11:50:59 +02:00
Pol Dellaiera
dc48b4b9c7 Fix #581: Collabora / wopi: le bouton "imprimer" ne fonctionne pas. 2022-04-26 11:47:46 +02:00
e72a2004d7 Merge remote-tracking branch 'origin/master' into feat/add-document-encrypter-service 2022-04-26 09:37:30 +02:00
329fb05db0 Merge branch 'issue571_ordering_socialactions' into 'master'
Ordering social actions

See merge request Chill-Projet/chill-bundles!412
2022-04-25 20:14:59 +00:00
75250402c8 fix ordering of social actions 2022-04-25 22:14:36 +02:00
e5209ca6d9 do not make a loop to normalizer for a native php object 2022-04-25 22:14:23 +02:00
4512b94293 Merge remote-tracking branch 'origin/master' into issue571_ordering_socialactions 2022-04-25 21:35:16 +02:00
217f95472b Merge branch 'issue574_accordeon_parcours' into 'master'
Accordeon for closed parcours in person search results

See merge request Chill-Projet/chill-bundles!413
2022-04-25 19:34:49 +00:00
b7abf6b6bf Merge remote-tracking branch 'origin/master' into issue571_ordering_socialactions 2022-04-25 21:30:48 +02:00
c39fa1c49b remove legacy folded/unfolded style requirements for showing label on accordion 2022-04-25 21:27:56 +02:00
81c8d0ec77 move extension of accordion bootstrap to dedicated file 2022-04-25 21:23:41 +02:00
72012a70d9 button "closed" with same layout than in course header 2022-04-25 21:23:12 +02:00
916560c522 list with period: full sentences in translation component 2022-04-25 21:21:38 +02:00
57d6240cd1 Merge remote-tracking branch 'origin/master' into issue574_accordeon_parcours 2022-04-25 20:46:57 +02:00
2d460adc4d Merge branch 'issue568_agents_traitants' into 'master'
Display agents traitants

See merge request Chill-Projet/chill-bundles!411
2022-04-25 17:30:18 +00:00
d155c76013 Merge remote-tracking branch 'origin/master' into issue568_agents_traitants 2022-04-25 19:22:52 +02:00
529a9e5f58 fix notification counter on entity 2022-04-25 16:34:49 +02:00
2b837e0445 Merge branch 'issue545_datepicker' into 'master'
Fix datepicker

See merge request Chill-Projet/chill-bundles!405
2022-04-25 14:19:36 +00:00
4279acc2f8 convert date for new household 2022-04-25 16:11:42 +02:00
8fb3870ca0 remove dead code 2022-04-25 15:59:35 +02:00
ff72b28861 Revert "private comment added to activity"
This reverts commit 1f2638626c.
2022-04-25 14:52:28 +02:00
1f2638626c private comment added to activity 2022-04-25 14:43:44 +02:00
41ff21ee23 update changelog with last release 2022-04-25 09:38:36 +02:00
30bb2e8393 Merge remote-tracking branch 'origin/master' into issue545_datepicker 2022-04-25 09:37:35 +02:00
ca166655da changelog updated 2022-04-22 18:05:47 +02:00
8f69f852b9 fix merge conflict 2022-04-22 18:04:20 +02:00
6747cad210 add amount of closed periods in accordeon message 2022-04-22 18:02:59 +02:00
0cbcd91c3f closed periods in accordeon + styling 2022-04-22 17:49:57 +02:00
d757e07dfc macro added + closed parcours displayed in accordeon 2022-04-22 17:22:46 +02:00
83dd8f810c Merge branch 'notification/deferring-sending-notification-to-terminate' into 'master'
Notification/deferring sending notification to terminate

See merge request Chill-Projet/chill-bundles!414
2022-04-22 10:48:18 +00:00
bd0b45b4dd fix cs 2022-04-22 12:47:50 +02:00
6dbe8068ae update changelog 2022-04-22 12:31:33 +02:00
19561c63cb do not persist if no notification is scheduled 2022-04-22 12:31:23 +02:00
354f130e9e use NotificationPersister into PersonMoveEventSubscriber 2022-04-22 12:12:50 +02:00
2d9af8f8c0 period: fix method hasPreviousUser and create method isChangedUser, and use it in Notification 2022-04-22 12:12:30 +02:00
f7d9551dc1 fix cs 2022-04-22 11:41:38 +02:00
abc3caee00 AccompanyingPeriod: fix method hasPreviousUser 2022-04-22 11:40:29 +02:00
33f93d484d deferring the sending of notification to kernel.terminate: prepare 2022-04-22 11:34:41 +02:00
8470604b8f macro added + closed parcours displayed in accordeon 2022-04-21 22:06:22 +02:00
b85e6aae3f csfixes 2022-04-21 21:22:18 +02:00
a4baf89a6a social actions ordered in store 2022-04-21 21:05:32 +02:00
0a05dcd753 add ordering to serialization 2022-04-21 20:49:54 +02:00
c6be7955fd remove save button datepicker parcours. set timeout 2022-04-21 13:59:45 +02:00
e246ccbcd9 [Course comment] add validationConstraint NotNull and NotBlank on comment content, to avoid sql error 2022-04-20 18:34:29 +02:00
44b537f05e [Accompanying period work evaluations] list documents associated to a work by creation date, and then by id, from the most recent to older 2022-04-20 18:34:27 +02:00
0fd23c61a1 Wording changed when user is not associated to household 2022-04-20 17:19:20 +02:00
6cad0be181 Ignore thirdparty for socialaction created via activity 2022-04-20 17:08:27 +02:00
9a0eb1c74c Renaming of tabs and removal of social actions tab 2022-04-20 16:33:05 +02:00
a70c561596 Number of parcours of user displayed in blue pill 2022-04-20 16:23:08 +02:00
daa3eabd43 Change wording for save document button 2022-04-20 16:12:58 +02:00
b24de76d77 display agents traitants 2022-04-20 15:16:26 +02:00
92d394b669 changelog updated 2022-04-20 14:22:35 +02:00
c17d20f945 comment out success message parcours start date 2022-04-20 14:18:24 +02:00
be77c3729b take empty date strings into account 2022-04-20 14:09:28 +02:00
ad1e7b576c remove success toast for parcours startdate + take empty string values into account for action dates 2022-04-20 13:58:45 +02:00
bf0578b6d7 [Accompanying period work] list evaluations associated to a work by startDate, and then by id, from the most recent to older 2022-04-20 13:49:47 +02:00
0ce23230da fix evaluation datepickers in edit 2022-04-20 13:32:51 +02:00
8b7404e531 Email on designation: allow raw characters
As the content-type of the email is text/plain, we should not escape
special character.

Add the raw filter on string which will be escaped by twig.
2022-04-20 13:05:11 +02:00
bc550ea42a updating openingdate parcours fixed 2022-04-20 12:14:19 +02:00
65e6471a02 fix datepicker for social action edit form.
still a problem with the display of already set evaluation dates... need to be transformed to correct format to display
2022-04-20 12:14:19 +02:00
de9d2aa885 fix datepicker for householdmember editor 2022-04-20 12:14:19 +02:00
66ab38c60f prefill startdate with now 2022-04-20 12:14:19 +02:00
8882c99f5a fix datepicker for social action 2022-04-20 12:14:19 +02:00
8512a5e1bc person list with period: use sameas twig operator instead of using '==' operator to introduce requestor 2022-04-20 11:24:20 +02:00
7f97215fe9 activity form: keep the same order for attendee field between edit and new form 2022-04-20 10:03:58 +02:00
6427fc64cd invert 'incoming' and 'receiving' 2022-04-20 10:00:48 +02:00
26d5bf03bd add order by on document list 2022-04-20 10:00:48 +02:00
Pol Dellaiera
7048f670ed Fix #552: Return AccessDeniedException when trying to access a document and user is not logged in. 2022-04-19 15:45:47 +02:00
c757fa068a Translations added for error message in parcours 2022-04-19 15:21:23 +02:00
ebc4ec0d7c updating openingdate parcours fixed 2022-04-19 15:09:25 +02:00
617473f6a5 notification - grant access by key - temporarily disable email verification due to character escaping in email 2022-04-14 01:36:01 +02:00
124a6a58fc fix cs 2022-04-14 01:13:16 +02:00
afa38e9dd5 addresses: add constraint in database to avoid error later 2022-04-14 01:11:39 +02:00
a52f29bb78 accompanyingWorkEditor: add label on form document title 2022-04-14 01:11:14 +02:00
b95ff337b6 add more time duration for aside activities 2022-04-14 00:41:15 +02:00
92a169be1e Merge branch 'issue541_change_moving_date' into 'master'
household address: add a form for editing the validFrom date

See merge request Chill-Projet/chill-bundles!402
2022-04-13 22:11:34 +00:00
e6d59bc837 fix cs 2022-04-14 00:11:15 +02:00
31731c6f44 Merge remote-tracking branch 'origin/master' into issue541_change_moving_date 2022-04-14 00:04:30 +02:00
86ec020f80 fixes on address valid from edit for household 2022-04-14 00:02:57 +02:00
07351e2946 Merge branch 'issue543_double_click_household' into 'master'
householdmemberseditor: fix composition type bug

See merge request Chill-Projet/chill-bundles!406
2022-04-13 21:37:41 +00:00
405694a0b4 Merge remote-tracking branch 'origin/master' into issue541_change_moving_date 2022-04-13 23:30:51 +02:00
bad39364c2 Merge remote-tracking branch 'origin/master' into issue543_double_click_household 2022-04-13 23:26:38 +02:00
c0b39e4e7c Merge branch 'notifications/allow-to-send-to-email' into 'master'
Notifications/allow to send to email

See merge request Chill-Projet/chill-bundles!409
2022-04-13 21:25:35 +00:00
f98b35f009 Merge remote-tracking branch 'origin/master' into issue543_double_click_household 2022-04-13 23:20:23 +02:00
8770188d54 update changelog 2022-04-13 23:18:50 +02:00
35c7d55b8c fix cs 2022-04-13 23:17:16 +02:00
2a53fb9341 show email adresses on notification list 2022-04-13 23:16:02 +02:00
e7f0cd50c9 controller to grant access to notification by access key 2022-04-13 23:05:38 +02:00
a41d6cf744 notification: send an email to addressesEmails 2022-04-13 22:50:32 +02:00
24d28b0a52 notification: alter form type to add and remove email addresses 2022-04-13 22:11:01 +02:00
4425f2ad49 fix type for Notification email addresses 2022-04-13 21:43:41 +02:00
a8db07a383 notification / add email: fix entity Notification 2022-04-13 21:33:18 +02:00
ef9fd80ad5 update schema to send to emails 2022-04-13 18:02:11 +02:00
e6169ddffa Merge branch 'docgen/improve-context-courses' into 'master'
docgen: some fixes and improvements

See merge request Chill-Projet/chill-bundles!408
2022-04-13 07:53:43 +00:00
ccf7c885bb fix normalization for phonenumber on person when phonenumber is null 2022-04-13 09:44:21 +02:00
01c571ab06 fix path to table 2022-04-11 21:04:36 +02:00
69b2dce7ee docgen/budget: add comment for each budget line (resource and charge)
The comments are cocatenated by lines of each type, and separated by a
`|`
2022-04-11 18:11:20 +02:00
910245f855 update changelog 2022-04-11 17:45:57 +02:00
7fbb3dfd07 docgen: add more persons choices in person1, person2 and mainPerson
Allow to pick amongst:

* requestor (if person)
* resources of course (if person)
* resources of person (if person)
2022-04-11 17:43:31 +02:00
9765bc5663 fix cs 2022-04-11 17:12:59 +02:00
bb65909bfa add docgen context for a list of activities in a course 2022-04-11 16:52:11 +02:00
03b0a8766e remove dumps 2022-04-08 19:12:11 +02:00
5eea202586 fix adding sibling action 2022-04-08 19:04:13 +02:00
a78c62789c if parent in collection replace with child, problem, sibling isn't added 2022-04-08 18:56:37 +02:00
68671e297c Merge branch 'issue471_activity_socialissue-action' of gitlab.com:Chill-Projet/chill-bundles into issue471_activity_socialissue-action 2022-04-08 13:24:49 +02:00
4257a918f3 fix error when search pattern is empty 2022-04-08 00:11:08 +02:00
7ffb3dc74f task: fix route name 2022-04-07 23:49:32 +02:00
0f926e9dfe allow to display pinned comment in item of accompanying course list 2022-04-07 22:40:20 +02:00
fc55567a64 update changelog 2022-04-07 22:12:13 +02:00
009030b5fb notification list: move action buttons outside of the toggle 2022-04-07 21:59:02 +02:00
6e1cabc8fc fix detecting of non-read notification 2022-04-07 21:55:04 +02:00
572c602387 filter users which are disabled 2022-04-07 21:47:56 +02:00
26a4577420 order query for location and add pagination in list 2022-04-07 21:08:11 +02:00
f09870931c switch to using getDescendantsWithThis() 2022-04-07 16:11:00 +02:00
ea21f2d9c4 improvement, but still not correct 2022-04-07 16:11:00 +02:00
d81a41bb17 Test added for activity-social action and social issue 2022-04-07 16:11:00 +02:00
7851d9956e csfixes 2022-04-07 16:11:00 +02:00
f35479e4d2 fix logic in activity entity 2022-04-07 16:11:00 +02:00
432b105be5 update changelog 2022-04-07 16:11:00 +02:00
988b67bd4b logic added to only keep youngest descendant. works for issue, seems not to for action 2022-04-07 16:11:00 +02:00
f64409e5e6 allow every person which has part for a workflow to see the workflow page 2022-04-07 16:06:26 +02:00
a1baf99294 able to see the workflow if the evaluation document has been deleted 2022-04-07 15:54:53 +02:00
d9bb18e042 hardcode the list of supported mime types for edition with collabora 2022-04-07 15:37:17 +02:00
00a6ef0598 fix creating of accompanying period work 2022-04-07 11:05:34 +02:00
nobohan
c03e38f4ff upd CHANGELOG 2022-04-07 10:47:14 +02:00
nobohan
f9bcc5b1e9 householdmemberseditor: fix composition type bug 2022-04-07 10:45:46 +02:00
934a066910 remove error disappearing from phpstan 2022-04-06 22:40:09 +02:00
095afb90c7 AddPerson search: fix aborting query when the query is altered by user 2022-04-06 21:47:01 +02:00
645549ae34 effectively filter on all words in third party search 2022-04-06 21:45:49 +02:00
nobohan
d34462d849 php code fix 2022-04-06 15:34:11 +02:00
nobohan
c65a73604d upd CHANGELOG 2022-04-06 15:33:07 +02:00
nobohan
6a4edd000f household address: add max date for changing the validFrom date 2022-04-06 15:31:17 +02:00
nobohan
017b7bca87 address: handle cases when null street and streetnumber are given 2022-04-06 15:14:51 +02:00
612d053892 fix phpstan and phpcs 2022-04-06 13:59:05 +02:00
8edc68859e do not allow to freeze a document 2022-04-06 13:41:34 +02:00
a4afe73efe take into account system notification in counter and fix hardcoded user id 2022-04-06 13:35:24 +02:00
2b67f105f7 Merge branch 'issues521_531_540' into 'master'
issues graphiques 521 531 540

See merge request Chill-Projet/chill-bundles!399
2022-04-06 10:43:29 +00:00
95b114a144 do not show button to send notification on draft courses 2022-04-06 12:42:12 +02:00
5477a70c84 add ACL around creation of work in course 2022-04-06 12:41:50 +02:00
7d69ec6d6b Merge remote-tracking branch 'origin/master' into issues521_531_540 2022-04-06 12:29:11 +02:00
17594b58ab Merge branch 'issue548_notifs_buttons' into 'master'
notification toggle read: correct js syntax

See merge request Chill-Projet/chill-bundles!404
2022-04-06 10:24:27 +00:00
cddd3c20c8 Merge remote-tracking branch 'origin/master' into issue548_notifs_buttons 2022-04-06 12:16:23 +02:00
25a37974e5 Merge branch 'issues522_523' into 'master'
activity: add spacing between buttons + better alignment

See merge request Chill-Projet/chill-bundles!397
2022-04-06 10:08:59 +00:00
066afc07a8 update changelog 2022-04-06 12:08:44 +02:00
56c3f05ec9 Merge remote-tracking branch 'origin/master' into issues522_523 2022-04-06 12:04:54 +02:00
1907beaf6e Merge branch 'change_interlocuteurs_display' into 'master'
Change display of interlocuteurs (parcours)

See merge request Chill-Projet/chill-bundles!396
2022-04-06 10:01:26 +00:00
37c04d3f12 update changelog 2022-04-06 12:00:49 +02:00
a7fbce0add Merge remote-tracking branch 'origin/master' into change_interlocuteurs_display 2022-04-06 11:59:18 +02:00
e663bae5c4 fix datepicker for social action edit form.
still a problem with the display of already set evaluation dates... need to be transformed to correct format to display
2022-04-06 11:26:04 +02:00
ad6a68487c fix datepicker for householdmember editor 2022-04-06 11:24:01 +02:00
nobohan
88f377778c upd CHANGELOG 2022-04-06 09:28:57 +02:00
nobohan
d6deaeb324 notification unread: correct class 2022-04-06 09:26:14 +02:00
nobohan
f2744fba43 notification toggle read: correct js syntax 2022-04-05 22:28:35 +02:00
72a62a3a1b prefill startdate with now 2022-04-05 16:03:07 +02:00
bcde4497cc fix datepicker for social action 2022-04-05 15:56:02 +02:00
nobohan
ddce7603ad household address: add condition for minimum value for vaildFrom date 2022-04-02 10:53:54 +02:00
nobohan
3a3eb68288 household address: add a form for editing the validFrom date 2022-04-01 16:17:04 +02:00
a4ece21f2b in household, force validTo of address to be NULL 2022-04-01 15:06:00 +02:00
c7762dd6d2 fix trimming for email in person / thirdparty 2022-03-31 12:51:53 +02:00
f47fb17b8d fix denormalization of invalid dates 2022-03-31 12:48:27 +02:00
51dc255be5 fix phonenumber denormalization when null value is given 2022-03-31 12:48:27 +02:00
6ddbb79157 format phonenumber in third party normalization 2022-03-31 12:48:27 +02:00
dcddf4b3f1 trim email 2022-03-31 10:24:58 +02:00
e027958c63 Merge branch 'fix-tests-2022-03-30' into 'master'
Fix tests 2022 03 30

See merge request Chill-Projet/chill-bundles!400
2022-03-30 20:20:03 +00:00
034a416612 fix test which fails randomly 2022-03-30 22:02:45 +02:00
63cdc97c47 fix phpstan errors on ThirdPartyRender 2022-03-30 21:52:43 +02:00
ae10a8bd1c fix post action on api controller: too many argument 2022-03-30 21:51:39 +02:00
eb2bad0f47 docgen normalization budget: fix budget when person is null 2022-03-30 21:35:02 +02:00
bc43d8bae5 force type on Person entity 2022-03-30 21:01:17 +02:00
83dfe530e9 household editor: handle case when the person is repositionned in the
same household, and the person is already in a position "without
household"
2022-03-30 17:00:07 +02:00
c477996acf fix cs 2022-03-30 16:43:16 +02:00
36b1f05524 do not launch PersonMoveEvent when moving to the same household 2022-03-30 16:42:57 +02:00
dae9d48574 really do not show thirdparty which are not active 2022-03-30 15:26:45 +02:00
9812710cd0 do not show duplicate menu entry temporarily 2022-03-30 15:08:34 +02:00
3b083c31e7 add tests for moving to not share position in another household 2022-03-30 12:57:16 +02:00
1b567327b7 fix normalisation for phonenumber in person entity 2022-03-30 12:37:18 +02:00
nobohan
1d6d8dc002 accompanyingcourse work: add ACL rights for create and edit buttons 2022-03-30 12:01:35 +02:00
38e92ee981 fix cs 2022-03-30 11:58:17 +02:00
e433b6a42b Do not dispatch PersonMoveEvent if moving to a position not sharing
household
2022-03-30 11:57:43 +02:00
df24d085ca Household members editor: leave household when repositionning to same
household, not sharing household
2022-03-30 11:53:06 +02:00
nobohan
f29ead4961 accompanying course: fix display bug in accompanying course resume 2022-03-30 11:26:19 +02:00
nobohan
b361ab2d74 workflow: add div for delete workflow form 2022-03-30 11:10:23 +02:00
de4f65fede change strategy for searching: use the AND between words, instead of OR 2022-03-29 12:42:17 +02:00
nobohan
10fcd4f732 accompanying course: evaluation documents: align buttons 2022-03-28 15:12:16 +02:00
nobohan
bc8709f9a1 activity: add spacing between buttons + better alignment 2022-03-28 14:30:49 +02:00
3d6745e535 display of interlocuteurs changed to flex-table to prevent cut-off of information 2022-03-28 12:00:13 +02:00
961c0a867c workflow notification display block for social action item 2022-03-28 11:42:24 +02:00
f5327fe8ab trailing guillemet removed 2022-03-28 11:25:07 +02:00
6f270188f7 buttons made sticky for parcours documents 2022-03-28 11:22:42 +02:00
5895334244 update changelog 2022-03-25 17:23:14 +01:00
1812592d43 fix create person on the fly 2022-03-25 17:22:10 +01:00
3babbe5e84 Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles 2022-03-25 17:06:06 +01:00
632ea710c8 budget menu entry placed in different order 2022-03-25 17:05:41 +01:00
bdcb135adb re-introduce link to create user 2022-03-25 15:48:30 +01:00
3b93d2c0a5 Merge remote-tracking branch 'origin/master' 2022-03-25 14:28:18 +01:00
f24b2931dd Merge branch 'issue585_canEditWopiDocument' into 'master'
Accompanying course evaluation documents: disable the WOPI edit link if mimetype not supported

See merge request Chill-Projet/chill-bundles!394
2022-03-25 13:04:24 +00:00
c1e972963f invert condition with key infos 2022-03-25 14:03:43 +01:00
ce2e05464f Merge remote-tracking branch 'origin/master' into issue585_canEditWopiDocument 2022-03-25 13:48:46 +01:00
dbe0c9097f Merge branch 'issue533_notification_for_workflow_bug' into 'master'
correct notification for workflow display bug

See merge request Chill-Projet/chill-bundles!393
2022-03-25 12:39:46 +00:00
e68c12e0e7 fix cs 2022-03-25 13:39:27 +01:00
c99a967fb9 slightly improvve the render box for workflow in notification 2022-03-25 13:35:52 +01:00
d11eebefae fix some authorization check in menu 2022-03-25 13:11:03 +01:00
b423821ae9 check existence of form before using it 2022-03-25 13:10:40 +01:00
7a0234adb2 Merge remote-tracking branch 'origin/master' into issue533_notification_for_workflow_bug 2022-03-25 12:45:29 +01:00
nobohan
f36fc0ba60 upd CHANGELOG 2022-03-25 11:46:57 +01:00
nobohan
cff126953e Accompanying course evaluation documents: disable the WOPI edit link if no keyInfos 2022-03-25 11:45:13 +01:00
nobohan
89064f55a1 Accompanying course evaluation documents: disable the WOPI edit link if mimetype not supported 2022-03-25 11:36:51 +01:00
f69dab5ca5 Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles 2022-03-25 11:09:23 +01:00
259cdd34c4 fix validation person resource 2022-03-25 11:07:12 +01:00
nobohan
9dca42e242 correct notification for workflow display bug 2022-03-25 10:44:15 +01:00
nobohan
248e4e93ed quick fix: change style of input field for document title in AccompanyingCourseWork documents 2022-03-25 10:16:48 +01:00
nobohan
db2bf1e98e quick fix: change style of input field for document title in AccompanyingCourseWork documents 2022-03-25 10:15:33 +01:00
ea66db07a4 fix cs 2022-03-24 22:10:07 +01:00
5f35a42fe3 allow phonumber helper to format null value 2022-03-24 22:09:12 +01:00
e82b2bd10a fix personcontent / content switch in some pages 2022-03-24 20:54:34 +01:00
ad4f400262 Merge remote-tracking branch 'origin/master' 2022-03-24 20:53:40 +01:00
866bcec114 Merge remote-tracking branch 'origin/master' 2022-03-24 20:53:10 +01:00
367188b03d Merge branch 'issue491_thirdparty_edit_modal' into 'master'
Thirdparty: fix edit modal + add firstname

See merge request Chill-Projet/chill-bundles!379
2022-03-24 18:33:31 +00:00
dd4d463c42 fix bug when setting civility to null in on the fly 2022-03-24 19:32:53 +01:00
1031f0d40e thirdparty: firstname after name in form 2022-03-24 19:18:48 +01:00
5d7943f871 index firstname in database 2022-03-24 19:06:53 +01:00
d0c34c0206 set empty thridparty.firstname to a string 2022-03-24 18:51:29 +01:00
726b8f0e3c Merge remote-tracking branch 'origin/master' into issue491_thirdparty_edit_modal 2022-03-24 18:44:42 +01:00
5d4149db35 Merge remote-tracking branch 'origin/issue491_thirdparty_edit_modal' into issue491_thirdparty_edit_modal 2022-03-24 18:41:22 +01:00
f04474c82f Merge branch 'issue494_activity_field_visibility' into 'master'
Activity display fields based on ActivityType + show error message

See merge request Chill-Projet/chill-bundles!376
2022-03-24 17:29:38 +00:00
156398caba Merge remote-tracking branch 'origin/master' into issue494_activity_field_visibility 2022-03-24 18:25:03 +01:00
ae3091f620 Merge branch 'issue469_budget' into 'master'
Adapt BudgetBundle to Vendee

See merge request Chill-Projet/chill-bundles!357
2022-03-24 17:23:26 +00:00
84f9fdba28 add budget to docgen 2022-03-24 18:22:49 +01:00
531f940b65 add a debug feature in docgenerator template controller 2022-03-24 18:22:36 +01:00
d907f3f11b desactivate calculator in current budget for household 2022-03-24 16:29:13 +01:00
02409d4992 Merge remote-tracking branch 'origin/master' into issue469_budget 2022-03-24 16:22:52 +01:00
771b6a59a5 Merge branch 'issue519_filiation_create_person' into 'master'
Add person to filiation

See merge request Chill-Projet/chill-bundles!392
2022-03-24 14:08:54 +00:00
2e336ac874 update case when the person was already on the graph 2022-03-24 15:07:46 +01:00
a61c9553e1 csfixes 2022-03-24 11:42:16 +01:00
3243a7e0a2 fix merge conflict in changelog 2022-03-24 11:41:02 +01:00
06cc84a21f conditional statements to allow for personne moral creation and edit 2022-03-24 11:40:06 +01:00
688914906d merge firstname branch 2022-03-24 11:13:07 +01:00
f9d87876f2 Merge remote-tracking branch 'origin/master' into issue519_filiation_create_person 2022-03-24 11:12:56 +01:00
7df70cab98 allow a user/referrer to see his own courses, even if the scope is not his own 2022-03-24 10:58:43 +01:00
287ea80be9 Merge remote-tracking branch 'origin/master' into issue491_thirdparty_edit_modal 2022-03-24 10:56:51 +01:00
dc3d88a1ef final fix to make current civility and profession values visible in edit form 2022-03-24 10:56:28 +01:00
cba6394823 Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles 2022-03-24 09:10:53 +01:00
eea0711a04 autowire sectionmenu service 2022-03-24 09:10:32 +01:00
949bdfd993 add missing property (phpstanerror) 2022-03-23 22:59:45 +01:00
3067da5d24 fix tests for removing temporarily resources on person 2022-03-23 22:56:45 +01:00
546c925224 Enforce a limit for search results when searching through api 2022-03-23 22:51:45 +01:00
d7b5944c5f temporarily desactivate resources for docgen 2022-03-23 22:51:45 +01:00
aa234e0749 activity annexe button made sticky 2022-03-23 17:33:23 +01:00
506118b3f1 edit and create of thirdparty pers physique is possible, but current civility and profession don't display yet in edit form 2022-03-23 16:10:02 +01:00
52a78902f7 Merge remote-tracking branch 'origin/master' into issue491_thirdparty_edit_modal 2022-03-23 15:53:55 +01:00
e89489fde9 update changelog 2022-03-23 15:04:52 +01:00
a7be9c0a83 Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles 2022-03-23 14:59:44 +01:00
6331d8fd3e validation fix for person ressource 2022-03-23 14:59:30 +01:00
nobohan
eb6790b17d quick fix: missing translation 2022-03-23 14:58:09 +01:00
61f010f5ad Merge branch 'issue507_conditional_menu_entries' into 'master'
Options added for section menu entries

See merge request Chill-Projet/chill-bundles!391
2022-03-23 13:23:32 +00:00
30fd36b741 forgotten translation added 2022-03-23 14:16:38 +01:00
91aacb91cc merge master into branch 2022-03-23 14:07:26 +01:00
73c17febd9 remove inter database reference 2022-03-23 00:05:36 +01:00
99dc9dd4a8 handle case when user is null in comment embeddable 2022-03-22 23:36:02 +01:00
c5ffca22ff ease docgen normlisation for resources 2022-03-22 22:37:19 +01:00
89e7eb85ff fix cs 2022-03-22 22:36:01 +01:00
98d5de29b0 translations added 2022-03-22 16:09:03 +01:00
4939c8c8e4 changelog updated 2022-03-22 15:50:31 +01:00
8d5c66dc40 person can be added to filiation graph and relationship created 2022-03-22 15:49:25 +01:00
02571bf727 switch to using getDescendantsWithThis() 2022-03-22 13:45:20 +01:00
2c6cbeb8ca minor fix in vue component to update thirdparty firstname 2022-03-22 11:30:33 +01:00
13a7d791a1 fixes to allow for firstname value of null 2022-03-22 11:07:26 +01:00
ae555fed00 migration executed down and new one created to allow firstname nullable 2022-03-22 11:07:05 +01:00
6d65009987 Merge remote-tracking branch 'origin/master' 2022-03-21 18:05:38 +01:00
386e88387d Merge branch 'issue560_ACCent_parcours_household' into 'master'
Create parcours from within household context

See merge request Chill-Projet/chill-bundles!390
2022-03-21 17:05:00 +00:00
22473d6547 Merge remote-tracking branch 'origin/master' into issue560_ACCent_parcours_household 2022-03-21 18:01:26 +01:00
e7b4f1a54f Merge branch 'issues546_553_554_documents_acc_period_activity' into 'master'
issues553_554_documents_activity

See merge request Chill-Projet/chill-bundles!389
2022-03-21 17:00:21 +00:00
1f6565d2ef add return path when creating an activity 2022-03-21 17:59:41 +01:00
e838a82556 Merge remote-tracking branch 'origin/master' into issues546_553_554_documents_acc_period_activity 2022-03-21 17:35:10 +01:00
eebca7b0f1 Merge branch 'issue517_extend_document_to_person_vendee' into 'master'
commentembeddable: add a condition for the early return in normalisation

See merge request Chill-Projet/chill-bundles!388
2022-03-21 16:33:23 +00:00
169d4dc41c finalize normalization on ressources 2022-03-21 17:33:01 +01:00
9e063180bf forgotten translation 2022-03-21 16:37:14 +01:00
5b0b15f395 Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles 2022-03-21 16:23:16 +01:00
736d43e756 translation fixed 2022-03-21 16:23:06 +01:00
b4add2de95 Merge remote-tracking branch 'origin/master' into issue517_extend_document_to_person_vendee 2022-03-21 16:20:03 +01:00
37a8928e41 remove dump 2022-03-21 16:19:27 +01:00
0a0243eb85 Merge branch 'issue511_document_evaluations' into 'master'
AccompanyingCourseWorkEdit: replace document by a new one, fix deleting

See merge request Chill-Projet/chill-bundles!384
2022-03-21 15:17:34 +00:00
a6c7c1d997 fix tests for user 2022-03-21 16:17:19 +01:00
c7caa2ba76 addpersons component, doesnt hear emitted event... 2022-03-21 16:13:02 +01:00
2ce8b1110d allow to change color for asyncupload button 2022-03-21 16:13:02 +01:00
11d57094e8 fix cs 2022-03-21 15:22:40 +01:00
704392a729 do not add referrer if user is null (fix condition) 2022-03-21 15:21:29 +01:00
efeda81e05 do not add referrer if user is null 2022-03-21 15:17:33 +01:00
ae5940eb48 Merge remote-tracking branch 'origin/master' into issue511_document_evaluations 2022-03-21 15:00:40 +01:00
638ae3315f Merge branch 'issue509_parcours_referent' into 'master'
Reassign parcours of absent user

See merge request Chill-Projet/chill-bundles!387
2022-03-21 13:58:33 +00:00
ac9e55e2fc fix methods for accompanying period repository acl aware
* add method to interface
* delegate ACL to another method
2022-03-21 14:54:01 +01:00
293efc03b4 fixes for reasign list
* use existing method in UserRepository and use a method instead of
building a query outside of the repository;
* use renderString to render users
* fix building of filter form (add $data). This make the use of the
method "get" instead of post
2022-03-21 13:35:14 +01:00
f084078cf2 Merge remote-tracking branch 'origin/master' into issue509_parcours_referent 2022-03-21 12:59:24 +01:00
c8a66f008e Merge branch 'issue502_user_in_actions' into 'master'
Issue502 referres in AccompanyingPeriodWork

See merge request Chill-Projet/chill-bundles!381
2022-03-21 11:55:24 +00:00
b6b6c25b3b adapt queries for listing near recents evaluation and work on homepage, taking care of referrers 2022-03-21 12:54:50 +01:00
cb35aed202 use remove-items UI api for listing referrers 2022-03-21 12:45:20 +01:00
eebe1d669a first commit 2022-03-21 12:39:33 +01:00
8f462da627 fix cs 2022-03-21 12:32:46 +01:00
3aaecc8630 set creator as referrer for works 2022-03-21 12:32:40 +01:00
9b97b03d42 csfixes 2022-03-21 12:16:49 +01:00
bdb07a3a05 options added to create person or parcours and to access global history 2022-03-21 12:10:03 +01:00
2fda5b751b Merge remote-tracking branch 'origin/master' into issue502_user_in_actions 2022-03-21 11:53:21 +01:00
ddb048daca Merge branch 'issue479_admin_user' into 'master'
user admin

See merge request Chill-Projet/chill-bundles!372
2022-03-21 10:47:43 +00:00
ac42de7863 Merge branch 'fix-test-2022-03-21' 2022-03-21 11:46:48 +01:00
2c55cfe1dc by default, translate menu items 2022-03-21 11:41:16 +01:00
3ba3498892 Merge remote-tracking branch 'origin/master' into issue479_admin_user 2022-03-21 11:36:28 +01:00
99276dc41c fix cs 2022-03-21 11:35:50 +01:00
fced8ef4b7 try to fix test with null id 2022-03-21 11:34:54 +01:00
247f1879e3 Merge remote-tracking branch 'origin/master' into issue471_activity_socialissue-action 2022-03-21 11:16:19 +01:00
a06a0788c1 csfixes 2022-03-21 10:22:28 +01:00
5a8291dc87 merge master into branch 2022-03-21 10:21:59 +01:00
15af0203ff add menu entry in section menu 2022-03-21 10:21:12 +01:00
7006196691 csfixes 2022-03-21 09:54:53 +01:00
5cbe14464d fix in view template to display firstname + lastname in title if it exists 2022-03-21 09:53:59 +01:00
2463a492c8 merge master into branch 2022-03-21 09:40:39 +01:00
72f69f0f82 changelog updated 2022-03-19 12:11:49 +01:00
a2daeff384 csfixes 2022-03-19 12:10:47 +01:00
caaa25ef8e controller action to create parcours from within household + link added in template 2022-03-19 12:08:20 +01:00
ff5aeaae17 translation changed in action evaluation section 2022-03-19 11:32:16 +01:00
184a664bf9 english text translated in thirdparty view page 2022-03-19 11:25:56 +01:00
nobohan
dbc604d84a AccompanyingCourseWorkEdit: download existing documents 2022-03-18 17:02:35 +01:00
nobohan
9c353669ea activity: fix delete button for documents 2022-03-18 16:11:09 +01:00
8d92cc0ba7 remove history from menus, temporarily 2022-03-18 15:40:01 +01:00
nobohan
215b859725 activity: hide delete button from asyncupload and add delete buttons from chill collection 2022-03-18 15:25:45 +01:00
da67fa4c4f fix role for creating activity in person 2022-03-18 14:33:05 +01:00
5b4c3ae9b3 Merge branch 'issue503_workflow_document_template' into 'master'
Workflow document template

See merge request Chill-Projet/chill-bundles!382
2022-03-18 13:24:40 +00:00
fdb36ab047 add document title to workflow EvaluationDocument handler 2022-03-18 14:18:47 +01:00
a1b1e6bb17 Merge remote-tracking branch 'origin/master' into issue503_workflow_document_template 2022-03-18 14:01:43 +01:00
nobohan
73dd97f7d3 upd CHANGELOG 2022-03-18 13:58:20 +01:00
bfd51c6615 allow downloads in LO editor 2022-03-18 13:55:33 +01:00
nobohan
b84e161399 quick fix css class in acc period evaluation form, issue client 557 2022-03-18 12:35:14 +01:00
nobohan
3b8c329ff6 upd CHANGELOG 2022-03-17 19:08:13 +01:00
nobohan
e7299bac4a person: add person ressource to person docgen normaliser 2022-03-17 19:07:11 +01:00
Marc Ducobu
80d518e4af Merge branch 'fixdataimportcp4digits' into 'master'
Fix pbm importing CP from France on 4 digits

See merge request Chill-Projet/chill-bundles!386
2022-03-17 17:44:39 +00:00
Marc Ducobu
730762d1c6 Merge branch 'master' into fixdataimportcp4digits 2022-03-17 18:37:00 +01:00
Marc Ducobu
288f0dbf69 Fix pbm importing CP from France on 4 digits 2022-03-17 18:34:55 +01:00
Marc Ducobu
2c02150b1a Use CS Fixer 2022-03-17 18:29:16 +01:00
nobohan
5e0a693108 commentembeddable: add a condition for the early return in normalisation 2022-03-17 17:51:25 +01:00
72ba2c6bca paginator added + phpcsfixes 2022-03-17 14:13:21 +01:00
6adb647ccc changelog updated 2022-03-17 12:31:44 +01:00
97731b0a9b controller + template made to list confirmed parcours for a specific user 2022-03-17 12:28:00 +01:00
Marc Ducobu
1e63d00767 Fix pbm importing CP from France on 4 digits 2022-03-16 16:27:17 +01:00
6151d0ce54 fix name suggestion badges underneath input fields 2022-03-16 12:32:54 +01:00
9551e10d2b improvement, but still not correct 2022-03-16 11:55:19 +01:00
387b7c2fbd first commit 2022-03-16 11:36:46 +01:00
39ba21f308 merge master into branch 2022-03-16 11:36:07 +01:00
Pol Dellaiera
22755de1dd fix: Remove PrependExtensionInterface.
It is now handled by `chill_main` bundle.
2022-03-15 13:45:07 +01:00
Pol Dellaiera
3d7fcd99a8 fix: Remove console.log. 2022-03-15 13:45:07 +01:00
Pol Dellaiera
35d723e5fb refactor: Use StoredObjectManager. 2022-03-15 13:45:07 +01:00
Pol Dellaiera
62af980ea5 feat: Add new StoredObjectManager service.
To read and write onto `StoredObject` document using a common interface.
2022-03-15 13:41:38 +01:00
Pol Dellaiera
8abed67e1c refactor: Return a string instead of a resource. 2022-03-15 09:40:32 +01:00
Pol Dellaiera
b8992b8eeb misc: Update interface doc. 2022-03-15 09:40:32 +01:00
Pol Dellaiera
6ddbf35a7b misc: Add return types. 2022-03-15 09:40:32 +01:00
Pol Dellaiera
325ab0daf3 chore: Update composer.json files. 2022-03-15 09:40:32 +01:00
1a783e1881 Merge branch 'issue495_AccPeriodWorkEval_circular_reference' into 'master'
AccompanyingPeriodWorkEvaluation: fix circular reference when serialising

See merge request Chill-Projet/chill-bundles!383
2022-03-14 20:48:37 +00:00
d04f5a527b remove link to action on homepage, in evaluation list 2022-03-14 21:46:21 +01:00
f51279e83e fix saving maxDate when denormalizing object 2022-03-14 21:46:01 +01:00
90bebbad7d fix normalization for docgen 2022-03-14 21:27:21 +01:00
nobohan
82052f5d70 AccompanyingCourseWorkEdit: fix setting title of document with a fresh upload 2022-03-14 15:13:21 +01:00
nobohan
369397bf4f upd CHANGELOG 2022-03-14 14:42:53 +01:00
c61577edda Merge remote-tracking branch 'origin/master' into issue495_AccPeriodWorkEval_circular_reference 2022-03-14 14:42:24 +01:00
nobohan
1beae4d713 AccompanyingCourseWorkEdit: download existing documents 2022-03-14 14:42:04 +01:00
352302b7aa merge master into branch 2022-03-14 13:51:43 +01:00
01b60f334a Merge remote-tracking branch 'origin/master' into issue491_thirdparty_edit_modal 2022-03-14 13:43:39 +01:00
0546a43d63 changelog updated 2022-03-14 13:41:32 +01:00
5c68879509 fix doctrine annotation to make it comply with cs 2022-03-14 13:41:11 +01:00
9d844f6692 Merge branch 'issue505_create_household_composition' into 'master'
Issue505 create household composition

See merge request Chill-Projet/chill-bundles!378
2022-03-14 12:40:15 +00:00
28509f651d fix button and acl in household composition list 2022-03-14 13:39:33 +01:00
b590444375 Merge remote-tracking branch 'origin/master' into issue505_create_household_composition 2022-03-14 13:35:43 +01:00
873258fc84 update button person ressource creation 2022-03-14 13:35:03 +01:00
7988becc45 Merge branch 'issue504_person_ressource_create' into 'master'
Separate create page person resource

See merge request Chill-Projet/chill-bundles!377
2022-03-14 12:33:42 +00:00
45c4a7ae64 Merge remote-tracking branch 'origin/master' into issue504_person_ressource_create 2022-03-14 13:30:32 +01:00
05803787a9 Merge branch 'issue493_order_parcours' into 'master'
Issue493 order parcours

See merge request Chill-Projet/chill-bundles!375
2022-03-14 12:28:33 +00:00
33acc645ea Merge remote-tracking branch 'origin/master' into issue493_order_parcours 2022-03-14 13:27:26 +01:00
0ce787701f Merge branch 'fix_blur_toggle' into 'master'
finding solution for toggle button position

See merge request Chill-Projet/chill-bundles!374
2022-03-14 12:26:25 +00:00
e9cacbb74a add comment for future refactorisation 2022-03-14 13:26:07 +01:00
a2f8f7ae43 add badge on third party in residential address list 2022-03-14 13:18:41 +01:00
a49c53772e Merge remote-tracking branch 'origin/master' into fix_blur_toggle 2022-03-14 13:15:05 +01:00
1adccdb06e Merge branch 'issue489_address_onTheFly' into 'master'
Address history onTheFly for linked person

See merge request Chill-Projet/chill-bundles!373
2022-03-14 12:14:08 +00:00
22d593fc12 Merge remote-tracking branch 'origin/master' into issue489_address_onTheFly 2022-03-14 13:12:53 +01:00
de7ec6fa54 Merge branch 'issue477_autosave_comment_parcours' into 'master'
Issue477 autosave comment parcours

See merge request Chill-Projet/chill-bundles!370
2022-03-14 12:12:07 +00:00
90948e5513 Merge remote-tracking branch 'origin/master' into issue477_autosave_comment_parcours 2022-03-14 13:11:53 +01:00
bd79391efc fix autosave of comment 2022-03-14 13:04:29 +01:00
4ea72f7d9d csfixes 2022-03-14 11:49:58 +01:00
96e38a8a6d eventlistener added to capitalize names correctly 2022-03-14 11:49:01 +01:00
09e6872724 firstname added to onthefly for child or contact 2022-03-14 11:48:39 +01:00
f44f9d356b migration adjusted to have actual empty string instead of '' 2022-03-14 11:16:58 +01:00
nobohan
9f0ab5aee7 upd CHANGELOG 2022-03-14 10:43:28 +01:00
nobohan
6eac6044cd AccompanyingCourseWorkEdit: replace document by a new one (working now) 2022-03-14 10:42:16 +01:00
a24cd693e3 firstname field added to twig form for child or contact types 2022-03-14 10:23:47 +01:00
f63aab327d Merge branch 'issue480_bug_householdrenderbox' into 'master'
bugfix when position of member is null

See merge request Chill-Projet/chill-bundles!365
2022-03-14 08:58:52 +00:00
0c9499dd58 Merge remote-tracking branch 'origin/master' into issue480_bug_householdrenderbox 2022-03-14 09:53:23 +01:00
00787adf2b firstname property added to thirdparty + canonicalize function adapted 2022-03-14 09:35:22 +01:00
nobohan
dbe186547f AccompanyingCourseWorkEdit: replace document by a new one 2022-03-13 22:31:26 +01:00
nobohan
13f0b8610c quick fix: missing translation in Task 2022-03-11 16:37:26 +01:00
nobohan
f9e8bf4f2d upd CHANGELOG 2022-03-11 10:22:09 +01:00
nobohan
44e93dd5f8 AccompanyingPeriodWorkEvaluation: fix circular reference when serialising 2022-03-11 10:20:42 +01:00
nobohan
ee8f331de4 Revert "AccompanyingPeriodWorkEvaluation: fix circular reference when serialising"
This reverts commit 99f8aeb6cd.
2022-03-11 10:18:14 +01:00
nobohan
99f8aeb6cd AccompanyingPeriodWorkEvaluation: fix circular reference when serialising 2022-03-11 10:01:20 +01:00
nobohan
fc1fe7c277 php cs fix 2022-03-10 18:14:57 +01:00
nobohan
a8b6609dbf comment in accompanying course: add loader + fix when resetting to empty string 2022-03-10 18:12:42 +01:00
nobohan
ded2ac7d48 accompanyiing period comment: fix removing of comment 2022-03-10 17:01:52 +01:00
nobohan
16a0dc4621 fix role for AccPeriod Comment API 2022-03-10 16:46:10 +01:00
nobohan
ba668d3b9d upd CHANGELOG 2022-03-10 16:27:03 +01:00
nobohan
690a443bdb fix code style for AccompanyingPeriodWork - referrers 2022-03-10 16:25:05 +01:00
nobohan
137eb184d0 accompanying period work: display referrers in the list of work 2022-03-10 16:18:59 +01:00
0a2730540e lost text removed plus condition to editing file uncommented 2022-03-10 14:45:43 +01:00
9284a4bc29 ACL added and buttons to download and edit document 2022-03-10 14:30:19 +01:00
nobohan
f2edc1ef0c set constrint ondelete for comment in AccompanyingPeriod 2022-03-10 14:23:00 +01:00
bf2d9acc5a correction of template, display title linked to workflow doc 2022-03-10 14:03:37 +01:00
2628e58ea0 document title added + concerned users 2022-03-10 12:28:17 +01:00
nobohan
da650fa1f2 AccompanyingPeriodWork: add doctrine event listener to add logged user to referrers collection 2022-03-10 10:53:40 +01:00
nobohan
55a65ee6e9 accompanyingPeriodWork: add referrer in vuejs form 2022-03-10 10:32:20 +01:00
nobohan
492c22d1b7 AccompanyingPeriodWork: add referrers field 2022-03-10 08:40:11 +01:00
e153fa34e9 merge master into branch 2022-03-09 20:48:30 +01:00
d272e1398c fix merge conflict in changelog 2022-03-09 20:45:42 +01:00
9457926a35 fix merge conflict 2022-03-09 20:43:31 +01:00
8ff80ac65e changelog updated 2022-03-09 20:42:48 +01:00
3d1ded8b1c position of toggle button improved (differentation between twig and vue) + fix fa-eye-slash in vue component 2022-03-09 20:41:24 +01:00
c611f35cd6 finding solution for toggle button position 2022-03-09 20:41:24 +01:00
f79cfda74a update changelog 2022-03-09 20:31:02 +01:00
ff4b90835e show current civility and profession in edit form + fix saving of edited information 2022-03-09 20:29:38 +01:00
d5501bcfbd remove console logs to avoid mess in the console 2022-03-09 20:07:41 +01:00
fb1552f6b7 update changelog and csfixes 2022-03-09 14:07:41 +01:00
e28da7e99b create-edit composition placed in separate page to avoid confusion 2022-03-09 14:06:18 +01:00
4b899d337a changelog updated 2022-03-09 13:36:26 +01:00
d6933fce35 add contact button color changed 2022-03-09 13:35:55 +01:00
aefd09693b position of toggle button improved (differentation between twig and vue) + fix fa-eye-slash in vue component 2022-03-09 12:10:33 +01:00
8555277827 changelog updated 2022-03-09 11:06:10 +01:00
6f58a9a8bb separate create page 2022-03-09 11:06:00 +01:00
b02739cc3c phonenumber placeholder removed 2022-03-09 09:35:47 +01:00
b8d9d59d76 condition added to display thirdparty centers or not 2022-03-09 09:19:29 +01:00
nobohan
ba52e95253 display error messages above form when creating new Location 2022-03-08 17:21:49 +01:00
nobohan
2e69dbb7c9 upd CHANGELOG 2022-03-08 17:06:58 +01:00
13d579dc33 add 'for' in macro workflow breadcrumb 2022-03-08 17:06:30 +01:00
nobohan
efcc602d53 Activity form: add required class name on required field built with vue 2022-03-08 16:09:22 +01:00
ee82bd2867 change personne to usager and & to ET 2022-03-08 16:03:59 +01:00
nobohan
fcc5d3d349 Activity: small fixes on displaying social Issues and social Actions hidden fields 2022-03-08 15:41:03 +01:00
af3b761208 evaluationWorkDocument: fill title with document is generated 2022-03-08 14:41:25 +01:00
23e61ac6a7 fixes stan errors 2022-03-08 11:43:47 +01:00
e4ae495a3f add empty lines on addresses when address is empty 2022-03-08 11:43:47 +01:00
ec99bc95fa add itemMeta variable for course list 2022-03-08 11:43:47 +01:00
nobohan
b68b43118b update CHANGELOG 2022-03-08 11:38:40 +01:00
nobohan
db95e935d9 order accompanying period by opening date in search person 2022-03-08 11:37:08 +01:00
nobohan
dc5ff53a57 order accompanying course by openingDate for Household 2022-03-08 11:21:59 +01:00
nobohan
50a2de1559 order accompanying course by openingDate for Person 2022-03-08 11:20:06 +01:00
d18ab5cf49 fix display of email in person renderbox if null or empty string 2022-03-08 11:00:31 +01:00
1860478aea finding solution for toggle button position 2022-03-08 09:48:17 +01:00
nobohan
17e83deb55 User admin: put pagination 2022-03-08 09:46:41 +01:00
16be28681a Test added for activity-social action and social issue 2022-03-07 15:13:47 +01:00
388b666b5d person badge changed to include onTheFly + changelog updated 2022-03-07 14:36:44 +01:00
nobohan
9b06ccc3e6 user admin: use flex-table and flex-bloc in twig 2022-03-07 11:13:11 +01:00
efbd9b0185 do not allow to remove doc or evaluations if workflow is associated 2022-03-07 00:30:53 +01:00
b2a61071bf create voter which blocks deletion if a workflow exists 2022-03-07 00:30:53 +01:00
f0849eeef5 Merge branch 'issue484_link_household' into 'master'
add current household link to person banner

See merge request Chill-Projet/chill-bundles!369
2022-03-06 21:58:37 +00:00
c7f2eedd4b Merge remote-tracking branch 'origin/master' into issue484_link_household 2022-03-06 22:57:12 +01:00
ab74478afc Merge branch 'issue478_remove_localisation' into 'master'
fix parcours localisation

See merge request Chill-Projet/chill-bundles!368
2022-03-06 21:56:04 +00:00
f88d0ee19e Merge remote-tracking branch 'origin/master' into issue478_remove_localisation 2022-03-06 22:54:48 +01:00
727480d6d1 Merge branch 'issue472_filter_job_user_in_set_referrer' into 'master'
assign User to undispatched acc period: filter users by job type

See merge request Chill-Projet/chill-bundles!367
2022-03-06 21:52:43 +00:00
af79ffd544 Merge remote-tracking branch 'origin/master' into issue472_filter_job_user_in_set_referrer 2022-03-06 22:40:14 +01:00
80aee185a7 Merge branch 'url_in_accompanyingPeriodWork_evaluations' into 'master'
Url in accompanying period work evaluations

See merge request Chill-Projet/chill-bundles!364
2022-03-06 21:37:27 +00:00
7afada5dad fix cs 2022-03-06 22:36:38 +01:00
739c7e9a77 Merge remote-tracking branch 'origin/master' into url_in_accompanyingPeriodWork_evaluations 2022-03-06 22:33:16 +01:00
03471a74fe fix creating alt phonenumber 2022-03-06 22:28:33 +01:00
44ed2e44e0 another way to fix phonenumber and telephone in third party / OnTheFly 2022-03-06 22:16:48 +01:00
68aa80269f rebase onto master 2022-03-04 17:29:36 +01:00
2012df512c merge conflict fixed 2022-03-04 17:27:26 +01:00
1c21b80703 csfixes 2022-03-04 17:25:37 +01:00
25fe105590 fix logic in activity entity 2022-03-04 17:25:37 +01:00
b6e530fec6 update changelog 2022-03-04 17:25:37 +01:00
4ef2274803 logic added to only keep youngest descendant. works for issue, seems not to for action 2022-03-04 17:25:22 +01:00
3352999862 rebase onto master 2022-03-04 17:23:37 +01:00
5605813826 Update changelog 2022-03-04 17:22:27 +01:00
72795240b9 Add current household link in person banner 2022-03-04 17:22:06 +01:00
d0772fc306 Add email to twig personRenderBox 2022-03-04 17:08:41 +01:00
nobohan
def90893de upd CHANGELOG 2022-03-04 15:12:11 +01:00
nobohan
4b692edd7d accompanying course comment: autosave the comment 2022-03-04 15:09:50 +01:00
nobohan
6472c554ed accompanying course comment: more tentative to delete the comment 2022-03-04 14:22:25 +01:00
nobohan
f04118218d accompanying course comment: tentative to delete the comment 2022-03-04 13:56:03 +01:00
nobohan
cde6e8f368 accompanying course: allow PATCH on a comment entity 2022-03-04 13:01:01 +01:00
474fffcbb5 changelog updated 2022-03-04 12:08:00 +01:00
0333e79b0a csfixes 2022-03-04 12:07:29 +01:00
7c043e9d85 fix logic in activity entity 2022-03-04 12:06:53 +01:00
nobohan
6d46efa610 accompanying course: fix posting of pinned comment 2022-03-04 11:53:27 +01:00
nobohan
84f2e1c72a Accompanying Period: set cascade persist on pinnedComment 2022-03-04 10:34:47 +01:00
nobohan
1c1dec1f5b upd CHANGELOG 2022-03-04 08:46:32 +01:00
nobohan
3ff9291580 assign User to undsipatched acc period: filter users by job type 2022-03-04 08:46:32 +01:00
9265a15427 Update changelog 2022-03-03 21:12:00 +01:00
6d3b88aee9 Add current household link in person banner 2022-03-03 21:09:50 +01:00
827c85ac56 fix parcours localisation 2022-03-03 20:37:12 +01:00
nobohan
7b52a10943 upd CHANGELOG 2022-03-03 17:21:54 +01:00
nobohan
187c9d82b6 assign User to undsipatched acc period: filter users by job type 2022-03-03 16:37:58 +01:00
214ef09fe7 update changelog 2022-03-03 16:29:35 +01:00
892be42580 update changelog 2022-03-03 16:28:31 +01:00
18694a34cf logic added to only keep youngest descendant. works for issue, seems not to for action 2022-03-03 16:24:37 +01:00
nobohan
c5eac09478 php cs fix on migration 2022-03-03 15:17:05 +01:00
nobohan
a88e052eb6 upd CHANGELOG 2022-03-03 15:12:47 +01:00
nobohan
568a1d95f4 AccompanyingCourseWorkEdit: add url to vuejs form 2022-03-03 15:10:05 +01:00
nobohan
349db2142d person: add url field to SocialWork Evaluation entity + populate with http title values 2022-03-03 14:39:00 +01:00
34b3c6fa32 bugfix when position of member is null 2022-03-03 14:15:20 +01:00
19cad9a7a4 do not update names after person update 2022-03-03 12:43:04 +01:00
a736c2a67e fix migrations 2022-03-03 12:32:38 +01:00
636f92b168 Revert "add migrations files"
This reverts commit 7f5a91fc49.
2022-03-03 12:10:25 +01:00
7f5a91fc49 add migrations files 2022-03-03 11:42:43 +01:00
3ab71c8a2e update chill-app with migrations for budget 2022-03-03 11:12:30 +01:00
fdf1911c15 fix default config 2022-03-03 11:07:02 +01:00
ba24abf788 fix cs 2022-03-03 10:56:36 +01:00
076728bf5f enable chilld budget bundle in test app 2022-03-03 10:55:25 +01:00
0833bb49ca fixes for budgets 2022-03-03 10:37:10 +01:00
ac12e75714 Merge remote-tracking branch 'origin/master' into issue469_budget 2022-03-02 22:01:28 +01:00
969f0b8aeb Display of budget result 2022-03-02 16:38:55 +01:00
8b37f008e6 csfixes 2022-03-02 16:38:31 +01:00
283b378291 fix template bug 2022-03-02 16:19:17 +01:00
9bb149fb02 added missing translations + further adjustment templates 2022-03-02 15:44:49 +01:00
5dc117037d change label styling for view of resource/charge (suggestion) 2022-03-02 12:02:49 +01:00
7f1083aa40 Use select2 field 2022-03-02 12:02:16 +01:00
900adc7105 improvements templates 2022-03-02 11:44:10 +01:00
0648154ba1 remove comments 2022-03-02 11:43:55 +01:00
86de8137e4 restyling layout of table 2022-03-02 11:42:54 +01:00
cefa304fb5 mixup colors fixed. color of resource to be discusses still 2022-03-01 15:49:37 +01:00
83760cc980 Merge remote-tracking branch 'origin/master' into issue469_budget 2022-03-01 15:42:59 +01:00
695b9d5bea merge with master 2022-03-01 14:32:03 +01:00
f38cfb4b28 adjustments templates 2022-03-01 14:30:12 +01:00
67948f7f3a styles in scss with webpack 2022-03-01 14:00:14 +01:00
d6bad9e030 reorganization of templates 2022-03-01 11:07:53 +01:00
a59994355b fix merge conflict 2022-02-28 17:14:37 +01:00
18c0e6a6bf template adjustments for household members 2022-02-28 10:12:40 +01:00
26373e5d23 template adjustments for household members 2022-02-28 09:47:47 +01:00
deadeb341e more template adjustments 2022-02-25 17:45:50 +01:00
274c6115cc index templates fixed for display of past and future budgets 2022-02-25 17:01:24 +01:00
416665f209 translations added 2022-02-25 17:01:04 +01:00
f60f927549 Fix budget voter for use with household 2022-02-25 16:40:27 +01:00
2e59c1415b csfixes plus changelog updated 2022-02-25 16:24:25 +01:00
d852477c51 Add budget of household members to overview page of household budget 2022-02-25 16:20:52 +01:00
f8d5f13a88 add methods to get budgetResources and budgetCharges in person entity 2022-02-25 16:20:07 +01:00
fc5a893b00 template fixes and controller fixes for household budget 2022-02-25 10:30:37 +01:00
92a6fed521 phpstan fixes 2022-02-25 09:48:33 +01:00
051ed19f97 cs-fixes 2022-02-25 09:29:28 +01:00
c4e0b68ebe change block personcontent to content more consistent with other templates and less need for if-statements 2022-02-24 15:59:13 +01:00
f8ec0f85e5 property household added to entity 2022-02-24 15:49:47 +01:00
ed33514aee Voter adapted for use within vendee 2022-02-24 15:49:28 +01:00
0d96c1f12d Repositories adapted for use with person or household 2022-02-24 15:49:04 +01:00
0fcf21bd35 Controllers adjusted for use with person or household 2022-02-24 15:48:39 +01:00
9065ec40b1 Menu entry added household menu 2022-02-24 15:47:58 +01:00
8f6ab15621 migrations 2022-02-24 15:46:22 +01:00
fd69ae3d4a Translation folder renamed to translation in accordance to other bundles 2022-02-24 15:46:08 +01:00
81b42ef99a templates adjusted to allow use for person and household 2022-02-24 15:45:35 +01:00
c546d23421 scss file added plus config webpack
still missing something, because doesn't work yet
2022-02-24 15:44:37 +01:00
7067d4b5bd Attempt to make voter work 2022-02-23 18:07:54 +01:00
de0be15fff Added budget link to household menu + created controller file
no content for controller yet
2022-02-23 18:07:38 +01:00
fd16222c51 translations folder moved 2022-02-23 17:20:19 +01:00
185d1dbf49 Styling view page 2022-02-23 17:16:26 +01:00
576f46f845 styling of index page
style needs to be moved to correct file and changed scss
2022-02-23 15:58:06 +01:00
d5477e94b1 fix merge conflicts 2022-02-23 14:55:43 +01:00
67ae506bb5 Testing to see what still works, minor changes 2022-02-23 14:53:37 +01:00
5a514cf2db Moving migration folder and adding migration 2022-02-23 14:53:01 +01:00
1fdc994c0a adding budget to person menu 2022-02-23 14:52:37 +01:00
35aa05fb97 change namespaces, removing AMLI 2022-02-23 14:52:04 +01:00
70c7b1385e change namespaces, removing AMLI 2022-02-23 11:24:24 +01:00
394 changed files with 7687 additions and 2587 deletions

View File

@@ -11,6 +11,86 @@ and this project adheres to
## Unreleased
<!-- write down unreleased development here -->
## Test releases
### 2021-04-26
* [Datepickers] datepickers fixed when using keyboard to enter date (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/545)
* [social_action] Display 'agents traitants' in parcours resumé and social action list (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/568)
* [Person_search] Closed parcours shown within an accordeon that can be opened/closed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/574)
### 2021-04-24
* [notification email on course designation] allow raw string in email content generation
* [Accompanying period work] list evaluations associated to a work by startDate, and then by id, from the most recent to older
* [Documents] Change wording 'créer' to 'enregistrer' (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/634)
* [Parcours]: The number of 'mes parcours' displayed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/572)
* [Hompage_widget]: Renaming of tabs and removal of social actions tab (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/570)
* [activity]: Ignore thirdparties when creating a social action via an activity (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/573)
* [parcours]: change wording of warning message and button when user is not associated to a household yet (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/590#note_918370943)
* [Accompanying period work evaluations] list documents associated to a work by creation date, and then by id, from the most recent to older
* [Course comment] add validationConstraint NotNull and NotBlank on comment content, to avoid sql error
* [Notifications] delay the sending of notificaiton to kernel.terminate
* [Notifications / Period user change] fix the sending of notification when user changes
* [Activity form] invert 'incoming' and 'receiving' in Activity form
* [Activity form] keep the same order for 'attendee' field in new and edit form
* [list with period] use "sameas" test operator to introduce requestor in list
* [notification email on course designation] allow raw string in email content generation
* [Accompanying period work] list evaluations associated to a work by startDate, and then by id, from the most recent to older
### 2021-04-13
* [person] household address: add a form for editing the validFrom date (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/541)
* [person] householdmemberseditor: fix composition type bug in select form (vuejs) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/543)
* [docgen] add more persons choices in docgen for course: amongst requestor (if person), resources of course (if person), and PersonResource (if person);
* [docgen] add a new context with a list of activities in course
* [docgen] add a comment in budget lines
* [notifications] allow to send a notification to an email address. The address receive an access link
* [adresses] add constraints in database to avoid errors later: postcode not null, and validfrom <= validto
* [accompanying work editor] add a label on document title input
### 2021-04-07
* notification list: move action buttons outside of the toggle
* fix detecting of non-read notification
* filter users which are disabled in search user api
* order query for location and add pagination in list
* allow every person which has part for a workflow to see the workflow page
* able to see the workflow if the evaluation document has been deleted
* hardcode the list of supported mime types for edition with collabora
* list of accompanying course: allow to see the pinned comment in list_item
### 2021-04-06
* [main] notification toggle read: correct js syntax for compilation in production (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/548)
* [parcours] Display of interlocuteurs changed to flex-table in parcours edit page to prevent cut-off of information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/535)
* [activity] espace entre les boutons pour supprimer les documents
### continuous release in February and March
* Creation of PickCivilityType, and implementation in PersonType and ThirdpartyType
* [person] Accompanying course evaluation documents: disable the WOPI edit link if mimetype not supported and if no keyInfos
(https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/585)
* [activity] display error messages above the form in creating a new location (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/481)
* [activity] show required field in activity edit/new by an asterix in the vuejs fields (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/494)
* [ACL] fix allow to see the course, event if the scope'course does not contains the scope's user
* [search] enforce limit of results for fetching rsults by search api https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/576
* [activity] Fix delete button for document (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/554)
* [activity] Add return path the document generation (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/553)
* [person] add person ressource to person docgen normaliser (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/517)
* [person] AccompanyingCourseWorkEdit: fix deleting evaluation documents (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/546)
* [person] AccompanyingCourseWorkEdit: download existing documents (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/512)
* [person] AccompanyingCourseWorkEdit: replace document by a new one (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/511)
* [person] AccompanyingPeriodWork: add referrers to work, add doctrine event listener to add logged user to referrers collection and display a referrers list in work list (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/502)
* [person] AccompanyingPeriodWorkEvaluation: fix circular reference when serialising (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/495)
* [person] order accompanying period by opening date in search persons, person and household period lists (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/493)
* [parcours] autosave of the pinned comment for draft accompanying course (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/477)
* [main] filter user job in undispatch acc period to assign (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/472)
* [main] filter user job in undispatch acc period to assign (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/472)
* [person] Add url in accompanying period work evaluations entity and form (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/476)
* [person] Add document generation in admin and in person/{id}/document (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/464)
* [activity] do not override location if already exist (when validating new activity) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/470)
* [parcours] Toggle emergency/intensity only by referrer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/442)
@@ -21,14 +101,46 @@ and this project adheres to
* [Person/Household list] when listing other simultaneous members of an household, exclude the members on person, not on members (avoid to show two membersship with the same person)
* [draft periods] add a delete button (if acl granted) on each draft period listed on draft period page (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/463)
* [Person] Display suffixText in RenderPerson, PersonText.vue, RenderPersonBox.vue (was made for displaying "enfant confie") (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/441)
* [person] residential address: show residential address or info in PersonRenderBox, refactor Residential Address (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/439)
* [budget]: budget enabled for persons and households (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/469)
* [person] residential address: show residential address or info in PersonRenderBox, refactor Residential Address (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/439)
* [thirdparty] Add a contact to a thirdparty from within onTheFly (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/345)
* [documents] Improve flex-table item-col placement when long buttons and long metadata
* [thirdparty] Fix display of multiple contact badges so they wrap onto next line (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/482)
* [confidential] Fix position of toggle button so it does not cover text nor fall outside of box (no issue)
* [parcours] Fix edit of both thirdparty and contact name (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/474)
* [template] do not list inactive templates (for doc generator)
* [household] bugfix if position of member is null, renderbox no longer throws an error (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/480)
* [parcours] location cannot be removed if linked to a user (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/478)
* [person] email added to twig personRenderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/490)
* [activity] Only youngest descendant is kept for social issues and actions (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/471)
* [person] Add link to current household in person banner (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/484)
* [address] person badge in address history changed to open OnTheFly with all person info (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/489)
* [person] Change 'personne' with 'usager' and '&' with 'ET' (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/499)
* [thirdparty] Add parameter condition to display centers or not (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/500)
* [phonenumber] Remove placeholder in phonenumber field (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/496)
* [person_resource] separate create page created to avoid confusion (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/504)
* [contact] add contact button color changed plus the pipe at the side removed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/506)
* [thirdparty] For contacts show current civility/profession in edit form + fix saving of edited information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/491)
* [household] create-edit household composition placed in separate page to avoid confusion (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/505)
* [blur] Improved positioning of toggle icon (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/486)
* [thirdparty] add firstname field to thirdparty 'child' or 'contact' types (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/508)
* [household] create-edit household composition placed in separate page to avoid confusion (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/505)
* [blur] Improved positioning of toggle icon (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/486)
* [parcours] List of parcours for a specific user so they can be reassigned in case of absence (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/509)
* [thirdparty] Thirdparty view page, english text translated (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/534)
* [social_action] Translation changed in evaluation section (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/512)
* [filiation] Possible to add person (or create onthefly) to add to filiation graph + add relation (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/519)
* [household] Within parcours listing page of household add create button (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/560)
* [person_resource] bugfix when adding thirdparty or freetext resource + prevent personOwner themselves to be added. (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/526)
* [aside_activity] style correction + sticky-form create button (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/529)
* [budget] order within the menu adjusted (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/592)
* [onthefly] fix create person. Bug was noticed in filiation (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/591)
* [parcours] Create document buttons made sticky (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/532)
* [person] Trailing guillemet removed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/530)
* [notification] Display of social action within workflow notification set to display block (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/537)
* [onthefly] trim trailing whitespace in email of person and thirdparty (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/542)
* [action] Only youngest descendant is kept for social issues and actions (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/471)
## Test releases
### test release 2022-02-21
@@ -57,8 +169,6 @@ and this project adheres to
* [bug]: fix confidential toggle of address in thirdpartyrenderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/460)
## Test releases
* Creation of PickCivilityType, and implementation in PersonType and ThirdpartyType
### test release 2022-02-14
@@ -85,6 +195,7 @@ and this project adheres to
* [address]: Correction residential address 'depuis le' (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/459)
* [Documents]: List view adapted to display more information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/414)
* [Thirdparty_contact]: address blurred if confidential in view page (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/450)
* [thirdparty] Add a contact to a thirdparty from within onTheFly (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/345)
### test release 2021-02-01
@@ -107,18 +218,9 @@ and this project adheres to
* [fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413
* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
* [thirdparty] Add a contact to a thirdparty from within onTheFly (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/345)
## Test releases
=======
* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
>>>>>>> issue422_and_others_on_AddPersons
=======
* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
* [thirdparty] Add a contact to a thirdparty from within onTheFly (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/345)
>>>>>>> b0d50d315c8e00959a967badac9cf5057ab2b4bc
### test release 2021-01-31
* [person] accompanying course: optimisation: do not fetch some resources for the banner (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/409)

View File

@@ -21,7 +21,7 @@
"knplabs/knp-time-bundle": "^1.12",
"league/csv": "^9.7.1",
"nyholm/psr7": "^1.4",
"ocramius/package-versions": "^1.10",
"ocramius/package-versions": "^1.10 || ^2",
"odolbeau/phone-number-bundle": "^3.6",
"phpoffice/phpspreadsheet": "^1.16",
"ramsey/uuid-doctrine": "^1.7",
@@ -33,6 +33,7 @@
"symfony/expression-language": "^4.4",
"symfony/form": "^4.4",
"symfony/framework-bundle": "^4.4",
"symfony/http-foundation": "^4.4",
"symfony/intl": "^4.4",
"symfony/mailer": "^5.4",
"symfony/mime": "^5.4",
@@ -103,7 +104,8 @@
"ergebnis/composer-normalize": true,
"ocramius/package-versions": true,
"phpro/grumphp": true,
"phpstan/extension-installer": true
"phpstan/extension-installer": true,
"roave/you-are-using-it-wrong": true
},
"bin-dir": "bin",
"optimize-autoloader": true,

View File

@@ -32,7 +32,7 @@ Then, render the pagination using the dedicated twig function.
{% block title 'Item list'|trans %}
{% block personcontent %}
{% block content %}
<table>

View File

@@ -156,7 +156,7 @@ This layout extend `ChillMainBundle::layoutWithVerticalMenu.html.twig` add the p
It proposes 1 new block :
* personcontent
* content
* where to display the information of the person

View File

@@ -222,33 +222,6 @@ parameters:
count: 1
path: src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php
-
message:
"""
#^Class Chill\\\\AMLI\\\\BudgetBundle\\\\Controller\\\\AbstractElementController extends deprecated class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\Controller\\:
since Symfony 4\\.2, use "Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController" instead\\.$#
"""
count: 1
path: src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php
-
message:
"""
#^Class Chill\\\\AMLI\\\\BudgetBundle\\\\Controller\\\\ElementController extends deprecated class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\Controller\\:
since Symfony 4\\.2, use "Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController" instead\\.$#
"""
count: 1
path: src/Bundle/ChillBudgetBundle/Controller/ElementController.php
-
message:
"""
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
"""
count: 1
path: src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php
-
message:
"""

View File

@@ -250,11 +250,6 @@ parameters:
count: 1
path: src/Bundle/ChillMainBundle/Entity/Address.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
@@ -350,11 +345,6 @@ parameters:
count: 6
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 2
path: src/Bundle/ChillPersonBundle/Entity/PersonPhone.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
@@ -460,18 +450,8 @@ parameters:
count: 1
path: src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php
-
message: "#^Method Chill\\\\ThirdPartyBundle\\\\Search\\\\ThirdPartySearch\\:\\:renderResult\\(\\) should return string but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php

View File

@@ -179,14 +179,15 @@ final class ActivityController extends AbstractController
{
$view = null;
[$person, $accompanyingPeriod] = $this->getEntity($request);
$entity = $this->activityRepository->find($id);
if (null === $entity) {
throw $this->createNotFoundException('Unable to find Activity entity.');
}
$accompanyingPeriod = $entity->getAccompanyingPeriod();
$person = $entity->getPerson();
if ($entity->getAccompanyingPeriod() instanceof AccompanyingPeriod) {
$view = 'ChillActivityBundle:Activity:editAccompanyingCourse.html.twig';
$accompanyingPeriod = $entity->getAccompanyingPeriod();
@@ -220,6 +221,9 @@ final class ActivityController extends AbstractController
$this->entityManager->persist($entity);
$this->entityManager->flush();
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
$params['id'] = $entity->getId();
if ($form->has('gendocTemplateId') && null !== $form['gendocTemplateId']->getData()) {
return $this->redirectToRoute(
'chill_docgenerator_generate_from_template',
@@ -227,15 +231,13 @@ final class ActivityController extends AbstractController
'template' => $form->get('gendocTemplateId')->getData(),
'entityClassName' => Activity::class,
'entityId' => $entity->getId(),
'returnPath' => $this->generateUrl('chill_activity_activity_edit', $params),
]
);
}
$this->addFlash('success', $this->get('translator')->trans('Success : activity updated!'));
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
$params['id'] = $entity->getId();
return $this->redirectToRoute('chill_activity_activity_show', $params);
}
@@ -444,6 +446,9 @@ final class ActivityController extends AbstractController
'template' => $form->get('gendocTemplateId')->getData(),
'entityClassName' => Activity::class,
'entityId' => $entity->getId(),
'returnPath' => $this->generateUrl('chill_activity_activity_edit', [
'id' => $entity->getId(),
]),
]
);
}

View File

@@ -231,11 +231,22 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
{
if (!$this->socialActions->contains($socialAction)) {
$this->socialActions[] = $socialAction;
$this->ensureSocialActionConsistency();
}
return $this;
}
/**
* Add a social issue.
*
* Note: the social issue consistency (the fact that only yougest social issues
* are kept) is processed by an entity listener:
*
* @see{\Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodSocialIssueConsistencyEntityListener}
*
* @return $this
*/
public function addSocialIssue(SocialIssue $socialIssue): self
{
if (!$this->socialIssues->contains($socialIssue)) {
@@ -631,4 +642,13 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
return $this;
}
private function ensureSocialActionConsistency(): void
{
$ancestors = SocialAction::findAncestorSocialActions($this->getSocialActions());
foreach ($ancestors as $ancestor) {
$this->removeSocialAction($ancestor);
}
}
}

View File

@@ -66,9 +66,6 @@ class ActivityEntityListener
$newAction->addPerson($person);
}
foreach ($associatedThirdparties as $thirdparty) {
$newAction->setHandlingThierparty($thirdparty);
}
$this->em->persist($newAction);
$this->em->flush();
}

View File

@@ -125,7 +125,9 @@ class ActivityType extends AbstractType
}
if ($activityType->isVisible('socialIssues') && $accompanyingPeriod) {
$builder->add('socialIssues', HiddenType::class);
$builder->add('socialIssues', HiddenType::class, [
'required' => $activityType->getSocialIssuesVisible() === 2,
]);
$builder->get('socialIssues')
->addModelTransformer(new CallbackTransformer(
static function (iterable $socialIssuesAsIterable): string {
@@ -151,7 +153,9 @@ class ActivityType extends AbstractType
}
if ($activityType->isVisible('socialActions') && $accompanyingPeriod) {
$builder->add('socialActions', HiddenType::class);
$builder->add('socialActions', HiddenType::class, [
'required' => $activityType->getSocialActionsVisible() === 2,
]);
$builder->get('socialActions')
->addModelTransformer(new CallbackTransformer(
static function (iterable $socialActionsAsIterable): string {
@@ -305,6 +309,7 @@ class ActivityType extends AbstractType
'label' => $activityType->getLabel('documents'),
'required' => $activityType->isRequired('documents'),
'allow_add' => true,
'allow_delete' => true,
'button_add_label' => 'activity.Insert a document',
'button_remove_label' => 'activity.Remove a document',
'empty_collection_explain' => 'No documents',
@@ -338,7 +343,9 @@ class ActivityType extends AbstractType
}
if ($activityType->isVisible('location')) {
$builder->add('location', HiddenType::class)
$builder->add('location', HiddenType::class, [
'required' => $activityType->getLocationVisible() === 2,
])
->get('location')
->addModelTransformer(new CallbackTransformer(
static function (?Location $location): string {
@@ -366,8 +373,8 @@ class ActivityType extends AbstractType
'label' => $activityType->getLabel('sentReceived'),
'required' => $activityType->isRequired('sentReceived'),
'choices' => [
'Sent' => Activity::SENTRECEIVED_SENT,
'Received' => Activity::SENTRECEIVED_RECEIVED,
'Sent' => Activity::SENTRECEIVED_SENT,
],
]);
}

View File

@@ -12,13 +12,20 @@ declare(strict_types=1);
namespace Chill\ActivityBundle\Repository;
use Chill\ActivityBundle\Entity\Activity;
use Chill\ActivityBundle\Entity\ActivityPresence;
use Chill\ActivityBundle\Entity\ActivityType;
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
use Chill\MainBundle\Entity\Location;
use Chill\MainBundle\Entity\LocationType;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query\ResultSetMappingBuilder;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Security\Core\Security;
@@ -72,6 +79,86 @@ final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInte
->findByAccompanyingPeriod($period, $scopes, true, $limit, $start, $orderBy);
}
public function findByAccompanyingPeriodSimplified(AccompanyingPeriod $period, ?int $limit = 1000): array
{
$rsm = new ResultSetMappingBuilder($this->em);
$sql = '
SELECT
a.id AS activity_id,
date,
CASE WHEN durationtime IS NOT NULL THEN (EXTRACT(EPOCH from durationtime) / 60)::int ELSE 0 END AS durationtimeminute,
attendee_id,
comment_comment,
emergency,
sentreceived,
CASE WHEN traveltime IS NOT NULL THEN (EXTRACT(EPOCH from traveltime) / 60)::int ELSE 0 END AS traveltimeminute,
t.id AS type_id, t.name as type_name,
p.id AS presence_id, p.name AS presence_name,
location.id AS location_id, location.address_id, location.name AS location_name, location.phonenumber1, location.phonenumber2, location.email,
location.locationtype_id, locationtype.title AS locationtype_title,
users.userids AS userids,
thirdparties.thirdpartyids,
persons.personids,
actions.socialactionids,
issues.socialissueids
FROM activity a
LEFT JOIN chill_main_location location ON a.location_id = location.id
LEFT JOIN chill_main_location_type locationtype ON location.locationtype_id = locationtype.id
LEFT JOIN activitytpresence p ON a.attendee_id = p.id
LEFT JOIN activitytype t ON a.type_id = t.id
LEFT JOIN LATERAL (SELECT jsonb_agg(user_id) userids, activity_id FROM activity_user AS au WHERE a.id = au.activity_id GROUP BY activity_id) AS users ON TRUE
LEFT JOIN LATERAL (SELECT jsonb_agg(thirdparty_id) thirdpartyids, activity_id FROM activity_thirdparty AS au WHERE a.id = au.activity_id GROUP BY activity_id) AS thirdparties ON TRUE
LEFT JOIN LATERAL (SELECT jsonb_agg(person_id) personids, activity_id FROM activity_person AS au WHERE a.id = au.activity_id GROUP BY activity_id) AS persons ON TRUE
LEFT JOIN LATERAL (SELECT jsonb_agg(socialaction_id) socialactionids, activity_id FROM chill_activity_activity_chill_person_socialaction AS au WHERE a.id = au.activity_id GROUP BY activity_id) AS actions ON TRUE
LEFT JOIN LATERAL (SELECT jsonb_agg(socialissue_id) socialissueids, activity_id FROM chill_activity_activity_chill_person_socialissue AS au WHERE a.id = au.activity_id GROUP BY activity_id) AS issues ON TRUE
WHERE accompanyingperiod_id = ?
ORDER BY a.date DESC, a.id DESC
LIMIT ?
';
$rsm
->addEntityResult(Activity::class, 'a')
->addFieldResult('a', 'activity_id', 'id')
->addFieldResult('a', 'date', 'date')
->addFieldResult('a', 'comment', 'comment')
->addFieldResult('a', 'sentreceived', 'sentReceived')
->addFieldResult('a', 'emergency', 'emergency')
->addJoinedEntityResult(Location::class, 'location', 'a', 'location')
->addFieldResult('location', 'location_id', 'id')
->addFieldResult('location', 'location_name', 'name')
->addFieldResult('location', 'phonenumber1', 'phonenumber1')
->addFieldResult('location', 'phonenumber2', 'phonenumber2')
->addFieldResult('location', 'email', 'email')
->addJoinedEntityResult(LocationType::class, 'locationType', 'location', 'locationType')
->addFieldResult('locationType', 'locationtype_id', 'id')
->addFieldResult('locationType', 'locationtype_title', 'title')
->addJoinedEntityResult(ActivityType::class, 'activityType', 'a', 'activityType')
->addFieldResult('activityType', 'type_id', 'id')
->addFieldResult('activityType', 'type_name', 'name')
->addJoinedEntityResult(ActivityPresence::class, 'activityPresence', 'a', 'attendee')
->addFieldResult('activityPresence', 'presence_id', 'id')
->addFieldResult('activityPresence', 'presence_name', 'name')
// results which cannot be mapped into entity
->addScalarResult('comment_comment', 'comment', Types::TEXT)
->addScalarResult('userids', 'userIds', Types::JSON)
->addScalarResult('thirdpartyids', 'thirdPartyIds', Types::JSON)
->addScalarResult('personids', 'personIds', Types::JSON)
->addScalarResult('socialactionids', 'socialActionIds', Types::JSON)
->addScalarResult('socialissueids', 'socialIssueIds', Types::JSON)
->addScalarResult('durationtimeminute', 'durationTimeMinute', Types::INTEGER)
->addScalarResult('traveltimeminute', 'travelTimeMinute', Types::INTEGER);
$nq = $this->em->createNativeQuery($sql, $rsm);
$nq->setParameter(0, $period->getId())->setParameter(1, $limit);
return $nq->getResult(AbstractQuery::HYDRATE_ARRAY);
}
/**
* @param array $orderBy
*

View File

@@ -21,6 +21,15 @@ interface ActivityACLAwareRepositoryInterface
*/
public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array;
/**
* Return a list of activities, simplified as array (not object).
*
* The aim of this method is to get a long list of activities and keep performance.
*
* @return array an array of array, each item representing an activity
*/
public function findByAccompanyingPeriodSimplified(AccompanyingPeriod $period, ?int $limit = 1000): array;
/**
* @return Activity[]|array
*/

View File

@@ -0,0 +1,23 @@
div.chill-dropzone__below-zone {
a.btn-delete {
display: none;
}
}
ul[data-collection-name="documents"] {
button.remove-entry {
margin: 0.5rem 0!important;
}
}
// do it in js does not work
// document.addEventListener('DOMContentLoaded', e => {
// const dropzoneBelow = document.querySelectorAll('div.chill-dropzone__below-zone');
// dropzoneBelow.forEach(
// d => {
// const a = d.querySelector('a.btn-delete');
// d.removeChild(a);
// }
// )
// });

View File

@@ -1,7 +1,7 @@
<template>
<teleport to="#location">
<div class="mb-3 row">
<label class="col-form-label col-sm-4">
<label :class="locationClassList">
{{ $t("activity.location") }}
</label>
<div class="col-sm-8">
@@ -41,6 +41,12 @@ export default {
NewLocation,
VueMultiselect,
},
data() {
return {
locationClassList:
`col-form-label col-sm-4 ${document.querySelector('input#chill_activitybundle_activity_location').getAttribute('required') ? 'required' : ''}`,
}
},
computed: {
...mapState(["activity", "availableLocations"]),
...mapGetters(["suggestedEntities"]),

View File

@@ -18,6 +18,12 @@
</template>
<template v-slot:body>
<form>
<div class="alert alert-warning" v-if="errors.length">
<ul>
<li v-for="(e, i) in errors" :key="i">{{ e }}</li>
</ul>
</div>
<div class="form-floating mb-3">
<select class="form-select form-select-lg" id="type" required v-model="selectType">
<option selected disabled value="">{{ $t('activity.choose_location_type') }}</option>
@@ -54,11 +60,6 @@
<label for="email">{{ $t('activity.location_fields.email') }}</label>
</div>
<div class="alert alert-warning" v-if="errors.length">
<ul>
<li v-for="(e, i) in errors" :key="i">{{ e }}</li>
</ul>
</div>
</form>
</template>
<template v-slot:footer>

View File

@@ -3,7 +3,7 @@
<div class="mb-3 row">
<div class="col-4">
<label class="col-form-label">{{ $t('activity.social_issues') }}</label>
<label :class="socialIssuesClassList">{{ $t('activity.social_issues') }}</label>
</div>
<div class="col-8">
@@ -42,7 +42,7 @@
<div class="mb-3 row">
<div class="col-4">
<label class="col-form-label">{{ $t('activity.social_actions') }}</label>
<label :class="socialActionsClassList">{{ $t('activity.social_actions') }}</label>
</div>
<div class="col-8">
@@ -54,19 +54,19 @@
{{ $t('activity.select_first_a_social_issue') }}
</span>
<template v-else-if="socialActionsList.length > 0">
<check-social-action
v-if="socialIssuesSelected.length || socialActionsSelected.length"
v-for="action in socialActionsList"
:key="action.id"
:action="action"
:selection="socialActionsSelected"
@updateSelected="updateActionsSelected">
</check-social-action>
</template>
<template v-else-if="socialActionsList.length > 0">
<check-social-action
v-if="socialIssuesSelected.length || socialActionsSelected.length"
v-for="action in socialActionsList"
:key="action.id"
:action="action"
:selection="socialActionsSelected"
@updateSelected="updateActionsSelected">
</check-social-action>
</template>
<span v-else-if="actionAreLoaded && socialActionsList.length === 0" class="inline-choice chill-no-data-statement mt-3">
{{ $t('activity.social_action_list_empty') }}
{{ $t('activity.social_action_list_empty') }}
</span>
@@ -94,6 +94,10 @@ export default {
issueIsLoading: false,
actionIsLoading: false,
actionAreLoaded: false,
socialIssuesClassList:
`col-form-label ${document.querySelector('input#chill_activitybundle_activity_socialIssues').getAttribute('required') ? 'required' : ''}`,
socialActionsClassList:
`col-form-label ${document.querySelector('input#chill_activitybundle_activity_socialActions').getAttribute('required') ? 'required' : ''}`,
}
},
computed: {
@@ -107,7 +111,7 @@ export default {
return this.$store.state.socialIssuesOther;
},
socialActionsList() {
return this.$store.state.socialActionsList;
return this.$store.getters.socialActionsListSorted;
},
socialActionsSelected() {
return this.$store.state.activity.socialActions;

View File

@@ -101,6 +101,9 @@ const store = createStore({
state.activity.activityType.thirdPartiesVisible !== 0)
);
},
socialActionsListSorted(state) {
return [ ...state.socialActionsList].sort((a, b) => a.ordering - b.ordering);
},
},
mutations: {
// SocialIssueAcc
@@ -131,7 +134,6 @@ const store = createStore({
state.socialActionsList = [];
},
addActionInList(state, action) {
//console.log('add action list', action.id);
state.socialActionsList.push(action);
},
updateActionsSelected(state, actions) {

View File

@@ -5,7 +5,7 @@
{% block title 'Remove activity'|trans %}
{% block personcontent %}
{% block content %}
{{ include('@ChillMain/Util/confirmation_template.html.twig',
{
'title' : 'Remove activity'|trans,

View File

@@ -35,7 +35,7 @@
{{ form_row(edit_form.socialActions) }}
{% endif %}
{%- if edit_form.socialIssues is defined or edit_form.socialIssues is defined -%}
{%- if edit_form.socialIssues is defined or edit_form.socialActions is defined -%}
<div id="social-issues-acc"></div>
{% endif %}

View File

@@ -30,4 +30,5 @@
{{ parent() }}
{{ encore_entry_link_tags('mod_async_upload') }}
{{ encore_entry_link_tags('vue_activity') }}
{{ encore_entry_link_tags('page_edit_activity') }}
{% endblock %}

View File

@@ -20,7 +20,7 @@
{% block title 'Update activity'|trans %}
{% block personcontent %}
{% block content %}
<div class="activity-edit">
<div id="activity"></div> {# <=== vue component #}

View File

@@ -30,7 +30,7 @@
{{ encore_entry_link_tags('mod_notification_toggle_read_status') }}
{% endblock %}
{% block personcontent %}
{% block content %}
{% set person_id = null %}
{% if person %}
@@ -46,7 +46,7 @@
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'person'} %}
{% if is_granted('CHILL_ACTIVITY_CREATE', person) %}
{% if is_granted('CHILL_ACTIVITY_CREATE_PERSON', person) %}
<ul class="record_actions sticky-form-buttons">
<li>
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}"

View File

@@ -35,7 +35,7 @@
{{ form_row(form.socialActions) }}
{% endif %}
{%- if form.socialIssues is defined or form.socialIssues is defined -%}
{%- if form.socialIssues is defined or form.socialActions is defined -%}
<div id="social-issues-acc"></div>
{% endif %}
@@ -85,15 +85,15 @@
{{ form_row(form.comment) }}
{% endif %}
{%- if form.attendee is defined -%}
{{ form_row(form.attendee) }}
{% endif %}
{%- if form.documents is defined -%}
{{ form_row(form.documents) }}
<div data-docgen-template-picker="data-docgen-template-picker" data-entity-class="Chill\ActivityBundle\Entity\Activity" data-entity-id="{{ entity.id }}"></div>
{% endif %}
{%- if form.attendee is defined -%}
{{ form_row(form.attendee) }}
{% endif %}
{# TODO .. status #}
<ul class="record_actions sticky-form-buttons">

View File

@@ -4,7 +4,7 @@
{% block title 'Activity creation' |trans %}
{% block personcontent %}
{% block content %}
<div class="activity-new">
<div id="activity"></div> {# <=== vue component #}

View File

@@ -4,6 +4,6 @@
{% block title 'Activity creation'|trans %}
{% block personcontent %}
{% block content %}
{% include 'ChillActivityBundle:Activity:selectType.html.twig' %}
{% endblock %}

View File

@@ -18,11 +18,11 @@
{% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %}
{% block personcontent -%}
{% block content -%}
<div class="activity-show">
{% include 'ChillActivityBundle:Activity:show.html.twig' with {'context': 'person'} %}
</div>
{% endblock personcontent %}
{% endblock %}
{% block block_post_menu %}
<div class="post-menu pt-4">

View File

@@ -25,7 +25,7 @@
{% endblock %}
{% block layout_wvm_content %}
{% block admin_content %}<!-- block personcontent empty -->
{% block admin_content %}<!-- block content empty -->
<h1>{{ 'Activity configuration' |trans }}</h1>
{% endblock %}
{% endblock %}

View File

@@ -0,0 +1,286 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Service\DocGenerator;
use Chill\ActivityBundle\Entity\ActivityPresence;
use Chill\ActivityBundle\Entity\ActivityType;
use Chill\ActivityBundle\Repository\ActivityACLAwareRepositoryInterface;
use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithAdminFormInterface;
use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithPublicFormInterface;
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
use Chill\DocStoreBundle\Entity\StoredObject;
use Chill\MainBundle\Entity\Location;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Repository\UserRepository;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
use Chill\PersonBundle\Repository\PersonRepository;
use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository;
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
use Chill\PersonBundle\Service\DocGenerator\AccompanyingPeriodContext;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Chill\ThirdPartyBundle\Repository\ThirdPartyRepository;
use DateTime;
use libphonenumber\PhoneNumber;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
class ListActivitiesByAccompanyingPeriodContext implements
DocGeneratorContextWithAdminFormInterface,
DocGeneratorContextWithPublicFormInterface
{
private AccompanyingPeriodContext $accompanyingPeriodContext;
private ActivityACLAwareRepositoryInterface $activityACLAwareRepository;
private NormalizerInterface $normalizer;
private PersonRepository $personRepository;
private SocialActionRepository $socialActionRepository;
private SocialIssueRepository $socialIssueRepository;
private ThirdPartyRepository $thirdPartyRepository;
private TranslatableStringHelperInterface $translatableStringHelper;
private UserRepository $userRepository;
public function __construct(
AccompanyingPeriodContext $accompanyingPeriodContext,
ActivityACLAwareRepositoryInterface $activityACLAwareRepository,
NormalizerInterface $normalizer,
PersonRepository $personRepository,
SocialActionRepository $socialActionRepository,
SocialIssueRepository $socialIssueRepository,
ThirdPartyRepository $thirdPartyRepository,
TranslatableStringHelperInterface $translatableStringHelper,
UserRepository $userRepository
) {
$this->accompanyingPeriodContext = $accompanyingPeriodContext;
$this->activityACLAwareRepository = $activityACLAwareRepository;
$this->normalizer = $normalizer;
$this->personRepository = $personRepository;
$this->socialActionRepository = $socialActionRepository;
$this->socialIssueRepository = $socialIssueRepository;
$this->thirdPartyRepository = $thirdPartyRepository;
$this->translatableStringHelper = $translatableStringHelper;
$this->userRepository = $userRepository;
}
public function adminFormReverseTransform(array $data): array
{
return $this->accompanyingPeriodContext->adminFormReverseTransform($data);
}
public function adminFormTransform(array $data): array
{
return $this->accompanyingPeriodContext->adminFormTransform($data);
}
public function buildAdminForm(FormBuilderInterface $builder): void
{
$this->accompanyingPeriodContext->buildAdminForm($builder);
}
public function buildPublicForm(FormBuilderInterface $builder, DocGeneratorTemplate $template, $entity): void
{
$this->accompanyingPeriodContext->buildPublicForm($builder, $template, $entity);
}
public function getData(DocGeneratorTemplate $template, $entity, array $contextGenerationData = []): array
{
$data = $this->accompanyingPeriodContext->getData($template, $entity, $contextGenerationData);
$data['activities'] = $this->getActivitiesSimplified($entity);
return $data;
}
public function getDescription(): string
{
return 'docgen.Accompanying period with a list of activities description';
}
public function getEntityClass(): string
{
return AccompanyingPeriod::class;
}
public function getFormData(DocGeneratorTemplate $template, $entity): array
{
return $this->accompanyingPeriodContext->getFormData($template, $entity);
}
public static function getKey(): string
{
return self::class;
}
public function getName(): string
{
return 'docgen.Accompanying period with a list of activities';
}
public function hasAdminForm(): bool
{
return $this->accompanyingPeriodContext->hasAdminForm();
}
public function hasPublicForm(DocGeneratorTemplate $template, $entity): bool
{
return $this->accompanyingPeriodContext->hasPublicForm($template, $entity);
}
public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void
{
$this->accompanyingPeriodContext->storeGenerated($template, $storedObject, $entity, $contextGenerationData);
}
private function getActivitiesSimplified(AccompanyingPeriod $period)
{
$activities =
$this->activityACLAwareRepository->findByAccompanyingPeriodSimplified($period);
$results = [];
foreach ($activities as $row) {
$activity = $row[0];
$activity['date'] = $this->normalizer->normalize($activity['date'], 'docgen', [
AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => DateTime::class,
]);
if (null === $activity['location']) {
$activity['location'] = $this->normalizer->normalize(null, 'docgen', [
AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => Location::class,
]);
$activity['location']['type'] = 'location';
} else {
$activity['location']['isNull'] = false;
$activity['location']['type'] = 'location';
foreach (['1', '2'] as $key) {
$activity['location']['phonenumber' . $key] = $this->normalizer->normalize(
$activity['location']['phonenumber' . $key],
'docgen',
[AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => PhoneNumber::class]
);
}
}
if (is_numeric($activity['location']['locationType']['id'])) {
$activity['location']['locationType']['title'] = $this->translatableStringHelper->localize(
$activity['location']['locationType']['title']
);
$activity['location']['locationType']['isNull'] = false;
$activity['location']['locationType']['type'] = 'locationType';
}
if (null !== $activity['activityType']) {
$activity['activityType']['name'] = $this->translatableStringHelper->localize(
$activity['activityType']['name']
);
$activity['activityType']['isNull'] = false;
$activity['activityType']['type'] = 'activityType';
} else {
$activity['activityType'] = $this->normalizer->normalize(null, 'docgen', [
AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => ActivityType::class,
]);
}
if (null !== $activity['attendee']) {
$activity['attendee']['name'] = $this->translatableStringHelper->localize(
$activity['attendee']['name']
);
$activity['attendee']['isNull'] = false;
$activity['attendee']['type'] = 'activityPresence';
} else {
$activity['attendee'] = $this->normalizer->normalize(null, 'docgen', [
AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => ActivityPresence::class,
]);
}
$activity['comment'] = (string) $row['comment'];
$activity['travelTimeMinute'] = $row['travelTimeMinute'];
$activity['durationTimeMinute'] = $row['durationTimeMinute'];
if (null !== $row['userIds']) {
foreach ($row['userIds'] as $id) {
$activity['users'][] = $this->normalizer->normalize(
$this->userRepository->find($id),
'docgen',
[AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => User::class]
);
}
} else {
$activity['users'] = [];
}
if (null !== $row['personIds']) {
foreach ($row['personIds'] as $id) {
$activity['persons'][] = $this->normalizer->normalize(
$this->personRepository->find($id),
'docgen',
[AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => Person::class]
);
}
} else {
$activity['persons'] = [];
}
if (null !== $row['thirdPartyIds']) {
foreach ($row['thirdPartyIds'] as $id) {
$activity['thirdParties'][] = $this->normalizer->normalize(
$this->thirdPartyRepository->find($id),
'docgen',
[AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => ThirdParty::class]
);
}
} else {
$activity['thirdParties'] = [];
}
if (null !== $row['socialActionIds']) {
foreach ($row['socialActionIds'] as $id) {
$activity['socialActions'][] = $this->normalizer->normalize(
$this->socialActionRepository->find($id),
'docgen',
[AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => SocialAction::class]
);
}
} else {
$activity['socialActions'] = [];
}
if (null !== $row['socialIssueIds']) {
foreach ($row['socialIssueIds'] as $id) {
$activity['socialIssues'][] = $this->normalizer->normalize(
$this->socialIssueRepository->find($id),
'docgen',
[AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => SocialIssue::class]
);
}
} else {
$activity['socialIssues'] = [];
}
$results[] = $activity;
}
return $results;
}
}

View File

@@ -0,0 +1,114 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Entity;
use Chill\ActivityBundle\Entity\Activity;
use Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodSocialIssueConsistencyEntityListener;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
use Doctrine\ORM\Event\LifecycleEventArgs;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
/**
* @internal
* @coversNothing
*/
final class ActivityTest extends TestCase
{
use ProphecyTrait;
public function testHierarchySocialActions(): void
{
$parent = new SocialAction();
$child = new SocialAction();
$parent->addChild($child);
$grandChild = new SocialAction();
$child->addChild($grandChild);
$activity = new Activity();
$activity->addSocialAction($parent);
$this->assertCount(1, $activity->getSocialActions());
$this->assertContains($parent, $activity->getSocialActions());
$activity->addSocialAction($grandChild);
$this->assertCount(1, $activity->getSocialActions());
$this->assertContains($grandChild, $activity->getSocialActions());
$this->assertNotContains($parent, $activity->getSocialActions());
$activity->addSocialAction($child);
$this->assertCount(1, $activity->getSocialActions());
$this->assertContains($grandChild, $activity->getSocialActions());
$this->assertNotContains($parent, $activity->getSocialActions());
$this->assertNotContains($child, $activity->getSocialActions());
$activity->addSocialAction($another = new SocialAction());
$this->assertCount(2, $activity->getSocialActions());
$this->assertContains($grandChild, $activity->getSocialActions());
$this->assertContains($another, $activity->getSocialActions());
$this->assertNotContains($parent, $activity->getSocialActions());
$this->assertNotContains($child, $activity->getSocialActions());
}
public function testHierarchySocialIssues(): void
{
$listener = new AccompanyingPeriodSocialIssueConsistencyEntityListener();
$event = $this->prophesize(LifecycleEventArgs::class)->reveal();
$parent = new SocialIssue();
$child = new SocialIssue();
$parent->addChild($child);
$grandChild = new SocialIssue();
$child->addChild($grandChild);
$activity = new Activity();
$activity->setAccompanyingPeriod(new AccompanyingPeriod());
$activity->addSocialIssue($parent);
$listener->preUpdate($activity, $event);
$this->assertCount(1, $activity->getSocialIssues());
$this->assertContains($parent, $activity->getSocialIssues());
$activity->addSocialIssue($grandChild);
$listener->preUpdate($activity, $event);
$this->assertCount(1, $activity->getSocialIssues());
$this->assertContains($grandChild, $activity->getSocialIssues());
$this->assertNotContains($parent, $activity->getSocialIssues());
$activity->addSocialIssue($child);
$listener->preUpdate($activity, $event);
$this->assertCount(1, $activity->getSocialIssues());
$this->assertContains($grandChild, $activity->getSocialIssues());
$this->assertNotContains($parent, $activity->getSocialIssues());
$this->assertNotContains($child, $activity->getSocialIssues());
$activity->addSocialIssue($another = new SocialIssue());
$listener->preUpdate($activity, $event);
$this->assertCount(2, $activity->getSocialIssues());
$this->assertContains($grandChild, $activity->getSocialIssues());
$this->assertContains($another, $activity->getSocialIssues());
$this->assertNotContains($parent, $activity->getSocialIssues());
$this->assertNotContains($child, $activity->getSocialIssues());
}
}

View File

@@ -7,5 +7,7 @@ module.exports = function(encore, entries)
ChillActivityAssets: __dirname + '/Resources/public'
});
encore.addEntry('page_edit_activity', __dirname + '/Resources/public/page/edit_activity/index.scss');
encore.addEntry('vue_activity', __dirname + '/Resources/public/vuejs/Activity/index.js');
};

View File

@@ -66,6 +66,14 @@ Choose a type: Choisir un type
1 hour 30: 1 heure 30
1 hour 45: 1 heure 45
2 hours: 2 heures
2 hours 15: 2 heures 15
2 hours 30: 2 heures 30
2 hours 45: 2 heures 45
3 hours: 3 heures
3 hours 30: 3 heures 30
4 hours: 4 heures
4 hours 30: 4 heures 30
5 hours: 5 heures
Concerned groups: Parties concernées
Persons in accompanying course: Usagers du parcours
Third persons: Tiers non-pro.
@@ -232,3 +240,5 @@ 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.

View File

@@ -31,6 +31,10 @@ class Configuration implements ConfigurationInterface
->isRequired()
->defaultValue(
[
['label' => '1 minutes', 'seconds' => 60],
['label' => '2 minutes', 'seconds' => 120],
['label' => '3 minutes', 'seconds' => 180],
['label' => '4 minutes', 'seconds' => 240],
['label' => '5 minutes', 'seconds' => 300],
['label' => '10 minutes', 'seconds' => 600],
['label' => '15 minutes', 'seconds' => 900],

View File

@@ -6,7 +6,7 @@
{% block layout_wvm_content %}
{% block admin_content %}
<!-- block personcontent empty -->
<!-- block content empty -->
<h1>{{ 'Aside activity configuration'|trans }}</h1>
{% endblock %}
{% endblock %}

View File

@@ -40,7 +40,7 @@
{% endif %}
</div>
</div>
<div class="item-col">
<div class="item-col" style="justify-content: flex-end;">
<div class="box">
<ul class="list-content fa-ul">
<li>
@@ -79,7 +79,7 @@
{{ chill_pagination(paginator) }}
<ul class="record_actions">
<ul class="record_actions sticky-form-buttons">
<li>
<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_new') }}" class="btn btn-create">
{{ 'Create'|trans }}

View File

@@ -9,9 +9,9 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Calculator;
namespace Chill\BudgetBundle\Calculator;
use Chill\AMLI\BudgetBundle\Entity\AbstractElement;
use Chill\BudgetBundle\Entity\AbstractElement;
interface CalculatorInterface
{

View File

@@ -9,9 +9,9 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Calculator;
namespace Chill\BudgetBundle\Calculator;
use Chill\AMLI\BudgetBundle\Entity\AbstractElement;
use Chill\BudgetBundle\Entity\AbstractElement;
use OutOfBoundsException;
use function array_key_exists;

View File

@@ -9,7 +9,7 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Calculator;
namespace Chill\BudgetBundle\Calculator;
class CalculatorResult
{

View File

@@ -9,12 +9,12 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle;
namespace Chill\BudgetBundle;
use Chill\AMLI\BudgetBundle\DependencyInjection\Compiler\CalculatorCompilerPass;
use Chill\BudgetBundle\DependencyInjection\Compiler\CalculatorCompilerPass;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class ChillAMLIBudgetBundle extends Bundle
class ChillBudgetBundle extends Bundle
{
public function build(\Symfony\Component\DependencyInjection\ContainerBuilder $container)
{

View File

@@ -9,7 +9,7 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Config;
namespace Chill\BudgetBundle\Config;
class ConfigRepository
{
@@ -29,6 +29,11 @@ class ConfigRepository
$this->charges = $charges;
}
public function getChargesKeys(): array
{
return array_map(static function ($element) { return $element['key']; }, $this->charges);
}
/**
* @return array where keys are the resource'key and label the ressource label
*/
@@ -43,6 +48,11 @@ class ConfigRepository
return $charges;
}
public function getResourcesKeys(): array
{
return array_map(static function ($element) { return $element['key']; }, $this->resources);
}
/**
* @return array where keys are the resource'key and label the ressource label
*/

View File

@@ -9,37 +9,29 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Controller;
namespace Chill\BudgetBundle\Controller;
use Chill\AMLI\BudgetBundle\Entity\AbstractElement;
use Chill\AMLI\BudgetBundle\Security\Authorization\BudgetElementVoter;
use Chill\BudgetBundle\Entity\AbstractElement;
use Chill\BudgetBundle\Security\Authorization\BudgetElementVoter;
use Chill\PersonBundle\Entity\Person;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Contracts\Translation\TranslatorInterface;
use function get_class;
abstract class AbstractElementController extends Controller
abstract class AbstractElementController extends AbstractController
{
/**
* @var LoggerInterface
*/
protected $chillMainLogger;
protected LoggerInterface $chillMainLogger;
/**
* @var EntityManagerInterface
*/
protected $em;
protected EntityManagerInterface $em;
/**
* @var TranslatorInterface
*/
protected $translator;
protected TranslatorInterface $translator;
public function __construct(
EntityManagerInterface $em,
@@ -59,16 +51,22 @@ abstract class AbstractElementController extends Controller
*
* @param mixed $template
* @param mixed $flashMessage
*
* @return \Symfony\Component\BrowserKit\Response
*/
protected function _delete(AbstractElement $element, Request $request, $template, $flashMessage)
protected function _delete(AbstractElement $element, Request $request, $template, $flashMessage): Response
{
$this->denyAccessUnlessGranted(BudgetElementVoter::DELETE, $element, 'You are not '
. 'allowed to delete this family membership');
. 'allowed to delete this item');
$form = $this->createDeleteForm();
if (null !== $element->getPerson()) {
$entity = $element->getPerson();
$indexPage = 'chill_budget_elements_index';
} else {
$entity = $element->getHousehold();
$indexPage = 'chill_budget_elements_household_index';
}
if ($request->getMethod() === Request::METHOD_DELETE) {
$form->handleRequest($request);
@@ -88,8 +86,8 @@ abstract class AbstractElementController extends Controller
$this->addFlash('success', $this->translator
->trans($flashMessage));
return $this->redirectToRoute('chill_budget_elements_index', [
'id' => $element->getPerson()->getId(),
return $this->redirectToRoute($indexPage, [
'id' => $entity->getId(),
]);
}
}
@@ -103,13 +101,23 @@ abstract class AbstractElementController extends Controller
/**
* @param string $template
* @param string $flashOnSuccess
*
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function _edit(AbstractElement $element, Request $request, $template, $flashOnSuccess)
protected function _edit(AbstractElement $element, Request $request, $template, $flashOnSuccess): Response
{
$this->denyAccessUnlessGranted(BudgetElementVoter::UPDATE, $element);
if (null !== $element->getPerson()) {
$entity = $element->getPerson();
$entityStr = 'person';
$indexPage = 'chill_budget_elements_index';
} else {
$entity = $element->getHousehold();
$entityStr = 'household';
$indexPage = 'chill_budget_elements_household_index';
}
$entity = null !== $element->getPerson() ? $element->getPerson() : $element->getHousehold();
$form = $this->createForm($this->getType(), $element);
$form->add('submit', SubmitType::class);
@@ -121,29 +129,39 @@ abstract class AbstractElementController extends Controller
$this->addFlash('success', $this->translator->trans($flashOnSuccess));
return $this->redirectToRoute('chill_budget_elements_index', [
'id' => $element->getPerson()->getId(),
return $this->redirectToRoute($indexPage, [
'id' => $entity->getId(),
]);
}
return $this->render($template, [
'element' => $element,
'form' => $form->createView(),
'person' => $element->getPerson(),
$entityStr => $entity,
]);
}
/**
* @param mixed $template
* @param mixed $flashMessageOnSuccess
* @param mixed $entity
*/
protected function _new(Person $person, Request $request, $template, $flashMessageOnSuccess)
protected function _new($entity, Request $request, $template, $flashMessageOnSuccess)
{
/** @var \Chill\AMLI\BudgetBundle\Entity\AbstractElement $element */
$element = $this->createNewElement()
->setPerson($person);
/** @var AbstractElement $element */
$element = $this->createNewElement();
$this->denyAccessUnlessGranted(BudgetElementVoter::CREATE, $element);
if ($entity instanceof Person) {
$element->setPerson($entity);
$entityStr = 'person';
$indexPage = 'chill_budget_elements_index';
} else {
$element->setHousehold($entity);
$entityStr = 'household';
$indexPage = 'chill_budget_elements_household_index';
}
// $this->denyAccessUnlessGranted(BudgetElementVoter::CREATE, $entity);
$form = $this->createForm($this->getType(), $element);
$form->add('submit', SubmitType::class);
@@ -157,8 +175,8 @@ abstract class AbstractElementController extends Controller
$this->addFlash('success', $this->translator->trans($flashMessageOnSuccess));
return $this->redirectToRoute('chill_budget_elements_index', [
'id' => $person->getId(),
return $this->redirectToRoute($indexPage, [
'id' => $entity->getId(),
]);
}
@@ -168,7 +186,7 @@ abstract class AbstractElementController extends Controller
return $this->render($template, [
'form' => $form->createView(),
'person' => $person,
$entityStr => $entity,
'element' => $element,
]);
}
@@ -183,7 +201,7 @@ abstract class AbstractElementController extends Controller
*/
protected function _view(AbstractElement $element, $template)
{
$this->denyAccessUnlessGranted(BudgetElementVoter::SHOW, $element);
$this->denyAccessUnlessGranted(BudgetElementVoter::SEE, $element);
return $this->render($template, [
'element' => $element,
@@ -199,10 +217,8 @@ abstract class AbstractElementController extends Controller
/**
* Creates a form to delete a help request entity by id.
*
* @return \Symfony\Component\Form\Form The form
*/
private function createDeleteForm()
private function createDeleteForm(): Form
{
return $this->createFormBuilder()
->setMethod(Request::METHOD_DELETE)

View File

@@ -9,10 +9,11 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Controller;
namespace Chill\BudgetBundle\Controller;
use Chill\AMLI\BudgetBundle\Entity\Charge;
use Chill\AMLI\BudgetBundle\Form\ChargeType;
use Chill\BudgetBundle\Entity\Charge;
use Chill\BudgetBundle\Form\ChargeType;
use Chill\PersonBundle\Entity\Household\Household;
use Chill\PersonBundle\Entity\Person;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
@@ -32,7 +33,7 @@ class ChargeController extends AbstractElementController
return $this->_delete(
$charge,
$request,
'@ChillAMLIBudget/Charge/confirm_delete.html.twig',
'@ChillBudget/Charge/confirm_delete.html.twig',
'Charge deleted'
);
}
@@ -50,7 +51,7 @@ class ChargeController extends AbstractElementController
return $this->_edit(
$charge,
$request,
'@ChillAMLIBudget/Charge/edit.html.twig',
'@ChillBudget/Charge/edit.html.twig',
'Charge updated'
);
}
@@ -68,7 +69,25 @@ class ChargeController extends AbstractElementController
return $this->_new(
$person,
$request,
'@ChillAMLIBudget/Charge/new.html.twig',
'@ChillBudget/Charge/new.html.twig',
'Charge created'
);
}
/**
* @Route(
* "{_locale}/budget/charge/by-household/{id}/new",
* name="chill_budget_charge_household_new"
* )
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function newHouseholdAction(Request $request, Household $household)
{
return $this->_new(
$household,
$request,
'@ChillBudget/Charge/new.html.twig',
'Charge created'
);
}
@@ -83,7 +102,7 @@ class ChargeController extends AbstractElementController
*/
public function viewAction(Charge $charge)
{
return $this->_view($charge, '@ChillAMLIBudget/Charge/view.html.twig');
return $this->_view($charge, '@ChillBudget/Charge/view.html.twig');
}
protected function createNewElement()

View File

@@ -9,44 +9,33 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Controller;
namespace Chill\BudgetBundle\Controller;
use Chill\AMLI\BudgetBundle\Calculator\CalculatorManager;
use Chill\AMLI\BudgetBundle\Entity\Charge;
use Chill\AMLI\BudgetBundle\Entity\Resource;
use Chill\AMLI\BudgetBundle\Security\Authorization\BudgetElementVoter;
use Chill\BudgetBundle\Calculator\CalculatorManager;
use Chill\BudgetBundle\Entity\Charge;
use Chill\BudgetBundle\Entity\Resource;
use Chill\BudgetBundle\Security\Authorization\BudgetElementVoter;
use Chill\PersonBundle\Entity\Household\Household;
use Chill\PersonBundle\Entity\Person;
use DateTime;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Contracts\Translation\TranslatorInterface;
use function array_merge;
use function count;
class ElementController extends Controller
class ElementController extends AbstractController
{
/**
* @var CalculatorManager
*/
protected $calculator;
protected CalculatorManager $calculator;
/**
* @var LoggerInterface
*/
protected $chillMainLogger;
protected LoggerInterface $chillMainLogger;
/**
* @var EntityManagerInterface
*/
protected $em;
protected EntityManagerInterface $em;
/**
* @var TranslatorInterface
*/
protected $translator;
protected TranslatorInterface $translator;
public function __construct(
EntityManagerInterface $em,
@@ -68,11 +57,12 @@ class ElementController extends Controller
*/
public function indexAction(Person $person)
{
$this->denyAccessUnlessGranted(BudgetElementVoter::SHOW, $person);
$this->denyAccessUnlessGranted(BudgetElementVoter::SEE, $person);
$charges = $this->em
->getRepository(Charge::class)
->findByPerson($person);
$ressources = $this->em
->getRepository(Resource::class)
->findByPerson($person);
@@ -81,10 +71,10 @@ class ElementController extends Controller
$actualCharges = $this->em
->getRepository(Charge::class)
->findByPersonAndDate($person, $now);
->findByEntityAndDate($person, $now);
$actualResources = $this->em
->getRepository(Resource::class)
->findByPersonAndDate($person, $now);
->findByEntityAndDate($person, $now);
$elements = array_merge($actualCharges, $actualResources);
@@ -92,11 +82,79 @@ class ElementController extends Controller
$results = $this->calculator->calculateDefault($elements);
}
return $this->render('ChillAMLIBudgetBundle:Element:index.html.twig', [
return $this->render('ChillBudgetBundle:Person:index.html.twig', [
'person' => $person,
'charges' => $charges,
'resources' => $ressources,
'results' => $results ?? [],
]);
}
/**
* @Route(
* "{_locale}/budget/elements/by-household/{id}",
* name="chill_budget_elements_household_index"
* )
*/
public function indexHouseholdAction(Household $household)
{
$this->denyAccessUnlessGranted(BudgetElementVoter::SEE, $household);
$charges = $this->em
->getRepository(Charge::class)
->findByHousehold($household);
$ressources = $this->em
->getRepository(Resource::class)
->findByHousehold($household);
$now = new DateTime('now');
$actualCharges = $this->em
->getRepository(Charge::class)
->findByEntityAndDate($household, $now);
$actualResources = $this->em
->getRepository(Resource::class)
->findByEntityAndDate($household, $now);
$elements = array_merge($actualCharges, $actualResources);
if (count($elements) > 0) {
$results = $this->calculator->calculateDefault($elements);
}
// quick solution to calculate the sum, difference and amount from
// controller. This should be done from the calculators
// TODO replace this by calculators
$wholeCharges = $actualCharges;
$wholeResources = $actualResources;
foreach ($household->getCurrentPersons() as $person) {
$wholeCharges = array_merge(
$wholeCharges,
$this->em
->getRepository(Charge::class)
->findByEntityAndDate($person, $now)
);
$wholeResources = array_merge(
$wholeResources,
$this->em
->getRepository(Resource::class)
->findByEntityAndDate($person, $now)
);
}
return $this->render('ChillBudgetBundle:Household:index.html.twig', [
'household' => $household,
'charges' => $charges,
'resources' => $ressources,
'wholeResources' => array_filter($wholeResources, static function (Resource $r) use ($now) {
return $r->getStartDate() <= $now && ($r->getEndDate() === null || $r->getEndDate() >= $now);
}),
'wholeCharges' => array_filter($wholeCharges, static function (Charge $c) use ($now) {
return $c->getStartDate() <= $now && ($c->getEndDate() === null || $c->getEndDate() >= $now);
}),
'results' => $results ?? [],
]);
}
}

View File

@@ -9,13 +9,15 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Controller;
namespace Chill\BudgetBundle\Controller;
use Chill\AMLI\BudgetBundle\Entity\Resource;
use Chill\AMLI\BudgetBundle\Form\ResourceType;
use Chill\BudgetBundle\Entity\Resource;
use Chill\BudgetBundle\Form\ResourceType;
use Chill\PersonBundle\Entity\Household\Household;
use Chill\PersonBundle\Entity\Person;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class ResourceController extends AbstractElementController
{
@@ -24,15 +26,13 @@ class ResourceController extends AbstractElementController
* "{_locale}/budget/resource/{id}/delete",
* name="chill_budget_resource_delete"
* )
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function deleteAction(Request $request, Resource $resource)
{
return $this->_delete(
$resource,
$request,
'@ChillAMLIBudget/Resource/confirm_delete.html.twig',
'@ChillBudget/Resource/confirm_delete.html.twig',
'Resource deleted'
);
}
@@ -42,33 +42,49 @@ class ResourceController extends AbstractElementController
* "{_locale}/budget/resource/{id}/edit",
* name="chill_budget_resource_edit"
* )
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function editAction(Request $request, Resource $resource)
public function editAction(Request $request, Resource $resource): Response
{
return $this->_edit(
$resource,
$request,
'@ChillAMLIBudget/Resource/edit.html.twig',
'@ChillBudget/Resource/edit.html.twig',
'Resource updated'
);
}
/**
* Create a new budget element for a person.
*
* @Route(
* "{_locale}/budget/resource/by-person/{id}/new",
* name="chill_budget_resource_new"
* )
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function newAction(Request $request, Person $person)
public function newAction(Request $request, Person $person): Response
{
return $this->_new(
$person,
$request,
'@ChillAMLIBudget/Resource/new.html.twig',
'@ChillBudget/Resource/new.html.twig',
'Resource created'
);
}
/**
* Create new budget element for a household.
*
* @Route(
* "{_locale}/budget/resource/by-household/{id}/new",
* name="chill_budget_resource_household_new"
* )
*/
public function newHouseholdAction(Request $request, Household $household): Response
{
return $this->_new(
$household,
$request,
'@ChillBudget/Resource/new.html.twig',
'Resource created'
);
}
@@ -78,12 +94,10 @@ class ResourceController extends AbstractElementController
* "{_locale}/budget/resource/{id}/view",
* name="chill_budget_resource_view"
* )
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function viewAction(Resource $resource)
public function viewAction(Resource $resource): Response
{
return $this->_view($resource, '@ChillAMLIBudget/Resource/view.html.twig');
return $this->_view($resource, '@ChillBudget/Resource/view.html.twig');
}
protected function createNewElement()

View File

@@ -9,9 +9,9 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\DependencyInjection;
namespace Chill\BudgetBundle\DependencyInjection;
use Chill\AMLI\BudgetBundle\Security\Authorization\BudgetElementVoter;
use Chill\BudgetBundle\Security\Authorization\BudgetElementVoter;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
@@ -23,11 +23,11 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
*
* @see http://symfony.com/doc/current/cookbook/bundles/extension.html
*/
class ChillAMLIBudgetExtension extends Extension implements PrependExtensionInterface
class ChillBudgetExtension extends Extension implements PrependExtensionInterface
{
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../config'));
@@ -38,6 +38,7 @@ class ChillAMLIBudgetExtension extends Extension implements PrependExtensionInte
$loader->load('services/templating.yaml');
$loader->load('services/menu.yaml');
$loader->load('services/calculator.yaml');
$loader->load('services/services.yaml');
$this->storeConfig('resources', $config, $container);
$this->storeConfig('charges', $config, $container);
@@ -58,7 +59,7 @@ class ChillAMLIBudgetExtension extends Extension implements PrependExtensionInte
$container->prependExtensionConfig('chill_main', [
'routing' => [
'resources' => [
'@ChillAMLIBudgetBundle/config/routing.yaml',
'@ChillBudgetBundle/config/routing.yaml',
],
],
]);
@@ -68,8 +69,8 @@ class ChillAMLIBudgetExtension extends Extension implements PrependExtensionInte
{
$container->prependExtensionConfig('security', [
'role_hierarchy' => [
BudgetElementVoter::UPDATE => [BudgetElementVoter::SHOW],
BudgetElementVoter::CREATE => [BudgetElementVoter::SHOW],
BudgetElementVoter::UPDATE => [BudgetElementVoter::SEE],
BudgetElementVoter::CREATE => [BudgetElementVoter::SEE],
],
]);
}

View File

@@ -9,7 +9,7 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\DependencyInjection\Compiler;
namespace Chill\BudgetBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -19,7 +19,7 @@ class CalculatorCompilerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
$manager = $container->getDefinition('Chill\AMLI\BudgetBundle\Calculator\CalculatorManager');
$manager = $container->getDefinition('Chill\BudgetBundle\Calculator\CalculatorManager');
foreach ($container->findTaggedServiceIds('chill_budget.calculator') as $id => $tags) {
foreach ($tags as $tag) {

View File

@@ -9,7 +9,7 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\DependencyInjection;
namespace Chill\BudgetBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
@@ -23,14 +23,14 @@ class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('chill_amli_budget');
$rootNode = $treeBuilder->getRootNode('chill_amli_budget');
$treeBuilder = new TreeBuilder('chill_budget');
$rootNode = $treeBuilder->getRootNode('chill_budget');
$rootNode
->children()
// ressources
->arrayNode('resources')->isRequired()->requiresAtLeastOneElement()
->arrayNode('resources')->defaultValue([])
->arrayPrototype()
->children()
->scalarNode('key')->isRequired()->cannotBeEmpty()
@@ -52,7 +52,7 @@ class Configuration implements ConfigurationInterface
->end()
->end()
->end()
->arrayNode('charges')->isRequired()->requiresAtLeastOneElement()
->arrayNode('charges')->defaultValue([])
->arrayPrototype()
->children()
->scalarNode('key')->isRequired()->cannotBeEmpty()

View File

@@ -9,13 +9,15 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Entity;
namespace Chill\BudgetBundle\Entity;
use Chill\PersonBundle\Entity\Household\Household;
use Chill\PersonBundle\Entity\Person;
use DateTime;
use DateTimeImmutable;
use DateTimeInterface;
use Doctrine\ORM\Mapping as ORM;
use Ramsey\Uuid\Type\Decimal;
use Symfony\Component\Validator\Constraints as Assert;
/**
@@ -26,8 +28,6 @@ use Symfony\Component\Validator\Constraints as Assert;
abstract class AbstractElement
{
/**
* @var decimal
*
* @ORM\Column(name="amount", type="decimal", precision=10, scale=2)
* @Assert\GreaterThan(
* value=0
@@ -36,100 +36,80 @@ abstract class AbstractElement
* message="The amount cannot be empty"
* )
*/
private $amount;
private string $amount;
/**
* @var string|null
*
* @ORM\Column(name="comment", type="text", nullable=true)
*/
private $comment;
private ?string $comment;
/**
* @var DateTimeImmutable|null
*
* @ORM\Column(name="endDate", type="datetime_immutable", nullable=true)
* @Assert\GreaterThan(
* propertyPath="startDate",
* message="The budget element's end date must be after the start date"
* )
*/
private $endDate;
private ?DateTimeImmutable $endDate;
/**
* @ORM\ManyToOne(
* targetEntity="\Chill\PersonBundle\Entity\Household\Household"
* )
*/
private ?Household $household = null;
/**
* @var Person
* @ORM\ManyToOne(
* targetEntity="\Chill\PersonBundle\Entity\Person"
* )
*/
private $person;
private ?Person $person = null;
/**
* @var DateTimeImmutable
*
* @ORM\Column(name="startDate", type="datetime_immutable")
* @Assert\Date
*/
private $startDate;
private DateTimeImmutable $startDate;
/**
* @var string
*
* @ORM\Column(name="type", type="string", length=255)
*/
private $type;
private string $type;
/**
* Get amount.
*
* @return float
*/
public function getAmount()
/*Getters and Setters */
public function getAmount(): float
{
return (float) $this->amount;
}
/**
* Get comment.
*
* @return string|null
*/
public function getComment()
public function getComment(): ?string
{
return $this->comment;
}
/**
* Get endDate.
*
* @return DateTimeImmutable|null
*/
public function getEndDate()
public function getEndDate(): ?DateTimeImmutable
{
return $this->endDate;
}
public function getPerson(): Person
public function getHousehold(): ?Household
{
return $this->household;
}
public function getPerson(): ?Person
{
return $this->person;
}
/**
* Get startDate.
*
* @return DateTimeImmutable
*/
public function getStartDate()
public function getStartDate(): DateTimeImmutable
{
return $this->startDate;
}
/**
* Get type.
*
* @return string
*/
public function getType()
public function getType(): string
{
return $this->type;
}
@@ -143,40 +123,21 @@ abstract class AbstractElement
abstract public function isResource(): bool;
/**
* Set amount.
*
* @param string $amount
*
* @return AbstractElement
*/
public function setAmount($amount)
public function setAmount(string $amount): self
{
$this->amount = $amount;
return $this;
}
/**
* Set comment.
*
* @param string|null $comment
*
* @return AbstractElement
*/
public function setComment($comment = null)
public function setComment(?string $comment = null): self
{
$this->comment = $comment;
return $this;
}
/**
* Set endDate.
*
* @return AbstractElement
*/
public function setEndDate(?DateTimeInterface $endDate = null)
public function setEndDate(?DateTimeInterface $endDate = null): self
{
if ($endDate instanceof DateTime) {
$this->endDate = DateTimeImmutable::createFromMutable($endDate);
@@ -189,19 +150,21 @@ abstract class AbstractElement
return $this;
}
public function setPerson(Person $person)
public function setHousehold(Household $household): self
{
$this->household = $household;
return $this;
}
public function setPerson(Person $person): self
{
$this->person = $person;
return $this;
}
/**
* Set startDate.
*
* @return AbstractElement
*/
public function setStartDate(DateTimeInterface $startDate)
public function setStartDate(DateTimeInterface $startDate): self
{
if ($startDate instanceof DateTime) {
$this->startDate = DateTimeImmutable::createFromMutable($startDate);
@@ -214,14 +177,7 @@ abstract class AbstractElement
return $this;
}
/**
* Set type.
*
* @param string $type
*
* @return AbstractElement
*/
public function setType($type)
public function setType(string $type): self
{
$this->type = $type;

View File

@@ -9,8 +9,9 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Entity;
namespace Chill\BudgetBundle\Entity;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\HasCenterInterface;
use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;
@@ -19,7 +20,7 @@ use Doctrine\ORM\Mapping as ORM;
* Charge.
*
* @ORM\Table(name="chill_budget.charge")
* @ORM\Entity(repositoryClass="Chill\AMLI\BudgetBundle\Repository\ChargeRepository")
* @ORM\Entity(repositoryClass="Chill\BudgetBundle\Repository\ChargeRepository")
*/
class Charge extends AbstractElement implements HasCenterInterface
{
@@ -58,7 +59,7 @@ class Charge extends AbstractElement implements HasCenterInterface
$this->setStartDate(new DateTimeImmutable('today'));
}
public function getCenter(): \Chill\MainBundle\Entity\Center
public function getCenter(): ?Center
{
return $this->getPerson()->getCenter();
}

View File

@@ -9,8 +9,9 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Entity;
namespace Chill\BudgetBundle\Entity;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\HasCenterInterface;
use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;
@@ -19,7 +20,7 @@ use Doctrine\ORM\Mapping as ORM;
* Resource.
*
* @ORM\Table(name="chill_budget.resource")
* @ORM\Entity(repositoryClass="Chill\AMLI\BudgetBundle\Repository\ResourceRepository")
* @ORM\Entity(repositoryClass="Chill\BudgetBundle\Repository\ResourceRepository")
*/
class Resource extends AbstractElement implements HasCenterInterface
{
@@ -37,7 +38,7 @@ class Resource extends AbstractElement implements HasCenterInterface
$this->setStartDate(new DateTimeImmutable('today'));
}
public function getCenter(): \Chill\MainBundle\Entity\Center
public function getCenter(): ?Center
{
return $this->getPerson()->getCenter();
}

View File

@@ -9,10 +9,10 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Form;
namespace Chill\BudgetBundle\Form;
use Chill\AMLI\BudgetBundle\Config\ConfigRepository;
use Chill\AMLI\BudgetBundle\Entity\Charge;
use Chill\BudgetBundle\Config\ConfigRepository;
use Chill\BudgetBundle\Entity\Charge;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Symfony\Component\Form\AbstractType;
@@ -45,6 +45,7 @@ class ChargeType extends AbstractType
->add('type', ChoiceType::class, [
'choices' => $this->getTypes(),
'placeholder' => 'Choose a charge type',
'attr' => ['class' => ' select2 '],
])
->add('amount', MoneyType::class)
->add('comment', TextareaType::class, [
@@ -96,7 +97,7 @@ class ChargeType extends AbstractType
public function getBlockPrefix()
{
return 'chill_amli_budgetbundle_charge';
return 'chill_budgetbundle_charge';
}
private function getTypes()

View File

@@ -9,10 +9,10 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Form;
namespace Chill\BudgetBundle\Form;
use Chill\AMLI\BudgetBundle\Config\ConfigRepository;
use Chill\AMLI\BudgetBundle\Entity\Resource;
use Chill\BudgetBundle\Config\ConfigRepository;
use Chill\BudgetBundle\Entity\Resource;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Symfony\Component\Form\AbstractType;
@@ -45,6 +45,7 @@ class ResourceType extends AbstractType
'choices' => $this->getTypes(),
'placeholder' => 'Choose a resource type',
'label' => 'Resource element type',
'attr' => ['class' => ' select2 '],
])
->add('amount', MoneyType::class)
->add('comment', TextareaType::class, [
@@ -80,7 +81,7 @@ class ResourceType extends AbstractType
public function getBlockPrefix()
{
return 'chill_amli_budgetbundle_resource';
return 'chill_budgetbundle_resource';
}
private function getTypes()

View File

@@ -0,0 +1,53 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\BudgetBundle\Menu;
use Chill\BudgetBundle\Security\Authorization\BudgetElementVoter;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
class HouseholdMenuBuilder implements LocalMenuBuilderInterface
{
protected AuthorizationCheckerInterface $authorizationChecker;
protected TranslatorInterface $translator;
public function __construct(
AuthorizationCheckerInterface $authorizationChecker,
TranslatorInterface $translator
) {
$this->authorizationChecker = $authorizationChecker;
$this->translator = $translator;
}
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
/** @var Household $household */
$household = $parameters['household'];
// if ($this->authorizationChecker->isGranted(BudgetElementVoter::SHOW, $household)) {
$menu->addChild($this->translator->trans('household.Budget'), [
'route' => 'chill_budget_elements_household_index',
'routeParameters' => [
'id' => $household->getId(),
], ])
->setExtras(['order' => 19]);
// }
}
public static function getMenuIds(): array
{
return ['household'];
}
}

View File

@@ -9,25 +9,19 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Menu;
namespace Chill\BudgetBundle\Menu;
use Chill\AMLI\BudgetBundle\Security\Authorization\BudgetElementVoter;
use Chill\BudgetBundle\Security\Authorization\BudgetElementVoter;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
class UserMenuBuilder implements LocalMenuBuilderInterface
class PersonMenuBuilder implements LocalMenuBuilderInterface
{
/**
* @var AuthorizationCheckerInterface
*/
protected $authorizationChecker;
protected AuthorizationCheckerInterface $authorizationChecker;
/**
* @var TranslatorInterface
*/
protected $translator;
protected TranslatorInterface $translator;
public function __construct(
AuthorizationCheckerInterface $authorizationChecker,
@@ -39,10 +33,10 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
/** @var \Chill\PersonBundle\Entity\Person $person */
/** @var Person $person */
$person = $parameters['person'];
if ($this->authorizationChecker->isGranted(BudgetElementVoter::SHOW, $person)) {
if ($this->authorizationChecker->isGranted(BudgetElementVoter::SEE, $person)) {
$menu->addChild(
$this->translator->trans('Budget'),
[
@@ -50,7 +44,7 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
'routeParameters' => ['id' => $person->getId()],
]
)
->setExtra('order', 460);
->setExtra('order', 59);
}
}

View File

@@ -9,10 +9,11 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Repository;
namespace Chill\BudgetBundle\Repository;
use Chill\PersonBundle\Entity\Person;
use DateTime;
use Doctrine\ORM\EntityRepository;
/**
* ChargeRepository.
@@ -20,13 +21,15 @@ use DateTime;
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class ChargeRepository extends \Doctrine\ORM\EntityRepository
class ChargeRepository extends EntityRepository
{
public function findByPersonAndDate(Person $person, DateTime $date, $sort = null)
public function findByEntityAndDate($entity, DateTime $date, $sort = null)
{
$qb = $this->createQueryBuilder('c');
$qb->where('c.person = :person')
$entityStr = $entity instanceof Person ? 'person' : 'household';
$qb->where("c.{$entityStr} = :{$entityStr}")
->andWhere('c.startDate < :date')
->andWhere('c.startDate < :date OR c.startDate IS NULL');
@@ -35,7 +38,7 @@ class ChargeRepository extends \Doctrine\ORM\EntityRepository
}
$qb->setParameters([
'person' => $person,
$entityStr => $entity,
'date' => $date,
]);

View File

@@ -9,10 +9,11 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Repository;
namespace Chill\BudgetBundle\Repository;
use Chill\PersonBundle\Entity\Person;
use DateTime;
use Doctrine\ORM\EntityRepository;
/**
* ResourceRepository.
@@ -20,23 +21,28 @@ use DateTime;
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class ResourceRepository extends \Doctrine\ORM\EntityRepository
class ResourceRepository extends EntityRepository
{
public function findByPersonAndDate(Person $person, DateTime $date, $sort = null)
public function findByEntityAndDate($entity, DateTime $date, $sort = null)
{
$qb = $this->createQueryBuilder('c');
$qb->where('c.person = :person')
->andWhere('c.startDate < :date')
->andWhere('c.startDate < :date OR c.startDate IS NULL');
$entityStr = $entity instanceof Person ? 'person' : 'household';
$qb->where("c.{$entityStr} = :{$entityStr}")
// TODO: in controller, the budget and charges asked are also for future and actual
//->andWhere('c.startDate < :date')
// TODO: there is a misconception here, the end date must be lower or null. startDate are never null
//->andWhere('c.startDate < :date OR c.startDate IS NULL');
;
if (null !== $sort) {
$qb->orderBy($sort);
}
$qb->setParameters([
'person' => $person,
'date' => $date,
$entityStr => $entity,
//'date' => $date,
]);
return $qb->getQuery()->getResult();

View File

@@ -0,0 +1,61 @@
.subtitle {
margin-top: 1rem;
margin-bottom: 1rem;
padding: 1rem;
}
.family-title {
margin-bottom: 1rem !important;
}
.budget-table th {
th {
color: white;
}
}
.budget-table {
th.charge {
background-color: #e03851d7;
}
}
.budget-table {
th.resource {
background-color: #6d9e63d8;
}
}
.budget-table {
th, td {
padding: 10px;
text-align: right;
}
td.column-wide {
width: 20%;
}
td.column-small {
width: 15%;
&.right {
align-items: right;
}
}
}
.btn-budget {
margin-right: 1rem !important;
}
.el-type {
font-weight: 600;
text-align: left !important;
}
.total {
margin-top: 1rem;
border-top: 1px dashed black;
}
.accordion-item {
margin-bottom: 1rem;
}
button[aria-expanded="true"] > span.folded,
button[aria-expanded="false"] > span.unfolded { display: none; }
button[aria-expanded="false"] > span.folded,
button[aria-expanded="true"] > span.unfolded { display: inline; }

View File

@@ -0,0 +1 @@
require('./chillbudget.scss');

View File

@@ -0,0 +1,74 @@
{% set entity = person is defined ? person : household %}
{% set actualResources = [] %}
{% set futureResources = [] %}
{% set pastResources = [] %}
{% for r in resources %}
{% if r.startDate|date('U') <= 'now'|date('U') %}
{% if r.endDate is null or r.endDate|date('U') >= 'now'|date('U') %}
{% set actualResources = actualResources|merge([ r ]) %}
{% else %}
{% set pastResources = pastResources|merge([ r ]) %}
{% endif %}
{% else %}
{% set futureResources = futureResources|merge([ r ]) %}
{% endif %}
{% endfor %}
{% set actualCharges = [] %}
{% set futureCharges = [] %}
{% set pastCharges = [] %}
{% for c in charges %}
{% if c.startDate|date('U') <= 'now'|date('U') %}
{% if c.endDate is null or c.endDate|date('U') >= 'now'|date('U') %}
{% set actualCharges = actualCharges|merge([ c ]) %}
{% else %}
{% set pastCharges = pastCharges|merge([ c ]) %}
{% endif %}
{% else %}
{% set futureCharges = futureCharges|merge([ c ]) %}
{% endif %}
{% endfor %}
<h3 class="subtitle">{{ 'Actual budget'|trans }}</h3>
{% if actualCharges|length > 0 or actualResources|length > 0 %}
{% include 'ChillBudgetBundle:Budget:_current_budget.html.twig' with {
'actualResources': actualResources,
'actualCharges': actualCharges,
'results': results,
'entity': entity
} %}
{% else %}
<div class="flex-table">
<div class="item-bloc">
<p><span class="chill-no-data-statement">{{ "There isn't any element recorded"|trans }}</span></p>
</div>
</div>
{% endif %}
{% if pastCharges|length > 0 or pastResources|length > 0 %}
<h2 class="subtitle">{{ 'Past budget'|trans }}</h2>
{% include 'ChillBudgetBundle:Budget:_past_budget.html.twig' with {
'pastCharges': pastCharges,
'pastResources': pastResources,
'entity': entity
} %}
{% endif %}
{% if futureCharges|length > 0 or futureResources|length > 0 %}
<h2 class="subtitle">{{ 'Future budget'|trans }}</h2>
{% include 'ChillBudgetBundle:Budget:_future_budget.html.twig' with {
'futureResources': futureResources,
'futureCharges': futureCharges,
'entity': entity
} %}
{% endif %}

View File

@@ -0,0 +1,30 @@
{% from 'ChillBudgetBundle:Budget:_macros.html.twig' import table_elements, table_results %}
{# <h2 class="subtitle">{{ 'Actual budget'|trans }}</h2> #}
<div class="flex-table">
<h4 class="family-title">{{ 'Actual resources'|trans }}</h4>
{% if actualResources|length > 0 %}
<div class="item-bloc">
{{ table_elements(actualResources, 'resource') }}
</div>
{% else %}
<div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No resources registered'|trans }}</span>
</div>
{% endif %}
</div>
<div class="flex-table">
<h4 class="family-title">{{ 'Actual charges'|trans }}</h4>
{% if actualCharges|length > 0 %}
<div class="item-bloc">
{{ table_elements(actualCharges, 'charge') }}
</div>
{% else %}
<div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No charges registered'|trans }}</span>
</div>
{% endif %}
</div>

View File

@@ -0,0 +1,51 @@
{% from 'ChillBudgetBundle:Budget:_macros.html.twig' import table_elements, table_results %}
<div class="accordion" id="future_{{ entity.id }}">
<div class="accordion-item">
<h2 class="accordion-header" id="heading_future_{{ entity.id }}">
<button
class="accordion-button collapsed"
type="button"
data-bs-toggle="collapse"
data-bs-target="#collapse_future_{{ entity.id }}"
aria-expanded="false"
aria-controls="collapse_future_{{ entity.id }}">
<span class="folded">{{ 'Show future budget'|trans }}</span>
<span class="unfolded text-secondary">{{ 'Hide budget'|trans }}</span>
</button>
</h2>
<div id="collapse_future_{{ entity.id }}"
class="accordion-collapse collapse"
aria-labelledby="heading_future_{{ entity.id }}"
data-bs-parent="#future_{{ entity.id }}">
<div class="flex-table">
<h3 class="family-title">{{ 'Future resources'|trans }}</h3>
{% if futureResources|length > 0 %}
<div class="item-bloc">
{{ table_elements(futureResources, 'resource') }}
</div>
{% else %}
<div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No future resources registered'|trans }}</span>
</div>
{% endif %}
</div>
<div class="flex-table">
<h3 class="family-title">{{ 'Future charges'|trans }}</h3>
{% if futureCharges|length > 0 %}
<div class="item-bloc">
{{ table_elements(futureCharges, 'charge') }}
</div>
{% else %}
<div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No future charges registered'|trans }}</span>
</div>
{% endif %}
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,97 @@
{% macro table_elements(elements, family) %}
<table class="budget-table">
<thead>
<tr>
<th class="{{ family }} el-type">{{ 'Budget element type'|trans }}</th>
<th class="{{ family }}">{{ 'Amount'|trans }}</th>
<th class="{{ family }}">{{ 'Validity period'|trans }}</th>
<th class="{{ family }}">&nbsp;</th>
</tr>
</thead>
<tbody>
{% set total = 0 %}
{% for f in elements %}
{% set total = total + f.amount %}
<tr>
<td class="column-wide el-type">
<span class="badge-title">
<span class="title_label title_label_{{ family }}"></span>
<span class="title_action">{{ f.type|budget_element_type_display(family) }}<span>
</span>
</td>
<td class="column-small">{{ f.amount|format_currency('EUR') }}</td>
<td class="column-wide">
{% if f.endDate is not null %}
{{ f.startDate|format_date('short') ~ ' - ' ~ f.endDate|format_date('short') }}
{% else %}
{{ f.startDate|format_date('short') ~ ' - ...' }}
{% endif %}
</td>
<td class="column-small">
<ul class="record_actions">
{% if is_granted('CHILL_BUDGET_ELEMENT_SEE', f) %}
<li>
<a href="{{ path('chill_budget_' ~ family ~ '_view', { 'id': f.id } ) }}" class="btn btn-sm btn-show"></a>
</li>
{% endif %}
{% if is_granted('CHILL_BUDGET_ELEMENT_UPDATE', f) %}
<li>
<a href="{{ path('chill_budget_' ~ family ~'_edit', { 'id': f.id } ) }}" class="btn btn-sm btn-edit"></a>
</li>
{% endif %}
{% if is_granted('CHILL_BUDGET_ELEMENT_DELETE', f) %}
<li>
<a href="{{ path('chill_budget_' ~ family ~ '_delete', { 'id': f.id } ) }}" class="btn btn-sm btn-delete"></a>
</li>
{% endif %}
</ul>
</td>
</tr>
{% endfor %}
<tr class="total">
<td class="el-type">
{{ 'Total'|trans }}
</td>
<td>
{{ total|format_currency('EUR') }}
</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
{% endmacro %}
{% macro table_results(actualCharges, actualResources) %}
{% set totalCharges = 0 %}
{% for c in actualCharges %}
{% set totalCharges = totalCharges + c.amount %}
{% endfor %}
{% set totalResources = 0 %}
{% for r in actualResources %}
{% set totalResources = totalResources + r.amount %}
{% endfor %}
{% set result = (totalResources - totalCharges) %}
<table>
<thead>
<tr>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>{{ 'Budget calculator result'|trans }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ 'The balance'|trans }}</td>
<td>&nbsp;</td>
<td>
{{ result|format_currency('EUR') }}
</td>
</tr>
</tbody>
</table>
{% endmacro %}

View File

@@ -0,0 +1,53 @@
{% from 'ChillBudgetBundle:Budget:_macros.html.twig' import table_elements, table_results %}
<div class="accordion" id="past_{{ entity.id }}">
<div class="accordion-item">
<h2 class="accordion-header" id="heading_past_{{ entity.id }}">
<button
class="accordion-button collapsed"
type="button"
data-bs-toggle="collapse"
data-bs-target="#collapse_past_{{ entity.id }}"
aria-expanded="false"
aria-controls="collapse_past_{{ entity.id }}">
<span class="folded">{{ 'Show past budget'|trans }}</span>
<span class="unfolded text-secondary">{{ 'Hide budget'|trans }}</span>
</button>
</h2>
<div id="collapse_past_{{ entity.id }}"
class="accordion-collapse collapse"
aria-labelledby="heading_past_{{ entity.id }}"
data-bs-parent="#past_{{ entity.id }}">
<div class="flex-table">
<h3 class="family-title">{{ 'Past resources'|trans }}</h3>
{% if pastResources|length > 0 %}
<div class="item-bloc">
{{ table_elements(pastResources, 'resource') }}
</div>
{% else %}
<div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No past resources registered'|trans }}</span>
</div>
{% endif %}
</div>
<div class="flex-table">
<h3 class="family-title">{{ 'Past charges'|trans }}</h3>
{% if pastCharges|length > 0 %}
<div class="item-bloc">
{{ table_elements(pastCharges, 'charge') }}
</div>
{% else %}
<div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No past charges registered'|trans }}</span>
</div>
{% endif %}
</div>
</div>
</div>
</div>

View File

@@ -1,18 +1,29 @@
{% extends "@ChillPerson/Person/layout.html.twig" %}
{% if element.person is not null %}
{% set template = '@ChillPerson/Person/layout.html.twig' %}
{% set indexPage = 'chill_budget_elements_index' %}
{% set activeRouteKey = '' %}
{% set person = element.person %}
{% set confirm_question = 'Are you sure you want to remove the charge "%type%" associated to "%name%" ?'|trans({ '%name%' : person.firstname ~ ' ' ~ person.lastname, '%type%': element.type|budget_element_type_display('charge') } ) %}
{% else %}
{% set template = '@ChillPerson/Household/layout.html.twig' %}
{% set indexPage = 'chill_budget_elements_household_index' %}
{% set activeRouteKey = '' %}
{% set household = element.household %}
{% set confirm_question = 'Are you sure you want to remove the charge "%type%" associated to household "%household%" ?'|trans({ '%household%' : household.id, '%type%': element.type|budget_element_type_display('charge') } ) %}
{% endif %}
{% set activeRouteKey = '' %}
{% set person = element.person %}
{% extends template %}
{% block title 'Remove resource'|trans %}
{% block title 'Remove charge'|trans %}
{% block personcontent %}
{% block content %}
{{ include('ChillMainBundle:Util:confirmation_template.html.twig',
{
'title' : 'Remove charge'|trans,
'confirm_question' : 'Are you sure you want to remove the charge "%type%" associated to "%name%" ?'|trans({ '%name%' : person.firstname ~ ' ' ~ person.lastname, '%type%': element.type|budget_element_type_display('charge') } ),
'cancel_route' : 'chill_budget_elements_index',
'cancel_parameters' : { 'id' : element.person.id },
'confirm_question' : confirm_question,
'cancel_route' : indexPage,
'cancel_parameters' : { 'id': person is defined ? person.id : household.id },
'form' : delete_form
} ) }}

View File

@@ -1,31 +1,43 @@
{% extends "@ChillPerson/Person/layout.html.twig" %}
{% if element.person is not null %}
{% set template = '@ChillPerson/Person/layout.html.twig' %}
{% set indexPage = 'chill_budget_elements_index' %}
{% set activeRouteKey = '' %}
{% set person = element.person %}
{% else %}
{% set template = '@ChillPerson/Household/layout.html.twig' %}
{% set indexPage = 'chill_budget_elements_household_index' %}
{% set activeRouteKey = '' %}
{% set household = element.household %}
{% endif %}
{% set title = 'Edit charge'|trans %}
{% extends template %}
{% set activeRouteKey = '' %}
{% set title = 'Edit Charge for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
{% block title title %}
{% block personcontent %}
{% block content %}
<h1>{{ title }}</h1>
{{ form_start(form) }}
{{ form_row(form.type) }}
{{ form_row(form.amount) }}
{{ form_row(form.help) }}
{{ form_row(form.help) }}
{{ form_row(form.comment) }}
{{ form_row(form.startDate) }}
{{ form_row(form.endDate) }}
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ path("chill_budget_elements_index", { 'id': person.id } ) }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
<a href="{{ path(indexPage, { 'id': person is defined ? person.id : household.id } ) }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
{{ form_widget(form.submit, { 'attr' : { 'class': 'btn btn-create' }, 'label': 'Edit' } ) }}
{{ form_widget(form.submit, { 'attr' : { 'class': 'btn btn-edit' }, 'label': 'Edit' } ) }}
</li>
</ul>
{{ form_end(form) }}
{% endblock %}

View File

@@ -1,31 +1,42 @@
{% extends "@ChillPerson/Person/layout.html.twig" %}
{% if element.person is not null %}
{% set template = '@ChillPerson/Person/layout.html.twig' %}
{% set indexPage = 'chill_budget_elements_index' %}
{% set activeRouteKey = '' %}
{% set person = element.person %}
{% else %}
{% set template = '@ChillPerson/Household/layout.html.twig' %}
{% set indexPage = 'chill_budget_elements_household_index' %}
{% set activeRouteKey = '' %}
{% set household = element.household %}
{% endif %}
{% set activeRouteKey = '' %}
{% set title = 'New Charge for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
{% set title = 'New charge'|trans %}
{% extends template %}
{% block title title %}
{% block personcontent %}
{% block content %}
<h1>{{ title }}</h1>
{{ form_start(form) }}
{{ form_row(form.type) }}
{{ form_row(form.amount) }}
{{ form_row(form.help) }}
{{ form_row(form.help) }}
{{ form_row(form.comment) }}
{{ form_row(form.startDate) }}
{{ form_row(form.endDate) }}
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ path("chill_budget_elements_index", { 'id': person.id } ) }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
<a href="{{ path(indexPage, { 'id': person is defined ? person.id : household.id } ) }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
{{ form_widget(form.submit, { 'attr' : { 'class': 'btn btn-create' }, 'label': 'Create' } ) }}
</li>
</ul>
{{ form_end(form) }}
{% endblock %}

View File

@@ -1,49 +1,68 @@
{% extends "@ChillPerson/Person/layout.html.twig" %}
{% if element.person is not null %}
{% set template = '@ChillPerson/Person/layout.html.twig' %}
{% set indexPage = 'chill_budget_elements_index' %}
{% set activeRouteKey = '' %}
{% set person = element.person %}
{% else %}
{% set template = '@ChillPerson/Household/layout.html.twig' %}
{% set indexPage = 'chill_budget_elements_household_index' %}
{% set activeRouteKey = '' %}
{% set household = element.household %}
{% endif %}
{% set activeRouteKey = '' %}
{% set person = element.person %}
{% set title = 'Charge for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
{% set title = 'Charge' %}
{% extends template %}
{% block title title %}
{% block personcontent %}
<h1>{{ title }}</h1>
{% block content %}
<div class="budget-show">
<h1>{{ title }}</h1>
<dl class="chill_view_data">
<dt>{{ 'Type'|trans }}</dt>
<dd>{{ element.type|budget_element_type_display('charge') }}</dd>
<dt>{{ 'Amount'|trans }}</dt>
<dd>{{ element.amount|localizedcurrency('EUR') }}</dd>
<dt>{{ 'Validity period'|trans }}</dt>
<dd>
{% if element.endDate is not null %}
{{ 'Valid since %startDate% until %endDate%'|trans( { '%startDate%': element.startDate|localizeddate('long', 'none'), '%endDate%': familyMember.endDate|localizeddate('long', 'none') } ) }}
{% else %}
{{ 'Valid since %startDate%'|trans( { '%startDate%': element.startDate|localizeddate('long', 'none') } ) }}
{% endif %}
</dd>
<dt>{{ 'Comment'|trans }}</dt>
<dd>
{%- if element.comment is not empty -%}
<blockquote class="chill-user-quote">
{{ element.comment }}
</blockquote>
{%- else -%}
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
{%- endif -%}
</dd>
</dl>
<div class="flex-table">
<div class="item-bloc">
<div class="item-row">
<h2 class="badge-title">
<span class="title_label title_label_charge"></span>
<span class="title_action">{{ element.type|budget_element_type_display('charge') }}</span>
</h2>
</div>
<div class="item-row separator">
<dl class="chill_view_data">
<dt>{{ 'Amount'|trans }}</dt>
<dd>{{ element.amount|format_currency('EUR') }}</dd>
<dt>{{ 'Validity period'|trans }}</dt>
<dd>
{% if element.endDate is not null %}
{{ 'Valid since %startDate% until %endDate%'|trans( { '%startDate%': element.startDate|format_date('long'), '%endDate%': element.endDate|format_date('long') } ) }}
{% else %}
{{ 'Valid since %startDate%'|trans( { '%startDate%': element.startDate|format_date('long') } ) }}
{% endif %}
</dd>
<dt>{{ 'Comment'|trans }}</dt>
<dd>
{%- if element.comment is not empty -%}
<blockquote class="chill-user-quote">
{{ element.comment }}
</blockquote>
{%- else -%}
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
{%- endif -%}
</dd>
</dl>
</div>
</div>
</div>
</div>
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ path("chill_budget_elements_index", { 'id': person.id } ) }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
<a href="{{ path(indexPage, { 'id': person is defined ? person.id : household.id } ) }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
{% if is_granted(constant('Chill\\AMLI\\BudgetBundle\\Security\\Authorization\\BudgetElementVoter::UPDATE'), element) %}
{% if is_granted('CHILL_BUDGET_ELEMENT_UPDATE', element) %}
<li>
<a href="{{ path('chill_budget_charge_edit', { 'id': element.id } ) }}" class="btn btn-edit">{{ 'Edit'|trans }}</a>
</li>

View File

@@ -1,228 +0,0 @@
{% extends "@ChillPerson/Person/layout.html.twig" %}
{% set activeRouteKey = '' %}
{% set title = 'Budget for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
{% block title title %}
{% set actualResources = [] %}
{% set futureResources = [] %}
{% set pastResources = [] %}
{% for r in resources %}
{% if r.startDate|date('U') <= 'now'|date('U') %}
{% if r.endDate is null or r.endDate|date('U') >= 'now'|date('U') %}
{% set actualResources = actualResources|merge([ r ]) %}
{% else %}
{% set pastResources = pastResources|merge([ r ]) %}
{% endif %}
{% else %}
{% set futureResources = futureResources|merge([ r ]) %}
{% endif %}
{% endfor %}
{% set actualCharges = [] %}
{% set futureCharges = [] %}
{% set pastCharges = [] %}
{% for c in charges %}
{% if c.startDate|date('U') <= 'now'|date('U') %}
{% if c.endDate is null or c.endDate|date('U') >= 'now'|date('U') %}
{% set actualCharges = actualCharges|merge([ c ]) %}
{% else %}
{% set pastCharges = pastCharges|merge([ c ]) %}
{% endif %}
{% else %}
{% set futureCharges = futureCharges|merge([ c ]) %}
{% endif %}
{% endfor %}
{% macro table_elements(elements, family) %}
<table>
<thead>
<tr>
<th>{{ 'Budget element type'|trans }}</th>
<th>{{ 'Amount'|trans }}</th>
<th>{{ 'Validity period'|trans }}</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{% set total = 0 %}
{% for f in elements %}
{% set total = total + f.amount %}
<tr>
<td>
{{ f.type|budget_element_type_display(family) }}
</td>
<td>{{ f.amount|format_currency('EUR') }}</td>
<td>
{% if f.endDate is not null %}
{{ 'Valid since %startDate% until %endDate%'|trans( { '%startDate%': f.startDate|format_date('long'), '%endDate%': f.endDate|format_date('long') } ) }}
{% else %}
{{ 'Valid since %startDate%'|trans( { '%startDate%': f.startDate|format_date('long') } ) }}
{% endif %}
</td>
<td>
<ul class="record_actions">
{% if is_granted(constant('Chill\\AMLI\\BudgetBundle\\Security\\Authorization\\BudgetElementVoter::SHOW'), f) %}
<li>
<a href="{{ path('chill_budget_' ~ family ~ '_view', { 'id': f.id } ) }}" class="btn btn-show"></a>
</li>
{% endif %}
{% if is_granted(constant('Chill\\AMLI\\BudgetBundle\\Security\\Authorization\\BudgetElementVoter::UPDATE'), f) %}
<li>
<a href="{{ path('chill_budget_' ~ family ~'_edit', { 'id': f.id } ) }}" class="btn btn-edit"></a>
</li>
{% endif %}
{% if is_granted(constant('Chill\\AMLI\\BudgetBundle\\Security\\Authorization\\BudgetElementVoter::DELETE'), f) %}
<li>
<a href="{{ path('chill_budget_' ~ family ~ '_delete', { 'id': f.id } ) }}" class="btn btn-delete"></a>
</li>
{% endif %}
</ul>
</td>
</tr>
{% endfor %}
<tr>
<td>
{{ 'Total'|trans }}
</td>
<td>
{{ total|format_currency('EUR') }}
</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
{% endmacro %}
{% macro table_results(results) %}
<table>
<thead>
<tr>
<th>&nbsp;</th>
<th>{{ 'Budget calculator result'|trans }}</th>
</tr>
</thead>
<tbody>
{% for result in results %}
<tr>
<td>{{ result.label }}</td>
<td>
{% if result.type == constant('CHILL\\AMLI\\BudgetBundle\\Calculator\\CalculatorResult::TYPE_CURRENCY') %}
{{ result.result|format_currency('EUR') }}
{% elseif result.type == constant('CHILL\\AMLI\\BudgetBundle\\Calculator\\CalculatorResult::TYPE_PERCENTAGE') %}
{{ result.result|round(2, 'ceil') ~ '%' }}
{% else %}
{{ result.result|round(2, 'common') }}
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endmacro %}
{% import _self as m %}
{% block personcontent %}
<h1>{{ title }}</h1>
<h2>{{ 'Actual budget'|trans }}</h2>
{% if resources|length == 0 and charges|length == 0 %}
<p><span class="chill-no-data-statement">{{ "There isn't any element recorded"|trans }}</span></p>
{% else %}
<h3>{{ 'Actual resources'|trans }}</h3>
{% if actualResources|length > 0 %}
{{ m.table_elements(actualResources, 'resource') }}
{% else %}
<span class="chill-no-data-statement">{{ 'No resources registered'|trans }}</span>
{% endif %}
<h3>{{ 'Actual charges'|trans }}</h3>
{% if actualCharges|length > 0 %}
{{ m.table_elements(actualCharges, 'charge') }}
{% else %}
<span class="chill-no-data-statement">{{ 'No charges registered'|trans }}</span>
{% endif %}
{% if results|length > 0 %}
<h2>{{ 'Budget calculator'|trans }}</h2>
{{ m.table_results(results) }}
{% endif %}
{% if is_granted(constant('Chill\\AMLI\\BudgetBundle\\Security\\Authorization\\BudgetElementVoter::CREATE'), person) %}
<ul class="record_actions">
<li>
<a class="btn btn-create" href="{{ path('chill_budget_resource_new', { 'id': person.id} ) }}">{{ 'Create new resource'|trans }}</a>
</li>
<li>
<a class="btn btn-create" href="{{ path('chill_budget_charge_new', { 'id': person.id} ) }}">{{ 'Create new charge'|trans }}</a>
</li>
</ul>
{% endif %}
{% endif %}
{% if pastCharges|length > 0 or pastResources|length > 0 %}
<h2>{{ 'Past budget'|trans }}</h2>
<h3>{{ 'Past resources'|trans }}</h3>
{% if pastResources|length > 0 %}
{{ m.table_elements(pastResources, 'resource') }}
{% else %}
<span class="chill-no-data-statement">{{ 'No past resources registered'|trans }}</span>
{% endif %}
<h3>{{ 'Past charges'|trans }}</h3>
{% if pastCharges|length > 0 %}
{{ m.table_elements(pastCharges, 'charge') }}
{% else %}
<span class="chill-no-data-statement">{{ 'No past charges registered'|trans }}</span>
{% endif %}
{% endif %}
{% if futureCharges|length > 0 or futureResources|length > 0 %}
<h2>{{ 'Future budget'|trans }}</h2>
<h3>{{ 'Future resources'|trans }}</h3>
{% if futureResources|length > 0 %}
{{ m.table_elements(futureResources, 'resource') }}
{% else %}
<span class="chill-no-data-statement">{{ 'No future resources registered'|trans }}</span>
{% endif %}
<h3>{{ 'Future charges'|trans }}</h3>
{% if futureCharges|length > 0 %}
{{ m.table_elements(futureCharges, 'charge') }}
{% else %}
<span class="chill-no-data-statement">{{ 'No future charges registered'|trans }}</span>
{% endif %}
{% endif %}
{% if (resources|length + charges|length) == 0 or futureCharges|length > 0 or futureResources|length > 0 or pastCharges|length > 0 or pastResources|length > 0 %}
{% if is_granted(constant('Chill\\AMLI\\BudgetBundle\\Security\\Authorization\\BudgetElementVoter::CREATE'), person) %}
<ul class="record_actions">
<li>
<a class="btn btn-create" href="{{ path('chill_budget_resource_new', { 'id': person.id} ) }}">{{ 'Create new resource'|trans }}</a>
</li>
<li>
<a class="btn btn-create" href="{{ path('chill_budget_charge_new', { 'id': person.id} ) }}">{{ 'Create new charge'|trans }}</a>
</li>
</ul>
{% endif %}
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,92 @@
{% extends "@ChillPerson/Household/layout.html.twig" %}
{% from 'ChillBudgetBundle:Budget:_macros.html.twig' import table_elements, table_results %}
{% set activeRouteKey = '' %}
{% set title = 'Budget for household %household%'|trans({ '%household%' : household.id } ) %}
{% block title title %}
{% block js %}
{{ encore_entry_script_tags('page_budget') }}
{% endblock %}
{% block css %}
{{ encore_entry_link_tags('page_budget') }}
{% endblock %}
{% block content %}
<h1>{{ title }}</h1>
{% include 'ChillBudgetBundle:Budget:_budget.html.twig' with {
'resources': resources,
'charges': charges,
'household': household
} %}
{#
<div class="flex-table">
<h3 class="family-title">{{ 'Budget calculator'|trans }}</h3>
<div class="item-bloc">
{{ table_results(wholeCharges, wholeResources) }}
</div>
</div>
#}
{% if household.getCurrentMembers|length > 0 %}
<h2 class="subtitle">{{ 'Current budget household members'|trans }}</h2>
{% for hm in household.getCurrentMembers %}
{% set member = hm.person %}
<div class="accordion" id="member_{{ member.id }}">
<div class="accordion-item">
<h2 class="accordion-header" id="heading_{{ member.id }}">
<button
class="accordion-button collapsed"
type="button"
data-bs-toggle="collapse"
data-bs-target="#collapse_{{ member.id }}"
aria-expanded="false"
aria-controls="collapse_{{ member.id }}">
<span class="folded">{{ 'Show budget of %name%'|trans({'%name%': member.firstName ~ " " ~ member.lastName }) }} ({{ 'budget.number of elements'|trans({ 'nb_items': member.getBudgetResources|length + member.getBudgetResources|length }) }})</span>
<span class="unfolded text-secondary">{{ 'Hide budget of %name%'|trans({'%name%': member.firstName ~ " " ~ member.lastName }) }}</span>
</button>
</h2>
<div id="collapse_{{ member.id }}"
class="accordion-collapse collapse"
aria-labelledby="heading_{{ member.id }}"
data-bs-parent="#nonCurrent">
{% include 'ChillBudgetBundle:Budget:_budget.html.twig' with {
'resources': member.getBudgetResources,
'charges': member.getBudgetCharges,
'person': member
} %}
<ul class="record_actions">
{% if is_granted('CHILL_BUDGET_ELEMENT_SEE', member) %}
<li class="btn-budget">
<a class="btn btn-edit" title={{ 'Edit budget'|trans }} href="{{ path('chill_budget_elements_index', { 'id': member.id } ) }}"></a>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
{% endfor %}
{% endif %}
{% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', household) %}
<ul class="record_actions sticky-form-buttons">
<li>
<a class="btn btn-create" href="{{ path('chill_budget_resource_household_new', { 'id': household.id} ) }}">{{ 'Create new resource'|trans }}</a>
</li>
<li>
<a class="btn btn-create" href="{{ path('chill_budget_charge_household_new', { 'id': household.id} ) }}">{{ 'Create new charge'|trans }}</a>
</li>
</ul>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,46 @@
{% extends "@ChillPerson/Person/layout.html.twig" %}
{% from 'ChillBudgetBundle:Budget:_macros.html.twig' import table_results %}
{% set activeRouteKey = '' %}
{% set title = 'Budget for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
{% block title title %}
{% block js %}
{{ encore_entry_script_tags('page_budget') }}
{% endblock %}
{% block css %}
{{ encore_entry_link_tags('page_budget') }}
{% endblock %}
{% block content %}
<h1>{{ title }}</h1>
{% include 'ChillBudgetBundle:Budget:_budget.html.twig' with {
'resources': resources,
'charges': charges,
'person': person
} %}
<div class="flex-table">
<h3 class="family-title">{{ 'Budget calculator'|trans }}</h2>
<div class="item-bloc">
{{ table_results(charges, resources) }}
</div>
</div>
{% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', person) %}
<ul class="record_actions sticky-form-buttons">
<li>
<a class="btn btn-create" href="{{ path('chill_budget_resource_new', { 'id': person.id} ) }}">{{ 'Create new resource'|trans }}</a>
</li>
<li>
<a class="btn btn-create" href="{{ path('chill_budget_charge_new', { 'id': person.id} ) }}">{{ 'Create new charge'|trans }}</a>
</li>
</ul>
{% endif %}
{% endblock %}

View File

@@ -1,18 +1,29 @@
{% extends "@ChillPerson/Person/layout.html.twig" %}
{% if element.person is not null %}
{% set template = '@ChillPerson/Person/layout.html.twig' %}
{% set indexPage = 'chill_budget_elements_index' %}
{% set activeRouteKey = '' %}
{% set person = element.person %}
{% set confirm_question = 'Are you sure you want to remove the ressource "%type%" associated to "%name%" ?'|trans({ '%name%' : person.firstname ~ ' ' ~ person.lastname, '%type%': element.type|budget_element_type_display('resource') } ) %}
{% else %}
{% set template = '@ChillPerson/Household/layout.html.twig' %}
{% set indexPage = 'chill_budget_elements_household_index' %}
{% set activeRouteKey = '' %}
{% set household = element.household %}
{% set confirm_question = 'Are you sure you want to remove the ressource "%type%" associated to household "%household%" ?'|trans({ '%household%' : household.id, '%type%': element.type|budget_element_type_display('resource') } ) %}
{% endif %}
{% set activeRouteKey = '' %}
{% set person = element.person %}
{% extends template %}
{% block title 'Remove resource'|trans %}
{% block personcontent %}
{% block content %}
{{ include('ChillMainBundle:Util:confirmation_template.html.twig',
{
'title' : 'Remove resource'|trans,
'confirm_question' : 'Are you sure you want to remove the ressource "%type%" associated to "%name%" ?'|trans({ '%name%' : person.firstname ~ ' ' ~ person.lastname, '%type%': element.type|budget_element_type_display('resource') } ),
'cancel_route' : 'chill_budget_elements_index',
'cancel_parameters' : { 'id' : element.person.id },
'confirm_question' : confirm_question,
'cancel_route' : indexPage,
'cancel_parameters' : { 'id': person is defined ? person.id : household.id },
'form' : delete_form
} ) }}

View File

@@ -1,10 +1,24 @@
{% extends "@ChillPerson/Person/layout.html.twig" %}
{% if element.person is not null %}
{% set template = '@ChillPerson/Person/layout.html.twig' %}
{% set indexPage = 'chill_budget_elements_index' %}
{% set activeRouteKey = '' %}
{% set person = element.person %}
{% set title = 'Edit resource for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
{% else %}
{% set template = '@ChillPerson/Household/layout.html.twig' %}
{% set indexPage = 'chill_budget_elements_household_index' %}
{% set activeRouteKey = '' %}
{% set household = element.household %}
{% set title = 'Edit resource for household %household%'|trans({ '%household%' : household.id } ) %}
{% endif %}
{% set title = 'Edit resource'|trans %}
{% extends template %}
{% set activeRouteKey = '' %}
{% set title = 'Edit Resource for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
{% block title title %}
{% block personcontent %}
{% block content %}
<h1>{{ title }}</h1>
{{ form_start(form) }}
@@ -17,14 +31,14 @@
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ path("chill_budget_elements_index", { 'id': person.id } ) }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
<a href="{{ path(indexPage, { 'id': person is defined ? person.id : household.id } ) }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
{{ form_widget(form.submit, { 'attr' : { 'class': 'btn btn-create' }, 'label': 'Edit' } ) }}
{{ form_widget(form.submit, { 'attr' : { 'class': 'btn btn-edit' }, 'label': 'Edit' } ) }}
</li>
</ul>
{{ form_end(form) }}
{% endblock %}

View File

@@ -1,10 +1,24 @@
{% extends "@ChillPerson/Person/layout.html.twig" %}
{% if element.person is not null %}
{% set template = '@ChillPerson/Person/layout.html.twig' %}
{% set indexPage = 'chill_budget_elements_index' %}
{% set activeRouteKey = '' %}
{% set person = element.person %}
{% set title = 'New Resource for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
{% else %}
{% set template = '@ChillPerson/Household/layout.html.twig' %}
{% set indexPage = 'chill_budget_elements_household_index' %}
{% set activeRouteKey = '' %}
{% set household = element.household %}
{% set title = 'New Resource for household %household%'|trans({ '%household%' : household.id } ) %}
{% endif %}
{% set title = 'New resource'|trans %}
{% extends template %}
{% set activeRouteKey = '' %}
{% set title = 'New Resource for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
{% block title title %}
{% block personcontent %}
{% block content %}
<h1>{{ title }}</h1>
{{ form_start(form) }}
@@ -17,14 +31,14 @@
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ path("chill_budget_elements_index", { 'id': person.id } ) }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
<a href="{{ path(indexPage, { 'id': person is defined ? person.id : household.id } ) }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
{{ form_widget(form.submit, { 'attr' : { 'class': 'btn btn-create' }, 'label': 'Create' } ) }}
</li>
</ul>
{{ form_end(form) }}
{% endblock %}

View File

@@ -1,49 +1,68 @@
{% extends "@ChillPerson/Person/layout.html.twig" %}
{% if element.person is not null %}
{% set template = '@ChillPerson/Person/layout.html.twig' %}
{% set indexPage = 'chill_budget_elements_index' %}
{% set activeRouteKey = '' %}
{% set person = element.person %}
{% else %}
{% set template = '@ChillPerson/Household/layout.html.twig' %}
{% set indexPage = 'chill_budget_elements_household_index' %}
{% set activeRouteKey = '' %}
{% set household = element.household %}
{% endif %}
{% set activeRouteKey = '' %}
{% set person = element.person %}
{% set title = 'Resource for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
{% set title = 'Resource' %}
{% extends template %}
{% block title title %}
{% block personcontent %}
<h1>{{ title }}</h1>
{% block content %}
<div class="budget-show">
<h1>{{ title }}</h1>
<dl class="chill_view_data">
<dt>{{ 'Type'|trans }}</dt>
<dd>{{ element.type|budget_element_type_display('resource') }}</dd>
<dt>{{ 'Amount'|trans }}</dt>
<dd>{{ element.amount|format_currency('EUR') }}</dd>
<dt>{{ 'Validity period'|trans }}</dt>
<dd>
{% if element.endDate is not null %}
{{ 'Valid since %startDate% until %endDate%'|trans( { '%startDate%': element.startDate|format_date('long'), '%endDate%': familyMember.endDate|format_date('long') } ) }}
{% else %}
{{ 'Valid since %startDate%'|trans( { '%startDate%': element.startDate|format_date('long') } ) }}
{% endif %}
</dd>
<dt>{{ 'Comment'|trans }}</dt>
<dd>
{%- if element.comment is not empty -%}
<blockquote class="chill-user-quote">
{{ element.comment }}
</blockquote>
{%- else -%}
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
{%- endif -%}
</dd>
</dl>
<div class="flex-table">
<div class="item-bloc">
<div class="item-row">
<h2 class="badge-title">
<span class="title_label title_label_resource"></span>
<span class="title_action title_action">{{ element.type|budget_element_type_display('resource') }}</span>
</h2>
</div>
<div class="item-row separator">
<dl class="chill_view_data">
<dt class="inline">{{ 'Amount'|trans }}</dt>
<dd>{{ element.amount|format_currency('EUR') }}</dd>
<dt class="inline">{{ 'Validity period'|trans }}</dt>
<dd>
{% if element.endDate is not null %}
{{ 'Valid since %startDate% until %endDate%'|trans( { '%startDate%': element.startDate|format_date('long'), '%endDate%': element.endDate|format_date('long') } ) }}
{% else %}
{{ 'Valid since %startDate%'|trans( { '%startDate%': element.startDate|format_date('long') } ) }}
{% endif %}
</dd>
<dt class="inline">{{ 'Comment'|trans }}</dt>
<dd>
{%- if element.comment is not empty -%}
<blockquote class="chill-user-quote">
{{ element.comment }}
</blockquote>
{%- else -%}
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
{%- endif -%}
</dd>
</dl>
</div>
</div>
</div>
</div>
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ path("chill_budget_elements_index", { 'id': person.id } ) }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
<a href="{{ path(indexPage, { 'id': person is defined ? person.id : household.id } ) }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
{% if is_granted(constant('Chill\\AMLI\\BudgetBundle\\Security\\Authorization\\BudgetElementVoter::UPDATE'), element) %}
{% if is_granted('CHILL_BUDGET_ELEMENT_UPDATE', element) %}
<li>
<a href="{{ path('chill_budget_resource_edit', { 'id': element.id } ) }}" class="btn btn-edit">{{ 'Edit'|trans }}</a>
</li>

View File

@@ -9,15 +9,16 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Security\Authorization;
namespace Chill\BudgetBundle\Security\Authorization;
use Chill\AMLI\BudgetBundle\Entity\AbstractElement;
use Chill\MainBundle\Entity\User;
use Chill\BudgetBundle\Entity\AbstractElement;
use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\MainBundle\Security\Authorization\VoterHelperFactoryInterface;
use Chill\MainBundle\Security\Authorization\VoterHelperInterface;
use Chill\MainBundle\Security\ProvideRoleHierarchyInterface;
use Chill\PersonBundle\Entity\Household\Household;
use Chill\PersonBundle\Entity\Person;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use function in_array;
@@ -30,22 +31,24 @@ class BudgetElementVoter extends AbstractChillVoter implements ProvideRoleHierar
public const ROLES = [
self::CREATE,
self::DELETE,
self::SHOW,
self::SEE,
self::UPDATE,
];
public const SHOW = 'CHILL_BUDGET_ELEMENT_SHOW';
public const SEE = 'CHILL_BUDGET_ELEMENT_SEE';
public const UPDATE = 'CHILL_BUDGET_ELEMENT_UPDATE';
/**
* @var AuthorizationHelper
*/
protected $authorizationHelper;
protected VoterHelperInterface $voter;
public function __construct(AuthorizationHelper $authorizationHelper)
public function __construct(VoterHelperFactoryInterface $voterFactory)
{
$this->authorizationHelper = $authorizationHelper;
$this->voter = $voterFactory
->generate(self::class)
->addCheckFor(AbstractElement::class, self::ROLES)
->addCheckFor(Person::class, [self::CREATE, self::SEE])
->addCheckFor(Household::class, [self::CREATE, self::SEE])
->build();
}
public function getRoles(): array
@@ -66,18 +69,11 @@ class BudgetElementVoter extends AbstractChillVoter implements ProvideRoleHierar
protected function supports($attribute, $subject)
{
return (in_array($attribute, self::ROLES, true) && $subject instanceof AbstractElement)
|| ($subject instanceof Person && in_array($attribute, [self::SHOW, self::CREATE], true));
|| (($subject instanceof Person || $subject instanceof Household) && in_array($attribute, [self::SEE, self::CREATE], true));
}
protected function voteOnAttribute($attribute, $subject, \Symfony\Component\Security\Core\Authentication\Token\TokenInterface $token)
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
{
$user = $token->getUser();
if (false === $user instanceof User) {
return false;
}
return $this->authorizationHelper
->userHasAccess($user, $subject, new Role($attribute));
return $this->voter->voteOnAttribute($attribute, $subject, $token);
}
}

View File

@@ -0,0 +1,168 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\BudgetBundle\Service\Summary;
use Chill\BudgetBundle\Config\ConfigRepository;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Chill\PersonBundle\Entity\Household\Household;
use Chill\PersonBundle\Entity\Person;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query\ResultSetMapping;
use LogicException;
use function count;
/**
* Helps to find a summary of the budget: the sum of resources and charges.
*/
class SummaryBudget implements SummaryBudgetInterface
{
private const QUERY_CHARGE_BY_HOUSEHOLD = 'select SUM(amount) AS sum, string_agg(comment, \'|\') AS comment, type FROM chill_budget.charge WHERE (person_id IN (_ids_) OR household_id = ?) AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY type';
private const QUERY_CHARGE_BY_PERSON = 'select SUM(amount) AS sum, string_agg(comment, \'|\') AS comment, type FROM chill_budget.charge WHERE person_id = ? AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY type';
private const QUERY_RESOURCE_BY_HOUSEHOLD = 'select SUM(amount) AS sum, string_agg(comment, \'|\') AS comment, type FROM chill_budget.resource WHERE (person_id IN (_ids_) OR household_id = ?) AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY type';
private const QUERY_RESOURCE_BY_PERSON = 'select SUM(amount) AS sum, string_agg(comment, \'|\') AS comment, type FROM chill_budget.resource WHERE person_id = ? AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY type';
private array $chargeLabels;
private ConfigRepository $configRepository;
private EntityManagerInterface $em;
private array $resourcesLabels;
private TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(EntityManagerInterface $em, ConfigRepository $configRepository, TranslatableStringHelperInterface $translatableStringHelper)
{
$this->em = $em;
$this->configRepository = $configRepository;
$this->chargeLabels = $configRepository->getChargesLabels();
$this->resourcesLabels = $configRepository->getResourcesLabels();
$this->translatableStringHelper = $translatableStringHelper;
}
public function getSummaryForHousehold(?Household $household): array
{
if (null === $household) {
return [
'resources' => $this->getEmptyResourceArray(),
'charges' => $this->getEmptyChargeArray(),
];
}
$personIds = $household->getCurrentPersons()->map(static function (Person $p) { return $p->getId(); });
$ids = implode(', ', array_fill(0, count($personIds), '?'));
$parameters = [...$personIds, $household->getId()];
$rsm = $this->buildRsm();
$resources = $this->em->createNativeQuery(strtr(self::QUERY_RESOURCE_BY_HOUSEHOLD, ['_ids_' => $ids]), $rsm)
->setParameters($parameters)
->getResult();
$charges = $this->em->createNativeQuery(strtr(self::QUERY_CHARGE_BY_HOUSEHOLD, ['_ids_' => $ids]), $rsm)
->setParameters($parameters)
->getResult();
return [
'resources' => array_merge($this->getEmptyResourceArray(), $this->rowToArray($resources, 'resource')),
'charges' => array_merge($this->getEmptyChargeArray(), $this->rowToArray($charges, 'charge')),
];
}
public function getSummaryForPerson(?Person $person): array
{
if (null === $person) {
return [
'resources' => $this->getEmptyResourceArray(),
'charges' => $this->getEmptyChargeArray(),
];
}
$rsm = $this->buildRsm();
$resources = $this->em->createNativeQuery(self::QUERY_RESOURCE_BY_PERSON, $rsm)
->setParameters([$person->getId()])
->getResult();
$charges = $this->em->createNativeQuery(self::QUERY_CHARGE_BY_PERSON, $rsm)
->setParameters([$person->getId()])
->getResult();
return [
'resources' => array_merge($this->getEmptyResourceArray(), $this->rowToArray($resources, 'resource')),
'charges' => array_merge($this->getEmptyChargeArray(), $this->rowToArray($charges, 'charge')),
];
}
private function buildRsm(): ResultSetMapping
{
$rsm = new ResultSetMapping();
$rsm
->addScalarResult('sum', 'sum')
->addScalarResult('type', 'type')
->addScalarResult('comment', 'comment');
return $rsm;
}
private function getEmptyChargeArray(): array
{
$keys = $this->configRepository->getChargesKeys();
$labels = $this->chargeLabels;
return array_combine($keys, array_map(function ($i) use ($labels) {
return ['sum' => 0.0, 'label' => $this->translatableStringHelper->localize($labels[$i]), 'comment' => ''];
}, $keys));
}
private function getEmptyResourceArray(): array
{
$keys = $this->configRepository->getResourcesKeys();
$labels = $this->resourcesLabels;
return array_combine($keys, array_map(function ($i) use ($labels) {
return ['sum' => 0.0, 'label' => $this->translatableStringHelper->localize($labels[$i]), 'comment' => ''];
}, $keys));
}
private function rowToArray(array $rows, string $kind): array
{
switch ($kind) {
case 'charge':
$label = $this->chargeLabels;
break;
case 'resource':
$label = $this->resourcesLabels;
break;
default:
throw new LogicException();
}
$result = [];
foreach ($rows as $row) {
$result[$row['type']] = [
'sum' => (float) $row['sum'],
'label' => $this->translatableStringHelper->localize($label[$row['type']]),
'comment' => (string) $row['comment'],
];
}
return $result;
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\BudgetBundle\Service\Summary;
use Chill\PersonBundle\Entity\Household\Household;
use Chill\PersonBundle\Entity\Person;
/**
* Helps to find a summary of the budget: the sum of resources and charges.
*/
interface SummaryBudgetInterface
{
public function getSummaryForHousehold(?Household $household): array;
public function getSummaryForPerson(?Person $person): array;
}

View File

@@ -9,9 +9,9 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Templating;
namespace Chill\BudgetBundle\Templating;
use Chill\AMLI\BudgetBundle\Config\ConfigRepository;
use Chill\BudgetBundle\Config\ConfigRepository;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;

View File

@@ -9,7 +9,7 @@
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Tests\Controller;
namespace Chill\BudgetBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

View File

@@ -0,0 +1,9 @@
// this file loads all assets from the Chill budget bundle
module.exports = function(encore, entries)
{
encore.addAliases({
ChillBudgetAssets: __dirname + '/Resources/public'
});
encore.addEntry('page_budget', __dirname + '/Resources/public/page/index.js');
};

View File

@@ -6,7 +6,7 @@
"keywords" : ["chill", "social work"],
"homepage" : "https://framagit.org/Chill-project/BudgetBundle",
"autoload": {
"psr-4": { "Chill\\AMLI\\BudgetBundle\\": "" }
"psr-4": { "Chill\\BudgetBundle\\": "" }
},
"autoload-dev": {
"classmap": [ "Resources/test/Fixtures/App/app/AppKernel.php" ]

View File

@@ -1,3 +1,3 @@
chill_amli_budget_controllers:
resource: "@ChillAMLIBudgetBundle/Controller"
chill_budget_controllers:
resource: "@ChillBudgetBundle/Controller"
type: annotation

View File

@@ -1,2 +1,2 @@
services:
Chill\AMLI\BudgetBundle\Calculator\CalculatorManager: ~
Chill\BudgetBundle\Calculator\CalculatorManager: ~

View File

@@ -1,5 +1,5 @@
services:
Chill\AMLI\BudgetBundle\Config\ConfigRepository:
Chill\BudgetBundle\Config\ConfigRepository:
arguments:
$resources: '%chill_budget.resources%'
$charges: '%chill_budget.charges%'

View File

@@ -1,5 +1,5 @@
services:
Chill\AMLI\BudgetBundle\Controller\:
Chill\BudgetBundle\Controller\:
autowire: true
resource: '../../Controller'
tags: ['controller.service_arguments']

View File

@@ -1,14 +1,14 @@
services:
Chill\AMLI\BudgetBundle\Form\ResourceType:
Chill\BudgetBundle\Form\ResourceType:
arguments:
$configRepository: '@Chill\AMLI\BudgetBundle\Config\ConfigRepository'
$configRepository: '@Chill\BudgetBundle\Config\ConfigRepository'
$translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper'
tags:
- { name: 'form.type' }
Chill\AMLI\BudgetBundle\Form\ChargeType:
Chill\BudgetBundle\Form\ChargeType:
arguments:
$configRepository: '@Chill\AMLI\BudgetBundle\Config\ConfigRepository'
$configRepository: '@Chill\BudgetBundle\Config\ConfigRepository'
$translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper'
tags:
- { name: 'form.type' }

View File

@@ -1,7 +1,8 @@
services:
Chill\AMLI\BudgetBundle\Menu\UserMenuBuilder:
arguments:
$authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
$translator: '@Symfony\Contracts\Translation\TranslatorInterface'
tags:
- { name: 'chill.menu_builder' }
Chill\BudgetBundle\Menu\PersonMenuBuilder:
autowire: true
autoconfigure: true
Chill\BudgetBundle\Menu\HouseholdMenuBuilder:
autowire: true
autoconfigure: true

View File

@@ -1,7 +1,6 @@
services:
Chill\AMLI\BudgetBundle\Security\Authorization\BudgetElementVoter:
arguments:
$authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
Chill\BudgetBundle\Security\Authorization\BudgetElementVoter:
autowire: true
tags:
- { name: chill.role }
- { name: security.voter }

View File

@@ -0,0 +1,6 @@
services:
Chill\BudgetBundle\Service\:
resource: './../Service'
autowire: true
autoconfigure: true

View File

@@ -1,7 +1,7 @@
services:
Chill\AMLI\BudgetBundle\Templating\Twig:
Chill\BudgetBundle\Templating\Twig:
arguments:
$configRepository: '@Chill\AMLI\BudgetBundle\Config\ConfigRepository'
$configRepository: '@Chill\BudgetBundle\Config\ConfigRepository'
$translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper'
tags:
- { name: 'twig.extension' }

View File

@@ -9,29 +9,29 @@
declare(strict_types=1);
namespace Application\Migrations;
namespace Chill\Migrations\Budget;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* create schema for chill budget.
*/
final class Version20180522080432 extends AbstractMigration
{
public function down(Schema $schema)
public function down(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE SCHEMA chill_budget CASCADE');
$this->addSql('DROP SCHEMA chill_budget CASCADE');
}
public function up(Schema $schema)
public function getDescription(): string
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
return 'Creation of necessary tables for budget bundle';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE SCHEMA chill_budget');
$this->addSql('DROP SEQUENCE report_id_seq CASCADE');
$this->addSql('CREATE SEQUENCE chill_budget.resource_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE chill_budget.charge_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE chill_budget.resource (id INT NOT NULL, person_id INT DEFAULT NULL, type VARCHAR(255) NOT NULL, amount NUMERIC(10, 2) NOT NULL, comment TEXT DEFAULT NULL, startDate TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, endDate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');

View File

@@ -9,7 +9,7 @@
declare(strict_types=1);
namespace Application\Migrations;
namespace Chill\Migrations\Budget;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
@@ -21,15 +21,11 @@ final class Version20181219145631 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE chill_budget.charge ALTER help SET NOT NULL');
}
public function up(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE chill_budget.charge ALTER help DROP NOT NULL');
}
}

View File

@@ -0,0 +1,44 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\Migrations\Budget;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220224090319 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_budget.charge DROP CONSTRAINT FK_5C99D2C3E79FF843');
$this->addSql('ALTER TABLE chill_budget.charge DROP household_id');
$this->addSql('ALTER TABLE chill_budget.resource DROP CONSTRAINT FK_5E0A5E97E79FF843');
$this->addSql('ALTER TABLE chill_budget.resource DROP household_id');
}
public function getDescription(): string
{
return 'Add household to budget AbstractElement';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_budget.charge ADD household_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE chill_budget.charge ADD CONSTRAINT FK_5C99D2C3E79FF843 FOREIGN KEY (household_id) REFERENCES chill_person_household (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_5C99D2C3E79FF843 ON chill_budget.charge (household_id)');
$this->addSql('ALTER TABLE chill_budget.resource ADD household_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE chill_budget.resource ADD CONSTRAINT FK_5E0A5E97E79FF843 FOREIGN KEY (household_id) REFERENCES chill_person_household (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_5E0A5E97E79FF843 ON chill_budget.resource (household_id)');
}
}

View File

@@ -0,0 +1,8 @@
budget:
number of elements: >-
{nb_items, plural,
=0 {Aucun élément}
one {Un élément}
many {# éléments}
other {# éléments}
}

View File

@@ -1,12 +1,24 @@
Budget: Budget
Resource: Ressource
Charge: Charge
Budget for %name%: Budget de %name%
Budget for household %household%: Budget du ménage
Current budget household members: Budget actuel des membres du ménage
Show budget of %name%: Montrer budget de %name%
See complete budget: Voir budget complet
Hide budget: Masquer
Hide budget of %name%: Masquer budget de %name%
Resource element type: Nature de la ressource
Actual budget: Budget actuel
Actual budget: Éléments actuels du budget
Actual resources: Ressources actuelles
Actual resources for %name%: Ressources actuelles de %name%
Actual charges for %name%: Charges actuelles de %name%
Actual charges: Charges actuelles
Past budget: Éléments du budget passé
Show past budget: Montrer budget passé
Show future budget: Montrer budget future
Past resources: Ressources passées
Past charges: Chargées passées
Past charges: Charges passées
Future budget: Futurs éléments du budget
Future resources: Ressources futures
Future charges: Charges futures
@@ -17,6 +29,7 @@ End of validity period: Fin de la période de validité
Total: Total
Create new resource: Créer une nouvelle ressource
Create new charge: Créer une nouvelle charge
See person: Voir personne
There isn't any element recorded: Aucun élément enregistré
No resources registered: Aucune ressource enregistrée
@@ -25,11 +38,13 @@ No past resources registered: Aucune ressource passée
No past charges registered: Aucune charge passée
No future resources registered: Aucune ressource future enregistrée
No future charges registered: Aucune ressource future enregistrée
No current budget element registered: Pas des éléments de budget actuelles enregistrés
New Resource for %name%: Nouvelle ressource pour %name%
New Charge for %name%: Nouvelle charge pour %name%
Edit Resource for %name%: Modifier une ressource de %name%
Edit Charge for %name%: Modifier une charge de %name%
New resource: Nouvelle ressource
New charge: Nouvelle charge
Edit resource: Modifier une ressource
Edit: Modifier
Edit charge: Modifier une charge
Remove resource: Supprimer la ressource
Remove charge: Supprimer la charge
Are you sure you want to remove the ressource "%type%" associated to "%name%" ?: Êtes-vous sûr·e de vouloir supprimer la ressource de nature "%type%" associée à %name% ?
@@ -54,7 +69,8 @@ charge.help.yes: Oui
charge.help.not-concerned: Non concerné
Budget calculator: Calculs et indices sur le budget
Budget calculator result: Résultats
Budget calculator result: Résultats
The balance: Différence entre ressources et charges
'Valid since %startDate% until %endDate%': Valide depuis le %startDate% jusqu'au %endDate%
'Valid since %startDate%': Valide depuis le %startDate%
Valid since %startDate% until %endDate%: Valide depuis le %startDate% jusqu'au %endDate%
Valid since %startDate%: Valide depuis le %startDate%

View File

@@ -41,12 +41,14 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
$period = $parameters['accompanyingCourse'];
if (AccompanyingPeriod::STEP_DRAFT !== $period->getStep()) {
/*
$menu->addChild($this->translator->trans('Calendar'), [
'route' => 'chill_calendar_calendar_list',
'routeParameters' => [
'accompanying_period_id' => $period->getId(),
], ])
->setExtras(['order' => 35]);
*/
}
}

View File

@@ -25,7 +25,7 @@
{% endblock %}
{% block layout_wvm_content %}
{% block admin_content %}<!-- block personcontent empty -->
{% block admin_content %}<!-- block content empty -->
<h1>{{ 'CustomFields configuration' |trans }}</h1>
{% endblock %}
{% endblock %}

View File

@@ -14,7 +14,7 @@ namespace Chill\DocGeneratorBundle\Context;
use Chill\DocGeneratorBundle\Context\Exception\ContextNotFoundException;
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
class ContextManager
final class ContextManager implements ContextManagerInterface
{
/**
* @var DocGeneratorContextInterface[]|iterable
@@ -26,9 +26,6 @@ class ContextManager
$this->contexts = $contexts;
}
/**
* @throw ContextNotFoundException when the context is not found
*/
public function getContextByDocGeneratorTemplate(DocGeneratorTemplate $docGeneratorTemplate): DocGeneratorContextInterface
{
foreach ($this->contexts as $key => $context) {

View File

@@ -0,0 +1,30 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\DocGeneratorBundle\Context;
use Chill\DocGeneratorBundle\Context\Exception\ContextNotFoundException;
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
interface ContextManagerInterface
{
/**
* @throws ContextNotFoundException When the context is not found.
*/
public function getContextByDocGeneratorTemplate(DocGeneratorTemplate $docGeneratorTemplate): DocGeneratorContextInterface;
/**
* @throws ContextNotFoundException When the context is not found.
*/
public function getContextByKey(string $searchedKey): DocGeneratorContextInterface;
public function getContexts(): array;
}

View File

@@ -11,8 +11,6 @@ declare(strict_types=1);
namespace Chill\DocGeneratorBundle\Controller;
use Base64Url\Base64Url;
use ChampsLibres\AsyncUploaderBundle\TempUrl\TempUrlGeneratorInterface;
use Chill\DocGeneratorBundle\Context\ContextManager;
use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithPublicFormInterface;
use Chill\DocGeneratorBundle\Context\Exception\ContextNotFoundException;
@@ -21,27 +19,28 @@ use Chill\DocGeneratorBundle\GeneratorDriver\DriverInterface;
use Chill\DocGeneratorBundle\GeneratorDriver\Exception\TemplateException;
use Chill\DocGeneratorBundle\Repository\DocGeneratorTemplateRepository;
use Chill\DocStoreBundle\Entity\StoredObject;
use Chill\DocStoreBundle\Service\StoredObjectManagerInterface;
use Chill\MainBundle\Pagination\PaginatorFactory;
use Chill\MainBundle\Serializer\Model\Collection;
use Doctrine\ORM\EntityManagerInterface;
use Exception;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\TransferException;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
// TODO à mettre dans services
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Throwable;
use function strlen;
final class DocGeneratorTemplateController extends AbstractController
{
@@ -53,13 +52,13 @@ final class DocGeneratorTemplateController extends AbstractController
private DriverInterface $driver;
private KernelInterface $kernel;
private EntityManagerInterface $entityManager;
private LoggerInterface $logger;
private PaginatorFactory $paginatorFactory;
private TempUrlGeneratorInterface $tempUrlGenerator;
private StoredObjectManagerInterface $storedObjectManager;
public function __construct(
ContextManager $contextManager,
@@ -67,18 +66,18 @@ final class DocGeneratorTemplateController extends AbstractController
DriverInterface $driver,
LoggerInterface $logger,
PaginatorFactory $paginatorFactory,
TempUrlGeneratorInterface $tempUrlGenerator,
KernelInterface $kernel,
HttpClientInterface $client
HttpClientInterface $client,
StoredObjectManagerInterface $storedObjectManager,
EntityManagerInterface $entityManager
) {
$this->contextManager = $contextManager;
$this->docGeneratorTemplateRepository = $docGeneratorTemplateRepository;
$this->driver = $driver;
$this->logger = $logger;
$this->paginatorFactory = $paginatorFactory;
$this->tempUrlGenerator = $tempUrlGenerator;
$this->kernel = $kernel;
$this->client = $client;
$this->storedObjectManager = $storedObjectManager;
$this->entityManager = $entityManager;
}
/**
@@ -177,8 +176,10 @@ final class DocGeneratorTemplateController extends AbstractController
return $this->redirectToRoute(
'chill_docgenerator_test_generate_from_template',
['template' => $template, 'entityClassName' => $entityClassName, 'entityId' => $entityId,
'returnPath' => $request->query->get('returnPath', '/'), ]
[
'template' => $template, 'entityClassName' => $entityClassName, 'entityId' => $entityId,
'returnPath' => $request->query->get('returnPath', '/'),
]
);
}
@@ -192,16 +193,26 @@ final class DocGeneratorTemplateController extends AbstractController
try {
$context = $this->contextManager->getContextByDocGeneratorTemplate($template);
} catch (ContextNotFoundException $e) {
throw new NotFoundHttpException($e->getMessage(), $e);
throw new NotFoundHttpException(
'Context not found.',
$e
);
}
$entity = $this->getDoctrine()->getRepository($context->getEntityClass())->find($entityId);
$entity = $this
->entityManager
->getRepository($context->getEntityClass())
->find($entityId);
if (null === $entity) {
throw new NotFoundHttpException("Entity with classname {$entityClassName} and id {$entityId} is not found");
throw new NotFoundHttpException(
sprintf('Entity with classname %s and id %s is not found', $entityClassName, $entityId)
);
}
$contextGenerationData = [];
$contextGenerationData = [
'test_file' => null,
];
if (
$context instanceof DocGeneratorContextWithPublicFormInterface
@@ -211,14 +222,14 @@ final class DocGeneratorTemplateController extends AbstractController
$builder = $this->createFormBuilder(
array_merge(
$context->getFormData($template, $entity),
$isTest ? ['test_file' => null] : []
$isTest ? ['test_file' => null, 'show_data' => false] : []
)
);
$context->buildPublicForm($builder, $template, $entity);
} else {
$builder = $this->createFormBuilder(
['test_file' => null]
['test_file' => null, 'show_data' => false]
);
}
@@ -227,6 +238,10 @@ final class DocGeneratorTemplateController extends AbstractController
'label' => 'Template file',
'required' => false,
]);
$builder->add('show_data', CheckboxType::class, [
'label' => 'Show data instead of generating',
'required' => false,
]);
}
$form = $builder->getForm()->handleRequest($request);
@@ -235,123 +250,114 @@ final class DocGeneratorTemplateController extends AbstractController
$contextGenerationData = $form->getData();
} elseif (!$form->isSubmitted() || ($form->isSubmitted() && !$form->isValid())) {
$templatePath = '@ChillDocGenerator/Generator/basic_form.html.twig';
$templateOptions = ['entity' => $entity, 'form' => $form->createView(),
'template' => $template, 'context' => $context, ];
$templateOptions = [
'entity' => $entity, 'form' => $form->createView(),
'template' => $template, 'context' => $context,
];
return $this->render($templatePath, $templateOptions);
}
}
if ($isTest && null !== $contextGenerationData['test_file']) {
/** @var File $file */
$file = $contextGenerationData['test_file'];
$templateResource = fopen($file->getPathname(), 'rb');
$document = $template->getFile();
if ($isTest && ($contextGenerationData['test_file'] instanceof File)) {
$dataDecrypted = file_get_contents($contextGenerationData['test_file']->getPathname());
} else {
$getUrlGen = $this->tempUrlGenerator->generate(
'GET',
$template->getFile()->getFilename()
);
$data = $this->client->request('GET', $getUrlGen->url);
$iv = $template->getFile()->getIv(); // iv as an Array
$ivGoodFormat = pack('C*', ...$iv); // iv as a String (ok for openssl_decrypt)
$method = 'AES-256-CBC';
$key = $template->getFile()->getKeyInfos()['k'];
$keyGoodFormat = Base64Url::decode($key);
$dataDecrypted = openssl_decrypt($data->getContent(), $method, $keyGoodFormat, 1, $ivGoodFormat);
if (false === $dataDecrypted) {
throw new Exception('Error during Decrypt ', 1);
try {
$dataDecrypted = $this->storedObjectManager->read($document);
} catch (Throwable $exception) {
throw $exception;
}
if (false === $templateResource = fopen('php://memory', 'r+b')) {
$this->logger->error('Could not write data to memory');
throw new HttpException(500);
}
fwrite($templateResource, $dataDecrypted);
rewind($templateResource);
}
$datas = $context->getData($template, $entity, $contextGenerationData);
if ($isTest && isset($form) && $form['show_data']->getData()) {
// very ugly hack...
dd($context->getData($template, $entity, $contextGenerationData));
}
try {
$generatedResource = $this->driver->generateFromResource($templateResource, $template->getFile()->getType(), $datas, $template->getFile()->getFilename());
$generatedResource = $this
->driver
->generateFromString(
$dataDecrypted,
$template->getFile()->getType(),
$context->getData($template, $entity, $contextGenerationData),
$template->getFile()->getFilename()
);
} catch (TemplateException $e) {
$msg = implode("\n", $e->getErrors());
return new Response($msg, 400, [
'Content-Type' => 'text/plain',
]);
return new Response(
implode("\n", $e->getErrors()),
400,
[
'Content-Type' => 'text/plain',
]
);
}
fclose($templateResource);
if ($isTest) {
return new StreamedResponse(
static function () use ($generatedResource) {
fpassthru($generatedResource);
fclose($generatedResource);
},
return new Response(
$generatedResource,
Response::HTTP_OK,
[
'Content-Transfer-Encoding', 'binary',
'Content-Type' => 'application/vnd.oasis.opendocument.text',
'Content-Disposition' => sprintf('attachment; filename="%s.odt"', 'generated'),
'Content-Length' => fstat($generatedResource)['size'],
'Content-Disposition' => 'attachment; filename="generated.odt"',
'Content-Length' => strlen($generatedResource),
],
);
}
$genDocName = 'doc_' . sprintf('%010d', mt_rand()) . 'odt';
$getUrlGen = $this->tempUrlGenerator->generate(
'PUT',
$genDocName
);
$client = new Client();
/** @var StoredObject $storedObject */
$storedObject = (new ObjectNormalizer())
->denormalize(
[
'type' => $template->getFile()->getType(),
'filename' => sprintf('%s_odt', uniqid('doc_', true)),
],
StoredObject::class
);
try {
$putResponse = $client->request('PUT', $getUrlGen->url, [
'body' => $generatedResource,
]);
$this->storedObjectManager->write($storedObject, $generatedResource);
} catch (Throwable $exception) {
throw $exception;
}
if ($putResponse->getStatusCode() === 201) {
$em = $this->getDoctrine()->getManager();
$storedObject = new StoredObject();
$storedObject
->setType($template->getFile()->getType())
->setFilename($genDocName);
$this->entityManager->persist($storedObject);
$em->persist($storedObject);
try {
$context->storeGenerated($template, $storedObject, $entity, $contextGenerationData);
} catch (Exception $e) {
$this->logger->error('Could not store the associated document to entity', [
try {
$context
->storeGenerated(
$template,
$storedObject,
$entity,
$contextGenerationData
);
} catch (Exception $e) {
$this
->logger
->error(
'Unable to store the associated document to entity',
[
'entityClassName' => $entityClassName,
'entityId' => $entityId,
'contextKey' => $context->getName(),
]);
]
);
throw $e;
}
$em->flush();
return $this->redirectToRoute('chill_wopi_file_edit', [
'fileId' => $storedObject->getUuid(),
'returnPath' => $request->query->get('returnPath', '/'),
]);
}
} catch (TransferException $e) {
throw $e;
}
throw new Exception('Unable to generate document.');
$this->entityManager->flush();
return $this
->redirectToRoute(
'chill_wopi_file_edit',
[
'fileId' => $storedObject->getUuid(),
'returnPath' => $request->query->get('returnPath', '/'),
]
);
}
}

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