mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-28 17:44:58 +00:00
Compare commits
1 Commits
issue443_l
...
issue385_c
Author | SHA1 | Date | |
---|---|---|---|
6bb39bc4e0 |
64
.env
Normal file
64
.env
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
##
|
||||||
|
## Manually dump .env files in .env.local.php with
|
||||||
|
## `$ composer symfony:dump-env prod`
|
||||||
|
##
|
||||||
|
|
||||||
|
## Project environment
|
||||||
|
APP_ENV=dev
|
||||||
|
|
||||||
|
## Enable debug
|
||||||
|
APP_DEBUG=true
|
||||||
|
|
||||||
|
## Locale
|
||||||
|
LOCALE=fr
|
||||||
|
|
||||||
|
## Framework secret
|
||||||
|
APP_SECRET=ThisTokenIsNotSoSecretChangeIt
|
||||||
|
|
||||||
|
## Symfony/swiftmailer
|
||||||
|
MAILER_TRANSPORT=smtp
|
||||||
|
MAILER_HOST=smtp
|
||||||
|
MAILER_PORT=1025
|
||||||
|
MAILER_CRYPT=
|
||||||
|
MAILER_AUTH=
|
||||||
|
MAILER_USER=
|
||||||
|
MAILER_PASSWORD=
|
||||||
|
MAILER_URL=${MAILER_TRANSPORT}://${MAILER_HOST}:${MAILER_PORT}?encryption=${MAILER_CRYPT}&auth_mode=${MAILER_AUTH}&username=${MAILER_USER}&password=${MAILER_PASSWORD}
|
||||||
|
|
||||||
|
## Notifications
|
||||||
|
NOTIFICATION_HOST=localhost:8001
|
||||||
|
NOTIFICATION_FROM_EMAIL=admin@chill.social
|
||||||
|
NOTIFICATION_FROM_NAME=Chill
|
||||||
|
|
||||||
|
## Gelf
|
||||||
|
GELF_HOST=gelf
|
||||||
|
GELF_PORT=12201
|
||||||
|
|
||||||
|
## OVH OpenStack Storage User/Role
|
||||||
|
OS_USERNAME=
|
||||||
|
OS_PASSWORD=
|
||||||
|
OS_TENANT_ID=
|
||||||
|
OS_REGION_NAME=GRA
|
||||||
|
OS_AUTH_URL=https://auth.cloud.ovh.net/v2.0/
|
||||||
|
|
||||||
|
## OVH OpenStack Storage Container
|
||||||
|
ASYNC_UPLOAD_TEMP_URL_KEY=
|
||||||
|
ASYNC_UPLOAD_TEMP_URL_BASE_PATH=
|
||||||
|
ASYNC_UPLOAD_TEMP_URL_CONTAINER=
|
||||||
|
|
||||||
|
## Redis Cache
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_URL=redis://${REDIS_HOST}:${REDIS_PORT}
|
||||||
|
|
||||||
|
## Twilio
|
||||||
|
TWILIO_SID=~
|
||||||
|
TWILIO_SECRET=~
|
||||||
|
|
||||||
|
## DOCKER IMAGES REGISTRY
|
||||||
|
#IMAGE_PHP=
|
||||||
|
#IMAGE_NGINX=
|
||||||
|
|
||||||
|
## DOCKER IMAGES VERSION
|
||||||
|
#VERSION=test
|
||||||
|
VERSION=prod
|
105
CHANGELOG.md
105
CHANGELOG.md
@@ -11,114 +11,17 @@ and this project adheres to
|
|||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
<!-- write down unreleased development here -->
|
<!-- write down unreleased development here -->
|
||||||
|
* [person] name suggestions within create person form when person is created departing from a search input (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/377)
|
||||||
|
* [parcours]: bug fix when comment is pinned all other comments remain in the collection (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/385)
|
||||||
|
|
||||||
## Test releases
|
## Test releases
|
||||||
|
|
||||||
### test release 2022-02-14
|
|
||||||
|
|
||||||
* AddPersons: remove ul-li html tags from AddPersons (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/419)
|
|
||||||
* [doc-generator] do not set required fields for mainPerson, person1, person2 (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement#456)
|
|
||||||
* [doc-generation] add age and obele in the mainPerson, person1 and person2 list + add obele in person renderString if addAge (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/370)
|
|
||||||
* [person] accompanying course work: fix on-the-fly update of thirdParty
|
|
||||||
* fix normalisation of accompanying course requestor api (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/378)
|
|
||||||
* [person] add a returnPath when clicking on some Person or ThirdParty badge (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/427)
|
|
||||||
* [person] accompanying course work: fix on-the-fly update of thirdParty
|
|
||||||
* [on-the-fly] close modal only after validation
|
|
||||||
* [person] correct thirdparty PATCH url + add email and altnames in AddPerson and serializer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/433)
|
|
||||||
* change order for accompanying course work list
|
|
||||||
* [parcours]: Mes parcours brouillon added to user menu (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/440)
|
|
||||||
* [Documents]: List view adapted to display more information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/414)
|
|
||||||
* [person]: style fix in parcours listing per person. (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/432)
|
|
||||||
* [household]: display address of current household (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/415)
|
|
||||||
* ajoute un ordre dans les localisation (api)
|
|
||||||
* [pick entity]: fix translations in modal (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/419)
|
|
||||||
* [homepage_widget]: fix translation on emergency badge (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/440)
|
|
||||||
* [person]: create person and household added to button dropdown (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/454)
|
|
||||||
* display full address in address.text in normalization. Adapt AddressRenderBox
|
|
||||||
* [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)
|
|
||||||
* [homepage_widget]: If no sender then display as 'notification automatique' (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/435)
|
|
||||||
|
|
||||||
### test release 2021-02-01
|
|
||||||
|
|
||||||
* renommer "dossier numéro" en "parcours numéro" dans les résultats de recherche
|
|
||||||
* renomme date de début en date d'ouverture dans le formulaire parcours
|
|
||||||
* [homepage widget] improve content tables, improve counter pluralization with style on number
|
|
||||||
* [notification lists] add comments counter information
|
|
||||||
* [workflows] fix popover header with previous transition
|
|
||||||
* [parcours]: validation + message for closing parcours adjusted.
|
|
||||||
* [household]: household composition double edit button replaced by a delete action (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/426)
|
|
||||||
[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.
|
|
||||||
* [person]: Comment on marital status is possible even if marital status is not defined (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/421)
|
|
||||||
* [parcours]: In the list of person results the requestor is not displayed if defined as anonymous (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/424)
|
|
||||||
* [bugfix]: modal closes and newly created person/thirdparty is selected when multiple persons/thirdparties are created through the modal (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/429)
|
|
||||||
* [person_resource]: Onthefly button added to view person/thirdparty and badge differentiation for a contact-thirdparty (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/428)
|
|
||||||
* [workflow][notification] improve how notifications and workflows are 'attached' to entities: contextual list, counter, buttons and vue modal
|
|
||||||
* [AddAddress] disable multiselect search, and rely only on most pertinent Cities and Street computed backend
|
|
||||||
* [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.
|
|
||||||
|
|
||||||
### 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)
|
|
||||||
* [person] accompanying course: close modal when edit participation (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/420)
|
|
||||||
* [person] accompanying course: treat validation error when editing on-the-fly entities (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/420)
|
|
||||||
* [activity] show activity attendee (présence) in the activity list (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/412)
|
|
||||||
* [activity] admin: change validation rule for social action visible field (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/413)
|
|
||||||
* [parcours]: component added to change the opening date of a parcours (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/411)
|
|
||||||
* [search]: listing of parcours display changed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/410)
|
|
||||||
* [user]: page with accompanying periods to which is user is referent (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/408)
|
|
||||||
* [person] age added to renderstring + renderbox/ vue component created to display person text (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/389)
|
|
||||||
* [household member editor] allow to push to existing household
|
|
||||||
|
|
||||||
|
|
||||||
### test release 2021-01-28
|
|
||||||
|
|
||||||
* [person] improve filiations vis graph: disable physics, use chill colors for persons-households-course, increase label of relations, remove labels on household arrows and other improvements (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/286, https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/362)
|
|
||||||
* [activity] Order activity by date and by id (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/364)
|
|
||||||
* [main] increase length of 4 Address fields (change to TEXT, no size limits) (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/277)
|
|
||||||
* [main] Add confidential option for address, in edit and view (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/165)
|
|
||||||
* [person] name suggestions within create person form when person is created departing from a search input (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/377)
|
|
||||||
* [person] Add residential address entity, form and list for each person
|
|
||||||
* [aside_activity]: dynamicUserPickerType used (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/399)
|
|
||||||
* dispatching list
|
|
||||||
|
|
||||||
|
|
||||||
### test release 2021-01-26
|
|
||||||
|
|
||||||
* [parcours] comments truncated if too long + link added (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/406)
|
|
||||||
* [person]: possibility to add person resources (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/382)
|
|
||||||
* [person ressources]: module added
|
|
||||||
|
|
||||||
|
|
||||||
### test release 2022-01-24
|
|
||||||
|
|
||||||
* [person] name suggestions within create person form when person is created departing from a search input (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/377)
|
|
||||||
* [notification: formulaire création] descend la box avec la description dans le bas du formulaire
|
|
||||||
* [notification for activity]: fix link to activity
|
|
||||||
* [notification] add "URGENT" before accompanying course with emergency = true
|
|
||||||
* [notification] add a "read more" button on system notification
|
|
||||||
* [notification] add `[Chill]` in the subject of each notification, automatically
|
|
||||||
* [notification] add a counter for notification in activity list and accompanying period list, and search results
|
|
||||||
* [parcours] bugfix if deathdate is not defined (eg. for a thirdparty) parcours is still displayed. Gave error before.
|
|
||||||
* [workflow] add breadcrumb to show steps
|
|
||||||
* [popover] add popover html popup mechanism (used by workflow breadcrumb)
|
|
||||||
* [templates] improve updatedBy macro in item metadatas
|
|
||||||
* [parcours]: bug fix when comment is pinned all other comments remain in the collection (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/385)
|
|
||||||
* [workflow]
|
|
||||||
* add My workflow section with my opened subscriptions
|
|
||||||
* apply workflow on documents, accompanyingCourseWork and Evaluations
|
|
||||||
* [wopi-link] a new vue component allow to open wopi link in a fullscreen chill-themed modal
|
|
||||||
|
|
||||||
### test release 2022-01-19
|
### test release 2022-01-19
|
||||||
* vuejs: add dead information on all on-the-fly person render boxes, in vis graph and other templates (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/271)
|
* vuejs: add dead information on all on-the-fly person render boxes, in vis graph and other templates (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/271)
|
||||||
* [thirdparty] fix bug in 3rd party view: types was replaced by thirdPartyTypes
|
* [thirdparty] fix bug in 3rd party view: types was replaced by thirdPartyTypes
|
||||||
* [main] location form type: fix unmapped address field (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/246)
|
* [main] location form type: fix unmapped address field (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/246)
|
||||||
* [activity] fix wrong import of js assets for adding and viewing documents in activity (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/83 & https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/176)
|
* [activity] fix wrong import of js assets for adding and viewing documents in activity (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/83 & https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/176)
|
||||||
* [person]: space added between deathdate and age in twig renderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/380)
|
* [person]: space added between deathdate and age in twig renderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/380)
|
||||||
* [forms] dynamic picker types for user/person/thirdparty types created (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/386)
|
|
||||||
|
|
||||||
### test release 2022-01-17
|
### test release 2022-01-17
|
||||||
|
|
||||||
@@ -128,14 +31,10 @@ and this project adheres to
|
|||||||
* [main] Add mainLocation field to User entity and add it in user form type
|
* [main] Add mainLocation field to User entity and add it in user form type
|
||||||
* [course list in person context] show full username/label for ref
|
* [course list in person context] show full username/label for ref
|
||||||
* [accompanying period work] remove the possibility to generate document from an accompanying period work
|
* [accompanying period work] remove the possibility to generate document from an accompanying period work
|
||||||
* vuejs: add validation on required fields for AddPerson, Address and Location components
|
|
||||||
* vuejs: treat 422 validation errors in locations and AddPerson components
|
|
||||||
* [person]: space added between deathdate and age in twig renderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/380)
|
|
||||||
|
|
||||||
## Test releases
|
## Test releases
|
||||||
* vuejs: add validation on required fields for AddPerson, Address and Location components
|
* vuejs: add validation on required fields for AddPerson, Address and Location components
|
||||||
* vuejs: treat 422 validation errors in locations and AddPerson components
|
* vuejs: treat 422 validation errors in locations and AddPerson components
|
||||||
* [person]: space added between deathdate and age in twig renderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/380)
|
|
||||||
|
|
||||||
### test release 2022-01-12
|
### test release 2022-01-12
|
||||||
|
|
||||||
|
@@ -52,6 +52,9 @@
|
|||||||
"twig/string-extra": "^3.3",
|
"twig/string-extra": "^3.3",
|
||||||
"twig/twig": "^3.0"
|
"twig/twig": "^3.0"
|
||||||
},
|
},
|
||||||
|
"conflict": {
|
||||||
|
"symfony/symfony": "*"
|
||||||
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"doctrine/doctrine-fixtures-bundle": "^3.3",
|
"doctrine/doctrine-fixtures-bundle": "^3.3",
|
||||||
"drupol/php-conventions": "^5",
|
"drupol/php-conventions": "^5",
|
||||||
@@ -68,17 +71,23 @@
|
|||||||
"symfony/var-dumper": "^4.4",
|
"symfony/var-dumper": "^4.4",
|
||||||
"symfony/web-profiler-bundle": "^4.4"
|
"symfony/web-profiler-bundle": "^4.4"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"config": {
|
||||||
"symfony/symfony": "*"
|
"bin-dir": "bin",
|
||||||
|
"optimize-autoloader": true,
|
||||||
|
"sort-packages": true,
|
||||||
|
"vendor-dir": "tests/app/vendor",
|
||||||
|
"allow-plugins": {
|
||||||
|
"composer/package-versions-deprecated": true,
|
||||||
|
"phpstan/extension-installer": true,
|
||||||
|
"ergebnis/composer-normalize": true,
|
||||||
|
"phpro/grumphp": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Chill\\ActivityBundle\\": "src/Bundle/ChillActivityBundle",
|
"Chill\\ActivityBundle\\": "src/Bundle/ChillActivityBundle",
|
||||||
"Chill\\AsideActivityBundle\\": "src/Bundle/ChillAsideActivityBundle/src",
|
|
||||||
"Chill\\BudgetBundle\\": "src/Bundle/ChillBudgetBundle",
|
"Chill\\BudgetBundle\\": "src/Bundle/ChillBudgetBundle",
|
||||||
"Chill\\CalendarBundle\\": "src/Bundle/ChillCalendarBundle",
|
|
||||||
"Chill\\CustomFieldsBundle\\": "src/Bundle/ChillCustomFieldsBundle",
|
"Chill\\CustomFieldsBundle\\": "src/Bundle/ChillCustomFieldsBundle",
|
||||||
"Chill\\DocGeneratorBundle\\": "src/Bundle/ChillDocGeneratorBundle",
|
|
||||||
"Chill\\DocStoreBundle\\": "src/Bundle/ChillDocStoreBundle",
|
"Chill\\DocStoreBundle\\": "src/Bundle/ChillDocStoreBundle",
|
||||||
"Chill\\EventBundle\\": "src/Bundle/ChillEventBundle",
|
"Chill\\EventBundle\\": "src/Bundle/ChillEventBundle",
|
||||||
"Chill\\FamilyMemberBundle\\": "src/Bundle/ChillFamilyMemberBundle",
|
"Chill\\FamilyMemberBundle\\": "src/Bundle/ChillFamilyMemberBundle",
|
||||||
@@ -87,6 +96,9 @@
|
|||||||
"Chill\\ReportBundle\\": "src/Bundle/ChillReportBundle",
|
"Chill\\ReportBundle\\": "src/Bundle/ChillReportBundle",
|
||||||
"Chill\\TaskBundle\\": "src/Bundle/ChillTaskBundle",
|
"Chill\\TaskBundle\\": "src/Bundle/ChillTaskBundle",
|
||||||
"Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle",
|
"Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle",
|
||||||
|
"Chill\\AsideActivityBundle\\": "src/Bundle/ChillAsideActivityBundle/src",
|
||||||
|
"Chill\\DocGeneratorBundle\\": "src/Bundle/ChillDocGeneratorBundle",
|
||||||
|
"Chill\\CalendarBundle\\": "src/Bundle/ChillCalendarBundle",
|
||||||
"Chill\\WopiBundle\\": "src/Bundle/ChillWopiBundle/src"
|
"Chill\\WopiBundle\\": "src/Bundle/ChillWopiBundle/src"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -99,10 +111,10 @@
|
|||||||
"config": {
|
"config": {
|
||||||
"allow-plugins": {
|
"allow-plugins": {
|
||||||
"composer/package-versions-deprecated": true,
|
"composer/package-versions-deprecated": true,
|
||||||
|
"phpstan/extension-installer": true,
|
||||||
"ergebnis/composer-normalize": true,
|
"ergebnis/composer-normalize": true,
|
||||||
"ocramius/package-versions": true,
|
|
||||||
"phpro/grumphp": true,
|
"phpro/grumphp": true,
|
||||||
"phpstan/extension-installer": true
|
"ocramius/package-versions": true
|
||||||
},
|
},
|
||||||
"bin-dir": "bin",
|
"bin-dir": "bin",
|
||||||
"optimize-autoloader": true,
|
"optimize-autoloader": true,
|
||||||
@@ -111,8 +123,8 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"auto-scripts": {
|
"auto-scripts": {
|
||||||
"assets:install %PUBLIC_DIR%": "symfony-cmd",
|
"cache:clear": "symfony-cmd",
|
||||||
"cache:clear": "symfony-cmd"
|
"assets:install %PUBLIC_DIR%": "symfony-cmd"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3
package.json.txt
Normal file
3
package.json.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
add npm/yarn dependency in package.json :
|
||||||
|
|
||||||
|
"select2-bootstrap-theme": "0.1.0-beta.10",
|
@@ -80,6 +80,11 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php
|
path: src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Foreach overwrites \\$action with its value variable\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Foreach overwrites \\$action with its value variable\\.$#"
|
message: "#^Foreach overwrites \\$action with its value variable\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@@ -30,6 +30,36 @@ parameters:
|
|||||||
count: 2
|
count: 2
|
||||||
path: src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php
|
path: src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Parameter \\$action of method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\AccompanyingPeriodWorkRepository\\:\\:buildQueryBySocialActionWithDescendants\\(\\) has invalid type Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\SocialAction\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Parameter \\$action of method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\AccompanyingPeriodWorkRepository\\:\\:countBySocialActionWithDescendants\\(\\) has invalid type Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\SocialAction\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Undefined variable\\: \\$action$#"
|
||||||
|
count: 1
|
||||||
|
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Undefined variable\\: \\$limit$#"
|
||||||
|
count: 1
|
||||||
|
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Undefined variable\\: \\$offset$#"
|
||||||
|
count: 1
|
||||||
|
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Undefined variable\\: \\$orderBy$#"
|
||||||
|
count: 1
|
||||||
|
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Variable variables are not allowed\\.$#"
|
message: "#^Variable variables are not allowed\\.$#"
|
||||||
count: 4
|
count: 4
|
||||||
|
@@ -408,6 +408,24 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php
|
path: src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message:
|
||||||
|
"""
|
||||||
|
#^Call to deprecated method getReachableScopes\\(\\) of class Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AuthorizationHelper\\:
|
||||||
|
Use getReachableCircles$#
|
||||||
|
"""
|
||||||
|
count: 1
|
||||||
|
path: src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message:
|
||||||
|
"""
|
||||||
|
#^Parameter \\$translator of method Chill\\\\DocStoreBundle\\\\Controller\\\\DocumentPersonController\\:\\:__construct\\(\\) has typehint with deprecated interface Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\:
|
||||||
|
since Symfony 4\\.2, use Symfony\\\\Contracts\\\\Translation\\\\TranslatorInterface instead$#
|
||||||
|
"""
|
||||||
|
count: 1
|
||||||
|
path: src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message:
|
message:
|
||||||
"""
|
"""
|
||||||
@@ -909,6 +927,15 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php
|
path: src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message:
|
||||||
|
"""
|
||||||
|
#^Parameter \\$trans of method Chill\\\\PersonBundle\\\\Controller\\\\AccompanyingCourseWorkController\\:\\:__construct\\(\\) has typehint with deprecated interface Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\:
|
||||||
|
since Symfony 4\\.2, use Symfony\\\\Contracts\\\\Translation\\\\TranslatorInterface instead$#
|
||||||
|
"""
|
||||||
|
count: 1
|
||||||
|
path: src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message:
|
message:
|
||||||
"""
|
"""
|
||||||
|
@@ -400,6 +400,11 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php
|
path: src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\AccompanyingPeriodWorkRepository\\:\\:buildQueryBySocialActionWithDescendants\\(\\) has invalid return type Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\QueryBuilder\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||||
count: 3
|
count: 3
|
||||||
|
@@ -31,17 +31,15 @@ use DateTime;
|
|||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use RuntimeException;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Security\Core\Role\Role;
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
|
|
||||||
use Symfony\Component\Serializer\SerializerInterface;
|
use Symfony\Component\Serializer\SerializerInterface;
|
||||||
|
|
||||||
use function array_key_exists;
|
use function array_key_exists;
|
||||||
|
|
||||||
final class ActivityController extends AbstractController
|
final class ActivityController extends AbstractController
|
||||||
@@ -201,36 +199,12 @@ final class ActivityController extends AbstractController
|
|||||||
'role' => new Role('CHILL_ACTIVITY_UPDATE'),
|
'role' => new Role('CHILL_ACTIVITY_UPDATE'),
|
||||||
'activityType' => $entity->getActivityType(),
|
'activityType' => $entity->getActivityType(),
|
||||||
'accompanyingPeriod' => $accompanyingPeriod,
|
'accompanyingPeriod' => $accompanyingPeriod,
|
||||||
]);
|
])->handleRequest($request);
|
||||||
|
|
||||||
if ($form->has('documents')) {
|
|
||||||
$form->add('gendocTemplateId', HiddenType::class, [
|
|
||||||
'mapped' => false,
|
|
||||||
'data' => null,
|
|
||||||
'attr' => [
|
|
||||||
// required for js
|
|
||||||
'data-template-id' => 'data-template-id',
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$form->handleRequest($request);
|
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$this->entityManager->persist($entity);
|
$this->entityManager->persist($entity);
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
|
|
||||||
if ($form->has('gendocTemplateId') && null !== $form['gendocTemplateId']->getData()) {
|
|
||||||
return $this->redirectToRoute(
|
|
||||||
'chill_docgenerator_generate_from_template',
|
|
||||||
[
|
|
||||||
'template' => $form->get('gendocTemplateId')->getData(),
|
|
||||||
'entityClassName' => Activity::class,
|
|
||||||
'entityId' => $entity->getId(),
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->addFlash('success', $this->get('translator')->trans('Success : activity updated!'));
|
$this->addFlash('success', $this->get('translator')->trans('Success : activity updated!'));
|
||||||
|
|
||||||
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
||||||
@@ -281,7 +255,7 @@ final class ActivityController extends AbstractController
|
|||||||
if ($person instanceof Person) {
|
if ($person instanceof Person) {
|
||||||
$this->denyAccessUnlessGranted(ActivityVoter::SEE, $person);
|
$this->denyAccessUnlessGranted(ActivityVoter::SEE, $person);
|
||||||
$activities = $this->activityACLAwareRepository
|
$activities = $this->activityACLAwareRepository
|
||||||
->findByPerson($person, ActivityVoter::SEE, 0, null, ['date' => 'DESC', 'id' => 'DESC']);
|
->findByPerson($person, ActivityVoter::SEE, 0, null);
|
||||||
|
|
||||||
$event = new PrivacyEvent($person, [
|
$event = new PrivacyEvent($person, [
|
||||||
'element_class' => Activity::class,
|
'element_class' => Activity::class,
|
||||||
@@ -294,7 +268,7 @@ final class ActivityController extends AbstractController
|
|||||||
$this->denyAccessUnlessGranted(ActivityVoter::SEE, $accompanyingPeriod);
|
$this->denyAccessUnlessGranted(ActivityVoter::SEE, $accompanyingPeriod);
|
||||||
|
|
||||||
$activities = $this->activityACLAwareRepository
|
$activities = $this->activityACLAwareRepository
|
||||||
->findByAccompanyingPeriod($accompanyingPeriod, ActivityVoter::SEE, 0, null, ['date' => 'DESC', 'id' => 'DESC']);
|
->findByAccompanyingPeriod($accompanyingPeriod, ActivityVoter::SEE);
|
||||||
|
|
||||||
$view = 'ChillActivityBundle:Activity:listAccompanyingCourse.html.twig';
|
$view = 'ChillActivityBundle:Activity:listAccompanyingCourse.html.twig';
|
||||||
}
|
}
|
||||||
@@ -418,36 +392,12 @@ final class ActivityController extends AbstractController
|
|||||||
'role' => new Role('CHILL_ACTIVITY_CREATE'),
|
'role' => new Role('CHILL_ACTIVITY_CREATE'),
|
||||||
'activityType' => $entity->getActivityType(),
|
'activityType' => $entity->getActivityType(),
|
||||||
'accompanyingPeriod' => $accompanyingPeriod,
|
'accompanyingPeriod' => $accompanyingPeriod,
|
||||||
]);
|
])->handleRequest($request);
|
||||||
|
|
||||||
if ($form->has('documents')) {
|
|
||||||
$form->add('gendocTemplateId', HiddenType::class, [
|
|
||||||
'mapped' => false,
|
|
||||||
'data' => null,
|
|
||||||
'attr' => [
|
|
||||||
// required for js
|
|
||||||
'data-template-id' => 'data-template-id',
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$form->handleRequest($request);
|
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$this->entityManager->persist($entity);
|
$this->entityManager->persist($entity);
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
|
|
||||||
if ($form->has('gendocTemplateId') && null !== $form['gendocTemplateId']->getData()) {
|
|
||||||
return $this->redirectToRoute(
|
|
||||||
'chill_docgenerator_generate_from_template',
|
|
||||||
[
|
|
||||||
'template' => $form->get('gendocTemplateId')->getData(),
|
|
||||||
'entityClassName' => Activity::class,
|
|
||||||
'entityId' => $entity->getId(),
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->addFlash('success', $this->get('translator')->trans('Success : activity created!'));
|
$this->addFlash('success', $this->get('translator')->trans('Success : activity created!'));
|
||||||
|
|
||||||
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
||||||
@@ -521,21 +471,20 @@ final class ActivityController extends AbstractController
|
|||||||
|
|
||||||
public function showAction(Request $request, int $id): Response
|
public function showAction(Request $request, int $id): Response
|
||||||
{
|
{
|
||||||
$entity = $this->activityRepository->find($id);
|
$view = null;
|
||||||
|
|
||||||
if (null === $entity) {
|
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
||||||
throw $this->createNotFoundException('Unable to find Activity entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$accompanyingPeriod = $entity->getAccompanyingPeriod();
|
|
||||||
$person = $entity->getPerson();
|
|
||||||
|
|
||||||
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
$view = 'ChillActivityBundle:Activity:showAccompanyingCourse.html.twig';
|
$view = 'ChillActivityBundle:Activity:showAccompanyingCourse.html.twig';
|
||||||
} elseif ($person instanceof Person) {
|
} elseif ($person instanceof Person) {
|
||||||
$view = 'ChillActivityBundle:Activity:showPerson.html.twig';
|
$view = 'ChillActivityBundle:Activity:showPerson.html.twig';
|
||||||
} else {
|
}
|
||||||
throw new RuntimeException('the activity should be linked with a period or person');
|
|
||||||
|
$entity = $this->activityRepository->find($id);
|
||||||
|
|
||||||
|
if (null === $entity) {
|
||||||
|
throw $this->createNotFoundException('Unable to find Activity entity.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $accompanyingPeriod) {
|
if (null !== $accompanyingPeriod) {
|
||||||
@@ -544,7 +493,8 @@ final class ActivityController extends AbstractController
|
|||||||
$entity->personsNotAssociated = $entity->getPersonsNotAssociated();
|
$entity->personsNotAssociated = $entity->getPersonsNotAssociated();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted(ActivityVoter::SEE, $entity);
|
// TODO revoir le Voter de Activity pour tenir compte qu'une activité peut appartenir a une période
|
||||||
|
// $this->denyAccessUnlessGranted('CHILL_ACTIVITY_SEE', $entity);
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($entity->getId(), $person, $accompanyingPeriod);
|
$deleteForm = $this->createDeleteForm($entity->getId(), $person, $accompanyingPeriod);
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Entity;
|
namespace Chill\ActivityBundle\Entity;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Validator\Constraints as ActivityValidator;
|
use Chill\ActivityBundle\Validator\Constraints as ActivityValidator;
|
||||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
use Chill\DocStoreBundle\Entity\Document;
|
||||||
use Chill\MainBundle\Entity\Center;
|
use Chill\MainBundle\Entity\Center;
|
||||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||||
use Chill\MainBundle\Entity\HasCenterInterface;
|
use Chill\MainBundle\Entity\HasCenterInterface;
|
||||||
@@ -67,7 +67,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
|
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
|
||||||
* @Groups({"read", "docgen:read"})
|
* @Groups({"read"})
|
||||||
* @SerializedName("activityType")
|
* @SerializedName("activityType")
|
||||||
* @ORM\JoinColumn(name="type_id")
|
* @ORM\JoinColumn(name="type_id")
|
||||||
*/
|
*/
|
||||||
@@ -75,19 +75,16 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityPresence")
|
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityPresence")
|
||||||
* @Groups({"docgen:read"})
|
|
||||||
*/
|
*/
|
||||||
private ?ActivityPresence $attendee = null;
|
private ?ActivityPresence $attendee = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
|
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
|
||||||
* @Groups({"docgen:read"})
|
|
||||||
*/
|
*/
|
||||||
private CommentEmbeddable $comment;
|
private CommentEmbeddable $comment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="datetime")
|
* @ORM\Column(type="datetime")
|
||||||
* @Groups({"docgen:read"})
|
|
||||||
*/
|
*/
|
||||||
private DateTime $date;
|
private DateTime $date;
|
||||||
|
|
||||||
@@ -103,7 +100,6 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="boolean", options={"default": false})
|
* @ORM\Column(type="boolean", options={"default": false})
|
||||||
* @Groups({"docgen:read"})
|
|
||||||
*/
|
*/
|
||||||
private bool $emergency = false;
|
private bool $emergency = false;
|
||||||
|
|
||||||
@@ -111,13 +107,13 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\Column(name="id", type="integer")
|
* @ORM\Column(name="id", type="integer")
|
||||||
* @ORM\GeneratedValue(strategy="AUTO")
|
* @ORM\GeneratedValue(strategy="AUTO")
|
||||||
* @Groups({"read", "docgen:read"})
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private ?int $id = null;
|
private ?int $id = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location")
|
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location")
|
||||||
* @groups({"read", "docgen:read"})
|
* @groups({"read"})
|
||||||
*/
|
*/
|
||||||
private ?Location $location = null;
|
private ?Location $location = null;
|
||||||
|
|
||||||
@@ -128,45 +124,42 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
|
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
|
||||||
* @Groups({"read", "docgen:read"})
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private ?Collection $persons = null;
|
private ?Collection $persons = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
|
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
|
||||||
* @Groups({"docgen:read"})
|
|
||||||
*/
|
*/
|
||||||
private Collection $reasons;
|
private Collection $reasons;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
|
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
|
||||||
* @Groups({"docgen:read"})
|
|
||||||
*/
|
*/
|
||||||
private ?Scope $scope = null;
|
private ?Scope $scope = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="string", options={"default": ""})
|
* @ORM\Column(type="string", options={"default": ""})
|
||||||
* @Groups({"docgen:read"})
|
|
||||||
*/
|
*/
|
||||||
private string $sentReceived = '';
|
private string $sentReceived = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction")
|
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction")
|
||||||
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction")
|
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction")
|
||||||
* @Groups({"read", "docgen:read"})
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private Collection $socialActions;
|
private Collection $socialActions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialIssue")
|
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialIssue")
|
||||||
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue")
|
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue")
|
||||||
* @Groups({"read", "docgen:read"})
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private Collection $socialIssues;
|
private Collection $socialIssues;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
|
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
|
||||||
* @Groups({"read", "docgen:read"})
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private ?Collection $thirdParties = null;
|
private ?Collection $thirdParties = null;
|
||||||
|
|
||||||
@@ -177,13 +170,12 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
|
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
|
||||||
* @Groups({"docgen:read"})
|
|
||||||
*/
|
*/
|
||||||
private User $user;
|
private User $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User")
|
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User")
|
||||||
* @Groups({"read", "docgen:read"})
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private ?Collection $users = null;
|
private ?Collection $users = null;
|
||||||
|
|
||||||
@@ -199,7 +191,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
$this->socialActions = new ArrayCollection();
|
$this->socialActions = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addDocument(StoredObject $document): self
|
public function addDocument(Document $document): self
|
||||||
{
|
{
|
||||||
$this->documents[] = $document;
|
$this->documents[] = $document;
|
||||||
|
|
||||||
@@ -310,18 +302,6 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
return $this->documents;
|
return $this->documents;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @Groups({"docgen:read"})
|
|
||||||
*/
|
|
||||||
public function getDurationMinute(): int
|
|
||||||
{
|
|
||||||
if (null === $this->durationTime) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (int) round(($this->durationTime->getTimestamp() + $this->durationTime->getOffset()) / 60.0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDurationTime(): ?DateTime
|
public function getDurationTime(): ?DateTime
|
||||||
{
|
{
|
||||||
return $this->durationTime;
|
return $this->durationTime;
|
||||||
@@ -422,18 +402,6 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
return $this->travelTime;
|
return $this->travelTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @Groups({"docgen:read"})
|
|
||||||
*/
|
|
||||||
public function getTravelTimeMinute(): int
|
|
||||||
{
|
|
||||||
if (null === $this->travelTime) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (int) round(($this->travelTime->getTimestamp() + $this->travelTime->getOffset()) / 60.0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
@@ -457,7 +425,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
return $this->getEmergency();
|
return $this->getEmergency();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeDocument(StoredObject $document): void
|
public function removeDocument(Document $document): void
|
||||||
{
|
{
|
||||||
$this->documents->removeElement($document);
|
$this->documents->removeElement($document);
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,6 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Entity;
|
namespace Chill\ActivityBundle\Entity;
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ActivityPresence.
|
* Class ActivityPresence.
|
||||||
@@ -32,14 +31,11 @@ class ActivityPresence
|
|||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\Column(name="id", type="integer")
|
* @ORM\Column(name="id", type="integer")
|
||||||
* @ORM\GeneratedValue(strategy="AUTO")
|
* @ORM\GeneratedValue(strategy="AUTO")
|
||||||
* @Serializer\Groups({"docgen:read"})
|
|
||||||
*/
|
*/
|
||||||
private ?int $id;
|
private ?int $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="json")
|
* @ORM\Column(type="json")
|
||||||
* @Serializer\Groups({"docgen:read"})
|
|
||||||
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
|
|
||||||
*/
|
*/
|
||||||
private array $name = [];
|
private array $name = [];
|
||||||
|
|
||||||
|
@@ -13,10 +13,8 @@ namespace Chill\ActivityBundle\Entity;
|
|||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
|
||||||
use Symfony\Component\Serializer\Annotation\Groups;
|
use Symfony\Component\Serializer\Annotation\Groups;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ActivityType.
|
* Class ActivityType.
|
||||||
@@ -120,7 +118,6 @@ class ActivityType
|
|||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\Column(name="id", type="integer")
|
* @ORM\Column(name="id", type="integer")
|
||||||
* @ORM\GeneratedValue(strategy="AUTO")
|
* @ORM\GeneratedValue(strategy="AUTO")
|
||||||
* @Groups({"docgen:read"})
|
|
||||||
*/
|
*/
|
||||||
private ?int $id;
|
private ?int $id;
|
||||||
|
|
||||||
@@ -136,8 +133,7 @@ class ActivityType
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="json")
|
* @ORM\Column(type="json")
|
||||||
* @Groups({"read", "docgen:read"})
|
* @Groups({"read"})
|
||||||
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
|
|
||||||
*/
|
*/
|
||||||
private array $name = [];
|
private array $name = [];
|
||||||
|
|
||||||
@@ -194,6 +190,7 @@ class ActivityType
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||||
|
* @Assert\EqualTo(propertyPath="socialIssuesVisible", message="This parameter must be equal to social issue parameter")
|
||||||
*/
|
*/
|
||||||
private int $socialActionsVisible = self::FIELD_INVISIBLE;
|
private int $socialActionsVisible = self::FIELD_INVISIBLE;
|
||||||
|
|
||||||
@@ -263,23 +260,6 @@ class ActivityType
|
|||||||
*/
|
*/
|
||||||
private int $userVisible = self::FIELD_REQUIRED;
|
private int $userVisible = self::FIELD_REQUIRED;
|
||||||
|
|
||||||
/**
|
|
||||||
* @Assert\Callback
|
|
||||||
*
|
|
||||||
* @param mixed $payload
|
|
||||||
*/
|
|
||||||
public function checkSocialActionsVisibility(ExecutionContextInterface $context, $payload)
|
|
||||||
{
|
|
||||||
if ($this->socialIssuesVisible !== $this->socialActionsVisible) {
|
|
||||||
if (!(2 === $this->socialIssuesVisible && 1 === $this->socialActionsVisible)) {
|
|
||||||
$context
|
|
||||||
->buildViolation('The socialActionsVisible value is not compatible with the socialIssuesVisible value')
|
|
||||||
->atPath('socialActionsVisible')
|
|
||||||
->addViolation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get active
|
* Get active
|
||||||
* return true if the type is active.
|
* return true if the type is active.
|
||||||
|
@@ -34,8 +34,6 @@ p.date-label {
|
|||||||
font-size: 18pt;
|
font-size: 18pt;
|
||||||
}
|
}
|
||||||
div.dashboard,
|
div.dashboard,
|
||||||
h4.badge-title,
|
|
||||||
h3.badge-title,
|
|
||||||
h2.badge-title {
|
h2.badge-title {
|
||||||
ul.list-content {
|
ul.list-content {
|
||||||
font-size: 70%;
|
font-size: 70%;
|
||||||
|
@@ -13,14 +13,11 @@
|
|||||||
<div v-if="getContext === 'accompanyingCourse' && suggestedEntities.length > 0">
|
<div v-if="getContext === 'accompanyingCourse' && suggestedEntities.length > 0">
|
||||||
<ul class="list-suggest add-items inline">
|
<ul class="list-suggest add-items inline">
|
||||||
<li v-for="(p, i) in suggestedEntities" @click="addSuggestedEntity(p)" :key="`suggestedEntities-${i}`">
|
<li v-for="(p, i) in suggestedEntities" @click="addSuggestedEntity(p)" :key="`suggestedEntities-${i}`">
|
||||||
<person-text v-if="p.type === 'person'" :person="p"></person-text>
|
<span>{{ p.text }}</span>
|
||||||
<span v-else>{{ p.text }}</span>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li class="add-persons">
|
|
||||||
<add-persons
|
<add-persons
|
||||||
buttonTitle="activity.add_persons"
|
buttonTitle="activity.add_persons"
|
||||||
modalTitle="activity.add_persons"
|
modalTitle="activity.add_persons"
|
||||||
@@ -29,8 +26,6 @@
|
|||||||
@addNewPersons="addNewPersons"
|
@addNewPersons="addNewPersons"
|
||||||
ref="addPersons">
|
ref="addPersons">
|
||||||
</add-persons>
|
</add-persons>
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</teleport>
|
</teleport>
|
||||||
</template>
|
</template>
|
||||||
@@ -39,14 +34,12 @@
|
|||||||
import { mapState, mapGetters } from 'vuex';
|
import { mapState, mapGetters } from 'vuex';
|
||||||
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
|
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
|
||||||
import PersonsBloc from './ConcernedGroups/PersonsBloc.vue';
|
import PersonsBloc from './ConcernedGroups/PersonsBloc.vue';
|
||||||
import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ConcernedGroups",
|
name: "ConcernedGroups",
|
||||||
components: {
|
components: {
|
||||||
AddPersons,
|
AddPersons,
|
||||||
PersonsBloc,
|
PersonsBloc
|
||||||
PersonText
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@@ -1,29 +1,21 @@
|
|||||||
<template>
|
<template>
|
||||||
<li>
|
<li>
|
||||||
<span :title="person.text">
|
<span :title="person.text">
|
||||||
<span class="chill_denomination" @click.prevent="$emit('remove', person)">
|
<span class="chill_denomination" @click.prevent="$emit('remove', person)">{{ textCutted }}</span>
|
||||||
<person-text :person="person" :isCut="true"></person-text>
|
|
||||||
</span>
|
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue';
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "PersonBadge",
|
name: "PersonBadge",
|
||||||
props: ['person'],
|
props: ['person'],
|
||||||
components: {
|
computed: {
|
||||||
PersonText
|
textCutted() {
|
||||||
|
let more = (this.person.text.length > 15) ?'…' : '';
|
||||||
|
return this.person.text.slice(0,15) + more;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// computed: {
|
|
||||||
// textCutted() {
|
|
||||||
// let more = (this.person.text.length > 15) ?'…' : '';
|
|
||||||
// return this.person.text.slice(0,15) + more;
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
emits: ['remove'],
|
emits: ['remove'],
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@@ -2,15 +2,11 @@ import { createApp } from 'vue';
|
|||||||
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n'
|
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n'
|
||||||
import { activityMessages } from './i18n'
|
import { activityMessages } from './i18n'
|
||||||
import store from './store'
|
import store from './store'
|
||||||
import PickTemplate from 'ChillDocGeneratorAssets/vuejs/_components/PickTemplate.vue';
|
|
||||||
import {fetchTemplates} from 'ChillDocGeneratorAssets/api/pickTemplate.js';
|
|
||||||
|
|
||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
|
|
||||||
const i18n = _createI18n(activityMessages);
|
const i18n = _createI18n(activityMessages);
|
||||||
|
|
||||||
// app for activity
|
|
||||||
|
|
||||||
const hasSocialIssues = document.querySelector('#social-issues-acc') !== null;
|
const hasSocialIssues = document.querySelector('#social-issues-acc') !== null;
|
||||||
const hasLocation = document.querySelector('#location') !== null;
|
const hasLocation = document.querySelector('#location') !== null;
|
||||||
const hasPerson = document.querySelector('#add-persons') !== null;
|
const hasPerson = document.querySelector('#add-persons') !== null;
|
||||||
@@ -33,54 +29,3 @@ const app = createApp({
|
|||||||
.use(i18n)
|
.use(i18n)
|
||||||
.component('app', App)
|
.component('app', App)
|
||||||
.mount('#activity');
|
.mount('#activity');
|
||||||
|
|
||||||
|
|
||||||
// app for picking template
|
|
||||||
|
|
||||||
const i18nGendoc = _createI18n({});
|
|
||||||
|
|
||||||
document.querySelectorAll('div[data-docgen-template-picker]').forEach(el => {
|
|
||||||
fetchTemplates(el.dataset.entityClass).then(templates => {
|
|
||||||
const picker = {
|
|
||||||
template:
|
|
||||||
'<pick-template :templates="this.templates" :preventDefaultMoveToGenerate="true" ' +
|
|
||||||
':entityClass="faked" @go-to-generate-document="generateDoc"></pick-template>',
|
|
||||||
components: {
|
|
||||||
PickTemplate,
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
templates: templates,
|
|
||||||
entityId: el.dataset.entityId,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
generateDoc({event, link, template}) {
|
|
||||||
console.log('generateDoc');
|
|
||||||
console.log('link', link);
|
|
||||||
console.log('template', template);
|
|
||||||
|
|
||||||
let hiddenInput = document.querySelector("input[data-template-id]");
|
|
||||||
|
|
||||||
if (hiddenInput === null) {
|
|
||||||
console.error('hidden input not found');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
hiddenInput.value = template;
|
|
||||||
|
|
||||||
let form = document.querySelector('form[name="chill_activitybundle_activity"');
|
|
||||||
|
|
||||||
if (form === null) {
|
|
||||||
console.error('form not found');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
form.submit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
createApp(picker).use(i18nGendoc).mount(el);
|
|
||||||
})
|
|
||||||
|
|
||||||
});
|
|
||||||
|
@@ -41,17 +41,6 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if activity.attendee and t.attendeeVisible %}
|
|
||||||
<div class="wl-row">
|
|
||||||
<div class="wl-col title"><h3>{{ 'Attendee'|trans }}</h3></div>
|
|
||||||
<div class="wl-col list">
|
|
||||||
<p class="wl-item">
|
|
||||||
{{ activity.attendee.name|localize_translatable_string }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if activity.sentReceived is not empty and t.sentReceivedVisible %}
|
{% if activity.sentReceived is not empty and t.sentReceivedVisible %}
|
||||||
<div class="wl-row">
|
<div class="wl-row">
|
||||||
<div class="wl-col title"><h3>{{ 'Sent received'|trans }}</h3></div>
|
<div class="wl-col title"><h3>{{ 'Sent received'|trans }}</h3></div>
|
||||||
@@ -68,7 +57,7 @@
|
|||||||
<div class="wl-col title"><h3>{{ 'Referrer'|trans }}</h3></div>
|
<div class="wl-col title"><h3>{{ 'Referrer'|trans }}</h3></div>
|
||||||
<div class="wl-col list">
|
<div class="wl-col list">
|
||||||
<p class="wl-item">
|
<p class="wl-item">
|
||||||
{{ activity.user|chill_entity_render_box }}
|
{{ activity.user|chill_entity_render_string|capitalize }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -154,17 +143,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="item-row separator">
|
<div class="item-row separator">
|
||||||
<div class="item-col item-meta">
|
|
||||||
{% set notif_counter = chill_count_notifications('Chill\\ActivityBundle\\Entity\\Activity', activity.id) %}
|
|
||||||
{% if notif_counter.total > 0 %}
|
|
||||||
{{ chill_counter_notifications('Chill\\ActivityBundle\\Entity\\Activity', activity.id) }}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
<div class="item-col">
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
{{ recordAction }}
|
{{ recordAction }}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
action: 'show', displayBadge: true,
|
action: 'show', displayBadge: true,
|
||||||
targetEntity: { name: type, id: entity.id },
|
targetEntity: { name: type, id: entity.id },
|
||||||
buttonText: entity|chill_entity_render_string,
|
buttonText: entity|chill_entity_render_string,
|
||||||
isDead: entity.deathdate is defined and entity.deathdate is not null,
|
isDead: entity.deathdate is not null,
|
||||||
parent: parent
|
parent: parent
|
||||||
} %}
|
} %}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
@@ -83,15 +83,15 @@
|
|||||||
{{ form_row(edit_form.comment) }}
|
{{ form_row(edit_form.comment) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if edit_form.documents is defined -%}
|
||||||
|
{{ form_row(edit_form.documents) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{%- if edit_form.attendee is defined -%}
|
{%- if edit_form.attendee is defined -%}
|
||||||
{{ form_row(edit_form.attendee) }}
|
{{ form_row(edit_form.attendee) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{%- if edit_form.documents is defined -%}
|
{# TODO .. status #}
|
||||||
{{ form_row(edit_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 %}
|
|
||||||
|
|
||||||
|
|
||||||
{% set person_id = null %}
|
{% set person_id = null %}
|
||||||
{% if entity.person %}
|
{% if entity.person %}
|
||||||
@@ -109,11 +109,9 @@
|
|||||||
{{ 'Cancel'|trans }}
|
{{ 'Cancel'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% if is_granted('CHILL_ACTIVITY_UPDATE', entity) %}
|
|
||||||
<li>
|
<li>
|
||||||
<button class="btn btn-update" type="submit">{{ 'Save'|trans }}</button>
|
<button class="btn btn-update" type="submit">{{ 'Save'|trans }}</button>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{{ form_end(edit_form) }}
|
{{ form_end(edit_form) }}
|
||||||
|
@@ -1,13 +1,10 @@
|
|||||||
{% macro recordAction(activity, context = null, person_id = null, accompanying_course_id = null) %}
|
{% macro recordAction(activity, context = null, person_id = null, accompanying_course_id = null) %}
|
||||||
{% if is_granted('CHILL_ACTIVITY_SEE_DETAILS', activity) %}
|
|
||||||
{% if no_action is not defined or no_action == false %}
|
{% if no_action is not defined or no_action == false %}
|
||||||
<li>
|
<li>
|
||||||
<a class="btn btn-misc" href="{{ chill_path_add_return_path('chill_main_notification_create', {
|
<a class="btn btn-notify" href="{{ chill_path_add_return_path('chill_main_notification_create', {
|
||||||
'entityClass': 'Chill\\ActivityBundle\\Entity\\Activity',
|
'entityClass': 'Chill\\ActivityBundle\\Entity\\Activity',
|
||||||
'entityId': activity.id
|
'entityId': activity.id
|
||||||
}) }}">
|
}) }}">{{ 'notification.Notify'|trans }}</a>
|
||||||
<i class="fa fa-paper-plane fa-fw"></i>
|
|
||||||
{{ 'notification.Notify'|trans }}</a>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if context == 'person' and activity.accompanyingPeriod is not empty %}
|
{% if context == 'person' and activity.accompanyingPeriod is not empty %}
|
||||||
@@ -57,7 +54,6 @@
|
|||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
<div class="context-{{ context }}">
|
<div class="context-{{ context }}">
|
||||||
|
@@ -41,14 +41,14 @@
|
|||||||
{% if activity.user and t.userVisible %}
|
{% if activity.user and t.userVisible %}
|
||||||
<li>
|
<li>
|
||||||
<span class="item-key">{{ 'Referrer'|trans ~ ': ' }}</span>
|
<span class="item-key">{{ 'Referrer'|trans ~ ': ' }}</span>
|
||||||
<b>{{ activity.user|chill_entity_render_box}}</b>
|
<b>{{ activity.user.usernameCanonical }}</b>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<li class="associated-persons">
|
<li class="associated-persons">
|
||||||
<span class="item-key">{{ 'Participants'|trans ~ ' : ' }}</span>
|
<span class="item-key">{{ 'Participants'|trans ~ ' : ' }}</span>
|
||||||
{% for p in activity.personsAssociated %}
|
{% for p in activity.personsAssociated %}
|
||||||
<span class="badge-person">{{ p|chill_entity_render_box({'addAgeBadge': true}) }}</span>
|
<span class="badge-person">{{ p|chill_entity_render_box }}</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@@ -87,7 +87,6 @@
|
|||||||
|
|
||||||
{%- if form.documents is defined -%}
|
{%- if form.documents is defined -%}
|
||||||
{{ form_row(form.documents) }}
|
{{ 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 %}
|
{% endif %}
|
||||||
|
|
||||||
{%- if form.attendee is defined -%}
|
{%- if form.attendee is defined -%}
|
||||||
|
@@ -17,6 +17,10 @@
|
|||||||
{{ parent() }}
|
{{ parent() }}
|
||||||
{{ encore_entry_script_tags('mod_async_upload') }}
|
{{ encore_entry_script_tags('mod_async_upload') }}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
window.addEventListener('DOMContentLoaded', function (e) {
|
||||||
|
chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]',
|
||||||
|
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
||||||
|
});
|
||||||
window.activity = {{ activity_json|json_encode|raw }};
|
window.activity = {{ activity_json|json_encode|raw }};
|
||||||
{% if default_location is not null %}window.default_location_id = {{ default_location.id }}{% endif %};
|
{% if default_location is not null %}window.default_location_id = {{ default_location.id }}{% endif %};
|
||||||
</script>
|
</script>
|
||||||
|
@@ -86,7 +86,7 @@
|
|||||||
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {
|
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {
|
||||||
'context': context,
|
'context': context,
|
||||||
'render': 'bloc',
|
'render': 'bloc',
|
||||||
'badge_person': true
|
'badge_person': 'true'
|
||||||
} %}
|
} %}
|
||||||
|
|
||||||
<h2 class="chill-blue">{{ 'Activity data'|trans }}</h2>
|
<h2 class="chill-blue">{{ 'Activity data'|trans }}</h2>
|
||||||
@@ -165,7 +165,11 @@
|
|||||||
<dt class="inline">{{ 'Attendee'|trans }}</dt>
|
<dt class="inline">{{ 'Attendee'|trans }}</dt>
|
||||||
<dd>
|
<dd>
|
||||||
{% if entity.attendee is not null %}
|
{% if entity.attendee is not null %}
|
||||||
{{ entity.attendee.name|localize_translatable_string }}
|
{% if entity.attendee %}
|
||||||
|
{{ 'present'|trans|capitalize }}
|
||||||
|
{% else %}
|
||||||
|
{{ 'not present'|trans|capitalize }}
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="chill-no-data-statement">{{ 'None'|trans|capitalize }}</span>
|
<span class="chill-no-data-statement">{{ 'None'|trans|capitalize }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -177,13 +181,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="notification notification-list">
|
|
||||||
{% set notifications = chill_list_notifications('Chill\\ActivityBundle\\Entity\\Activity', entity.id) %}
|
|
||||||
{% if notifications is not empty %}
|
|
||||||
{{ notifications|raw }}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% set person_id = null %}
|
{% set person_id = null %}
|
||||||
{% if person %}
|
{% if person %}
|
||||||
{% set person_id = person.id %}
|
{% set person_id = person.id %}
|
||||||
@@ -200,21 +197,18 @@
|
|||||||
{{ 'Back to the list'|trans }}
|
{{ 'Back to the list'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<a class="btn btn-notify" href="{{ chill_path_add_return_path('chill_main_notification_create', {'entityClass': 'Chill\\ActivityBundle\\Entity\\Activity', 'entityId': entity.id}) }}">
|
|
||||||
{{ 'notification.Notify'|trans }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% if is_granted('CHILL_ACTIVITY_UPDATE', entity) %}
|
{% if is_granted('CHILL_ACTIVITY_UPDATE', entity) %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activity_edit', { 'id': entity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}"
|
<a class="btn btn-update" href="{{ path('chill_activity_activity_edit', { 'id': entity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}">
|
||||||
class="btn btn-update">{{ 'Edit'|trans }}</a>
|
{{ 'Edit'|trans }}
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if is_granted('CHILL_ACTIVITY_DELETE', entity) %}
|
{% if is_granted('CHILL_ACTIVITY_DELETE', entity) %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activity_delete', { 'id': entity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}"
|
<a href="{{ path('chill_activity_activity_delete', { 'id': entity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}" class="btn btn-delete">
|
||||||
class="btn btn-delete" title="{{ 'Delete'|trans }}"></a>
|
{{ 'Delete'|trans }}
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
|
@@ -25,5 +25,19 @@
|
|||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
||||||
{% block block_post_menu %}
|
{% block block_post_menu %}
|
||||||
<div class="post-menu pt-4"></div>
|
<div class="post-menu pt-4">
|
||||||
|
|
||||||
|
<div class="d-grid gap-2">
|
||||||
|
<a class="btn btn-primary" href="{{ chill_path_add_return_path('chill_main_notification_create', {'entityClass': 'Chill\\ActivityBundle\\Entity\\Activity', 'entityId': entity.id}) }}">
|
||||||
|
<i class="fa fa-paper-plane fa-fw"></i>
|
||||||
|
{{ 'notification.Notify'|trans }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% set notifications = chill_list_notifications('Chill\\ActivityBundle\\Entity\\Activity', entity.id) %}
|
||||||
|
{% if notifications is not empty %}
|
||||||
|
{{ notifications|raw }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -28,7 +28,8 @@
|
|||||||
<div class="post-menu pt-4">
|
<div class="post-menu pt-4">
|
||||||
|
|
||||||
<div class="d-grid gap-2">
|
<div class="d-grid gap-2">
|
||||||
<a class="btn btn-notify" href="{{ chill_path_add_return_path('chill_main_notification_create', {'entityClass': 'Chill\\ActivityBundle\\Entity\\Activity', 'entityId': entity.id}) }}">
|
<a class="btn btn-primary" href="{{ chill_path_add_return_path('chill_main_notification_create', {'entityClass': 'Chill\\ActivityBundle\\Entity\\Activity', 'entityId': entity.id}) }}">
|
||||||
|
<i class="fa fa-paper-plane fa-fw"></i>
|
||||||
{{ 'notification.Notify'|trans }}
|
{{ 'notification.Notify'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,216 +0,0 @@
|
|||||||
<?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\Activity;
|
|
||||||
use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithAdminFormInterface;
|
|
||||||
use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithPublicFormInterface;
|
|
||||||
use Chill\DocGeneratorBundle\Context\Exception\UnexpectedTypeException;
|
|
||||||
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
|
||||||
use Chill\DocGeneratorBundle\Service\Context\BaseContextData;
|
|
||||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
|
||||||
use Chill\DocStoreBundle\Repository\DocumentCategoryRepository;
|
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
|
||||||
use Chill\PersonBundle\Entity\Person;
|
|
||||||
use Chill\PersonBundle\Templating\Entity\PersonRender;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
class ActivityContext implements
|
|
||||||
DocGeneratorContextWithAdminFormInterface,
|
|
||||||
DocGeneratorContextWithPublicFormInterface
|
|
||||||
{
|
|
||||||
private BaseContextData $baseContextData;
|
|
||||||
|
|
||||||
private DocumentCategoryRepository $documentCategoryRepository;
|
|
||||||
|
|
||||||
private EntityManagerInterface $em;
|
|
||||||
|
|
||||||
private NormalizerInterface $normalizer;
|
|
||||||
|
|
||||||
private PersonRender $personRender;
|
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
DocumentCategoryRepository $documentCategoryRepository,
|
|
||||||
NormalizerInterface $normalizer,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper,
|
|
||||||
EntityManagerInterface $em,
|
|
||||||
PersonRender $personRender,
|
|
||||||
TranslatorInterface $translator,
|
|
||||||
BaseContextData $baseContextData
|
|
||||||
) {
|
|
||||||
$this->documentCategoryRepository = $documentCategoryRepository;
|
|
||||||
$this->normalizer = $normalizer;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->em = $em;
|
|
||||||
$this->personRender = $personRender;
|
|
||||||
$this->translator = $translator;
|
|
||||||
$this->baseContextData = $baseContextData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function adminFormReverseTransform(array $data): array
|
|
||||||
{
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function adminFormTransform(array $data): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'mainPerson' => $data['mainPerson'] ?? false,
|
|
||||||
'mainPersonLabel' => $data['mainPersonLabel'] ?? $this->translator->trans('docgen.Main person'),
|
|
||||||
'person1' => $data['person1'] ?? false,
|
|
||||||
'person1Label' => $data['person1Label'] ?? $this->translator->trans('docgen.person 1'),
|
|
||||||
'person2' => $data['person2'] ?? false,
|
|
||||||
'person2Label' => $data['person2Label'] ?? $this->translator->trans('docgen.person 2'),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildAdminForm(FormBuilderInterface $builder): void
|
|
||||||
{
|
|
||||||
$builder
|
|
||||||
->add('mainPerson', CheckboxType::class, [
|
|
||||||
'required' => false,
|
|
||||||
'label' => 'docgen.Ask for main person',
|
|
||||||
])
|
|
||||||
->add('mainPersonLabel', TextType::class, [
|
|
||||||
'label' => 'main person label',
|
|
||||||
'required' => true,
|
|
||||||
])
|
|
||||||
->add('person1', CheckboxType::class, [
|
|
||||||
'required' => false,
|
|
||||||
'label' => 'docgen.Ask for person 1',
|
|
||||||
])
|
|
||||||
->add('person1Label', TextType::class, [
|
|
||||||
'label' => 'person 1 label',
|
|
||||||
'required' => true,
|
|
||||||
])
|
|
||||||
->add('person2', CheckboxType::class, [
|
|
||||||
'required' => false,
|
|
||||||
'label' => 'docgen.Ask for person 2',
|
|
||||||
])
|
|
||||||
->add('person2Label', TextType::class, [
|
|
||||||
'label' => 'person 2 label',
|
|
||||||
'required' => true,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Activity $entity
|
|
||||||
*/
|
|
||||||
public function buildPublicForm(FormBuilderInterface $builder, DocGeneratorTemplate $template, $entity): void
|
|
||||||
{
|
|
||||||
$options = $template->getOptions();
|
|
||||||
$persons = $entity->getPersons();
|
|
||||||
|
|
||||||
foreach (['mainPerson', 'person1', 'person2'] as $key) {
|
|
||||||
if ($options[$key] ?? false) {
|
|
||||||
$builder->add($key, EntityType::class, [
|
|
||||||
'class' => Person::class,
|
|
||||||
'choices' => $persons,
|
|
||||||
'choice_label' => function (Person $p) {
|
|
||||||
return $this->personRender->renderString($p, []);
|
|
||||||
},
|
|
||||||
'multiple' => false,
|
|
||||||
'expanded' => true,
|
|
||||||
'label' => $options[$key . 'Label'],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getData(DocGeneratorTemplate $template, $entity, array $contextGenerationData = []): array
|
|
||||||
{
|
|
||||||
if (!$entity instanceof Activity) {
|
|
||||||
throw new UnexpectedTypeException($entity, Activity::class);
|
|
||||||
}
|
|
||||||
$options = $template->getOptions();
|
|
||||||
|
|
||||||
$data = [];
|
|
||||||
$data = array_merge($data, $this->baseContextData->getData());
|
|
||||||
$data['activity'] = $this->normalizer->normalize($entity, 'docgen', ['docgen:expects' => Activity::class, 'groups' => 'docgen:read']);
|
|
||||||
|
|
||||||
$data['course'] = $this->normalizer->normalize($entity->getAccompanyingPeriod(), 'docgen', ['docgen:expects' => AccompanyingPeriod::class, 'groups' => 'docgen:read']);
|
|
||||||
$data['person'] = $this->normalizer->normalize($entity->getPerson(), 'docgen', ['docgen:expects' => Person::class, 'groups' => 'docgen:read']);
|
|
||||||
|
|
||||||
foreach (['mainPerson', 'person1', 'person2'] as $k) {
|
|
||||||
if ($options[$k]) {
|
|
||||||
$data[$k] = $this->normalizer->normalize($contextGenerationData[$k], 'docgen', [
|
|
||||||
'docgen:expects' => Person::class,
|
|
||||||
'groups' => 'docgen:read',
|
|
||||||
'docgen:person:with-household' => true,
|
|
||||||
'docgen:person:with-relations' => true,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDescription(): string
|
|
||||||
{
|
|
||||||
return 'docgen.A basic context for activity';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getEntityClass(): string
|
|
||||||
{
|
|
||||||
return Activity::class;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormData(DocGeneratorTemplate $template, $entity): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'activity' => $entity,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getKey(): string
|
|
||||||
{
|
|
||||||
return self::class;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getName(): string
|
|
||||||
{
|
|
||||||
return 'docgen.Activity basic';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function hasAdminForm(): bool
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function hasPublicForm(DocGeneratorTemplate $template, $entity): bool
|
|
||||||
{
|
|
||||||
$options = $template->getOptions();
|
|
||||||
|
|
||||||
return $options['mainPerson'] || $options['person1'] || $options['person2'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Activity $entity
|
|
||||||
*/
|
|
||||||
public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void
|
|
||||||
{
|
|
||||||
$entity->addDocument($storedObject);
|
|
||||||
|
|
||||||
$this->em->persist($storedObject);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\ActivityBundle\Tests\Export\Aggregator;
|
namespace Chill\ActivityBundle\Tests\Aggregator;
|
||||||
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\ActivityBundle\Tests\Export\Aggregator;
|
namespace Chill\ActivityBundle\Tests\Aggregator;
|
||||||
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\ActivityBundle\Tests\Export\Aggregator;
|
namespace Chill\ActivityBundle\Tests\Aggregator;
|
||||||
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\ActivityBundle\Tests\Export\Filter;
|
namespace Chill\ActivityBundle\Tests\Filter;
|
||||||
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\ActivityBundle\Tests\Export\Filter;
|
namespace Chill\ActivityBundle\Tests\Filter;
|
||||||
|
|
||||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
@@ -29,13 +29,9 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
|||||||
final class ActivityVoterTest extends KernelTestCase
|
final class ActivityVoterTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
use PrepareActivityTrait;
|
use PrepareActivityTrait;
|
||||||
|
|
||||||
use PrepareCenterTrait;
|
use PrepareCenterTrait;
|
||||||
|
|
||||||
use PreparePersonTrait;
|
use PreparePersonTrait;
|
||||||
|
|
||||||
use PrepareScopeTrait;
|
use PrepareScopeTrait;
|
||||||
|
|
||||||
use PrepareUserTrait;
|
use PrepareUserTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -32,8 +32,3 @@ services:
|
|||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
resource: '../Validator/Constraints/'
|
resource: '../Validator/Constraints/'
|
||||||
|
|
||||||
Chill\ActivityBundle\Service\DocGenerator\:
|
|
||||||
autowire: true
|
|
||||||
autoconfigure: true
|
|
||||||
resource: '../Service/DocGenerator/'
|
|
||||||
|
@@ -228,7 +228,3 @@ See activity in accompanying course context: Voir l'activité dans le contexte d
|
|||||||
You get notified of an activity which does not exists any more: Cette notification ne correspond pas à une activité valide.
|
You get notified of an activity which does not exists any more: Cette notification ne correspond pas à une activité valide.
|
||||||
you are not allowed to see it details: La notification fait référence à une activité à laquelle vous n'avez pas accès.
|
you are not allowed to see it details: La notification fait référence à une activité à laquelle vous n'avez pas accès.
|
||||||
This is the minimal activity data: Activité n°
|
This is the minimal activity data: Activité n°
|
||||||
|
|
||||||
docgen:
|
|
||||||
Activity basic: Echange
|
|
||||||
A basic context for activity: Contexte pour les échanges
|
|
||||||
|
@@ -20,4 +20,3 @@ For this type of activity, you must add at least one social action: Pour ce type
|
|||||||
|
|
||||||
# admin
|
# admin
|
||||||
This parameter must be equal to social issue parameter: Ce paramètre doit être égal au paramètre "Visibilité du champs Problématiques sociales"
|
This parameter must be equal to social issue parameter: Ce paramètre doit être égal au paramètre "Visibilité du champs Problématiques sociales"
|
||||||
The socialActionsVisible value is not compatible with the socialIssuesVisible value: Cette valeur du paramètre "Visibilité du champs Actions sociales" n'est pas compatible avec la valeur du paramètre "Visibilité du champs Problématiques sociales"
|
|
@@ -32,8 +32,6 @@ final class AsideActivityController extends CRUDController
|
|||||||
{
|
{
|
||||||
$asideActivity = new AsideActivity();
|
$asideActivity = new AsideActivity();
|
||||||
|
|
||||||
$asideActivity->setAgent($this->getUser());
|
|
||||||
|
|
||||||
$duration = $request->query->get('duration', '300');
|
$duration = $request->query->get('duration', '300');
|
||||||
$duration = DateTime::createFromFormat('U', $duration);
|
$duration = DateTime::createFromFormat('U', $duration);
|
||||||
$asideActivity->setDuration($duration);
|
$asideActivity->setDuration($duration);
|
||||||
|
@@ -167,6 +167,7 @@ class AsideActivityCategory
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->parent = $parent;
|
$this->parent = $parent;
|
||||||
|
dump($this);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@@ -14,9 +14,9 @@ namespace Chill\AsideActivityBundle\Form;
|
|||||||
use Chill\AsideActivityBundle\Entity\AsideActivity;
|
use Chill\AsideActivityBundle\Entity\AsideActivity;
|
||||||
use Chill\AsideActivityBundle\Entity\AsideActivityCategory;
|
use Chill\AsideActivityBundle\Entity\AsideActivityCategory;
|
||||||
use Chill\AsideActivityBundle\Templating\Entity\CategoryRender;
|
use Chill\AsideActivityBundle\Templating\Entity\CategoryRender;
|
||||||
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||||
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
||||||
use Chill\MainBundle\Form\Type\PickUserDynamicType;
|
|
||||||
use DateInterval;
|
use DateInterval;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use DateTimeImmutable;
|
use DateTimeImmutable;
|
||||||
@@ -68,10 +68,22 @@ final class AsideActivityFormType extends AbstractType
|
|||||||
];
|
];
|
||||||
|
|
||||||
$builder
|
$builder
|
||||||
->add('agent', PickUserDynamicType::class, [
|
->add(
|
||||||
|
'agent',
|
||||||
|
EntityType::class,
|
||||||
|
[
|
||||||
'label' => 'For agent',
|
'label' => 'For agent',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
])
|
'class' => User::class,
|
||||||
|
'data' => $this->storage->getToken()->getUser(),
|
||||||
|
'query_builder' => static function (EntityRepository $er) {
|
||||||
|
return $er->createQueryBuilder('u')->where('u.enabled = true');
|
||||||
|
},
|
||||||
|
'attr' => ['class' => 'select2 '],
|
||||||
|
'placeholder' => 'Choose the agent for whom this activity is created',
|
||||||
|
'choice_label' => 'username',
|
||||||
|
]
|
||||||
|
)
|
||||||
->add(
|
->add(
|
||||||
'date',
|
'date',
|
||||||
ChillDateType::class,
|
ChillDateType::class,
|
||||||
|
@@ -1,15 +1,5 @@
|
|||||||
{% extends '@ChillMain/Admin/layout.html.twig' %}
|
{% extends '@ChillMain/Admin/layout.html.twig' %}
|
||||||
|
|
||||||
{% block js %}
|
|
||||||
{{ parent() }}
|
|
||||||
{{ encore_entry_script_tags('mod_pickentity_type') }}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block css %}
|
|
||||||
{{ parent() }}
|
|
||||||
{{ encore_entry_link_tags('mod_pickentity_type') }}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
|
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -19,4 +9,3 @@
|
|||||||
{% block content_form_actions_save_and_show %}{% endblock %}
|
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||||
{% endembed %}
|
{% endembed %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@@ -97,6 +97,8 @@ class CalendarType extends AbstractType
|
|||||||
return $res;
|
return $res;
|
||||||
},
|
},
|
||||||
static function (?string $dateAsString): DateTimeImmutable {
|
static function (?string $dateAsString): DateTimeImmutable {
|
||||||
|
dump($dateAsString);
|
||||||
|
|
||||||
return new DateTimeImmutable($dateAsString);
|
return new DateTimeImmutable($dateAsString);
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Tests\CustomFields;
|
namespace Chill\CustomFieldsBundle\Tests;
|
||||||
|
|
||||||
use Chill\CustomFieldsBundle\CustomFields\CustomFieldChoice;
|
use Chill\CustomFieldsBundle\CustomFields\CustomFieldChoice;
|
||||||
use Chill\CustomFieldsBundle\Entity\CustomField;
|
use Chill\CustomFieldsBundle\Entity\CustomField;
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Tests\CustomFields;
|
namespace Chill\CustomFieldsBundle\Tests;
|
||||||
|
|
||||||
use Chill\CustomFieldsBundle\CustomFields\CustomFieldNumber;
|
use Chill\CustomFieldsBundle\CustomFields\CustomFieldNumber;
|
||||||
use Chill\CustomFieldsBundle\Entity\CustomField;
|
use Chill\CustomFieldsBundle\Entity\CustomField;
|
||||||
|
@@ -9,11 +9,10 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Tests\CustomFields;
|
namespace Chill\CustomFieldsBundle\Tests;
|
||||||
|
|
||||||
use Chill\CustomFieldsBundle\CustomFields\CustomFieldText;
|
use Chill\CustomFieldsBundle\CustomFields\CustomFieldText;
|
||||||
use Chill\CustomFieldsBundle\Entity\CustomField;
|
use Chill\CustomFieldsBundle\Entity\CustomField;
|
||||||
use Chill\CustomFieldsBundle\Tests\CustomFieldTestHelper;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Tests\Routing;
|
namespace Chill\CustomFieldsBundle\Tests;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
@@ -1,13 +0,0 @@
|
|||||||
|
|
||||||
const buildLink = function(templateId, entityId, entityClass) {
|
|
||||||
const
|
|
||||||
entityIdEncoded = encodeURI(entityId),
|
|
||||||
returnPath = encodeURIComponent(window.location.pathname + window.location.search + window.location.hash),
|
|
||||||
entityClassEncoded = encodeURI(entityClass),
|
|
||||||
url = `/fr/doc/gen/generate/from/${templateId}/for/${entityClassEncoded}/${entityIdEncoded}?returnPath=${returnPath}`
|
|
||||||
;
|
|
||||||
console.log('computed Url');
|
|
||||||
return url;
|
|
||||||
};
|
|
||||||
|
|
||||||
export {buildLink};
|
|
@@ -17,11 +17,11 @@
|
|||||||
<select class="form-select" v-model="template">
|
<select class="form-select" v-model="template">
|
||||||
<option disabled selected value="">{{ $t('choose_a_template') }}</option>
|
<option disabled selected value="">{{ $t('choose_a_template') }}</option>
|
||||||
<template v-for="t in templates">
|
<template v-for="t in templates">
|
||||||
<option v-bind:value="t.id">{{ t.name.fr || 'Aucun nom défini' }}</option>
|
<option v-bind:value="t.id">{{ t.name.fr }}</option>
|
||||||
</template>
|
</template>
|
||||||
</select>
|
</select>
|
||||||
<a v-if="canGenerate" class="btn btn-update btn-sm change-icon" :href="buildUrlGenerate" @click.prevent="clickGenerate($event, buildUrlGenerate)"><i class="fa fa-fw fa-cog"></i></a>
|
<button v-if="canGenerate" class="btn btn-update btn-sm change-icon" type="button" @click="generateDocument"><i class="fa fa-fw fa-cog"></i></button>
|
||||||
<a v-else class="btn btn-update btn-sm change-icon" href="#" disabled ><i class="fa fa-fw fa-cog"></i></a>
|
<button v-else class="btn btn-update btn-sm change-icon" type="button" disabled ><i class="fa fa-fw fa-cog"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -39,27 +39,23 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import {buildLink} from 'ChillDocGeneratorAssets/lib/document-generator';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "PickTemplate",
|
name: "PickTemplate",
|
||||||
props: {
|
props: {
|
||||||
entityId: [String, Number],
|
entityId: [String, Number],
|
||||||
entityClass: {
|
entityClass: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
templates: {
|
|
||||||
type: Array,
|
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
preventDefaultMoveToGenerate: {
|
templates: {
|
||||||
type: Boolean,
|
required: true,
|
||||||
|
},
|
||||||
|
// beforeMove execute "something" before
|
||||||
|
beforeMove: {
|
||||||
|
type: Function,
|
||||||
required: false,
|
required: false,
|
||||||
default: false,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
emits: ['goToGenerateDocument'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
template: null,
|
template: null,
|
||||||
@@ -77,37 +73,62 @@ export default {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
getDescription() {
|
getDescription() {
|
||||||
if (null === this.template) {
|
return this.templates.find(t => t.id === this.template).description || '';
|
||||||
return '';
|
|
||||||
}
|
|
||||||
let desc = this.templates.find(t => t.id === this.template);
|
|
||||||
if (null === desc) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
return desc.description || '';
|
|
||||||
},
|
},
|
||||||
buildUrlGenerate() {
|
|
||||||
if (null === this.template) {
|
|
||||||
return '#';
|
|
||||||
}
|
|
||||||
|
|
||||||
return buildLink(this.template, this.entityId, this.entityClass);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
clickGenerate(event, link) {
|
generateDocument() {
|
||||||
if (!this.preventDefaultMoveToGenerate) {
|
console.log('generateDocument');
|
||||||
window.location.assign(link);
|
console.log('beforeMove', this.beforeMove);
|
||||||
|
if (this.beforeMove != null) {
|
||||||
|
console.log('execute before move');
|
||||||
|
let r = this.beforeMove();
|
||||||
|
if (r instanceof Promise) {
|
||||||
|
r.then((obj) => this.goToGenerate(obj));
|
||||||
|
} else {
|
||||||
|
this.goToGenerate();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.goToGenerate();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
goToGenerate(obj) {
|
||||||
|
console.log('goToGenerate');
|
||||||
|
console.log('obj', obj);
|
||||||
|
console.log('entityId', this.entityId);
|
||||||
|
let
|
||||||
|
realId = this.entityId,
|
||||||
|
realEntityClass = this.entityClass
|
||||||
|
;
|
||||||
|
|
||||||
|
if (obj !== undefined) {
|
||||||
|
if (obj.entityId !== undefined) {
|
||||||
|
realId = obj.entityId;
|
||||||
|
}
|
||||||
|
if (obj.entityClass !== undefined) {
|
||||||
|
realEntityClass = obj.entityClass;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$emit('goToGenerateDocument', {event, link, template: this.template});
|
console.log('realId', realId);
|
||||||
|
console.log('realEntityClass', realEntityClass);
|
||||||
|
|
||||||
|
const
|
||||||
|
entityId = encodeURI(realId),
|
||||||
|
returnPath = encodeURIComponent(window.location.pathname + window.location.search + window.location.hash),
|
||||||
|
fqdnEntityClass = encodeURI(realEntityClass),
|
||||||
|
url = `/fr/doc/gen/generate/from/${this.template}/for/${fqdnEntityClass}/${entityId}?returnPath=${returnPath}`
|
||||||
|
;
|
||||||
|
|
||||||
|
console.log('I will generate your doc at', url);
|
||||||
|
window.location.assign(url);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
i18n: {
|
i18n: {
|
||||||
messages: {
|
messages: {
|
||||||
fr: {
|
fr: {
|
||||||
generate_document: 'Générer un document',
|
generate_document: 'Générer un document',
|
||||||
select_a_template: 'Choisir un modèle',
|
select_a_template: 'Choisir un gabarit',
|
||||||
choose_a_template: 'Choisir',
|
choose_a_template: 'Choisir',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,9 +13,7 @@ namespace Chill\DocStoreBundle\Controller;
|
|||||||
|
|
||||||
use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument;
|
use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument;
|
||||||
use Chill\DocStoreBundle\Form\AccompanyingCourseDocumentType;
|
use Chill\DocStoreBundle\Form\AccompanyingCourseDocumentType;
|
||||||
use Chill\DocStoreBundle\Repository\AccompanyingCourseDocumentRepository;
|
|
||||||
use Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter;
|
use Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter;
|
||||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
@@ -31,15 +29,20 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
*/
|
*/
|
||||||
class DocumentAccompanyingCourseController extends AbstractController
|
class DocumentAccompanyingCourseController extends AbstractController
|
||||||
{
|
{
|
||||||
protected AuthorizationHelper $authorizationHelper;
|
/**
|
||||||
|
* @var AuthorizationHelper
|
||||||
|
*/
|
||||||
|
protected $authorizationHelper;
|
||||||
|
|
||||||
protected EventDispatcherInterface $eventDispatcher;
|
/**
|
||||||
|
* @var EventDispatcherInterface
|
||||||
|
*/
|
||||||
|
protected $eventDispatcher;
|
||||||
|
|
||||||
protected TranslatorInterface $translator;
|
/**
|
||||||
|
* @var TranslatorInterface
|
||||||
private AccompanyingCourseDocumentRepository $courseRepository;
|
*/
|
||||||
|
protected $translator;
|
||||||
private PaginatorFactory $paginatorFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DocumentAccompanyingCourseController constructor.
|
* DocumentAccompanyingCourseController constructor.
|
||||||
@@ -47,15 +50,11 @@ class DocumentAccompanyingCourseController extends AbstractController
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
TranslatorInterface $translator,
|
TranslatorInterface $translator,
|
||||||
EventDispatcherInterface $eventDispatcher,
|
EventDispatcherInterface $eventDispatcher,
|
||||||
AuthorizationHelper $authorizationHelper,
|
AuthorizationHelper $authorizationHelper
|
||||||
PaginatorFactory $paginatorFactory,
|
|
||||||
AccompanyingCourseDocumentRepository $courseRepository
|
|
||||||
) {
|
) {
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
$this->authorizationHelper = $authorizationHelper;
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
$this->paginatorFactory = $paginatorFactory;
|
|
||||||
$this->courseRepository = $courseRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -131,15 +130,11 @@ class DocumentAccompanyingCourseController extends AbstractController
|
|||||||
|
|
||||||
$this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::SEE, $course);
|
$this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::SEE, $course);
|
||||||
|
|
||||||
$total = $this->courseRepository->countByCourse($course);
|
$documents = $em
|
||||||
$pagination = $this->paginatorFactory->create($total);
|
->getRepository('ChillDocStoreBundle:AccompanyingCourseDocument')
|
||||||
|
|
||||||
$documents = $this->courseRepository
|
|
||||||
->findBy(
|
->findBy(
|
||||||
['course' => $course],
|
['course' => $course],
|
||||||
['date' => 'DESC'],
|
['date' => 'DESC']
|
||||||
$pagination->getItemsPerPage(),
|
|
||||||
$pagination->getCurrentPageFirstItemNumber()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->render(
|
return $this->render(
|
||||||
@@ -147,7 +142,6 @@ class DocumentAccompanyingCourseController extends AbstractController
|
|||||||
[
|
[
|
||||||
'documents' => $documents,
|
'documents' => $documents,
|
||||||
'accompanyingCourse' => $course,
|
'accompanyingCourse' => $course,
|
||||||
'pagination' => $pagination,
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -13,8 +13,7 @@ namespace Chill\DocStoreBundle\Controller;
|
|||||||
|
|
||||||
use Chill\DocStoreBundle\Entity\PersonDocument;
|
use Chill\DocStoreBundle\Entity\PersonDocument;
|
||||||
use Chill\DocStoreBundle\Form\PersonDocumentType;
|
use Chill\DocStoreBundle\Form\PersonDocumentType;
|
||||||
use Chill\DocStoreBundle\Repository\PersonDocumentACLAwareRepositoryInterface;
|
use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter;
|
||||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||||
@@ -25,7 +24,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
|||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Component\Translation\TranslatorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class DocumentPersonController.
|
* Class DocumentPersonController.
|
||||||
@@ -36,15 +35,20 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
*/
|
*/
|
||||||
class DocumentPersonController extends AbstractController
|
class DocumentPersonController extends AbstractController
|
||||||
{
|
{
|
||||||
protected AuthorizationHelper $authorizationHelper;
|
/**
|
||||||
|
* @var AuthorizationHelper
|
||||||
|
*/
|
||||||
|
protected $authorizationHelper;
|
||||||
|
|
||||||
protected EventDispatcherInterface $eventDispatcher;
|
/**
|
||||||
|
* @var EventDispatcherInterface
|
||||||
|
*/
|
||||||
|
protected $eventDispatcher;
|
||||||
|
|
||||||
protected TranslatorInterface $translator;
|
/**
|
||||||
|
* @var TranslatorInterface
|
||||||
private PaginatorFactory $paginatorFactory;
|
*/
|
||||||
|
protected $translator;
|
||||||
private PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DocumentPersonController constructor.
|
* DocumentPersonController constructor.
|
||||||
@@ -52,15 +56,11 @@ class DocumentPersonController extends AbstractController
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
TranslatorInterface $translator,
|
TranslatorInterface $translator,
|
||||||
EventDispatcherInterface $eventDispatcher,
|
EventDispatcherInterface $eventDispatcher,
|
||||||
AuthorizationHelper $authorizationHelper,
|
AuthorizationHelper $authorizationHelper
|
||||||
PaginatorFactory $paginatorFactory,
|
|
||||||
PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository
|
|
||||||
) {
|
) {
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
$this->authorizationHelper = $authorizationHelper;
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
$this->paginatorFactory = $paginatorFactory;
|
|
||||||
$this->personDocumentACLAwareRepository = $personDocumentACLAwareRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -156,14 +156,18 @@ class DocumentPersonController extends AbstractController
|
|||||||
|
|
||||||
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
|
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
|
||||||
|
|
||||||
$total = $this->personDocumentACLAwareRepository->countByPerson($person);
|
$reachableScopes = $this->authorizationHelper
|
||||||
$pagination = $this->paginatorFactory->create($total);
|
->getReachableScopes(
|
||||||
|
$this->getUser(),
|
||||||
|
PersonDocumentVoter::SEE,
|
||||||
|
$person->getCenter()
|
||||||
|
);
|
||||||
|
|
||||||
$documents = $this->personDocumentACLAwareRepository->findByPerson(
|
$documents = $em
|
||||||
$person,
|
->getRepository('ChillDocStoreBundle:PersonDocument')
|
||||||
[],
|
->findBy(
|
||||||
$pagination->getItemsPerPage(),
|
['person' => $person, 'scope' => $reachableScopes],
|
||||||
$pagination->getCurrentPageFirstItemNumber()
|
['date' => 'DESC']
|
||||||
);
|
);
|
||||||
|
|
||||||
$event = new PrivacyEvent($person, [
|
$event = new PrivacyEvent($person, [
|
||||||
@@ -177,7 +181,6 @@ class DocumentPersonController extends AbstractController
|
|||||||
[
|
[
|
||||||
'documents' => $documents,
|
'documents' => $documents,
|
||||||
'person' => $person,
|
'person' => $person,
|
||||||
'pagination' => $pagination,
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -38,7 +38,6 @@ class ChillDocStoreExtension extends Extension implements PrependExtensionInterf
|
|||||||
$loader->load('services/menu.yaml');
|
$loader->load('services/menu.yaml');
|
||||||
$loader->load('services/fixtures.yaml');
|
$loader->load('services/fixtures.yaml');
|
||||||
$loader->load('services/form.yaml');
|
$loader->load('services/form.yaml');
|
||||||
$loader->load('services/templating.yaml');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prepend(ContainerBuilder $container)
|
public function prepend(ContainerBuilder $container)
|
||||||
|
@@ -11,13 +11,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\DocStoreBundle\Entity;
|
namespace Chill\DocStoreBundle\Entity;
|
||||||
|
|
||||||
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
|
||||||
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
|
||||||
use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
|
|
||||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
|
||||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
|
|
||||||
use Chill\MainBundle\Entity\HasScopeInterface;
|
use Chill\MainBundle\Entity\HasScopeInterface;
|
||||||
use Chill\MainBundle\Entity\Scope;
|
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use DateTimeInterface;
|
use DateTimeInterface;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
@@ -26,12 +20,8 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
/**
|
/**
|
||||||
* @ORM\MappedSuperclass
|
* @ORM\MappedSuperclass
|
||||||
*/
|
*/
|
||||||
class Document implements HasScopeInterface, TrackCreationInterface, TrackUpdateInterface
|
class Document implements HasScopeInterface
|
||||||
{
|
{
|
||||||
use TrackCreationTrait;
|
|
||||||
|
|
||||||
use TrackUpdateTrait;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\DocStoreBundle\Entity\DocumentCategory")
|
* @ORM\ManyToOne(targetEntity="Chill\DocStoreBundle\Entity\DocumentCategory")
|
||||||
* @ORM\JoinColumns({
|
* @ORM\JoinColumns({
|
||||||
@@ -77,11 +67,6 @@ class Document implements HasScopeInterface, TrackCreationInterface, TrackUpdate
|
|||||||
*/
|
*/
|
||||||
private $scope;
|
private $scope;
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate")
|
|
||||||
*/
|
|
||||||
private $template;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="text")
|
* @ORM\Column(type="text")
|
||||||
* @Assert\Length(
|
* @Assert\Length(
|
||||||
@@ -97,6 +82,9 @@ class Document implements HasScopeInterface, TrackCreationInterface, TrackUpdate
|
|||||||
*/
|
*/
|
||||||
private $user;
|
private $user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return DocumentCategory
|
||||||
|
*/
|
||||||
public function getCategory(): ?DocumentCategory
|
public function getCategory(): ?DocumentCategory
|
||||||
{
|
{
|
||||||
return $this->category;
|
return $this->category;
|
||||||
@@ -127,16 +115,11 @@ class Document implements HasScopeInterface, TrackCreationInterface, TrackUpdate
|
|||||||
*
|
*
|
||||||
* @return \Chill\MainBundle\Entity\Scope
|
* @return \Chill\MainBundle\Entity\Scope
|
||||||
*/
|
*/
|
||||||
public function getScope(): ?Scope
|
public function getScope()
|
||||||
{
|
{
|
||||||
return $this->scope;
|
return $this->scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTemplate(): ?DocGeneratorTemplate
|
|
||||||
{
|
|
||||||
return $this->template;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTitle(): ?string
|
public function getTitle(): ?string
|
||||||
{
|
{
|
||||||
return $this->title;
|
return $this->title;
|
||||||
@@ -182,13 +165,6 @@ class Document implements HasScopeInterface, TrackCreationInterface, TrackUpdate
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setTemplate(?DocGeneratorTemplate $template): self
|
|
||||||
{
|
|
||||||
$this->template = $template;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setTitle(string $title): self
|
public function setTitle(string $title): self
|
||||||
{
|
{
|
||||||
$this->title = $title;
|
$this->title = $title;
|
||||||
|
@@ -18,12 +18,10 @@ use Chill\MainBundle\Form\Type\ChillDateType;
|
|||||||
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
||||||
use Chill\MainBundle\Form\Type\ScopePickerType;
|
use Chill\MainBundle\Form\Type\ScopePickerType;
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
use Chill\MainBundle\Security\Resolver\ScopeResolverDispatcher;
|
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\Persistence\ObjectManager;
|
use Doctrine\Persistence\ObjectManager;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
@@ -53,25 +51,14 @@ class PersonDocumentType extends AbstractType
|
|||||||
*/
|
*/
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
private ParameterBagInterface $parameterBag;
|
|
||||||
|
|
||||||
private ScopeResolverDispatcher $scopeResolverDispatcher;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
TranslatableStringHelper $translatableStringHelper,
|
TranslatableStringHelper $translatableStringHelper
|
||||||
ScopeResolverDispatcher $scopeResolverDispatcher,
|
|
||||||
ParameterBagInterface $parameterBag
|
|
||||||
) {
|
) {
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
$this->scopeResolverDispatcher = $scopeResolverDispatcher;
|
|
||||||
$this->parameterBag = $parameterBag;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
{
|
{
|
||||||
$document = $options['data'];
|
|
||||||
$isScopeConcerned = $this->scopeResolverDispatcher->isConcerned($document);
|
|
||||||
|
|
||||||
$builder
|
$builder
|
||||||
->add('title', TextType::class)
|
->add('title', TextType::class)
|
||||||
->add('description', ChillTextareaType::class, [
|
->add('description', ChillTextareaType::class, [
|
||||||
@@ -80,6 +67,10 @@ class PersonDocumentType extends AbstractType
|
|||||||
->add('object', StoredObjectType::class, [
|
->add('object', StoredObjectType::class, [
|
||||||
'error_bubbling' => true,
|
'error_bubbling' => true,
|
||||||
])
|
])
|
||||||
|
->add('scope', ScopePickerType::class, [
|
||||||
|
'center' => $options['center'],
|
||||||
|
'role' => $options['role'],
|
||||||
|
])
|
||||||
->add('date', ChillDateType::class)
|
->add('date', ChillDateType::class)
|
||||||
->add('category', EntityType::class, [
|
->add('category', EntityType::class, [
|
||||||
'placeholder' => 'Choose a document category',
|
'placeholder' => 'Choose a document category',
|
||||||
@@ -93,13 +84,6 @@ class PersonDocumentType extends AbstractType
|
|||||||
return $entity ? $this->translatableStringHelper->localize($entity->getName()) : '';
|
return $entity ? $this->translatableStringHelper->localize($entity->getName()) : '';
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($isScopeConcerned && $this->parameterBag->get('chill_main')['acl']['form_show_scopes']) {
|
|
||||||
$builder->add('scope', ScopePickerType::class, [
|
|
||||||
'center' => $options['center'],
|
|
||||||
'role' => $options['role'],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
@@ -1,75 +0,0 @@
|
|||||||
<?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\DocStoreBundle\Repository;
|
|
||||||
|
|
||||||
use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument;
|
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Doctrine\ORM\EntityRepository;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
|
||||||
use Doctrine\Persistence\ObjectRepository;
|
|
||||||
|
|
||||||
class AccompanyingCourseDocumentRepository implements ObjectRepository
|
|
||||||
{
|
|
||||||
private EntityManagerInterface $em;
|
|
||||||
|
|
||||||
private EntityRepository $repository;
|
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $em)
|
|
||||||
{
|
|
||||||
$this->em = $em;
|
|
||||||
$this->repository = $em->getRepository(AccompanyingCourseDocument::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildQueryByCourse(AccompanyingPeriod $course): QueryBuilder
|
|
||||||
{
|
|
||||||
$qb = $this->repository->createQueryBuilder('d');
|
|
||||||
|
|
||||||
$qb
|
|
||||||
->where($qb->expr()->eq('d.course', ':course'))
|
|
||||||
->setParameter('course', $course);
|
|
||||||
|
|
||||||
return $qb;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function countByCourse(AccompanyingPeriod $course): int
|
|
||||||
{
|
|
||||||
$qb = $this->buildQueryByCourse($course)->select('COUNT(d)');
|
|
||||||
|
|
||||||
return $qb->getQuery()->getSingleScalarResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function find($id): ?AccompanyingCourseDocument
|
|
||||||
{
|
|
||||||
return $this->repository->find($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findAll(): array
|
|
||||||
{
|
|
||||||
return $this->repository->findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null)
|
|
||||||
{
|
|
||||||
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findOneBy(array $criteria): ?AccompanyingCourseDocument
|
|
||||||
{
|
|
||||||
return $this->findOneBy($criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getClassName()
|
|
||||||
{
|
|
||||||
return AccompanyingCourseDocument::class;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,90 +0,0 @@
|
|||||||
<?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\DocStoreBundle\Repository;
|
|
||||||
|
|
||||||
use Chill\DocStoreBundle\Entity\PersonDocument;
|
|
||||||
use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter;
|
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
|
|
||||||
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher;
|
|
||||||
use Chill\PersonBundle\Entity\Person;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
|
||||||
use Symfony\Component\Security\Core\Security;
|
|
||||||
|
|
||||||
class PersonDocumentACLAwareRepository implements PersonDocumentACLAwareRepositoryInterface
|
|
||||||
{
|
|
||||||
private AuthorizationHelperInterface $authorizationHelper;
|
|
||||||
|
|
||||||
private CenterResolverDispatcher $centerResolverDispatcher;
|
|
||||||
|
|
||||||
private EntityManagerInterface $em;
|
|
||||||
|
|
||||||
private Security $security;
|
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $em, AuthorizationHelperInterface $authorizationHelper, CenterResolverDispatcher $centerResolverDispatcher, Security $security)
|
|
||||||
{
|
|
||||||
$this->em = $em;
|
|
||||||
$this->authorizationHelper = $authorizationHelper;
|
|
||||||
$this->centerResolverDispatcher = $centerResolverDispatcher;
|
|
||||||
$this->security = $security;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildQueryByPerson(Person $person): QueryBuilder
|
|
||||||
{
|
|
||||||
$qb = $this->em->getRepository(PersonDocument::class)->createQueryBuilder('d');
|
|
||||||
|
|
||||||
$qb
|
|
||||||
->where($qb->expr()->eq('d.person', ':person'))
|
|
||||||
->setParameter('person', $person);
|
|
||||||
|
|
||||||
return $qb;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function countByPerson(Person $person): int
|
|
||||||
{
|
|
||||||
$qb = $this->buildQueryByPerson($person)->select('COUNT(d)');
|
|
||||||
|
|
||||||
$this->addACL($qb, $person);
|
|
||||||
|
|
||||||
return $qb->getQuery()->getSingleScalarResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findByPerson(Person $person, array $orderBy = [], int $limit = 20, int $offset = 0): array
|
|
||||||
{
|
|
||||||
$qb = $this->buildQueryByPerson($person)->select('d');
|
|
||||||
|
|
||||||
$this->addACL($qb, $person);
|
|
||||||
|
|
||||||
foreach ($orderBy as [$field, $order]) {
|
|
||||||
$qb->addOrderBy($field, $order);
|
|
||||||
}
|
|
||||||
|
|
||||||
$qb->setFirstResult($offset)->setMaxResults($limit);
|
|
||||||
|
|
||||||
return $qb->getQuery()->getResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
private function addACL(QueryBuilder $qb, Person $person): void
|
|
||||||
{
|
|
||||||
$center = $this->centerResolverDispatcher->resolveCenter($person);
|
|
||||||
|
|
||||||
$reachableScopes = $this->authorizationHelper
|
|
||||||
->getReachableScopes(
|
|
||||||
$this->security->getUser(),
|
|
||||||
PersonDocumentVoter::SEE,
|
|
||||||
$center
|
|
||||||
);
|
|
||||||
|
|
||||||
$qb->andWhere($qb->expr()->in('d.scope', ':scopes'))
|
|
||||||
->setParameter('scopes', $reachableScopes);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,21 +0,0 @@
|
|||||||
<?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\DocStoreBundle\Repository;
|
|
||||||
|
|
||||||
use Chill\PersonBundle\Entity\Person;
|
|
||||||
|
|
||||||
interface PersonDocumentACLAwareRepositoryInterface
|
|
||||||
{
|
|
||||||
public function countByPerson(Person $person): int;
|
|
||||||
|
|
||||||
public function findByPerson(Person $person, array $orderBy = [], int $limit = 20, int $offset = 0): array;
|
|
||||||
}
|
|
@@ -1,68 +0,0 @@
|
|||||||
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
|
||||||
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
|
|
||||||
|
|
||||||
<div class="flex-table accompanying_course_work-list">
|
|
||||||
<div class="item-bloc document-item bg-chill-llight-gray">
|
|
||||||
<div class="row justify-content-center my-4">
|
|
||||||
<div class="col-2">
|
|
||||||
<i class="fa fa-4x fa-file-text-o text-success"></i>
|
|
||||||
</div>
|
|
||||||
<div class="col-8">
|
|
||||||
<h3>{{ document.title }}</h3>
|
|
||||||
|
|
||||||
{{ mm.mimeIcon(document.object.type) }}
|
|
||||||
|
|
||||||
{% if document.description is not empty %}
|
|
||||||
<blockquote class="chill-user-quote mt-4">
|
|
||||||
{{ document.description }}
|
|
||||||
</blockquote>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% set freezed = false %}
|
|
||||||
{% for step in entity_workflow.stepsChained %}
|
|
||||||
{% if loop.last %}
|
|
||||||
{% if step.previous is not null and step.previous.freezeAfter == true %}
|
|
||||||
{% set freezed = true %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
{% if display_action is defined and display_action == true %}
|
|
||||||
<ul class="record_actions">
|
|
||||||
{% if document.course != null and is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', document.course) %}
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('chill_person_accompanying_course_index', {'accompanying_period_id': document.course.id}) }}" class="btn btn-show change-icon">
|
|
||||||
<i class="fa fa-random"></i> {{ 'Course number'|trans }} {{ document.course.id }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE', document) and document.course != null %}
|
|
||||||
<li>
|
|
||||||
{{ m.download_button(document.object, document.title) }}
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
|
|
||||||
<li>
|
|
||||||
{% if chill_document_is_editable(document.object) %}
|
|
||||||
{% if not freezed %}
|
|
||||||
{{ document.object|chill_document_edit_button({'title': document.title|e('html') }) }}
|
|
||||||
{% else %}
|
|
||||||
<a class="btn btn-wopilink disabled" href="#" title="{{ 'workflow.freezed document'|trans }}">
|
|
||||||
{{ 'Update document'|trans }}
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE', document) and document.course != null %}
|
|
||||||
<li>
|
|
||||||
<a href="{{ chill_path_add_return_path('accompanying_course_document_show', {'course': document.course.id, 'id': document.id}) }}" class="btn btn-show"></a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
@@ -1,19 +0,0 @@
|
|||||||
{% import '@ChillMain/Workflow/macro_breadcrumb.html.twig' as m %}
|
|
||||||
|
|
||||||
<div class="flex-grow-1 {% if add_classes is defined %}{{ add_classes }}{% else %}h2{% endif %}">
|
|
||||||
<div>
|
|
||||||
{% if concerne is defined and concerne == true %}
|
|
||||||
<span class="item-key">{{ 'Concerne'|trans }}: </span>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{{ 'workflow.Document (n°%doc%)'|trans({'%doc%': document.id}) }}
|
|
||||||
|
|
||||||
{% if description is defined and description == true %}
|
|
||||||
{{ ' — ' ~ document.title }}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% if breadcrumb is defined and breadcrumb == true %}
|
|
||||||
{{ m.breadcrumb(_context) }}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
@@ -19,17 +19,15 @@
|
|||||||
{{ form_row(form.description) }}
|
{{ form_row(form.description) }}
|
||||||
{{ form_row(form.object, { 'label': 'Document', 'existing': document.object }) }}
|
{{ form_row(form.object, { 'label': 'Document', 'existing': document.object }) }}
|
||||||
|
|
||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions">
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
<a href="{{ path('accompanying_course_document_index', {'course': accompanyingCourse.id}) }}" class="btn btn-cancel">
|
<a href="{{ path('accompanying_course_document_index', {'course': accompanyingCourse.id}) }}" class="btn btn-cancel">
|
||||||
{{ 'Back to the list' | trans }}
|
{{ 'Back to the list' | trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
|
|
||||||
<li class="edit">
|
<li class="edit">
|
||||||
<button class="btn btn-edit">{{ 'Edit'|trans }}</button>
|
<button class="btn btn-edit">{{ 'Edit'|trans }}</button>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{{ form_end(form) }}
|
{{ form_end(form) }}
|
||||||
|
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
{% set activeRouteKey = '' %}
|
{% set activeRouteKey = '' %}
|
||||||
|
|
||||||
|
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{{ 'Documents' }}
|
{{ 'Documents' }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -19,25 +21,54 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="col-md-10 col-xxl">
|
|
||||||
<h1>{{ 'Documents' }}</h1>
|
<h1>{{ 'Documents' }}</h1>
|
||||||
|
|
||||||
{% if documents|length == 0 %}
|
<table class="table table-bordered border-dark table-striped">
|
||||||
<p class="chill-no-data-statement">{{ 'No documents'|trans }}</p>
|
|
||||||
{% else %}
|
|
||||||
<div class="flex-table chill-task-list">
|
|
||||||
{% for document in documents %}
|
|
||||||
{% include 'ChillDocStoreBundle:List:list_item.html.twig' %}
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{{ chill_pagination(pagination) }}
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{{ 'Title' | trans }}</th>
|
||||||
|
<th>{{ 'Category'|trans }}</th>
|
||||||
|
<th>{{ 'Actions' | trans }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for document in documents %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ document.title }}</td>
|
||||||
|
<td>{% if document.category %}{{ document.category.name|localize_translatable_string }}{% endif %}</td>
|
||||||
|
<td>
|
||||||
|
<ul class="record_actions">
|
||||||
|
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE_DETAILS', document) %}
|
||||||
|
<li>
|
||||||
|
{{ m.download_button(document.object, document.title) }}
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{ chill_path_add_return_path('accompanying_course_document_show', {'course': accompanyingCourse.id, 'id': document.id}) }}" class="btn btn-show"></a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('accompanying_course_document_edit', {'course': accompanyingCourse.id, 'id': document.id }) }}" class="btn btn-update"></a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% else %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="9" style="text-align:center;">
|
||||||
|
<span class="chill-no-data-statement">{{ 'Any document found'|trans }}</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
<div data-docgen-template-picker="data-docgen-template-picker" data-entity-class="Chill\PersonBundle\Entity\AccompanyingPeriod" data-entity-id="{{ accompanyingCourse.id }}"></div>
|
<div data-docgen-template-picker="data-docgen-template-picker" data-entity-class="Chill\PersonBundle\Entity\AccompanyingPeriod" data-entity-id="{{ accompanyingCourse.id }}"></div>
|
||||||
|
|
||||||
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_CREATE', accompanyingCourse) %}
|
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_CREATE', accompanyingCourse) %}
|
||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions">
|
||||||
<li class="create">
|
<li class="create">
|
||||||
<a href="{{ path('accompanying_course_document_new', {'course': accompanyingCourse.id}) }}" class="btn btn-create">
|
<a href="{{ path('accompanying_course_document_new', {'course': accompanyingCourse.id}) }}" class="btn btn-create">
|
||||||
{{ 'Create'|trans }}
|
{{ 'Create'|trans }}
|
||||||
@@ -45,6 +76,4 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -3,26 +3,27 @@
|
|||||||
{% set activeRouteKey = '' %}
|
{% set activeRouteKey = '' %}
|
||||||
|
|
||||||
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
||||||
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
|
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{# {{ 'Detail of document of %name%'|trans({ '%name%': accompanyingCourse|chill_entity_render_string } ) }} #}
|
{# {{ 'Detail of document of %name%'|trans({ '%name%': accompanyingCourse|chill_entity_render_string } ) }} #}
|
||||||
{{ 'Document %title%' | trans({ '%title%': document.title }) }}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
{{ parent() }}
|
||||||
|
{{ encore_entry_script_tags('mod_async_upload') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block css %}
|
{% block css %}
|
||||||
{{ parent() }}
|
{{ parent() }}
|
||||||
{{ encore_entry_link_tags('mod_async_upload') }}
|
{{ encore_entry_link_tags('mod_async_upload') }}
|
||||||
{{ encore_entry_link_tags('mod_entity_workflow_pick') }}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="document-show">
|
|
||||||
<h1>{{ block('title') }}</h1>
|
|
||||||
|
|
||||||
{{ mm.mimeIcon(document.object.type) }}
|
<h1>{{ 'Document %title%' | trans({ '%title%': document.title }) }}</h1>
|
||||||
|
|
||||||
<dl class="chill_view_data mt-4">
|
<dl class="chill_view_data">
|
||||||
<dt>{{ 'Title'|trans }}</dt>
|
<dt>{{ 'Title'|trans }}</dt>
|
||||||
<dd>{{ document.title }}</dd>
|
<dd>{{ document.title }}</dd>
|
||||||
|
|
||||||
@@ -41,44 +42,25 @@
|
|||||||
</blockquote>
|
</blockquote>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions">
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
<a href="{{ path('accompanying_course_document_index', {'course': accompanyingCourse.id}) }}" class="btn btn-cancel">
|
<a href="{{ path('accompanying_course_document_index', {'course': accompanyingCourse.id}) }}" class="btn btn-cancel">
|
||||||
{{ 'Back to the list' | trans }}
|
{{ 'Back to the list' | trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
{{ m.download_button(document.object, document.title) }}
|
{{ m.download_button(document.object, document.title) }}
|
||||||
</li>
|
</li>
|
||||||
{% if chill_document_is_editable(document.object) %}
|
|
||||||
<li>
|
|
||||||
{{ document.object|chill_document_edit_button }}
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
|
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('accompanying_course_document_edit', {'id': document.id, 'course': accompanyingCourse.id}) }}"
|
<a href="{{ path('accompanying_course_document_edit', {'id': document.id, 'course': accompanyingCourse.id}) }}" class="btn btn-edit">
|
||||||
class="btn btn-edit" title="{{ 'Edit attributes' | trans }}"></a>
|
{{ 'Edit' | trans }}
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% set workflows_frame = chill_entity_workflow_list('Chill\\DocStoreBundle\\Entity\\AccompanyingCourseDocument', document.id) %}
|
|
||||||
{% if workflows_frame is not empty %}
|
|
||||||
<li>
|
|
||||||
{{ workflows_frame|raw }}
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block block_post_menu %}
|
|
||||||
<div class="post-menu pt-4"></div>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block js %}
|
|
||||||
{{ parent() }}
|
|
||||||
{{ encore_entry_script_tags('mod_async_upload') }}
|
|
||||||
{{ encore_entry_script_tags('mod_entity_workflow_pick') }}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -1,9 +0,0 @@
|
|||||||
|
|
||||||
{# Twig way
|
|
||||||
TODO: une route, un template avec un header CHILL et un iframe
|
|
||||||
#}
|
|
||||||
<a href="{{ chill_path_add_return_path('chill_wopi_file_edit', {'fileId': document.uuid}) }}"
|
|
||||||
class="btn btn-wopilink">
|
|
||||||
{{ 'online_edit_document'|trans }}
|
|
||||||
</a>
|
|
||||||
|
|
@@ -1,83 +0,0 @@
|
|||||||
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
|
||||||
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
|
|
||||||
<div class="item-bloc">
|
|
||||||
<div class="item-row">
|
|
||||||
<div class="item-col">
|
|
||||||
<div class="denomination h2">
|
|
||||||
{{ document.title }}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
{{ mm.mimeIcon(document.object.type) }}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p>{{ document.category.name|localize_translatable_string }}</p>
|
|
||||||
</div>
|
|
||||||
{% if document.template is not null %}
|
|
||||||
<div>
|
|
||||||
<p>{{ document.template.name.fr }}</p>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="item-col">
|
|
||||||
<div class="container">
|
|
||||||
{% if document.date is not null %}
|
|
||||||
<div class="dates row" style="float: right;">
|
|
||||||
<span>{{ document.createdAt|format_date('short') }}</span>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% if document.description is not empty %}
|
|
||||||
<div class="item-row separator">
|
|
||||||
<blockquote class="chill-user-quote">
|
|
||||||
{{ document.description|chill_markdown_to_html }}
|
|
||||||
</blockquote>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
<div class="item-row separator">
|
|
||||||
<div class="item-col item-meta">
|
|
||||||
<div class="updatedBy">
|
|
||||||
{{ 'Created by'|trans }}:
|
|
||||||
<span class="user">{{ document.createdBy|chill_entity_render_string }}</span>
|
|
||||||
<span class="date">le {{ document.createdAt|format_date('long') }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
{% if document.course is defined %}
|
|
||||||
<ul class="record_actions">
|
|
||||||
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE_DETAILS', document) %}
|
|
||||||
<li>
|
|
||||||
{{ m.download_button(document.object, document.title) }}
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ chill_path_add_return_path('accompanying_course_document_show', {'course': accompanyingCourse.id, 'id': document.id}) }}" class="btn btn-show"></a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('accompanying_course_document_edit', {'course': accompanyingCourse.id, 'id': document.id }) }}" class="btn btn-update"></a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
{% else %}
|
|
||||||
<ul class="record_actions">
|
|
||||||
{% if is_granted('CHILL_PERSON_DOCUMENT_SEE_DETAILS', document) %}
|
|
||||||
<li>
|
|
||||||
{{ m.download_button(document.object, document.title) }}
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('person_document_show', {'person': person.id, 'id': document.id}) }}" class="btn btn-show"></a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %}
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('person_document_edit', {'person': person.id, 'id': document.id}) }}" class="btn btn-update"></a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
@@ -1,55 +0,0 @@
|
|||||||
{% macro mimeIcon(type) %}
|
|
||||||
|
|
||||||
{# mapping
|
|
||||||
forkawesome and mime type https://gist.github.com/colemanw/9c9a12aae16a4bfe2678de86b661d922
|
|
||||||
#}
|
|
||||||
{% set mapmime = {
|
|
||||||
'image': 'fa-file-image-o',
|
|
||||||
'audio': 'fa-file-audio-o',
|
|
||||||
'video': 'fa-file-video-o',
|
|
||||||
'application/pdf': 'fa-file-pdf-o',
|
|
||||||
'application/msword': 'fa-file-word-o',
|
|
||||||
'application/vnd.ms-word': 'fa-file-word-o',
|
|
||||||
'application/vnd.oasis.opendocument.text': 'fa-file-word-o',
|
|
||||||
'application/vnd.openxmlformats-officedocument.wordprocessingml': 'fa-file-word-o',
|
|
||||||
'application/vnd.ms-excel': 'fa-file-excel-o',
|
|
||||||
'application/vnd.openxmlformats-officedocument.spreadsheetml': 'fa-file-excel-o',
|
|
||||||
'application/vnd.oasis.opendocument.spreadsheet': 'fa-file-excel-o',
|
|
||||||
'application/vnd.ms-powerpoint': 'fa-file-powerpoint-o',
|
|
||||||
'application/vnd.openxmlformats-officedocument.presentationml': 'fa-file-powerpoint-o',
|
|
||||||
'application/vnd.oasis.opendocument.presentation': 'fa-file-powerpoint-o',
|
|
||||||
'text/plain': 'fa-file-text-o',
|
|
||||||
'text/html': 'fa-file-code-o',
|
|
||||||
'application/json': 'fa-file-code-o',
|
|
||||||
'application/gzip': 'fa-file-archive-o',
|
|
||||||
'application/zip': 'fa-file-archive-o',
|
|
||||||
} %}
|
|
||||||
|
|
||||||
{% set icon = 'fa-file-o' %}
|
|
||||||
{% for key,val in mapmime %}
|
|
||||||
{% if type starts with key %}
|
|
||||||
{% set icon = val %}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
{# TODO improve mapping
|
|
||||||
mime type and friendly name https://gist.github.com/rosskmurphy/3724501
|
|
||||||
#}
|
|
||||||
{% set maptype = {
|
|
||||||
'fa-file-word-o': 'office document/texte',
|
|
||||||
'fa-file-excel-o': 'office document/tableur',
|
|
||||||
'fa-file-powerpoint-o': 'office document/presentation',
|
|
||||||
} %}
|
|
||||||
|
|
||||||
{% set label = type %}
|
|
||||||
{% for key, val in maptype %}
|
|
||||||
{% if icon == key %}
|
|
||||||
{% set label = val %}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
<div class="metadata">
|
|
||||||
<i class="fa {{ icon }} fa-lg me-1"></i>
|
|
||||||
{{ label|capitalize }}
|
|
||||||
</div>
|
|
||||||
{% endmacro %}
|
|
@@ -30,9 +30,7 @@
|
|||||||
{{ form_row(form.title) }}
|
{{ form_row(form.title) }}
|
||||||
{{ form_row(form.date) }}
|
{{ form_row(form.date) }}
|
||||||
{{ form_row(form.category) }}
|
{{ form_row(form.category) }}
|
||||||
{% if form.scope is defined %}
|
|
||||||
{{ form_row(form.scope) }}
|
{{ form_row(form.scope) }}
|
||||||
{% endif %}
|
|
||||||
{{ form_row(form.description) }}
|
{{ form_row(form.description) }}
|
||||||
{{ form_row(form.object, { 'label': 'Document', 'existing': document.object }) }}
|
{{ form_row(form.object, { 'label': 'Document', 'existing': document.object }) }}
|
||||||
|
|
||||||
@@ -42,11 +40,9 @@
|
|||||||
{{ 'Back to the list' | trans }}
|
{{ 'Back to the list' | trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %}
|
|
||||||
<li class="edit">
|
<li class="edit">
|
||||||
<button class="btn btn-edit">{{ 'Edit'|trans }}</button>
|
<button class="btn btn-edit">{{ 'Edit'|trans }}</button>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
|
||||||
{# {% if is_granted('CHILL_PERSON_DOCUMENT_DELETE', document) %}
|
{# {% if is_granted('CHILL_PERSON_DOCUMENT_DELETE', document) %}
|
||||||
<li class="delete">
|
<li class="delete">
|
||||||
{{ include('ChillDocStoreBundle:PersonDocument:_delete_form.html.twig') }}
|
{{ include('ChillDocStoreBundle:PersonDocument:_delete_form.html.twig') }}
|
||||||
|
@@ -30,24 +30,54 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block personcontent %}
|
{% block personcontent %}
|
||||||
|
|
||||||
<div class="col-md-10 col-xxl">
|
|
||||||
<h1>{{ 'Documents for %name%'|trans({ '%name%': person|chill_entity_render_string } ) }}</h1>
|
<h1>{{ 'Documents for %name%'|trans({ '%name%': person|chill_entity_render_string } ) }}</h1>
|
||||||
|
|
||||||
{% if documents|length == 0 %}
|
<table class="table table-bordered border-dark table-striped">
|
||||||
<p class="chill-no-data-statement">{{ 'No documents'|trans }}</p>
|
|
||||||
{% else %}
|
|
||||||
<div class="flex-table chill-task-list">
|
|
||||||
{% for document in documents %}
|
|
||||||
{% include 'ChillDocStoreBundle:List:list_item.html.twig' %}
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{{ chill_pagination(pagination) }}
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{{ 'Title' | trans }}</th>
|
||||||
|
<th>{{ 'Category'|trans }}</th>
|
||||||
|
<th>{{ 'Circle' | trans }}</th>
|
||||||
|
<th>{{ 'Actions' | trans }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for document in documents %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ document.title }}</td>
|
||||||
|
<td>{{ document.category.name|localize_translatable_string }}</td>
|
||||||
|
<td>{{ document.scope.name|localize_translatable_string }}</td>
|
||||||
|
<td>
|
||||||
|
<ul class="record_actions">
|
||||||
|
{% if is_granted('CHILL_PERSON_DOCUMENT_SEE_DETAILS', document) %}
|
||||||
|
<li>
|
||||||
|
{{ m.download_button(document.object, document.title) }}
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('person_document_show', {'person': person.id, 'id': document.id}) }}" class="btn btn-show"></a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('person_document_edit', {'person': person.id, 'id': document.id}) }}" class="btn btn-update"></a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% else %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="9" style="text-align:center;">
|
||||||
|
<span class="chill-no-data-statement">{{ 'Any document found'|trans }}</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
{% if is_granted('CHILL_PERSON_DOCUMENT_CREATE', person) %}
|
{% if is_granted('CHILL_PERSON_DOCUMENT_CREATE', person) %}
|
||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions">
|
||||||
<li class="create">
|
<li class="create">
|
||||||
<a href="{{ path('person_document_new', {'person': person.id}) }}" class="btn btn-create">
|
<a href="{{ path('person_document_new', {'person': person.id}) }}" class="btn btn-create">
|
||||||
{{ 'Create new document' | trans }}
|
{{ 'Create new document' | trans }}
|
||||||
@@ -55,6 +85,4 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -46,11 +46,9 @@
|
|||||||
{{ 'Back to the list' | trans }}
|
{{ 'Back to the list' | trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% if is_granted ('CHILL_PERSON_DOCUMENT_CREATE', person) %}
|
|
||||||
<li class="create">
|
<li class="create">
|
||||||
<button class="btn btn-create">{{ 'Create'|trans }}</button>
|
<button class="btn btn-create">{{ 'Create'|trans }}</button>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
|
||||||
</ul>
|
</ul>
|
||||||
{{ form_end(form) }}
|
{{ form_end(form) }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -19,7 +19,6 @@
|
|||||||
{% set activeRouteKey = '' %}
|
{% set activeRouteKey = '' %}
|
||||||
|
|
||||||
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
||||||
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
|
|
||||||
|
|
||||||
{% block title %}{{ 'Detail of document of %name%'|trans({ '%name%': person|chill_entity_render_string } ) }}{% endblock %}
|
{% block title %}{{ 'Detail of document of %name%'|trans({ '%name%': person|chill_entity_render_string } ) }}{% endblock %}
|
||||||
|
|
||||||
@@ -30,16 +29,12 @@
|
|||||||
{% block personcontent %}
|
{% block personcontent %}
|
||||||
<h1>{{ 'Document %title%' | trans({ '%title%': document.title }) }}</h1>
|
<h1>{{ 'Document %title%' | trans({ '%title%': document.title }) }}</h1>
|
||||||
|
|
||||||
{{ mm.mimeIcon(document.object.type) }}
|
|
||||||
|
|
||||||
<dl class="chill_view_data">
|
<dl class="chill_view_data">
|
||||||
<dt>{{ 'Title'|trans }}</dt>
|
<dt>{{ 'Title'|trans }}</dt>
|
||||||
<dd>{{ document.title }}</dd>
|
<dd>{{ document.title }}</dd>
|
||||||
|
|
||||||
{% if document.scope is not null %}
|
|
||||||
<dt>{{ 'Scope' | trans }}</dt>
|
<dt>{{ 'Scope' | trans }}</dt>
|
||||||
<dd>{{ document.scope.name | localize_translatable_string }}</dd>
|
<dd>{{ document.scope.name | localize_translatable_string }}</dd>
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<dt>{{ 'Category'|trans }}</dt>
|
<dt>{{ 'Category'|trans }}</dt>
|
||||||
<dd>{{ document.category.name|localize_translatable_string }}</dd>
|
<dd>{{ document.category.name|localize_translatable_string }}</dd>
|
||||||
@@ -57,7 +52,7 @@
|
|||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions">
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
<a href="{{ path('person_document_index', {'person': person.id}) }}" class="btn btn-cancel">
|
<a href="{{ path('person_document_index', {'person': person.id}) }}" class="btn btn-cancel">
|
||||||
{{ 'Back to the list' | trans }}
|
{{ 'Back to the list' | trans }}
|
||||||
@@ -68,12 +63,6 @@
|
|||||||
{{ m.download_button(document.object, document.title) }}
|
{{ m.download_button(document.object, document.title) }}
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
{% if chill_document_is_editable(document.object) %}
|
|
||||||
<li>
|
|
||||||
{{ document.object|chill_document_edit_button }}
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %}
|
{% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('person_document_edit', {'id': document.id, 'person': person.id}) }}" class="btn btn-edit">
|
<a href="{{ path('person_document_edit', {'id': document.id, 'person': person.id}) }}" class="btn btn-edit">
|
||||||
|
@@ -1,36 +0,0 @@
|
|||||||
<?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\DocStoreBundle\Templating;
|
|
||||||
|
|
||||||
use Twig\Extension\AbstractExtension;
|
|
||||||
use Twig\TwigFilter;
|
|
||||||
use Twig\TwigFunction;
|
|
||||||
|
|
||||||
class WopiEditTwigExtension extends AbstractExtension
|
|
||||||
{
|
|
||||||
public function getFilters(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
new TwigFilter('chill_document_edit_button', [WopiEditTwigExtensionRuntime::class, 'renderEditButton'], [
|
|
||||||
'needs_environment' => true,
|
|
||||||
'is_safe' => ['html'],
|
|
||||||
]),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFunctions(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
new TwigFunction('chill_document_is_editable', [WopiEditTwigExtensionRuntime::class, 'isEditable']),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,55 +0,0 @@
|
|||||||
<?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\DocStoreBundle\Templating;
|
|
||||||
|
|
||||||
use ChampsLibres\WopiLib\Contract\Service\Discovery\DiscoveryInterface;
|
|
||||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
|
||||||
use Twig\Environment;
|
|
||||||
use Twig\Extension\RuntimeExtensionInterface;
|
|
||||||
use function array_key_exists;
|
|
||||||
|
|
||||||
class WopiEditTwigExtensionRuntime implements RuntimeExtensionInterface
|
|
||||||
{
|
|
||||||
public const TEMPLATE = '@ChillDocStore/Button/wopi_edit_document.html.twig';
|
|
||||||
|
|
||||||
private DiscoveryInterface $discovery;
|
|
||||||
|
|
||||||
public function __construct(DiscoveryInterface $discovery)
|
|
||||||
{
|
|
||||||
$this->discovery = $discovery;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isEditable(StoredObject $document): bool
|
|
||||||
{
|
|
||||||
$mime_type = $this->discovery->discoverMimeType($document->getType());
|
|
||||||
|
|
||||||
if ([] === $mime_type) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($mime_type as $item) {
|
|
||||||
if (array_key_exists('default', $item) && 'true' === $item['default']) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function renderEditButton(Environment $environment, StoredObject $document, ?array $options = null): string
|
|
||||||
{
|
|
||||||
return $environment->render(self::TEMPLATE, [
|
|
||||||
'document' => $document,
|
|
||||||
'options' => $options,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,74 +0,0 @@
|
|||||||
<?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\DocStoreBundle\Workflow;
|
|
||||||
|
|
||||||
use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument;
|
|
||||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
|
|
||||||
use Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Doctrine\ORM\EntityRepository;
|
|
||||||
|
|
||||||
class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandlerInterface
|
|
||||||
{
|
|
||||||
private EntityRepository $repository;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: injecter le repository directement.
|
|
||||||
*/
|
|
||||||
public function __construct(EntityManagerInterface $em)
|
|
||||||
{
|
|
||||||
$this->repository = $em->getRepository(AccompanyingCourseDocument::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getRelatedEntity(EntityWorkflow $entityWorkflow): ?AccompanyingCourseDocument
|
|
||||||
{
|
|
||||||
return $this->repository->find($entityWorkflow->getRelatedEntityId());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getRoleShow(EntityWorkflow $entityWorkflow): ?string
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTemplate(EntityWorkflow $entityWorkflow, array $options = []): string
|
|
||||||
{
|
|
||||||
return '@ChillDocStore/AccompanyingCourseDocument/_workflow.html.twig';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTemplateData(EntityWorkflow $entityWorkflow, array $options = []): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'entity_workflow' => $entityWorkflow,
|
|
||||||
'document' => $this->getRelatedEntity($entityWorkflow),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTemplateTitle(EntityWorkflow $entityWorkflow, array $options = []): string
|
|
||||||
{
|
|
||||||
return '@ChillDocStore/AccompanyingCourseDocument/_workflow.title.html.twig';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTemplateTitleData(EntityWorkflow $entityWorkflow, array $options = []): array
|
|
||||||
{
|
|
||||||
return $this->getTemplateData($entityWorkflow, $options);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function supports(EntityWorkflow $entityWorkflow, array $options = []): bool
|
|
||||||
{
|
|
||||||
return $entityWorkflow->getRelatedEntityClass() === AccompanyingCourseDocument::class;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function supportsFreeze(EntityWorkflow $entityWorkflow, array $options = []): bool
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -6,6 +6,7 @@ services:
|
|||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
resource: "../Repository/"
|
resource: "../Repository/"
|
||||||
|
tags: ["doctrine.repository_service"]
|
||||||
|
|
||||||
Chill\DocStoreBundle\Form\DocumentCategoryType:
|
Chill\DocStoreBundle\Form\DocumentCategoryType:
|
||||||
class: Chill\DocStoreBundle\Form\DocumentCategoryType
|
class: Chill\DocStoreBundle\Form\DocumentCategoryType
|
||||||
@@ -15,10 +16,8 @@ services:
|
|||||||
|
|
||||||
Chill\DocStoreBundle\Form\PersonDocumentType:
|
Chill\DocStoreBundle\Form\PersonDocumentType:
|
||||||
class: Chill\DocStoreBundle\Form\PersonDocumentType
|
class: Chill\DocStoreBundle\Form\PersonDocumentType
|
||||||
autowire: true
|
arguments:
|
||||||
autoconfigure: true
|
- "@chill.main.helper.translatable_string"
|
||||||
# arguments:
|
|
||||||
# - "@chill.main.helper.translatable_string"
|
|
||||||
tags:
|
tags:
|
||||||
- { name: form.type, alias: chill_docstorebundle_form_document }
|
- { name: form.type, alias: chill_docstorebundle_form_document }
|
||||||
|
|
||||||
@@ -28,8 +27,3 @@ services:
|
|||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.role }
|
- { name: chill.role }
|
||||||
|
|
||||||
Chill\DocStoreBundle\Workflow\:
|
|
||||||
resource: './../Workflow/'
|
|
||||||
autoconfigure: true
|
|
||||||
autowire: true
|
|
||||||
|
@@ -1,6 +0,0 @@
|
|||||||
services:
|
|
||||||
|
|
||||||
Chill\DocStoreBundle\Templating\:
|
|
||||||
resource: ../../Templating
|
|
||||||
autoconfigure: true
|
|
||||||
autowire: true
|
|
@@ -1,76 +0,0 @@
|
|||||||
<?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\DocStore;
|
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementations of create and update traits for Document entity + template property added.
|
|
||||||
*/
|
|
||||||
final class Version20220131093117 extends AbstractMigration
|
|
||||||
{
|
|
||||||
public function down(Schema $schema): void
|
|
||||||
{
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.person_document DROP CONSTRAINT FK_41DA53C5DA0FB8');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.person_document DROP CONSTRAINT FK_41DA53C3174800F');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.person_document DROP CONSTRAINT FK_41DA53C65FF1AEC');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.person_document DROP template_id');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.person_document DROP createdAt');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.person_document DROP updatedAt');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.person_document DROP createdBy_id');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.person_document DROP updatedBy_id');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP CONSTRAINT FK_A45098F65DA0FB8');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP CONSTRAINT FK_A45098F63174800F');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP CONSTRAINT FK_A45098F665FF1AEC');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP template_id');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP createdAt');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP updatedAt');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP createdBy_id');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP updatedBy_id');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDescription(): string
|
|
||||||
{
|
|
||||||
return 'Implementations of create and update traits for Document entity + template property added';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function up(Schema $schema): void
|
|
||||||
{
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD template_id INT DEFAULT NULL');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD createdAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD updatedAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD createdBy_id INT DEFAULT NULL');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD updatedBy_id INT DEFAULT NULL');
|
|
||||||
$this->addSql('COMMENT ON COLUMN chill_doc.accompanyingcourse_document.createdAt IS \'(DC2Type:datetime_immutable)\'');
|
|
||||||
$this->addSql('COMMENT ON COLUMN chill_doc.accompanyingcourse_document.updatedAt IS \'(DC2Type:datetime_immutable)\'');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD CONSTRAINT FK_A45098F65DA0FB8 FOREIGN KEY (template_id) REFERENCES chill_docgen_template (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD CONSTRAINT FK_A45098F63174800F FOREIGN KEY (createdBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD CONSTRAINT FK_A45098F665FF1AEC FOREIGN KEY (updatedBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
|
||||||
$this->addSql('CREATE INDEX IDX_A45098F65DA0FB8 ON chill_doc.accompanyingcourse_document (template_id)');
|
|
||||||
$this->addSql('CREATE INDEX IDX_A45098F63174800F ON chill_doc.accompanyingcourse_document (createdBy_id)');
|
|
||||||
$this->addSql('CREATE INDEX IDX_A45098F665FF1AEC ON chill_doc.accompanyingcourse_document (updatedBy_id)');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.person_document ADD template_id INT DEFAULT NULL');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.person_document ADD createdAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.person_document ADD updatedAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.person_document ADD createdBy_id INT DEFAULT NULL');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.person_document ADD updatedBy_id INT DEFAULT NULL');
|
|
||||||
$this->addSql('COMMENT ON COLUMN chill_doc.person_document.createdAt IS \'(DC2Type:datetime_immutable)\'');
|
|
||||||
$this->addSql('COMMENT ON COLUMN chill_doc.person_document.updatedAt IS \'(DC2Type:datetime_immutable)\'');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.person_document ADD CONSTRAINT FK_41DA53C5DA0FB8 FOREIGN KEY (template_id) REFERENCES chill_docgen_template (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.person_document ADD CONSTRAINT FK_41DA53C3174800F FOREIGN KEY (createdBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
|
||||||
$this->addSql('ALTER TABLE chill_doc.person_document ADD CONSTRAINT FK_41DA53C65FF1AEC FOREIGN KEY (updatedBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
|
||||||
$this->addSql('CREATE INDEX IDX_41DA53C5DA0FB8 ON chill_doc.person_document (template_id)');
|
|
||||||
$this->addSql('CREATE INDEX IDX_41DA53C3174800F ON chill_doc.person_document (createdBy_id)');
|
|
||||||
$this->addSql('CREATE INDEX IDX_41DA53C65FF1AEC ON chill_doc.person_document (updatedBy_id)');
|
|
||||||
}
|
|
||||||
}
|
|
@@ -9,8 +9,6 @@ Create new document: Créer un nouveau document
|
|||||||
New document for %name%: Nouveau document pour %name%
|
New document for %name%: Nouveau document pour %name%
|
||||||
Editing document for %name%: Modification d'un document pour %name%
|
Editing document for %name%: Modification d'un document pour %name%
|
||||||
Edit Document: Modification d'un document
|
Edit Document: Modification d'un document
|
||||||
Update document: Modifier le document
|
|
||||||
Edit attributes: Modifier les propriétés du document
|
|
||||||
Existing document: Document existant
|
Existing document: Document existant
|
||||||
No document to download: Aucun document à télécharger
|
No document to download: Aucun document à télécharger
|
||||||
'Choose a document category': Choisissez une catégorie de document
|
'Choose a document category': Choisissez une catégorie de document
|
||||||
@@ -53,6 +51,3 @@ Document class: Classe de document
|
|||||||
no records found:
|
no records found:
|
||||||
Create new category: Créer une nouvelle catégorie
|
Create new category: Créer une nouvelle catégorie
|
||||||
Back to the category list: Retour à la liste
|
Back to the category list: Retour à la liste
|
||||||
|
|
||||||
# WOPI EDIT
|
|
||||||
online_edit_document: Éditer en ligne
|
|
||||||
|
@@ -31,7 +31,6 @@ use Chill\MainBundle\Security\Resolver\ScopeResolverInterface;
|
|||||||
use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
|
use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
|
||||||
use Chill\MainBundle\Templating\Entity\CompilerPass as RenderEntityCompilerPass;
|
use Chill\MainBundle\Templating\Entity\CompilerPass as RenderEntityCompilerPass;
|
||||||
use Chill\MainBundle\Templating\UI\NotificationCounterInterface;
|
use Chill\MainBundle\Templating\UI\NotificationCounterInterface;
|
||||||
use Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface;
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||||
|
|
||||||
@@ -57,8 +56,6 @@ class ChillMainBundle extends Bundle
|
|||||||
->addTag('chill_main.notification_handler');
|
->addTag('chill_main.notification_handler');
|
||||||
$container->registerForAutoconfiguration(NotificationCounterInterface::class)
|
$container->registerForAutoconfiguration(NotificationCounterInterface::class)
|
||||||
->addTag('chill.count_notification.user');
|
->addTag('chill.count_notification.user');
|
||||||
$container->registerForAutoconfiguration(EntityWorkflowHandlerInterface::class)
|
|
||||||
->addTag('chill_main.workflow_handler');
|
|
||||||
|
|
||||||
$container->addCompilerPass(new SearchableServicesCompilerPass());
|
$container->addCompilerPass(new SearchableServicesCompilerPass());
|
||||||
$container->addCompilerPass(new ConfigConsistencyCompilerPass());
|
$container->addCompilerPass(new ConfigConsistencyCompilerPass());
|
||||||
|
@@ -12,8 +12,6 @@ declare(strict_types=1);
|
|||||||
namespace Chill\MainBundle\Controller;
|
namespace Chill\MainBundle\Controller;
|
||||||
|
|
||||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,7 +19,7 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
*/
|
*/
|
||||||
class LocationApiController extends ApiController
|
class LocationApiController extends ApiController
|
||||||
{
|
{
|
||||||
protected function customizeQuery(string $action, Request $request, $query): void
|
public function customizeQuery(string $action, Request $request, $query): void
|
||||||
{
|
{
|
||||||
$query
|
$query
|
||||||
->leftJoin('e.locationType', 'lt')
|
->leftJoin('e.locationType', 'lt')
|
||||||
@@ -33,14 +31,4 @@ class LocationApiController extends ApiController
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param QueryBuilder $query
|
|
||||||
* @param mixed $_format
|
|
||||||
*/
|
|
||||||
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format)
|
|
||||||
{
|
|
||||||
return $query
|
|
||||||
->addOrderBy('e.name', 'ASC');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -13,19 +13,13 @@ namespace Chill\MainBundle\Controller;
|
|||||||
|
|
||||||
use Chill\MainBundle\Entity\Notification;
|
use Chill\MainBundle\Entity\Notification;
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
|
||||||
use Chill\MainBundle\Repository\NotificationRepository;
|
|
||||||
use Chill\MainBundle\Security\Authorization\NotificationVoter;
|
use Chill\MainBundle\Security\Authorization\NotificationVoter;
|
||||||
use Chill\MainBundle\Serializer\Model\Collection;
|
|
||||||
use Chill\MainBundle\Serializer\Model\Counter;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
use Symfony\Component\Serializer\SerializerInterface;
|
|
||||||
use UnexpectedValueException;
|
use UnexpectedValueException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,26 +29,12 @@ class NotificationApiController
|
|||||||
{
|
{
|
||||||
private EntityManagerInterface $entityManager;
|
private EntityManagerInterface $entityManager;
|
||||||
|
|
||||||
private NotificationRepository $notificationRepository;
|
|
||||||
|
|
||||||
private PaginatorFactory $paginatorFactory;
|
|
||||||
|
|
||||||
private Security $security;
|
private Security $security;
|
||||||
|
|
||||||
private SerializerInterface $serializer;
|
public function __construct(EntityManagerInterface $entityManager, Security $security)
|
||||||
|
{
|
||||||
public function __construct(
|
|
||||||
EntityManagerInterface $entityManager,
|
|
||||||
NotificationRepository $notificationRepository,
|
|
||||||
PaginatorFactory $paginatorFactory,
|
|
||||||
Security $security,
|
|
||||||
SerializerInterface $serializer
|
|
||||||
) {
|
|
||||||
$this->entityManager = $entityManager;
|
$this->entityManager = $entityManager;
|
||||||
$this->notificationRepository = $notificationRepository;
|
|
||||||
$this->paginatorFactory = $paginatorFactory;
|
|
||||||
$this->security = $security;
|
$this->security = $security;
|
||||||
$this->serializer = $serializer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,37 +53,6 @@ class NotificationApiController
|
|||||||
return $this->markAs('unread', $notification);
|
return $this->markAs('unread', $notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @Route("/my/unread")
|
|
||||||
*/
|
|
||||||
public function myUnreadNotifications(Request $request): JsonResponse
|
|
||||||
{
|
|
||||||
$total = $this->notificationRepository->countUnreadByUser($this->security->getUser());
|
|
||||||
|
|
||||||
if ($request->query->getBoolean('countOnly')) {
|
|
||||||
return new JsonResponse(
|
|
||||||
$this->serializer->serialize(new Counter($total), 'json', ['groups' => ['read']]),
|
|
||||||
JsonResponse::HTTP_OK,
|
|
||||||
[],
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
$paginator = $this->paginatorFactory->create($total);
|
|
||||||
$notifications = $this->notificationRepository->findUnreadByUser(
|
|
||||||
$this->security->getUser(),
|
|
||||||
$paginator->getItemsPerPage(),
|
|
||||||
$paginator->getCurrentPageFirstItemNumber()
|
|
||||||
);
|
|
||||||
$collection = new Collection($notifications, $paginator);
|
|
||||||
|
|
||||||
return new JsonResponse(
|
|
||||||
$this->serializer->serialize($collection, 'json', ['groups' => ['read']]),
|
|
||||||
JsonResponse::HTTP_OK,
|
|
||||||
[],
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function markAs(string $target, Notification $notification): JsonResponse
|
private function markAs(string $target, Notification $notification): JsonResponse
|
||||||
{
|
{
|
||||||
if (!$this->security->isGranted(NotificationVoter::NOTIFICATION_TOGGLE_READ_STATUS, $notification)) {
|
if (!$this->security->isGranted(NotificationVoter::NOTIFICATION_TOGGLE_READ_STATUS, $notification)) {
|
||||||
|
@@ -236,10 +236,6 @@ class NotificationController extends AbstractController
|
|||||||
'_fragment' => 'comment-' . $commentId,
|
'_fragment' => 'comment-' . $commentId,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($editedCommentForm->isSubmitted() && !$editedCommentForm->isValid()) {
|
|
||||||
$this->addFlash('error', $this->translator->trans('This form contains errors'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,10 +257,6 @@ class NotificationController extends AbstractController
|
|||||||
'id' => $notification->getId(),
|
'id' => $notification->getId(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($appendCommentForm->isSubmitted() && !$appendCommentForm->isValid()) {
|
|
||||||
$this->addFlash('error', $this->translator->trans('This form contains errors'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,118 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Chill is a software for social workers
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Controller;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use LogicException;
|
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
|
||||||
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
|
||||||
use Symfony\Component\Security\Core\Security;
|
|
||||||
|
|
||||||
class WorkflowApiController
|
|
||||||
{
|
|
||||||
private EntityManagerInterface $entityManager;
|
|
||||||
|
|
||||||
private Security $security;
|
|
||||||
|
|
||||||
public function __construct(Security $security, EntityManagerInterface $entityManager)
|
|
||||||
{
|
|
||||||
$this->entityManager = $entityManager;
|
|
||||||
$this->security = $security;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Route("/api/1.0/main/workflow/{id}/subscribe", methods={"POST"})
|
|
||||||
*/
|
|
||||||
public function subscribe(EntityWorkflow $entityWorkflow, Request $request): Response
|
|
||||||
{
|
|
||||||
return $this->handleSubscription($entityWorkflow, $request, 'subscribe');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Route("/api/1.0/main/workflow/{id}/unsubscribe", methods={"POST"})
|
|
||||||
*/
|
|
||||||
public function unsubscribe(EntityWorkflow $entityWorkflow, Request $request): Response
|
|
||||||
{
|
|
||||||
return $this->handleSubscription($entityWorkflow, $request, 'unsubscribe');
|
|
||||||
}
|
|
||||||
|
|
||||||
private function handleSubscription(EntityWorkflow $entityWorkflow, Request $request, string $action): JsonResponse
|
|
||||||
{
|
|
||||||
if (!$this->security->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
|
|
||||||
throw new AccessDeniedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$request->query->has('subscribe')) {
|
|
||||||
throw new BadRequestHttpException('missing subscribe parameter');
|
|
||||||
}
|
|
||||||
|
|
||||||
$user = $this->security->getUser();
|
|
||||||
|
|
||||||
switch ($request->query->get('subscribe')) {
|
|
||||||
case 'final':
|
|
||||||
switch ($action) {
|
|
||||||
case 'subscribe':
|
|
||||||
$entityWorkflow->addSubscriberToFinal($user);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'unsubscribe':
|
|
||||||
$entityWorkflow->removeSubscriberToFinal($user);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new LogicException();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'step':
|
|
||||||
switch ($action) {
|
|
||||||
case 'subscribe':
|
|
||||||
$entityWorkflow->addSubscriberToStep($user);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'unsubscribe':
|
|
||||||
$entityWorkflow->removeSubscriberToStep($user);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new LogicException();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new BadRequestHttpException('subscribe parameter must be equal to "step" or "final"');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->entityManager->flush();
|
|
||||||
|
|
||||||
return new JsonResponse(
|
|
||||||
[
|
|
||||||
'step' => $entityWorkflow->isUserSubscribedToStep($user),
|
|
||||||
'final' => $entityWorkflow->isUserSubscribedToFinal($user),
|
|
||||||
],
|
|
||||||
JsonResponse::HTTP_OK,
|
|
||||||
[],
|
|
||||||
false
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,269 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Chill is a software for social workers
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Controller;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
|
|
||||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflowComment;
|
|
||||||
use Chill\MainBundle\Form\EntityWorkflowCommentType;
|
|
||||||
use Chill\MainBundle\Form\WorkflowStepType;
|
|
||||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
|
||||||
use Chill\MainBundle\Repository\Workflow\EntityWorkflowRepository;
|
|
||||||
use Chill\MainBundle\Security\Authorization\EntityWorkflowVoter;
|
|
||||||
use Chill\MainBundle\Workflow\EntityWorkflowManager;
|
|
||||||
use Chill\MainBundle\Workflow\Validator\StepDestValid;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
|
||||||
use Symfony\Component\Workflow\Registry;
|
|
||||||
use Symfony\Component\Workflow\TransitionBlocker;
|
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
use function count;
|
|
||||||
|
|
||||||
class WorkflowController extends AbstractController
|
|
||||||
{
|
|
||||||
private EntityManagerInterface $entityManager;
|
|
||||||
|
|
||||||
private EntityWorkflowManager $entityWorkflowManager;
|
|
||||||
|
|
||||||
private EntityWorkflowRepository $entityWorkflowRepository;
|
|
||||||
|
|
||||||
private PaginatorFactory $paginatorFactory;
|
|
||||||
|
|
||||||
private Registry $registry;
|
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
|
||||||
|
|
||||||
private ValidatorInterface $validator;
|
|
||||||
|
|
||||||
public function __construct(EntityWorkflowManager $entityWorkflowManager, EntityWorkflowRepository $entityWorkflowRepository, ValidatorInterface $validator, PaginatorFactory $paginatorFactory, Registry $registry, EntityManagerInterface $entityManager, TranslatorInterface $translator)
|
|
||||||
{
|
|
||||||
$this->entityWorkflowManager = $entityWorkflowManager;
|
|
||||||
$this->entityWorkflowRepository = $entityWorkflowRepository;
|
|
||||||
$this->validator = $validator;
|
|
||||||
$this->paginatorFactory = $paginatorFactory;
|
|
||||||
$this->registry = $registry;
|
|
||||||
$this->entityManager = $entityManager;
|
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Route("/{_locale}/main/workflow/create", name="chill_main_workflow_create")
|
|
||||||
*/
|
|
||||||
public function create(Request $request): Response
|
|
||||||
{
|
|
||||||
if (!$request->query->has('entityClass')) {
|
|
||||||
throw new BadRequestHttpException('Missing entityClass parameter');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$request->query->has('entityId')) {
|
|
||||||
throw new BadRequestHttpException('missing entityId parameter');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$request->query->has('workflow')) {
|
|
||||||
throw new BadRequestHttpException('missing workflow parameter');
|
|
||||||
}
|
|
||||||
|
|
||||||
$entityWorkflow = new EntityWorkflow();
|
|
||||||
$entityWorkflow
|
|
||||||
->setRelatedEntityClass($request->query->get('entityClass'))
|
|
||||||
->setRelatedEntityId($request->query->getInt('entityId'))
|
|
||||||
->setWorkflowName($request->query->get('workflow'));
|
|
||||||
|
|
||||||
$errors = $this->validator->validate($entityWorkflow, null, ['creation']);
|
|
||||||
|
|
||||||
if (count($errors) > 0) {
|
|
||||||
$msg = [];
|
|
||||||
|
|
||||||
foreach ($errors as $error) {
|
|
||||||
/** @var \Symfony\Component\Validator\ConstraintViolationInterface $error */
|
|
||||||
$msg[] = $error->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Response(implode("\n", $msg), Response::HTTP_UNPROCESSABLE_ENTITY);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted(EntityWorkflowVoter::CREATE, $entityWorkflow);
|
|
||||||
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$em->persist($entityWorkflow);
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
return $this->redirectToRoute('chill_main_workflow_show', ['id' => $entityWorkflow->getId()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Route("/{_locale}/main/workflow/list/dest", name="chill_main_workflow_list_dest")
|
|
||||||
*/
|
|
||||||
public function myWorkflowsDest(Request $request): Response
|
|
||||||
{
|
|
||||||
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
|
|
||||||
|
|
||||||
$total = $this->entityWorkflowRepository->countByDest($this->getUser());
|
|
||||||
$paginator = $this->paginatorFactory->create($total);
|
|
||||||
|
|
||||||
$workflows = $this->entityWorkflowRepository->findByDest(
|
|
||||||
$this->getUser(),
|
|
||||||
['createdAt' => 'DESC'],
|
|
||||||
$paginator->getItemsPerPage(),
|
|
||||||
$paginator->getCurrentPageFirstItemNumber()
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this->render(
|
|
||||||
'@ChillMain/Workflow/list.html.twig',
|
|
||||||
[
|
|
||||||
'workflows' => $this->buildHandler($workflows),
|
|
||||||
'paginator' => $paginator,
|
|
||||||
'step' => 'dest',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Route("/{_locale}/main/workflow/list/subscribed", name="chill_main_workflow_list_subscribed")
|
|
||||||
*/
|
|
||||||
public function myWorkflowsSubscribed(Request $request): Response
|
|
||||||
{
|
|
||||||
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
|
|
||||||
|
|
||||||
$total = $this->entityWorkflowRepository->countBySubscriber($this->getUser());
|
|
||||||
$paginator = $this->paginatorFactory->create($total);
|
|
||||||
|
|
||||||
$workflows = $this->entityWorkflowRepository->findBySubscriber(
|
|
||||||
$this->getUser(),
|
|
||||||
['createdAt' => 'DESC'],
|
|
||||||
$paginator->getItemsPerPage(),
|
|
||||||
$paginator->getCurrentPageFirstItemNumber()
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this->render(
|
|
||||||
'@ChillMain/Workflow/list.html.twig',
|
|
||||||
[
|
|
||||||
'workflows' => $this->buildHandler($workflows),
|
|
||||||
'paginator' => $paginator,
|
|
||||||
'step' => 'subscribed',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Route("/{_locale}/main/workflow/{id}/show", name="chill_main_workflow_show")
|
|
||||||
*/
|
|
||||||
public function show(EntityWorkflow $entityWorkflow, Request $request): Response
|
|
||||||
{
|
|
||||||
$this->denyAccessUnlessGranted(EntityWorkflowVoter::SEE, $entityWorkflow);
|
|
||||||
|
|
||||||
$handler = $this->entityWorkflowManager->getHandler($entityWorkflow);
|
|
||||||
$workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName());
|
|
||||||
$errors = [];
|
|
||||||
|
|
||||||
if (count($workflow->getEnabledTransitions($entityWorkflow)) > 0) {
|
|
||||||
// possible transition
|
|
||||||
$transitionForm = $this->createForm(
|
|
||||||
WorkflowStepType::class,
|
|
||||||
$entityWorkflow->getCurrentStep(),
|
|
||||||
['transition' => true, 'entity_workflow' => $entityWorkflow]
|
|
||||||
);
|
|
||||||
|
|
||||||
$transitionForm->handleRequest($request);
|
|
||||||
|
|
||||||
if ($transitionForm->isSubmitted() && $transitionForm->isValid()) {
|
|
||||||
if (!$workflow->can($entityWorkflow, $transition = $transitionForm['transition']->getData()->getName())) {
|
|
||||||
$blockers = $workflow->buildTransitionBlockerList($entityWorkflow, $transition);
|
|
||||||
$msgs = array_map(function (TransitionBlocker $tb) {
|
|
||||||
return $this->translator->trans(
|
|
||||||
$tb->getMessage(),
|
|
||||||
$tb->getParameters()
|
|
||||||
);
|
|
||||||
}, iterator_to_array($blockers));
|
|
||||||
|
|
||||||
throw $this->createAccessDeniedException(
|
|
||||||
sprintf(
|
|
||||||
"not allowed to apply transition {$transition}: %s",
|
|
||||||
implode(', ', $msgs)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$workflow->apply($entityWorkflow, $transition);
|
|
||||||
|
|
||||||
foreach ($transitionForm['future_dest_users']->getData() as $user) {
|
|
||||||
$entityWorkflow->getCurrentStep()->addDestUser($user);
|
|
||||||
}
|
|
||||||
|
|
||||||
$errors = $this->validator->validate(
|
|
||||||
$entityWorkflow->getCurrentStep(),
|
|
||||||
new StepDestValid()
|
|
||||||
);
|
|
||||||
|
|
||||||
if (count($errors) === 0) {
|
|
||||||
$this->entityManager->flush();
|
|
||||||
|
|
||||||
return $this->redirectToRoute('chill_main_workflow_show', ['id' => $entityWorkflow->getId()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Response((string) $errors, Response::HTTP_UNPROCESSABLE_ENTITY);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($transitionForm->isSubmitted() && !$transitionForm->isValid()) {
|
|
||||||
$this->addFlash('error', $this->translator->trans('This form contains errors'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
$commentForm = $this->createForm(EntityWorkflowCommentType::class, $newComment = new EntityWorkflowComment());
|
|
||||||
$commentForm->handleRequest($request);
|
|
||||||
|
|
||||||
if ($commentForm->isSubmitted() && $commentForm->isValid()) {
|
|
||||||
$this->entityManager->persist($newComment);
|
|
||||||
$this->entityManager->flush();
|
|
||||||
|
|
||||||
$this->addFlash('success', $this->translator->trans('workflow.Comment added'));
|
|
||||||
|
|
||||||
return $this->redirectToRoute('chill_main_workflow_show', ['id' => $entityWorkflow->getId()]);
|
|
||||||
} elseif ($commentForm->isSubmitted() && !$commentForm->isValid()) {
|
|
||||||
$this->addFlash('error', $this->translator->trans('This form contains errors'));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
return $this->render(
|
|
||||||
'@ChillMain/Workflow/index.html.twig',
|
|
||||||
[
|
|
||||||
'handler_template' => $handler->getTemplate($entityWorkflow),
|
|
||||||
'handler_template_title' => $handler->getTemplateTitle($entityWorkflow),
|
|
||||||
'handler_template_data' => $handler->getTemplateData($entityWorkflow),
|
|
||||||
'transition_form' => isset($transitionForm) ? $transitionForm->createView() : null,
|
|
||||||
'entity_workflow' => $entityWorkflow,
|
|
||||||
'transition_form_errors' => $errors,
|
|
||||||
//'comment_form' => $commentForm->createView(),
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function buildHandler(array $workflows): array
|
|
||||||
{
|
|
||||||
$lines = [];
|
|
||||||
|
|
||||||
foreach ($workflows as $workflow) {
|
|
||||||
$handler = $this->entityWorkflowManager->getHandler($workflow);
|
|
||||||
$lines[] = [
|
|
||||||
'handler' => $handler,
|
|
||||||
'entity_workflow' => $workflow,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $lines;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -168,7 +168,6 @@ class ChillMainExtension extends Extension implements
|
|||||||
$loader->load('services/timeline.yaml');
|
$loader->load('services/timeline.yaml');
|
||||||
$loader->load('services/search.yaml');
|
$loader->load('services/search.yaml');
|
||||||
$loader->load('services/serializer.yaml');
|
$loader->load('services/serializer.yaml');
|
||||||
$loader->load('services/mailer.yaml');
|
|
||||||
|
|
||||||
$this->configureCruds($container, $config['cruds'], $config['apis'], $loader);
|
$this->configureCruds($container, $config['cruds'], $config['apis'], $loader);
|
||||||
}
|
}
|
||||||
@@ -392,26 +391,6 @@ class ChillMainExtension extends Extension implements
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
|
||||||
'class' => \Chill\MainBundle\Entity\UserJob::class,
|
|
||||||
'name' => 'user_job',
|
|
||||||
'base_path' => '/api/1.0/main/user-job',
|
|
||||||
'base_role' => 'ROLE_USER',
|
|
||||||
'actions' => [
|
|
||||||
'_index' => [
|
|
||||||
'methods' => [
|
|
||||||
Request::METHOD_GET => true,
|
|
||||||
Request::METHOD_HEAD => true,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'_entity' => [
|
|
||||||
'methods' => [
|
|
||||||
Request::METHOD_GET => true,
|
|
||||||
Request::METHOD_HEAD => true,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
'controller' => \Chill\MainBundle\Controller\AddressReferenceAPIController::class,
|
'controller' => \Chill\MainBundle\Controller\AddressReferenceAPIController::class,
|
||||||
'class' => \Chill\MainBundle\Entity\AddressReference::class,
|
'class' => \Chill\MainBundle\Entity\AddressReference::class,
|
||||||
|
@@ -1,56 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Chill is a software for social workers
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Doctrine\Model;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\User;
|
|
||||||
use DateTime;
|
|
||||||
use DateTimeImmutable;
|
|
||||||
use DateTimeInterface;
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
trait TrackCreationTrait
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="datetime_immutable", nullable=true, options={"default": NULL})
|
|
||||||
*/
|
|
||||||
private ?DateTimeImmutable $createdAt = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToOne(targetEntity=User::class)
|
|
||||||
* @ORM\JoinColumn(nullable=true)
|
|
||||||
*/
|
|
||||||
private ?User $createdBy = null;
|
|
||||||
|
|
||||||
public function getCreatedAt(): ?DateTimeInterface
|
|
||||||
{
|
|
||||||
return $this->createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCreatedBy(): ?User
|
|
||||||
{
|
|
||||||
return $this->createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setCreatedAt(DateTimeInterface $datetime): self
|
|
||||||
{
|
|
||||||
$this->createdAt = $datetime instanceof DateTime ? DateTimeImmutable::createFromMutable($datetime) : $datetime;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setCreatedBy(User $user): self
|
|
||||||
{
|
|
||||||
$this->createdBy = $user;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,56 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Chill is a software for social workers
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Doctrine\Model;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\User;
|
|
||||||
use DateTime;
|
|
||||||
use DateTimeImmutable;
|
|
||||||
use DateTimeInterface;
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
trait TrackUpdateTrait
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="datetime_immutable", nullable=true, options={"default": NULL})
|
|
||||||
*/
|
|
||||||
private ?DateTimeImmutable $updatedAt = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToOne(targetEntity=User::class)
|
|
||||||
* @ORM\JoinColumn(nullable=true)
|
|
||||||
*/
|
|
||||||
private ?User $updatedBy = null;
|
|
||||||
|
|
||||||
public function getUpdatedAt(): ?DateTimeInterface
|
|
||||||
{
|
|
||||||
return $this->updatedAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getUpdatedBy(): ?User
|
|
||||||
{
|
|
||||||
return $this->updatedBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setUpdatedAt(DateTimeInterface $datetime): self
|
|
||||||
{
|
|
||||||
$this->updatedAt = $datetime instanceof DateTime ? DateTimeImmutable::createFromMutable($datetime) : $datetime;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setUpdatedBy(User $user): self
|
|
||||||
{
|
|
||||||
$this->updatedBy = $user;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -42,16 +42,10 @@ class Address
|
|||||||
*/
|
*/
|
||||||
private $buildingName;
|
private $buildingName;
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="boolean")
|
|
||||||
* @Groups({"write"})
|
|
||||||
*/
|
|
||||||
private bool $confidential = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string|null
|
* @var string|null
|
||||||
*
|
*
|
||||||
* @ORM\Column(type="string", length=255, nullable=true)
|
* @ORM\Column(type="string", length=16, nullable=true)
|
||||||
* @Groups({"write"})
|
* @Groups({"write"})
|
||||||
*/
|
*/
|
||||||
private $corridor;
|
private $corridor;
|
||||||
@@ -84,7 +78,7 @@ class Address
|
|||||||
/**
|
/**
|
||||||
* @var string|null
|
* @var string|null
|
||||||
*
|
*
|
||||||
* @ORM\Column(type="string", length=255, nullable=true)
|
* @ORM\Column(type="string", length=16, nullable=true)
|
||||||
* @Groups({"write"})
|
* @Groups({"write"})
|
||||||
*/
|
*/
|
||||||
private $flat;
|
private $flat;
|
||||||
@@ -92,7 +86,7 @@ class Address
|
|||||||
/**
|
/**
|
||||||
* @var string|null
|
* @var string|null
|
||||||
*
|
*
|
||||||
* @ORM\Column(type="string", length=255, nullable=true)
|
* @ORM\Column(type="string", length=16, nullable=true)
|
||||||
* @Groups({"write"})
|
* @Groups({"write"})
|
||||||
*/
|
*/
|
||||||
private $floor;
|
private $floor;
|
||||||
@@ -149,7 +143,7 @@ class Address
|
|||||||
/**
|
/**
|
||||||
* @var string|null
|
* @var string|null
|
||||||
*
|
*
|
||||||
* @ORM\Column(type="string", length=255, nullable=true)
|
* @ORM\Column(type="string", length=16, nullable=true)
|
||||||
* @Groups({"write"})
|
* @Groups({"write"})
|
||||||
*/
|
*/
|
||||||
private $steps;
|
private $steps;
|
||||||
@@ -198,7 +192,6 @@ class Address
|
|||||||
return (new Address())
|
return (new Address())
|
||||||
->setAddressReference($original->getAddressReference())
|
->setAddressReference($original->getAddressReference())
|
||||||
->setBuildingName($original->getBuildingName())
|
->setBuildingName($original->getBuildingName())
|
||||||
->setConfidential($original->getConfidential())
|
|
||||||
->setCorridor($original->getCorridor())
|
->setCorridor($original->getCorridor())
|
||||||
->setCustoms($original->getCustoms())
|
->setCustoms($original->getCustoms())
|
||||||
->setDistribution($original->getDistribution())
|
->setDistribution($original->getDistribution())
|
||||||
@@ -236,11 +229,6 @@ class Address
|
|||||||
return $this->buildingName;
|
return $this->buildingName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getConfidential(): bool
|
|
||||||
{
|
|
||||||
return $this->confidential;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCorridor(): ?string
|
public function getCorridor(): ?string
|
||||||
{
|
{
|
||||||
return $this->corridor;
|
return $this->corridor;
|
||||||
@@ -381,13 +369,6 @@ class Address
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setConfidential(bool $confidential): self
|
|
||||||
{
|
|
||||||
$this->confidential = $confidential;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setCorridor(?string $corridor): self
|
public function setCorridor(?string $corridor): self
|
||||||
{
|
{
|
||||||
$this->corridor = $corridor;
|
$this->corridor = $corridor;
|
||||||
|
@@ -20,9 +20,10 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
class CommentEmbeddable
|
class CommentEmbeddable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* @var string
|
||||||
* @ORM\Column(type="text", nullable=true)
|
* @ORM\Column(type="text", nullable=true)
|
||||||
*/
|
*/
|
||||||
private ?string $comment = null;
|
private $comment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var DateTime
|
* @var DateTime
|
||||||
@@ -38,7 +39,10 @@ class CommentEmbeddable
|
|||||||
*/
|
*/
|
||||||
private $userId;
|
private $userId;
|
||||||
|
|
||||||
public function getComment(): ?string
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getComment()
|
||||||
{
|
{
|
||||||
return $this->comment;
|
return $this->comment;
|
||||||
}
|
}
|
||||||
@@ -64,6 +68,9 @@ class CommentEmbeddable
|
|||||||
return empty($this->getComment());
|
return empty($this->getComment());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $comment
|
||||||
|
*/
|
||||||
public function setComment(?string $comment)
|
public function setComment(?string $comment)
|
||||||
{
|
{
|
||||||
$this->comment = $comment;
|
$this->comment = $comment;
|
||||||
|
@@ -64,7 +64,7 @@ class Location implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="string", length=255, nullable=true)
|
* @ORM\Column(type="string", length=255, nullable=true)
|
||||||
* @Serializer\Groups({"read", "write", "docgen:read"})
|
* @Serializer\Groups({"read", "write"})
|
||||||
*/
|
*/
|
||||||
private ?string $email = null;
|
private ?string $email = null;
|
||||||
|
|
||||||
|
@@ -23,9 +23,6 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
* @ORM\Table(
|
* @ORM\Table(
|
||||||
* name="chill_main_notification",
|
* name="chill_main_notification",
|
||||||
* indexes={
|
|
||||||
* @ORM\Index(name="chill_main_notification_related_entity_idx", columns={"relatedentityclass", "relatedentityid"})
|
|
||||||
* }
|
|
||||||
* )
|
* )
|
||||||
* @ORM\HasLifecycleCallbacks
|
* @ORM\HasLifecycleCallbacks
|
||||||
*/
|
*/
|
||||||
|
@@ -18,7 +18,6 @@ use DateTimeInterface;
|
|||||||
use Doctrine\ORM\Event\LifecycleEventArgs;
|
use Doctrine\ORM\Event\LifecycleEventArgs;
|
||||||
use Doctrine\ORM\Event\PreFlushEventArgs;
|
use Doctrine\ORM\Event\PreFlushEventArgs;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
@@ -29,7 +28,6 @@ class NotificationComment implements TrackCreationInterface, TrackUpdateInterfac
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="text")
|
* @ORM\Column(type="text")
|
||||||
* @Assert\NotBlank(message="notification.Comment content might not be blank")
|
|
||||||
*/
|
*/
|
||||||
private string $content = '';
|
private string $content = '';
|
||||||
|
|
||||||
@@ -138,9 +136,9 @@ class NotificationComment implements TrackCreationInterface, TrackUpdateInterfac
|
|||||||
$this->recentlyPersisted = true;
|
$this->recentlyPersisted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setContent(?string $content): self
|
public function setContent(string $content): self
|
||||||
{
|
{
|
||||||
$this->content = (string) $content;
|
$this->content = $content;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@@ -1,166 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Chill is a software for social workers
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Entity;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
|
||||||
use Chill\MainBundle\Repository\ResidentialAddressRepository;
|
|
||||||
use Chill\PersonBundle\Entity\Person;
|
|
||||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
|
||||||
use DateTimeImmutable;
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Entity(repositoryClass=ResidentialAddressRepository::class)
|
|
||||||
* @ORM\Table(name="chill_main_residential_address")
|
|
||||||
*/
|
|
||||||
class ResidentialAddress
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToOne(targetEntity=Address::class)
|
|
||||||
* @ORM\JoinColumn(nullable=true)
|
|
||||||
*/
|
|
||||||
private ?Address $address = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="residentialAddressComment_")
|
|
||||||
*/
|
|
||||||
private CommentEmbeddable $comment;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="datetime_immutable", nullable=true)
|
|
||||||
*/
|
|
||||||
private ?DateTimeImmutable $endDate = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToOne(targetEntity=Person::class)
|
|
||||||
* @ORM\JoinColumn(nullable=true)
|
|
||||||
*/
|
|
||||||
private ?Person $hostPerson = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
|
|
||||||
* @ORM\JoinColumn(nullable=true)
|
|
||||||
*/
|
|
||||||
private ?ThirdParty $hostThirdParty = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Id
|
|
||||||
* @ORM\GeneratedValue
|
|
||||||
* @ORM\Column(type="integer")
|
|
||||||
*/
|
|
||||||
private $id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToOne(targetEntity=Person::class)
|
|
||||||
* @ORM\JoinColumn(nullable=false)
|
|
||||||
*/
|
|
||||||
private Person $person;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="datetime_immutable")
|
|
||||||
*/
|
|
||||||
private ?DateTimeImmutable $startDate = null;
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->comment = new CommentEmbeddable();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getAddress(): ?Address
|
|
||||||
{
|
|
||||||
return $this->address;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getComment(): CommentEmbeddable
|
|
||||||
{
|
|
||||||
return $this->comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getEndDate(): ?DateTimeImmutable
|
|
||||||
{
|
|
||||||
return $this->endDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getHostPerson(): ?Person
|
|
||||||
{
|
|
||||||
return $this->hostPerson;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getHostThirdParty(): ?ThirdParty
|
|
||||||
{
|
|
||||||
return $this->hostThirdParty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getId(): ?int
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPerson(): ?Person
|
|
||||||
{
|
|
||||||
return $this->person;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getStartDate(): ?DateTimeImmutable
|
|
||||||
{
|
|
||||||
return $this->startDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setAddress(?Address $address): self
|
|
||||||
{
|
|
||||||
$this->address = $address;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setComment(CommentEmbeddable $comment): self
|
|
||||||
{
|
|
||||||
$this->comment = $comment;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setEndDate(?DateTimeImmutable $endDate): self
|
|
||||||
{
|
|
||||||
$this->endDate = $endDate;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setHostPerson(?Person $hostPerson): self
|
|
||||||
{
|
|
||||||
$this->hostPerson = $hostPerson;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setHostThirdParty(?ThirdParty $hostThirdParty): self
|
|
||||||
{
|
|
||||||
$this->hostThirdParty = $hostThirdParty;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setPerson(?Person $person): self
|
|
||||||
{
|
|
||||||
$this->person = $person;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setStartDate(DateTimeImmutable $startDate): self
|
|
||||||
{
|
|
||||||
$this->startDate = $startDate;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,456 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Chill is a software for social workers
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Entity\Workflow;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
|
||||||
use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
|
|
||||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
|
||||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
|
|
||||||
use Chill\MainBundle\Entity\User;
|
|
||||||
use Chill\MainBundle\Workflow\Validator\EntityWorkflowCreation;
|
|
||||||
use DateTimeInterface;
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
use Iterator;
|
|
||||||
use RuntimeException;
|
|
||||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
|
||||||
use function count;
|
|
||||||
use function is_array;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Entity
|
|
||||||
* @ORM\Table("chill_main_workflow_entity")
|
|
||||||
* @EntityWorkflowCreation(groups={"creation"})
|
|
||||||
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
|
|
||||||
* "entity_workflow": EntityWorkflow::class
|
|
||||||
* })
|
|
||||||
*/
|
|
||||||
class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
|
|
||||||
{
|
|
||||||
use TrackCreationTrait;
|
|
||||||
|
|
||||||
use TrackUpdateTrait;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\OneToMany(targetEntity=EntityWorkflowComment::class, mappedBy="entityWorkflow", orphanRemoval=true)
|
|
||||||
*
|
|
||||||
* @var Collection|EntityWorkflowComment[]
|
|
||||||
*/
|
|
||||||
private Collection $comments;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Id
|
|
||||||
* @ORM\GeneratedValue
|
|
||||||
* @ORM\Column(type="integer")
|
|
||||||
*/
|
|
||||||
private ?int $id = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="string", length=255)
|
|
||||||
*/
|
|
||||||
private string $relatedEntityClass = '';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="integer")
|
|
||||||
*/
|
|
||||||
private int $relatedEntityId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\OneToMany(targetEntity=EntityWorkflowStep::class, mappedBy="entityWorkflow", orphanRemoval=true, cascade={"persist"})
|
|
||||||
* @ORM\OrderBy({"transitionAt": "ASC", "id": "ASC"})
|
|
||||||
*
|
|
||||||
* @var Collection|EntityWorkflowStep[]
|
|
||||||
*/
|
|
||||||
private Collection $steps;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var null|array|EntityWorkflowStep[]
|
|
||||||
*/
|
|
||||||
private ?array $stepsChainedCache = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToMany(targetEntity=User::class)
|
|
||||||
* @ORM\JoinTable(name="chill_main_workflow_entity_subscriber_to_final")
|
|
||||||
*
|
|
||||||
* @var Collection|User[]
|
|
||||||
*/
|
|
||||||
private Collection $subscriberToFinal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToMany(targetEntity=User::class)
|
|
||||||
* @ORM\JoinTable(name="chill_main_workflow_entity_subscriber_to_step")
|
|
||||||
*
|
|
||||||
* @var Collection|User[]
|
|
||||||
*/
|
|
||||||
private Collection $subscriberToStep;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a step which will store all the transition data.
|
|
||||||
*/
|
|
||||||
private ?EntityWorkflowStep $transitionningStep = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="text")
|
|
||||||
*/
|
|
||||||
private string $workflowName;
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->subscriberToFinal = new ArrayCollection();
|
|
||||||
$this->subscriberToStep = new ArrayCollection();
|
|
||||||
$this->comments = new ArrayCollection();
|
|
||||||
$this->steps = new ArrayCollection();
|
|
||||||
|
|
||||||
$initialStep = new EntityWorkflowStep();
|
|
||||||
$initialStep
|
|
||||||
->setCurrentStep('initial');
|
|
||||||
$this->addStep($initialStep);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addComment(EntityWorkflowComment $comment): self
|
|
||||||
{
|
|
||||||
if (!$this->comments->contains($comment)) {
|
|
||||||
$this->comments[] = $comment;
|
|
||||||
$comment->setEntityWorkflow($this);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal You should prepare a step and run a workflow transition instead of manually adding a step
|
|
||||||
*/
|
|
||||||
public function addStep(EntityWorkflowStep $step): self
|
|
||||||
{
|
|
||||||
if (!$this->steps->contains($step)) {
|
|
||||||
$this->steps[] = $step;
|
|
||||||
$step->setEntityWorkflow($this);
|
|
||||||
$this->stepsChainedCache = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addSubscriberToFinal(User $user): self
|
|
||||||
{
|
|
||||||
if (!$this->subscriberToFinal->contains($user)) {
|
|
||||||
$this->subscriberToFinal[] = $user;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addSubscriberToStep(User $user): self
|
|
||||||
{
|
|
||||||
if (!$this->subscriberToStep->contains($user)) {
|
|
||||||
$this->subscriberToStep[] = $user;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getComments(): Collection
|
|
||||||
{
|
|
||||||
return $this->comments;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCurrentStep(): ?EntityWorkflowStep
|
|
||||||
{
|
|
||||||
$step = $this->steps->last();
|
|
||||||
|
|
||||||
if (false !== $step) {
|
|
||||||
return $step;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCurrentStepChained(): ?EntityWorkflowStep
|
|
||||||
{
|
|
||||||
$steps = $this->getStepsChained();
|
|
||||||
$currentStep = $this->getCurrentStep();
|
|
||||||
|
|
||||||
foreach ($steps as $step) {
|
|
||||||
if ($step === $currentStep) {
|
|
||||||
return $step;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCurrentStepCreatedAt(): ?DateTimeInterface
|
|
||||||
{
|
|
||||||
if (null !== $previous = $this->getPreviousStepIfAny()) {
|
|
||||||
return $previous->getTransitionAt();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCurrentStepCreatedBy(): ?User
|
|
||||||
{
|
|
||||||
if (null !== $previous = $this->getPreviousStepIfAny()) {
|
|
||||||
return $previous->getTransitionBy();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getId(): ?int
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getRelatedEntityClass(): string
|
|
||||||
{
|
|
||||||
return $this->relatedEntityClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getRelatedEntityId(): int
|
|
||||||
{
|
|
||||||
return $this->relatedEntityId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method used by MarkingStore.
|
|
||||||
*
|
|
||||||
* get a string representation of the step
|
|
||||||
*/
|
|
||||||
public function getStep(): string
|
|
||||||
{
|
|
||||||
return $this->getCurrentStep()->getCurrentStep();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getStepAfter(EntityWorkflowStep $step): ?EntityWorkflowStep
|
|
||||||
{
|
|
||||||
$iterator = $this->steps->getIterator();
|
|
||||||
|
|
||||||
if ($iterator instanceof Iterator) {
|
|
||||||
$iterator->rewind();
|
|
||||||
|
|
||||||
while ($iterator->valid()) {
|
|
||||||
$curStep = $iterator->current();
|
|
||||||
|
|
||||||
if ($curStep === $step) {
|
|
||||||
$iterator->next();
|
|
||||||
|
|
||||||
if ($iterator->valid()) {
|
|
||||||
return $iterator->current();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$iterator->next();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return ArrayCollection|Collection
|
|
||||||
*/
|
|
||||||
public function getSteps()
|
|
||||||
{
|
|
||||||
return $this->steps;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getStepsChained(): array
|
|
||||||
{
|
|
||||||
if (is_array($this->stepsChainedCache)) {
|
|
||||||
return $this->stepsChainedCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
$iterator = $this->steps->getIterator();
|
|
||||||
$current = null;
|
|
||||||
$steps = [];
|
|
||||||
|
|
||||||
$iterator->rewind();
|
|
||||||
|
|
||||||
do {
|
|
||||||
$previous = $current;
|
|
||||||
$current = $iterator->current();
|
|
||||||
$steps[] = $current;
|
|
||||||
|
|
||||||
$current->setPrevious($previous);
|
|
||||||
|
|
||||||
$iterator->next();
|
|
||||||
|
|
||||||
if ($iterator->valid()) {
|
|
||||||
$current->setNext($iterator->current());
|
|
||||||
} else {
|
|
||||||
$current->setNext(null);
|
|
||||||
}
|
|
||||||
} while ($iterator->valid());
|
|
||||||
|
|
||||||
$this->stepsChainedCache = $steps;
|
|
||||||
|
|
||||||
return $steps;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return ArrayCollection|Collection
|
|
||||||
*/
|
|
||||||
public function getSubscriberToFinal()
|
|
||||||
{
|
|
||||||
return $this->subscriberToFinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return ArrayCollection|Collection
|
|
||||||
*/
|
|
||||||
public function getSubscriberToStep()
|
|
||||||
{
|
|
||||||
return $this->subscriberToStep;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get the step which is transitionning. Should be called only by event which will
|
|
||||||
* concern the transition.
|
|
||||||
*/
|
|
||||||
public function getTransitionningStep(): ?EntityWorkflowStep
|
|
||||||
{
|
|
||||||
return $this->transitionningStep;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getWorkflowName(): string
|
|
||||||
{
|
|
||||||
return $this->workflowName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isFinal(): bool
|
|
||||||
{
|
|
||||||
foreach ($this->getStepsChained() as $step) {
|
|
||||||
if ($step->isFinal()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isFreeze(): bool
|
|
||||||
{
|
|
||||||
$steps = $this->getStepsChained();
|
|
||||||
|
|
||||||
foreach ($this->getStepsChained() as $step) {
|
|
||||||
if ($step->isFreezeAfter()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isUserSubscribedToFinal(User $user): bool
|
|
||||||
{
|
|
||||||
return $this->subscriberToFinal->contains($user);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isUserSubscribedToStep(User $user): bool
|
|
||||||
{
|
|
||||||
return $this->subscriberToStep->contains($user);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function prepareStepBeforeTransition(EntityWorkflowStep $step): self
|
|
||||||
{
|
|
||||||
$this->transitionningStep = $step;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function removeComment(EntityWorkflowComment $comment): self
|
|
||||||
{
|
|
||||||
if ($this->comments->removeElement($comment)) {
|
|
||||||
$comment->setEntityWorkflow(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function removeStep(EntityWorkflowStep $step): self
|
|
||||||
{
|
|
||||||
if ($this->steps->removeElement($step)) {
|
|
||||||
$step->setEntityWorkflow(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function removeSubscriberToFinal(User $user): self
|
|
||||||
{
|
|
||||||
$this->subscriberToFinal->removeElement($user);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function removeSubscriberToStep(User $user): self
|
|
||||||
{
|
|
||||||
$this->subscriberToStep->removeElement($user);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setRelatedEntityClass(string $relatedEntityClass): EntityWorkflow
|
|
||||||
{
|
|
||||||
$this->relatedEntityClass = $relatedEntityClass;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setRelatedEntityId(int $relatedEntityId): EntityWorkflow
|
|
||||||
{
|
|
||||||
$this->relatedEntityId = $relatedEntityId;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method use by marking store.
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function setStep(string $step): self
|
|
||||||
{
|
|
||||||
$newStep = new EntityWorkflowStep();
|
|
||||||
$newStep->setCurrentStep($step);
|
|
||||||
|
|
||||||
// copy the freeze
|
|
||||||
if ($this->isFreeze()) {
|
|
||||||
$newStep->setFreezeAfter(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->addStep($newStep);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setWorkflowName(string $workflowName): EntityWorkflow
|
|
||||||
{
|
|
||||||
$this->workflowName = $workflowName;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getPreviousStepIfAny(): ?EntityWorkflowStep
|
|
||||||
{
|
|
||||||
if (1 === count($this->steps)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->steps->get($this->steps->count() - 2);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,78 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Chill is a software for social workers
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Entity\Workflow;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
|
||||||
use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
|
|
||||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
|
||||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Entity
|
|
||||||
* @ORM\Table("chill_main_workflow_entity_comment")
|
|
||||||
*/
|
|
||||||
class EntityWorkflowComment implements TrackCreationInterface, TrackUpdateInterface
|
|
||||||
{
|
|
||||||
use TrackCreationTrait;
|
|
||||||
|
|
||||||
use TrackUpdateTrait;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="text", options={"default": ""})
|
|
||||||
*/
|
|
||||||
private string $comment = '';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToOne(targetEntity=EntityWorkflow::class, inversedBy="comments")
|
|
||||||
*/
|
|
||||||
private ?EntityWorkflow $entityWorkflow = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Id
|
|
||||||
* @ORM\GeneratedValue
|
|
||||||
* @ORM\Column(type="integer")
|
|
||||||
*/
|
|
||||||
private ?int $id = null;
|
|
||||||
|
|
||||||
public function getComment(): string
|
|
||||||
{
|
|
||||||
return $this->comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getEntityWorkflow(): ?EntityWorkflow
|
|
||||||
{
|
|
||||||
return $this->entityWorkflow;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getId(): ?int
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setComment(string $comment): self
|
|
||||||
{
|
|
||||||
$this->comment = $comment;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal use @see{EntityWorkflow::addComment}
|
|
||||||
*/
|
|
||||||
public function setEntityWorkflow(?EntityWorkflow $entityWorkflow): self
|
|
||||||
{
|
|
||||||
$this->entityWorkflow = $entityWorkflow;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,336 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Chill is a software for social workers
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Entity\Workflow;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\User;
|
|
||||||
use DateTimeImmutable;
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
|
||||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
|
||||||
use function count;
|
|
||||||
use function in_array;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Entity
|
|
||||||
* @ORM\Table("chill_main_workflow_entity_step")
|
|
||||||
*/
|
|
||||||
class EntityWorkflowStep
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="text", options={"default": ""})
|
|
||||||
*/
|
|
||||||
private string $comment = '';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="text")
|
|
||||||
*/
|
|
||||||
private ?string $currentStep = '';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="json")
|
|
||||||
*/
|
|
||||||
private array $destEmail = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToMany(targetEntity=User::class)
|
|
||||||
* @ORM\JoinTable(name="chill_main_workflow_entity_step_user")
|
|
||||||
*/
|
|
||||||
private Collection $destUser;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToOne(targetEntity=EntityWorkflow::class, inversedBy="steps")
|
|
||||||
*/
|
|
||||||
private ?EntityWorkflow $entityWorkflow = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="boolean", options={"default": false})
|
|
||||||
*/
|
|
||||||
private bool $freezeAfter = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Id
|
|
||||||
* @ORM\GeneratedValue
|
|
||||||
* @ORM\Column(type="integer")
|
|
||||||
*/
|
|
||||||
private ?int $id = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="boolean", options={"default": false})
|
|
||||||
*/
|
|
||||||
private bool $isFinal = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* filled by @see{EntityWorkflow::getStepsChained}.
|
|
||||||
*/
|
|
||||||
private ?EntityWorkflowStep $next = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* filled by @see{EntityWorkflow::getStepsChained}.
|
|
||||||
*/
|
|
||||||
private ?EntityWorkflowStep $previous = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="text", nullable=true, options={"default": null})
|
|
||||||
*/
|
|
||||||
private ?string $transitionAfter = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="datetime_immutable")
|
|
||||||
*/
|
|
||||||
private ?DateTimeImmutable $transitionAt = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToOne(targetEntity=User::class)
|
|
||||||
* @ORM\JoinColumn(nullable=true)
|
|
||||||
*/
|
|
||||||
private ?User $transitionBy = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="text", nullable=true)
|
|
||||||
*/
|
|
||||||
private ?string $transitionByEmail = null;
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->destUser = new ArrayCollection();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addDestEmail(string $email): self
|
|
||||||
{
|
|
||||||
if (!in_array($email, $this->destEmail, true)) {
|
|
||||||
$this->destEmail[] = $email;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addDestUser(User $user): self
|
|
||||||
{
|
|
||||||
if (!$this->destUser->contains($user)) {
|
|
||||||
$this->destUser[] = $user;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getComment(): string
|
|
||||||
{
|
|
||||||
return $this->comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCurrentStep(): ?string
|
|
||||||
{
|
|
||||||
return $this->currentStep;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDestEmail(): array
|
|
||||||
{
|
|
||||||
return $this->destEmail;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return ArrayCollection|Collection
|
|
||||||
*/
|
|
||||||
public function getDestUser()
|
|
||||||
{
|
|
||||||
return $this->destUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getEntityWorkflow(): ?EntityWorkflow
|
|
||||||
{
|
|
||||||
return $this->entityWorkflow;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getId(): ?int
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getNext(): ?EntityWorkflowStep
|
|
||||||
{
|
|
||||||
return $this->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPrevious(): ?EntityWorkflowStep
|
|
||||||
{
|
|
||||||
return $this->previous;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTransitionAfter(): ?string
|
|
||||||
{
|
|
||||||
return $this->transitionAfter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTransitionAt(): ?DateTimeImmutable
|
|
||||||
{
|
|
||||||
return $this->transitionAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTransitionBy(): ?User
|
|
||||||
{
|
|
||||||
return $this->transitionBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTransitionByEmail(): ?string
|
|
||||||
{
|
|
||||||
return $this->transitionByEmail;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isFinal(): bool
|
|
||||||
{
|
|
||||||
return $this->isFinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isFreezeAfter(): bool
|
|
||||||
{
|
|
||||||
return $this->freezeAfter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function removeDestEmail(string $email): self
|
|
||||||
{
|
|
||||||
$this->destEmail = array_filter($this->destEmail, static function (string $existing) use ($email) {
|
|
||||||
return $email !== $existing;
|
|
||||||
});
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function removeDestUser(User $user): self
|
|
||||||
{
|
|
||||||
$this->destUser->removeElement($user);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setComment(?string $comment): EntityWorkflowStep
|
|
||||||
{
|
|
||||||
$this->comment = (string) $comment;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setCurrentStep(?string $currentStep): EntityWorkflowStep
|
|
||||||
{
|
|
||||||
$this->currentStep = $currentStep;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setDestEmail(array $destEmail): EntityWorkflowStep
|
|
||||||
{
|
|
||||||
$this->destEmail = $destEmail;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal use @see(EntityWorkflow::addStep} instead
|
|
||||||
*/
|
|
||||||
public function setEntityWorkflow(?EntityWorkflow $entityWorkflow): EntityWorkflowStep
|
|
||||||
{
|
|
||||||
$this->entityWorkflow = $entityWorkflow;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setFreezeAfter(bool $freezeAfter): EntityWorkflowStep
|
|
||||||
{
|
|
||||||
$this->freezeAfter = $freezeAfter;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setIsFinal(bool $isFinal): EntityWorkflowStep
|
|
||||||
{
|
|
||||||
$this->isFinal = $isFinal;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return EntityWorkflowStep
|
|
||||||
*
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
public function setNext(?EntityWorkflowStep $next): self
|
|
||||||
{
|
|
||||||
$this->next = $next;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return EntityWorkflowStep
|
|
||||||
*
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
public function setPrevious(?EntityWorkflowStep $previous): self
|
|
||||||
{
|
|
||||||
$this->previous = $previous;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setTransitionAfter(?string $transitionAfter): EntityWorkflowStep
|
|
||||||
{
|
|
||||||
$this->transitionAfter = $transitionAfter;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setTransitionAt(?DateTimeImmutable $transitionAt): EntityWorkflowStep
|
|
||||||
{
|
|
||||||
$this->transitionAt = $transitionAt;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setTransitionBy(?User $transitionBy): EntityWorkflowStep
|
|
||||||
{
|
|
||||||
$this->transitionBy = $transitionBy;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setTransitionByEmail(?string $transitionByEmail): EntityWorkflowStep
|
|
||||||
{
|
|
||||||
$this->transitionByEmail = $transitionByEmail;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Assert\Callback
|
|
||||||
*
|
|
||||||
* @param mixed $payload
|
|
||||||
*/
|
|
||||||
public function validateOnCreation(ExecutionContextInterface $context, $payload): void
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ($this->isFinalizeAfter()) {
|
|
||||||
if (0 !== count($this->getDestUser())) {
|
|
||||||
$context->buildViolation('workflow.No dest users when the workflow is finalized')
|
|
||||||
->atPath('finalizeAfter')
|
|
||||||
->addViolation();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (0 === count($this->getDestUser())) {
|
|
||||||
$context->buildViolation('workflow.The next step must count at least one dest')
|
|
||||||
->atPath('finalizeAfter')
|
|
||||||
->addViolation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,27 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Chill is a software for social workers
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Form;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
|
|
||||||
class EntityWorkflowCommentType extends AbstractType
|
|
||||||
{
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
||||||
{
|
|
||||||
$builder
|
|
||||||
->add('comment', ChillTextareaType::class, [
|
|
||||||
'required' => false,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -12,18 +12,14 @@ declare(strict_types=1);
|
|||||||
namespace Chill\MainBundle\Form\Type\DataTransformer;
|
namespace Chill\MainBundle\Form\Type\DataTransformer;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
|
||||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
|
||||||
use Symfony\Component\Form\DataTransformerInterface;
|
use Symfony\Component\Form\DataTransformerInterface;
|
||||||
use Symfony\Component\Form\Exception\TransformationFailedException;
|
use Symfony\Component\Form\Exception\TransformationFailedException;
|
||||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||||
use Symfony\Component\Serializer\SerializerInterface;
|
use Symfony\Component\Serializer\SerializerInterface;
|
||||||
use UnexpectedValueException;
|
|
||||||
|
|
||||||
use function array_key_exists;
|
use function array_key_exists;
|
||||||
|
|
||||||
class EntityToJsonTransformer implements DataTransformerInterface
|
class UserToJsonTransformer implements DataTransformerInterface
|
||||||
{
|
{
|
||||||
private DenormalizerInterface $denormalizer;
|
private DenormalizerInterface $denormalizer;
|
||||||
|
|
||||||
@@ -31,36 +27,23 @@ class EntityToJsonTransformer implements DataTransformerInterface
|
|||||||
|
|
||||||
private SerializerInterface $serializer;
|
private SerializerInterface $serializer;
|
||||||
|
|
||||||
private string $type;
|
public function __construct(DenormalizerInterface $denormalizer, SerializerInterface $serializer, bool $multiple)
|
||||||
|
|
||||||
public function __construct(DenormalizerInterface $denormalizer, SerializerInterface $serializer, bool $multiple, string $type)
|
|
||||||
{
|
{
|
||||||
$this->denormalizer = $denormalizer;
|
$this->denormalizer = $denormalizer;
|
||||||
$this->serializer = $serializer;
|
$this->serializer = $serializer;
|
||||||
$this->multiple = $multiple;
|
$this->multiple = $multiple;
|
||||||
$this->type = $type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reverseTransform($value)
|
public function reverseTransform($value)
|
||||||
{
|
{
|
||||||
$denormalized = json_decode($value, true);
|
|
||||||
|
|
||||||
if ($this->multiple) {
|
if ($this->multiple) {
|
||||||
if (null === $denormalized) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
return array_map(
|
return array_map(
|
||||||
function ($item) { return $this->denormalizeOne($item); },
|
function ($item) { return $this->denormalizeOne($item); },
|
||||||
$denormalized
|
json_decode($value, true)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('' === $value) {
|
return $this->denormalizeOne(json_decode($value, true));
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->denormalizeOne($denormalized);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,7 +60,7 @@ class EntityToJsonTransformer implements DataTransformerInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function denormalizeOne(array $item)
|
private function denormalizeOne(array $item): User
|
||||||
{
|
{
|
||||||
if (!array_key_exists('type', $item)) {
|
if (!array_key_exists('type', $item)) {
|
||||||
throw new TransformationFailedException('the key "type" is missing on element');
|
throw new TransformationFailedException('the key "type" is missing on element');
|
||||||
@@ -87,30 +70,10 @@ class EntityToJsonTransformer implements DataTransformerInterface
|
|||||||
throw new TransformationFailedException('the key "id" is missing on element');
|
throw new TransformationFailedException('the key "id" is missing on element');
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($this->type) {
|
|
||||||
case 'user':
|
|
||||||
$class = User::class;
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'person':
|
|
||||||
$class = Person::class;
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'thirdparty':
|
|
||||||
$class = ThirdParty::class;
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new UnexpectedValueException('This type is not supported');
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
$this->denormalizer->denormalize(
|
$this->denormalizer->denormalize(
|
||||||
['type' => $item['type'], 'id' => $item['id']],
|
['type' => $item['type'], 'id' => $item['id']],
|
||||||
$class,
|
User::class,
|
||||||
'json',
|
'json',
|
||||||
[AbstractNormalizer::GROUPS => ['read']],
|
[AbstractNormalizer::GROUPS => ['read']],
|
||||||
);
|
);
|
@@ -12,7 +12,7 @@ declare(strict_types=1);
|
|||||||
namespace Chill\MainBundle\Form\Type;
|
namespace Chill\MainBundle\Form\Type;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\MainBundle\Form\Type\DataTransformer\EntityToJsonTransformer;
|
use Chill\MainBundle\Form\Type\DataTransformer\UserToJsonTransformer;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
@@ -38,7 +38,7 @@ class PickUserDynamicType extends AbstractType
|
|||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
{
|
{
|
||||||
$builder->addViewTransformer(new EntityToJsonTransformer($this->denormalizer, $this->serializer, $options['multiple'], 'user'));
|
$builder->addViewTransformer(new UserToJsonTransformer($this->denormalizer, $this->serializer, $options['multiple']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||||
@@ -58,6 +58,6 @@ class PickUserDynamicType extends AbstractType
|
|||||||
|
|
||||||
public function getBlockPrefix()
|
public function getBlockPrefix()
|
||||||
{
|
{
|
||||||
return 'pick_entity_dynamic';
|
return 'pick_user_dynamic';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,73 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Chill is a software for social workers
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Form\Type;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\ResidentialAddress;
|
|
||||||
use Chill\PersonBundle\Form\Type\PickPersonDynamicType;
|
|
||||||
use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType;
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
||||||
|
|
||||||
final class ResidentialAddressType extends AbstractType
|
|
||||||
{
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
||||||
{
|
|
||||||
$builder
|
|
||||||
->add('startDate', DateType::class, [
|
|
||||||
'required' => true,
|
|
||||||
'input' => 'datetime_immutable',
|
|
||||||
'widget' => 'single_text',
|
|
||||||
])
|
|
||||||
->add('endDate', DateType::class, [
|
|
||||||
'required' => false,
|
|
||||||
'input' => 'datetime_immutable',
|
|
||||||
'widget' => 'single_text',
|
|
||||||
])
|
|
||||||
->add('comment', CommentType::class, [
|
|
||||||
'required' => false,
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ('person' === $options['kind']) {
|
|
||||||
$builder
|
|
||||||
->add('hostPerson', PickPersonDynamicType::class, [
|
|
||||||
'label' => 'Person',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('thirdparty' === $options['kind']) {
|
|
||||||
$builder
|
|
||||||
->add('hostThirdParty', PickThirdpartyDynamicType::class, [
|
|
||||||
'label' => 'Third party',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('address' === $options['kind']) {
|
|
||||||
$builder
|
|
||||||
->add('address', PickAddressType::class, [
|
|
||||||
'required' => false,
|
|
||||||
'label' => 'Address',
|
|
||||||
'use_valid_from' => false,
|
|
||||||
'use_valid_to' => false,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
|
||||||
{
|
|
||||||
$resolver->setDefaults([
|
|
||||||
'data_class' => ResidentialAddress::class,
|
|
||||||
'kind' => null,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,180 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Chill is a software for social workers
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Form;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
|
|
||||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflowStep;
|
|
||||||
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
|
||||||
use Chill\MainBundle\Form\Type\PickUserDynamicType;
|
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
|
||||||
use Chill\MainBundle\Workflow\EntityWorkflowManager;
|
|
||||||
use LogicException;
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
||||||
use Symfony\Component\Workflow\Registry;
|
|
||||||
use Symfony\Component\Workflow\Transition;
|
|
||||||
use function array_key_exists;
|
|
||||||
|
|
||||||
class WorkflowStepType extends AbstractType
|
|
||||||
{
|
|
||||||
private EntityWorkflowManager $entityWorkflowManager;
|
|
||||||
|
|
||||||
private Registry $registry;
|
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(EntityWorkflowManager $entityWorkflowManager, Registry $registry, TranslatableStringHelperInterface $translatableStringHelper)
|
|
||||||
{
|
|
||||||
$this->entityWorkflowManager = $entityWorkflowManager;
|
|
||||||
$this->registry = $registry;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
||||||
{
|
|
||||||
/** @var \Chill\MainBundle\Entity\Workflow\EntityWorkflow $entityWorkflow */
|
|
||||||
$entityWorkflow = $options['entity_workflow'];
|
|
||||||
$handler = $this->entityWorkflowManager->getHandler($entityWorkflow);
|
|
||||||
$workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName());
|
|
||||||
$place = $workflow->getMarking($entityWorkflow);
|
|
||||||
$placeMetadata = $workflow->getMetadataStore()->getPlaceMetadata(array_keys($place->getPlaces())[0]);
|
|
||||||
|
|
||||||
if (true === $options['transition']) {
|
|
||||||
if (null === $options['entity_workflow']) {
|
|
||||||
throw new LogicException('if transition is true, entity_workflow should be defined');
|
|
||||||
}
|
|
||||||
|
|
||||||
$transitions = $this->registry
|
|
||||||
->get($options['entity_workflow'], $entityWorkflow->getWorkflowName())
|
|
||||||
->getEnabledTransitions($entityWorkflow);
|
|
||||||
|
|
||||||
$choices = array_combine(
|
|
||||||
array_map(
|
|
||||||
static function (Transition $transition) {
|
|
||||||
return $transition->getName();
|
|
||||||
},
|
|
||||||
$transitions
|
|
||||||
),
|
|
||||||
$transitions
|
|
||||||
);
|
|
||||||
|
|
||||||
if (array_key_exists('validationFilterInputLabels', $placeMetadata)) {
|
|
||||||
$inputLabels = $placeMetadata['validationFilterInputLabels'];
|
|
||||||
|
|
||||||
$builder->add('transitionFilter', ChoiceType::class, [
|
|
||||||
'multiple' => false,
|
|
||||||
'label' => 'workflow.My decision',
|
|
||||||
'choices' => [
|
|
||||||
'forward' => 'forward',
|
|
||||||
'backward' => 'backward',
|
|
||||||
'neutral' => 'neutral',
|
|
||||||
],
|
|
||||||
'choice_label' => function (string $key) use ($inputLabels) {
|
|
||||||
return $this->translatableStringHelper->localize($inputLabels[$key]);
|
|
||||||
},
|
|
||||||
'choice_attr' => static function (string $key) {
|
|
||||||
return [
|
|
||||||
$key => $key,
|
|
||||||
];
|
|
||||||
},
|
|
||||||
'mapped' => false,
|
|
||||||
'expanded' => true,
|
|
||||||
'data' => 'forward',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$builder
|
|
||||||
->add('transition', ChoiceType::class, [
|
|
||||||
'label' => 'workflow.Next step',
|
|
||||||
'mapped' => false,
|
|
||||||
'multiple' => false,
|
|
||||||
'expanded' => true,
|
|
||||||
'choices' => $choices,
|
|
||||||
'choice_label' => function (Transition $transition) use ($workflow) {
|
|
||||||
$meta = $workflow->getMetadataStore()->getTransitionMetadata($transition);
|
|
||||||
|
|
||||||
if (array_key_exists('label', $meta)) {
|
|
||||||
return $this->translatableStringHelper->localize($meta['label']);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $transition->getName();
|
|
||||||
},
|
|
||||||
'choice_attr' => static function (Transition $transition) use ($workflow) {
|
|
||||||
$toFinal = true;
|
|
||||||
$isForward = 'neutral';
|
|
||||||
|
|
||||||
$metadata = $workflow->getMetadataStore()->getTransitionMetadata($transition);
|
|
||||||
|
|
||||||
if (array_key_exists('isForward', $metadata)) {
|
|
||||||
if ($metadata['isForward']) {
|
|
||||||
$isForward = 'forward';
|
|
||||||
} else {
|
|
||||||
$isForward = 'backward';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($transition->getTos() as $to) {
|
|
||||||
$meta = $workflow->getMetadataStore()->getPlaceMetadata($to);
|
|
||||||
|
|
||||||
if (
|
|
||||||
!array_key_exists('isFinal', $meta) || false === $meta['isFinal']
|
|
||||||
) {
|
|
||||||
$toFinal = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return [
|
|
||||||
'data-is-transition' => 'data-is-transition',
|
|
||||||
'data-to-final' => $toFinal ? '1' : '0',
|
|
||||||
'data-is-forward' => $isForward,
|
|
||||||
];
|
|
||||||
},
|
|
||||||
])
|
|
||||||
->add('future_dest_users', PickUserDynamicType::class, [
|
|
||||||
'label' => 'workflow.dest for next steps',
|
|
||||||
'multiple' => true,
|
|
||||||
'mapped' => false,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
$handler->supportsFreeze($entityWorkflow)
|
|
||||||
&& !$entityWorkflow->isFreeze()
|
|
||||||
) {
|
|
||||||
$builder
|
|
||||||
->add('freezeAfter', CheckboxType::class, [
|
|
||||||
'required' => false,
|
|
||||||
'label' => 'workflow.Freeze',
|
|
||||||
'help' => 'workflow.The associated element will be freezed',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$builder
|
|
||||||
->add('comment', ChillTextareaType::class, [
|
|
||||||
'required' => false,
|
|
||||||
'label' => 'Comment',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
|
||||||
{
|
|
||||||
$resolver
|
|
||||||
->setDefined('class', EntityWorkflowStep::class)
|
|
||||||
->setRequired('transition')
|
|
||||||
->setAllowedTypes('transition', 'bool')
|
|
||||||
->setRequired('entity_workflow')
|
|
||||||
->setAllowedTypes('entity_workflow', EntityWorkflow::class);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,36 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Chill is a software for social workers
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Form;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
||||||
|
|
||||||
class WorkflowTransitionType extends AbstractType
|
|
||||||
{
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
||||||
{
|
|
||||||
$builder
|
|
||||||
->add('current_step', WorkflowStepType::class, [
|
|
||||||
'transition' => true,
|
|
||||||
'entity_workflow' => $options['entity_workflow'],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
|
||||||
{
|
|
||||||
$resolver
|
|
||||||
->setRequired('entity_workflow')
|
|
||||||
->setAllowedTypes('entity_workflow', EntityWorkflow::class);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -50,7 +50,7 @@ class NotificationMailer
|
|||||||
$email = new TemplatedEmail();
|
$email = new TemplatedEmail();
|
||||||
$email
|
$email
|
||||||
->to($dest->getEmail())
|
->to($dest->getEmail())
|
||||||
->subject('Re: ' . $comment->getNotification()->getTitle())
|
->subject('Re: [Chill] ' . $comment->getNotification()->getTitle())
|
||||||
->textTemplate('@ChillMain/Notification/email_notification_comment_persist.fr.md.twig')
|
->textTemplate('@ChillMain/Notification/email_notification_comment_persist.fr.md.twig')
|
||||||
->context([
|
->context([
|
||||||
'comment' => $comment,
|
'comment' => $comment,
|
||||||
@@ -82,7 +82,8 @@ class NotificationMailer
|
|||||||
if ($notification->isSystem()) {
|
if ($notification->isSystem()) {
|
||||||
$email = new Email();
|
$email = new Email();
|
||||||
$email
|
$email
|
||||||
->text($notification->getMessage());
|
->text($notification->getMessage())
|
||||||
|
->subject('[Chill] ' . $notification->getTitle());
|
||||||
} else {
|
} else {
|
||||||
$email = new TemplatedEmail();
|
$email = new TemplatedEmail();
|
||||||
$email
|
$email
|
||||||
@@ -93,9 +94,7 @@ class NotificationMailer
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$email
|
$email->to($addressee->getEmail());
|
||||||
->subject($notification->getTitle())
|
|
||||||
->to($addressee->getEmail());
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->mailer->send($email);
|
$this->mailer->send($email);
|
||||||
|
@@ -15,15 +15,12 @@ use Chill\MainBundle\Entity\Notification;
|
|||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\MainBundle\Repository\NotificationRepository;
|
use Chill\MainBundle\Repository\NotificationRepository;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
use function array_key_exists;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helps to find if a notification exist for a given entity.
|
* Helps to find if a notification exist for a given entity.
|
||||||
*/
|
*/
|
||||||
class NotificationPresence
|
class NotificationPresence
|
||||||
{
|
{
|
||||||
private array $cache = [];
|
|
||||||
|
|
||||||
private NotificationRepository $notificationRepository;
|
private NotificationRepository $notificationRepository;
|
||||||
|
|
||||||
private Security $security;
|
private Security $security;
|
||||||
@@ -34,29 +31,6 @@ class NotificationPresence
|
|||||||
$this->notificationRepository = $notificationRepository;
|
$this->notificationRepository = $notificationRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function countNotificationsForClassAndEntity(string $relatedEntityClass, int $relatedEntityId): array
|
|
||||||
{
|
|
||||||
if (array_key_exists($relatedEntityClass, $this->cache) && array_key_exists($relatedEntityId, $this->cache[$relatedEntityClass])) {
|
|
||||||
return $this->cache[$relatedEntityClass][$relatedEntityId];
|
|
||||||
}
|
|
||||||
|
|
||||||
$user = $this->security->getUser();
|
|
||||||
|
|
||||||
if ($user instanceof User) {
|
|
||||||
$counter = $this->notificationRepository->countNotificationByRelatedEntityAndUserAssociated(
|
|
||||||
$relatedEntityClass,
|
|
||||||
$relatedEntityId,
|
|
||||||
$user
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->cache[$relatedEntityClass][$relatedEntityId] = $counter;
|
|
||||||
|
|
||||||
return $counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ['unread' => 0, 'read' => 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array|Notification[]
|
* @return array|Notification[]
|
||||||
*/
|
*/
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user