mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-10 08:44:58 +00:00
Compare commits
5 Commits
2.0.0-beta
...
feature-ad
Author | SHA1 | Date | |
---|---|---|---|
|
06aa672133 | ||
77943a69fb | |||
|
7fbb8a9fb0 | ||
|
535f57bb68 | ||
|
d53caf1f37 |
@@ -7,7 +7,6 @@ charset = utf-8
|
||||
end_of_line = LF
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
indent_size = 4
|
||||
|
||||
[*.{php,html,twig}]
|
||||
indent_style = space
|
||||
@@ -18,10 +17,3 @@ max_line_length = 80
|
||||
|
||||
[COMMIT_EDITMSG]
|
||||
max_line_length = 0
|
||||
<<<<<<< Updated upstream
|
||||
=======
|
||||
|
||||
[*.{js, vue, ts}]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
>>>>>>> Stashed changes
|
||||
|
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
|
@@ -3,3 +3,4 @@
|
||||
# Run tests from root to adapt your own environment
|
||||
KERNEL_CLASS='App\Kernel'
|
||||
APP_SECRET='$ecretf0rt3st'
|
||||
DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres?serverVersion=12&charset=utf8
|
||||
|
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,5 +1,4 @@
|
||||
.composer/*
|
||||
composer
|
||||
composer.phar
|
||||
composer.lock
|
||||
docs/build/
|
||||
@@ -20,7 +19,3 @@ docs/build/
|
||||
/phpunit.xml
|
||||
.phpunit.result.cache
|
||||
###< phpunit/phpunit ###
|
||||
|
||||
/.php-cs-fixer.cache
|
||||
/.idea/
|
||||
/.psalm/
|
||||
|
115
.gitlab-ci.yml
115
.gitlab-ci.yml
@@ -1,102 +1,37 @@
|
||||
---
|
||||
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
|
||||
|
||||
# Select what we should cache between builds
|
||||
cache:
|
||||
paths:
|
||||
- tests/app/vendor/
|
||||
- .cache
|
||||
paths:
|
||||
- tests/app/vendor/
|
||||
|
||||
before_script:
|
||||
# add extensions to postgres
|
||||
- PGPASSWORD=$POSTGRES_PASSWORD psql -U $POSTGRES_USER -h db -c "CREATE EXTENSION IF NOT EXISTS unaccent; CREATE EXTENSION IF NOT EXISTS pg_trgm;"
|
||||
# Install and run Composer
|
||||
- curl -sS https://getcomposer.org/installer | php
|
||||
- php composer.phar install
|
||||
- php tests/app/bin/console doctrine:migrations:migrate -n
|
||||
- php tests/app/bin/console doctrine:fixtures:load -n
|
||||
|
||||
# Bring in any services we need http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service
|
||||
# See http://docs.gitlab.com/ee/ci/services/README.html for examples.
|
||||
services:
|
||||
- name: postgis/postgis:12-3.1-alpine
|
||||
alias: db
|
||||
- name: redis
|
||||
alias: redis
|
||||
- name: postgres:12
|
||||
alias: db
|
||||
- name: redis
|
||||
alias: redis
|
||||
|
||||
# Set any variables we need
|
||||
variables:
|
||||
GIT_DEPTH: 1
|
||||
# Configure postgres environment variables (https://hub.docker.com/r/_/postgres/)
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
# configure database access
|
||||
DATABASE_URL: postgresql://postgres:postgres@db:5432/postgres?serverVersion=12&charset=utf8
|
||||
# fetch the chill-app using git submodules
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: 6379
|
||||
REDIS_URL: redis://redis:6379
|
||||
# change vendor dir to make the app install into tests/apps
|
||||
COMPOSER_VENDOR_DIR: tests/app/vendor
|
||||
DEFAULT_CARRIER_CODE: BE
|
||||
# Configure postgres environment variables (https://hub.docker.com/r/_/postgres/)
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
# fetch the chill-app using git submodules
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
|
||||
stages:
|
||||
- Composer install
|
||||
- Tests
|
||||
|
||||
build:
|
||||
stage: Composer install
|
||||
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
|
||||
before_script:
|
||||
- curl -sS https://getcomposer.org/installer | php
|
||||
- php -d memory_limit=2G composer.phar config -g cache-dir "$(pwd)/.cache"
|
||||
script:
|
||||
- php -d memory_limit=2G composer.phar install --optimize-autoloader --no-ansi --no-interaction --no-progress
|
||||
cache:
|
||||
paths:
|
||||
- .cache/
|
||||
artifacts:
|
||||
expire_in: 30 min
|
||||
paths:
|
||||
- bin
|
||||
- tests/app/vendor/
|
||||
|
||||
code_style:
|
||||
stage: Tests
|
||||
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
|
||||
script:
|
||||
- bin/grumphp run --tasks=phpcsfixer
|
||||
artifacts:
|
||||
expire_in: 30 min
|
||||
paths:
|
||||
- bin
|
||||
- tests/app/vendor/
|
||||
|
||||
phpstan_tests:
|
||||
stage: Tests
|
||||
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
|
||||
script:
|
||||
- bin/grumphp run --tasks=phpstan
|
||||
artifacts:
|
||||
expire_in: 30 min
|
||||
paths:
|
||||
- bin
|
||||
- tests/app/vendor/
|
||||
|
||||
psalm_tests:
|
||||
stage: Tests
|
||||
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
|
||||
script:
|
||||
- bin/grumphp run --tasks=psalm
|
||||
allow_failure: true
|
||||
artifacts:
|
||||
expire_in: 30 min
|
||||
paths:
|
||||
- bin
|
||||
- tests/app/vendor/
|
||||
|
||||
unit_tests:
|
||||
stage: Tests
|
||||
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
|
||||
script:
|
||||
- php tests/app/bin/console doctrine:migrations:migrate -n
|
||||
- php -d memory_limit=2G tests/app/bin/console cache:clear --env=dev
|
||||
- php -d memory_limit=3G tests/app/bin/console doctrine:fixtures:load -n
|
||||
- php -d memory_limit=2G tests/app/bin/console cache:clear --env=test
|
||||
- php -d memory_limit=4G bin/phpunit --colors=never
|
||||
artifacts:
|
||||
expire_in: 30 min
|
||||
paths:
|
||||
- bin
|
||||
- tests/app/vendor/
|
||||
# Run our tests
|
||||
test:
|
||||
script:
|
||||
- bin/phpunit --colors=never
|
||||
|
@@ -1,24 +0,0 @@
|
||||
|
||||
# Description of changes
|
||||
|
||||
<!--
|
||||
describe here the change of your MR. It can be either a text, or a bullet list
|
||||
for changes
|
||||
-->
|
||||
|
||||
|
||||
# Issues related
|
||||
|
||||
<!--
|
||||
list the issues related to this MR.
|
||||
|
||||
It may be client issues, or dev issues
|
||||
-->
|
||||
|
||||
* ...
|
||||
* ...
|
||||
|
||||
# Tests
|
||||
|
||||
<!-- Describe tests if any, or why no tests -->
|
||||
|
25
.php_cs.dist
Normal file
25
.php_cs.dist
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers.
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$config = require __DIR__ . '/vendor/drupol/php-conventions/config/php73/php_cs_fixer.config.php';
|
||||
|
||||
$config
|
||||
->getFinder()
|
||||
->ignoreDotFiles(false)
|
||||
->name(['.php_cs.dist']);
|
||||
|
||||
$rules = $config->getRules();
|
||||
|
||||
$rules['header_comment']['header'] = trim(file_get_contents(__DIR__ . '/resource/header.txt'));
|
||||
|
||||
return $config->setRules($rules);
|
@@ -1,79 +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);
|
||||
|
||||
/** @var \drupol\PhpCsFixerConfigsPhp\Config\Php73 $config */
|
||||
$config = require __DIR__ . '/tests/app/vendor/drupol/php-conventions/config/php73/php_cs_fixer.config.php';
|
||||
|
||||
$config
|
||||
->getFinder()
|
||||
->ignoreDotFiles(false)
|
||||
->notPath('tests/app')
|
||||
->name(['.php_cs.dist.php']);
|
||||
|
||||
$rules = $config->getRules();
|
||||
|
||||
$riskyRules = [
|
||||
'ternary_to_elvis_operator' => false,
|
||||
'php_unit_mock_short_will_return' => false,
|
||||
'php_unit_set_up_tear_down_visibility' => false,
|
||||
'php_unit_construct' => false,
|
||||
'php_unit_dedicate_assert' => false,
|
||||
'php_unit_expectation' => false,
|
||||
'php_unit_mock' => false,
|
||||
'php_unit_namespaced' => false,
|
||||
'php_unit_no_expectation_annotation' => false,
|
||||
'php_unit_test_case_static_method_calls' => false,
|
||||
'php_unit_test_annotation' => false,
|
||||
// 'final_internal_class' => false,
|
||||
// 'strict_param' => false,
|
||||
// 'declare_strict_types' => false,
|
||||
// 'strict_comparison' => false,
|
||||
// 'no_unreachable_default_argument_value' => false,
|
||||
// 'ereg_to_preg' => false,
|
||||
// 'ordered_interfaces' => false,
|
||||
// 'error_suppression' => false,
|
||||
// 'non_printable_character' => false,
|
||||
// 'ordered_traits' => false,
|
||||
// 'no_useless_sprintf' => false,
|
||||
// 'dir_constant' => false,
|
||||
// 'no_alias_functions' => false,
|
||||
// 'implode_call' => false,
|
||||
// 'combine_nested_dirname' => false,
|
||||
// 'pow_to_exponentiation' => false,
|
||||
// 'comment_to_phpdoc' => false,
|
||||
// 'no_unset_on_property' => false,
|
||||
// 'native_constant_invocation' => false,
|
||||
// 'function_to_constant' => false,
|
||||
// 'is_null' => false,
|
||||
// 'native_function_invocation' => false,
|
||||
// 'no_trailing_whitespace_in_string' => false,
|
||||
// 'array_push' => false,
|
||||
// 'fopen_flag_order' => false,
|
||||
// 'fopen_flags' => false,
|
||||
// 'logical_operators' => false,
|
||||
// 'modernize_types_casting' => false,
|
||||
// 'no_homoglyph_names' => false,
|
||||
// 'no_unneeded_final_method' => false,
|
||||
// 'random_api_migration' => false,
|
||||
// 'static_lambda' => false,
|
||||
// 'set_type_to_cast' => false,
|
||||
// 'string_line_ending' => false,
|
||||
// 'psr_autoloading' => false,
|
||||
];
|
||||
|
||||
$rules = array_merge(
|
||||
$rules,
|
||||
$riskyRules
|
||||
);
|
||||
|
||||
$rules['header_comment']['header'] = trim(file_get_contents(__DIR__ . '/resource/header.txt'));
|
||||
|
||||
return $config->setRules($rules);
|
674
CHANGELOG.md
674
CHANGELOG.md
@@ -1,674 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to
|
||||
|
||||
* [Semantic Versioning](https://semver.org/spec/v2.0.0.html) for stable releases;
|
||||
* date versioning for test releases
|
||||
|
||||
## Unreleased
|
||||
|
||||
<!-- write down unreleased development here -->
|
||||
|
||||
## Test releases
|
||||
|
||||
### 2.0.0-beta2
|
||||
|
||||
* [workflow]: Fixed: the notification is sent when the user is added to the first step.
|
||||
* [budget] Feature: allow to desactivate some charges and resources, adding an `active` key in the configuration
|
||||
* [person] Feature: on Evaluation, allow to configure an URL from the admin
|
||||
|
||||
### 2022-06
|
||||
|
||||
* [workflow]: added pagination to workflow list page
|
||||
* [homepage_widget]: null error on tasks widget fixed
|
||||
* [person-thirdparty]: fix quick-add of names that consist of multiple parts (eg. De Vlieger) within onthefly modal person/thirdparty
|
||||
* [search]: Order of birthdate fields changed in advanced search to avoid confusion.
|
||||
* [workflow]: Constraint added to workflow (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/675)
|
||||
* [household]: Reposition and cut button for enfant hors menage have been deleted (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/620)
|
||||
* [admin]: Add crud for composition type in admin (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/611)
|
||||
|
||||
### 2022-05-30
|
||||
|
||||
* fix creating a new AccompanyingPeriodWorkEvaluationDocument when replacing the document (the workflow was lost)
|
||||
|
||||
### 2022-05-27
|
||||
|
||||
* [storedobject] add title field on StoredObject entity + use it in activity documents (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/604)
|
||||
* [main] add a "read more..." on comment embeddable when overflown (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/604)
|
||||
* [person] add closing motive to closed acc course (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/603)
|
||||
* [person] household filiation: fetch person info when unfolding person (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/586)
|
||||
* [admin] repair edit of social action in the admin (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/601)
|
||||
* [admin]: add select2 to Goal form type entity fields (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/702)
|
||||
* [main] allow hide permissions group list menu (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/577)
|
||||
* [main] allow hide change user password menu (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/577)
|
||||
* [main] filter user jobs by active jobs (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/577)
|
||||
* [main] add civility to User (entity, migration and form type) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/577)
|
||||
* [admin] refactorisation of the admin section: reorganisation of the menu, translations, form types, new entities (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/592)
|
||||
* [admin] add admin section for languages and countries (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/596)
|
||||
* [activity] activity admin: translations + remove label field for comment on admin activity type (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/587)
|
||||
* [main] admin user_job: improvements (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/588)
|
||||
* [address] can add extra address info even if noAddress (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/576)
|
||||
|
||||
|
||||
### 2022-05-06
|
||||
|
||||
* [person] add civility when creating a person (with the on-the-fly component or in the php form) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/557)
|
||||
* [person] add address when creating a person (with the on-the-fly component or in the php form) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/557)
|
||||
* [person] add household creation API point (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/557)
|
||||
|
||||
### 2021-04-29
|
||||
|
||||
* [person] prevent circular references in PersonDocGenNormalizer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/527)
|
||||
* [person] add maritalStatusComment to PersonDocGenNormalizer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/582)
|
||||
* Load relationships without gender in french fixtures
|
||||
* Add command to remove old draft accompanying periods
|
||||
* [parcours]: If users assings him/herself as referrer and job is not null. Update parcours job (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/578)
|
||||
|
||||
### 2021-04-28
|
||||
|
||||
* [address] fix bug when editing address: update location and addressreferenceId + better update of the map in edition (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/593)
|
||||
* [main] avoid address reference search on undefined post code (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/561)
|
||||
* [person] prevent duplicate relationship in filiation/household graph (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/560)
|
||||
* [Documents] Validate storedObject and allow for null data (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/565)
|
||||
* [parcours]: Comments can be unpinned + edit/delete for all users that are allowed to edit parcours (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/566)
|
||||
|
||||
### 2021-04-26
|
||||
|
||||
* [Datepickers] datepickers fixed when using keyboard to enter date (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/545)
|
||||
* [social_action] Display 'agents traitants' in parcours resumé and social action list (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/568)
|
||||
* [Person_search] Closed parcours shown within an accordeon that can be opened/closed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/574)
|
||||
|
||||
### 2021-04-24
|
||||
|
||||
* [notification email on course designation] allow raw string in email content generation
|
||||
* [Accompanying period work] list evaluations associated to a work by startDate, and then by id, from the most recent to older
|
||||
* [Documents] Change wording 'créer' to 'enregistrer' (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/634)
|
||||
* [Parcours]: The number of 'mes parcours' displayed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/572)
|
||||
* [Hompage_widget]: Renaming of tabs and removal of social actions tab (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/570)
|
||||
* [activity]: Ignore thirdparties when creating a social action via an activity (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/573)
|
||||
* [parcours]: change wording of warning message and button when user is not associated to a household yet (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/590#note_918370943)
|
||||
* [Accompanying period work evaluations] list documents associated to a work by creation date, and then by id, from the most recent to older
|
||||
* [Course comment] add validationConstraint NotNull and NotBlank on comment content, to avoid sql error
|
||||
* [Notifications] delay the sending of notificaiton to kernel.terminate
|
||||
* [Notifications / Period user change] fix the sending of notification when user changes
|
||||
* [Activity form] invert 'incoming' and 'receiving' in Activity form
|
||||
* [Activity form] keep the same order for 'attendee' field in new and edit form
|
||||
* [list with period] use "sameas" test operator to introduce requestor in list
|
||||
* [notification email on course designation] allow raw string in email content generation
|
||||
* [Accompanying period work] list evaluations associated to a work by startDate, and then by id, from the most recent to older
|
||||
* [evaluation_document] changing date to datetime in order to display the time at which document was created (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/569)
|
||||
|
||||
|
||||
### 2021-04-13
|
||||
|
||||
* [person] household address: add a form for editing the validFrom date (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/541)
|
||||
* [person] householdmemberseditor: fix composition type bug in select form (vuejs) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/543)
|
||||
* [docgen] add more persons choices in docgen for course: amongst requestor (if person), resources of course (if person), and PersonResource (if person);
|
||||
* [docgen] add a new context with a list of activities in course
|
||||
* [docgen] add a comment in budget lines
|
||||
* [notifications] allow to send a notification to an email address. The address receive an access link
|
||||
* [adresses] add constraints in database to avoid errors later: postcode not null, and validfrom <= validto
|
||||
* [accompanying work editor] add a label on document title input
|
||||
|
||||
### 2021-04-07
|
||||
|
||||
* notification list: move action buttons outside of the toggle
|
||||
* fix detecting of non-read notification
|
||||
* filter users which are disabled in search user api
|
||||
* order query for location and add pagination in list
|
||||
* allow every person which has part for a workflow to see the workflow page
|
||||
* able to see the workflow if the evaluation document has been deleted
|
||||
* hardcode the list of supported mime types for edition with collabora
|
||||
* list of accompanying course: allow to see the pinned comment in list_item
|
||||
|
||||
### 2021-04-06
|
||||
|
||||
* [main] notification toggle read: correct js syntax for compilation in production (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/548)
|
||||
* [parcours] Display of interlocuteurs changed to flex-table in parcours edit page to prevent cut-off of information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/535)
|
||||
* [activity] espace entre les boutons pour supprimer les documents
|
||||
|
||||
|
||||
### continuous release in February and March
|
||||
|
||||
* Creation of PickCivilityType, and implementation in PersonType and ThirdpartyType
|
||||
* [person] Accompanying course evaluation documents: disable the WOPI edit link if mimetype not supported and if no keyInfos
|
||||
(https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/585)
|
||||
* [activity] display error messages above the form in creating a new location (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/481)
|
||||
* [activity] show required field in activity edit/new by an asterix in the vuejs fields (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/494)
|
||||
* [ACL] fix allow to see the course, event if the scope'course does not contains the scope's user
|
||||
* [search] enforce limit of results for fetching rsults by search api https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/576
|
||||
* [activity] Fix delete button for document (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/554)
|
||||
* [activity] Add return path the document generation (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/553)
|
||||
* [person] add person ressource to person docgen normaliser (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/517)
|
||||
* [person] AccompanyingCourseWorkEdit: fix deleting evaluation documents (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/546)
|
||||
* [person] AccompanyingCourseWorkEdit: download existing documents (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/512)
|
||||
* [person] AccompanyingCourseWorkEdit: replace document by a new one (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/511)
|
||||
* [person] AccompanyingPeriodWork: add referrers to work, add doctrine event listener to add logged user to referrers collection and display a referrers list in work list (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/502)
|
||||
* [person] AccompanyingPeriodWorkEvaluation: fix circular reference when serialising (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/495)
|
||||
* [person] order accompanying period by opening date in search persons, person and household period lists (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/493)
|
||||
* [parcours] autosave of the pinned comment for draft accompanying course (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/477)
|
||||
* [main] filter user job in undispatch acc period to assign (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/472)
|
||||
* [main] filter user job in undispatch acc period to assign (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/472)
|
||||
* [person] Add url in accompanying period work evaluations entity and form (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/476)
|
||||
* [person] Add document generation in admin and in person/{id}/document (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/464)
|
||||
* [activity] do not override location if already exist (when validating new activity) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/470)
|
||||
* [parcours] Toggle emergency/intensity only by referrer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/442)
|
||||
* [docstore] Add an API entrypoint for StoredObject (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/466)
|
||||
* [person] Add the possibility of uploading existing documents to AccPeriodWorkEvaluationDocument (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/466)
|
||||
* [person] Add title to AccPeriodWorkEvaluationDocument (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/466)
|
||||
* [person] Order social issues by the field "ordering" (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/388)
|
||||
* [Person/Household list] when listing other simultaneous members of an household, exclude the members on person, not on members (avoid to show two membersship with the same person)
|
||||
* [draft periods] add a delete button (if acl granted) on each draft period listed on draft period page (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/463)
|
||||
* [Person] Display suffixText in RenderPerson, PersonText.vue, RenderPersonBox.vue (was made for displaying "enfant confie") (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/441)
|
||||
* [budget]: budget enabled for persons and households (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/469)
|
||||
* [person] residential address: show residential address or info in PersonRenderBox, refactor Residential Address (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/439)
|
||||
* [thirdparty] Add a contact to a thirdparty from within onTheFly (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/345)
|
||||
* [documents] Improve flex-table item-col placement when long buttons and long metadata
|
||||
* [thirdparty] Fix display of multiple contact badges so they wrap onto next line (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/482)
|
||||
* [confidential] Fix position of toggle button so it does not cover text nor fall outside of box (no issue)
|
||||
* [parcours] Fix edit of both thirdparty and contact name (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/474)
|
||||
* [template] do not list inactive templates (for doc generator)
|
||||
* [household] bugfix if position of member is null, renderbox no longer throws an error (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/480)
|
||||
* [parcours] location cannot be removed if linked to a user (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/478)
|
||||
* [person] email added to twig personRenderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/490)
|
||||
* [activity] Only youngest descendant is kept for social issues and actions (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/471)
|
||||
* [person] Add link to current household in person banner (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/484)
|
||||
* [address] person badge in address history changed to open OnTheFly with all person info (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/489)
|
||||
* [person] Change 'personne' with 'usager' and '&' with 'ET' (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/499)
|
||||
* [thirdparty] Add parameter condition to display centers or not (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/500)
|
||||
* [phonenumber] Remove placeholder in phonenumber field (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/496)
|
||||
* [person_resource] separate create page created to avoid confusion (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/504)
|
||||
* [contact] add contact button color changed plus the pipe at the side removed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/506)
|
||||
* [thirdparty] For contacts show current civility/profession in edit form + fix saving of edited information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/491)
|
||||
* [household] create-edit household composition placed in separate page to avoid confusion (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/505)
|
||||
* [blur] Improved positioning of toggle icon (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/486)
|
||||
* [thirdparty] add firstname field to thirdparty 'child' or 'contact' types (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/508)
|
||||
* [household] create-edit household composition placed in separate page to avoid confusion (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/505)
|
||||
* [blur] Improved positioning of toggle icon (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/486)
|
||||
* [parcours] List of parcours for a specific user so they can be reassigned in case of absence (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/509)
|
||||
* [thirdparty] Thirdparty view page, english text translated (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/534)
|
||||
* [social_action] Translation changed in evaluation section (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/512)
|
||||
* [filiation] Possible to add person (or create onthefly) to add to filiation graph + add relation (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/519)
|
||||
* [household] Within parcours listing page of household add create button (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/560)
|
||||
* [person_resource] bugfix when adding thirdparty or freetext resource + prevent personOwner themselves to be added. (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/526)
|
||||
* [aside_activity] style correction + sticky-form create button (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/529)
|
||||
* [budget] order within the menu adjusted (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/592)
|
||||
* [onthefly] fix create person. Bug was noticed in filiation (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/591)
|
||||
* [parcours] Create document buttons made sticky (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/532)
|
||||
* [person] Trailing guillemet removed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/530)
|
||||
* [notification] Display of social action within workflow notification set to display block (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/537)
|
||||
* [onthefly] trim trailing whitespace in email of person and thirdparty (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/542)
|
||||
|
||||
* [action] Only youngest descendant is kept for social issues and actions (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/471)
|
||||
## Test releases
|
||||
|
||||
### test release 2022-02-21
|
||||
|
||||
* [notifications] Word 'un' changed to number '1' for notifications in user menu (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/483)
|
||||
* [documents] 'gabarit' changed to 'modèle' (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/405)
|
||||
* [person_resources] Menu name and order changed (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/460)
|
||||
* workflow: fix sending notifications
|
||||
* [thirdparty] Extend the thirdparty search to thirdparty children (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/448)
|
||||
* [person]: AddPersons: allow creation of person or thirdparty only (no users) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/422)
|
||||
* [person]: AddPersons: allow creation of person or thirdparty depending on allowed types (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/422)
|
||||
* [person]: AddPersons: add suggestion of name when creating new person or thirdparty (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/422)
|
||||
* [main] Address: fix small bug: when modifying an address without street (isNoAddress), also check errors if street is an empty string as back-end change null value to empty string for street (and streetNumber)
|
||||
* [main] Address: stronger client-side validation of addresses (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/449)
|
||||
* [person] accompanying course: filter suggested entities by open participations (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/415)
|
||||
[activity] can click through the cross icon for removing person in concerned group (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/476)
|
||||
[activity] correct associated persons by considering only open participations (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/476)
|
||||
* [person_resources]: Renderboxes used to display person/thirdparty info (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/465)
|
||||
* [Household]: Add end date in HouseholdMember form for 'enfant hors menage' (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/434)
|
||||
* [homepage_widget]: If no sender then display as 'notification automatique' (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/435)
|
||||
* [parcours]: Order social activities and only display most recent three in parcours resumé (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/481)
|
||||
* [3party]: 3party: redirect to parent when contact (child) is opened in view page
|
||||
* [parcours / addresses]: launch an event when a person change address (either through changing household or because the household is associated to a new address). If the person is localising a course, the course location go back to a temporarily address.
|
||||
* [thirdparty]: address/phonenumber/email/fonction displayed in thirdpartyrenderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/401)
|
||||
* [thirdparty_contact]: in search results the 'qualité' is displayed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/465)
|
||||
* [bug]: fix confidential toggle of address in thirdpartyrenderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/460)
|
||||
|
||||
|
||||
|
||||
### 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)
|
||||
* [parcours]: Only the referrer can toggle the intensity of the parcours (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/442)
|
||||
* [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)
|
||||
* [thirdparty] Add a contact to a thirdparty from within onTheFly (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/345)
|
||||
|
||||
|
||||
### test release 2021-02-01
|
||||
|
||||
* 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.
|
||||
* [thirdparty] Add a contact to a thirdparty from within onTheFly (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/345)
|
||||
* [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
|
||||
* 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
|
||||
* [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)
|
||||
* [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
|
||||
|
||||
* [main] Add editableByUser field to locationType entity, adapt the admin template and add this condition in the location-type endpoint (see https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/297)
|
||||
* [main] Add mainLocation field to User entity and add it in user form type
|
||||
* rewrite page which allow to select activity
|
||||
* [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
|
||||
* [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
|
||||
* 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 release 2022-01-12
|
||||
|
||||
* fix thirdparty normalizer on telephone field: https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/322
|
||||
|
||||
### test release 2022-01-11
|
||||
|
||||
* vuejs: translate in French all multiselect widgets
|
||||
* [address] define address lines according postal standards for France and Belgium (default) and change AddressRender, chill_entity_render_box and AddressRenderBox.vue
|
||||
* [household] change translations (champs-libres/departement-de-la-vendee/accent-suivi-developpement#109)
|
||||
* [household] add address i18n in household component (champs-libres/departement-de-la-vendee/accent-suivi-developpement#158)
|
||||
* [household] add on the fly i18n in household component
|
||||
* [household] redirect to the household page when a household is created from a person (champs-libres/departement-de-la-vendee/accent-suivi-developpement#175)
|
||||
* [household] household member editor: display alert if some members have already an household (champs-libres/departement-de-la-vendee/accent-suivi-developpement#172)
|
||||
* [household] household member editor: do not add in new members if the member is included in the members of household (champs-libres/departement-de-la-vendee/accent-suivi-developpement#123)
|
||||
* [household] household member editor: remove markNoAddress button (champs-libres/departement-de-la-vendee/accent-suivi-developpement#109)
|
||||
* [person]: ordering fields in add person (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/61)
|
||||
* [person]: Add email and alt names in add person (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/61)
|
||||
* [accompanyingCourse] Add a delete action and delete buttons to delete a accompanying course when step = DRAFT (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/64)
|
||||
* [accompanyingCourse] Add a administrative location in the accompanying course, set the user current location as default, allow to select a location in a select field and do not allow to confirm the accompanying course if location is empty.
|
||||
* [accompanyingCourse] Add the administrative location in the available variables for document generation
|
||||
* AddAddress: optimize loading: wait for the user finish typing;
|
||||
* UserPicker: fix bug with deprecated role
|
||||
* docgen: add base context + tests
|
||||
* docgen: add age for person
|
||||
* [household menu] fix filiation order https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/265
|
||||
* [AddAddress]: optimize loading: wait for the user finish typing;
|
||||
* [UserPicker]: fix bug with deprecated role
|
||||
* [docgen]: add base context + tests
|
||||
* [docgen]: add age for person
|
||||
* [task]: fix dropdown menu style + fix bug in singleTaskController (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/338)
|
||||
* Household: fix bug when moving person on the same day (see https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/281)
|
||||
* Household: show date validFrom and validTo when moving
|
||||
* address reference: add index for refid
|
||||
* [accompanyingCourse_work] fix styles conflicts + fix bug with remove goal (remove goals one at a time)
|
||||
* [accompanyingCourse] improve masonry on resume page, add origin
|
||||
* [notification] new notification interface, can be associated to AccompanyingCourse/Period, Activities.
|
||||
* List notifications, show, and comment in User section
|
||||
* Notify button and contextual notification box on associated objects pages
|
||||
* [accompanyingCourse] add a comment for each resource associated. A modal allow to save comment. Comment is displayed in on-the-fly show modal of the accompanyingCourse context (edit page + resume page).
|
||||
|
||||
### test release 2021-12-14
|
||||
|
||||
* [asideactivity] creation of aside activity category fixed (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/262)
|
||||
* [vendee/person] fix typo "situation professionelle" => "situation professionnelle"
|
||||
* [main] add availableForUsers condition from locationType in the location API endpoint (champs-libres/departement-de-la-vendee/accent-suivi-developpement#248)
|
||||
* [main] add the current location of the user as API point + add it in the activity location list (champs-libres/departement-de-la-vendee/accent-suivi-developpement#247)
|
||||
* [activity] improve show/new/edit templates, fix SEE and SEE_DETAILS acl
|
||||
* [badges] create specific badge for TMS, and make person/thirdparty badges clickable with on-the-fly modal in :
|
||||
* concerned groups items (activity, calendar)
|
||||
* accompanyingCourseWork lists
|
||||
* accompanyingCourse lists
|
||||
* [acompanyingCourse] add initial comment on Resume page
|
||||
* [person] create button full width (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/330)
|
||||
|
||||
### test release 2021-12-11
|
||||
|
||||
* [main] add order field to civility
|
||||
* [main] change address format in case the country is France, in Address render box and address normalizer
|
||||
* [person] add validator for accompanying period with a test on social issues (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/76)
|
||||
* [activity] fix visibility for location
|
||||
* [origin] fix origin: use correctly the translatable strings
|
||||
* /!\ everyone must update the origin table. As there is only one row, execute `update chill_person_accompanying_period_origin set label = jsonb_build_object('fr', 'appel téléphonique');`
|
||||
* [person] redirect bug fixed.
|
||||
* [action] add an unrelated issue within action creation.
|
||||
* [origin] fix origin: use correctly the translatable strings
|
||||
* /!\ everyone must update the origin table. As there is only one row, execute `update chill_person_accompanying_period_origin set label = jsonb_build_object('fr', 'appel téléphonique');`
|
||||
* [main] change order of civilities in civility fixtures (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/191)
|
||||
* [person] set min attr in the minimum of children field (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/191)
|
||||
* [person] add marital status date in person view (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/191)
|
||||
* [person] show number of children + allow set number of children to null (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/191)
|
||||
* [person] show acceptSMS option (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/191)
|
||||
* [person] add death information in person render box in twig and vue render boxes (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/191)
|
||||
* [asideactivity] creation of aside activity category fixed (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/262)
|
||||
* [vendee/person] fix typo "situation professionelle" => "situation professionnelle"
|
||||
* [accompanyingcourse_work] Changes in layout/behavior of edit form (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/321)
|
||||
* [badge-entity] design coherency between pills badge-person and 3 kinds of badge-thirdparty
|
||||
* [AddPersons] suggestions row are clickable, not only checkbox
|
||||
|
||||
### test release 2021-12-06
|
||||
|
||||
* [main] address: use search API end points for getting postal code and reference address (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/316)
|
||||
* [main] address: in edit mode, select the encoded values in multiselect for address reference and city (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/316)
|
||||
* [person search] fix bug when using birthdate after and birthdate before
|
||||
* [person search] increase pertinence when lastname begins with search pattern
|
||||
* [activity/actions] Améliore la cohérence du design entre
|
||||
* la page résumé d'un parcours (liste d'actions récentes et liste d'activités récentes)
|
||||
* la page liste des actions
|
||||
* la page liste des activités (contexte personne / contexte parcours)
|
||||
* [household] field to edit wheter person is titulaire of household or not removed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/322)
|
||||
* [activity] create work if a work with same social action is not associated to the activity
|
||||
* [visgraph] improve and fix bugs on vis-network relationship graph
|
||||
* [bugfix] posting of birth- and deathdate through api fixed.
|
||||
* [suggestions] improve suggestions lists
|
||||
|
||||
### Test release 2021-11-19 - bis
|
||||
|
||||
* [household] do not allow to create two addresses on the same date
|
||||
* [activity] handle case when there is no social action associated to social issue
|
||||
* [activity] layout for issues / actions
|
||||
* [activity][bugfix] in edit mode, the form will now load the social action list
|
||||
|
||||
|
||||
### Test release 2021-11-29
|
||||
|
||||
* [person] suggest entities (person | thirdparty) when creating/editing the accompanying course (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/119)
|
||||
* [activity] add custom validation on the Activity class, based on what is required from the ActivityType (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/188)
|
||||
* [main] translate multiselect messages when selecting/creating address
|
||||
* [main] set the coordinates of the city when creating a new address OR choosing "pas d'adresse complète"
|
||||
* Use the user.label in accompanying course banner, instead of username;
|
||||
* fix: show validation message when closing accompanying course;
|
||||
* [thirdparty] link from modal to thirdparty detail page fixed (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/228)
|
||||
* [assets] new asset to style suggestions lists (with add/remove item link) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/258)
|
||||
* [accompanyingCourseWorkEdit] improves hyphenation and line breaks for long badges
|
||||
* [acompanyingCourse] improve Resume page
|
||||
* complete all needed informations,
|
||||
* actions and activities are clickables,
|
||||
* better placement with js masonry blocks on top of content area,
|
||||
* https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/101
|
||||
* https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/295
|
||||
* [activity/calendar] on show page, concerned groups of persons table adapt itself to isVisibles options
|
||||
* [activity] remove the "plus" button in activity list
|
||||
* [activity] check ACL on activity list in person context
|
||||
* [list for accompanying course in person] filter list using ACL
|
||||
* [validation] toasts are displayed for errors when modifying accompanying course (generalization required).
|
||||
* [period] only the user can enable confidentiality
|
||||
* add an endpoint for checking permissions. See https://gitlab.com/Chill-Projet/chill-bundles/-/merge_requests/232
|
||||
* [activity] for a new activity: suggest and create on-the-fly locations based on the accompanying course location + location of the suggested parties
|
||||
* [calendar] for a new rdv: suggest and create on-the-fly locations based on the accompanying course location + location of the suggested parties
|
||||
* [period] Validation added when period is confidential and confirmed -> user cannot be null.
|
||||
|
||||
|
||||
## Test releases
|
||||
|
||||
### Test release 2021-11-22
|
||||
|
||||
* [activity] delete admin_user_show in twig template because this route is not defined and should be defined
|
||||
* [activity] suggest requestor, user and ressources for adding persons|user|3rdparty
|
||||
* [calendar] suggest persons, professionals and invites for adding persons|3rdparty|user
|
||||
* [activity] take into account the restrictions on person|thirdparties|users visibilities defined in ActivityType
|
||||
* [main] Add currentLocation to the User entity + add a page for selecting this location + add in the user menu (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/133)
|
||||
* [activity] add user current location as default location for a new activity (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/133)
|
||||
* [task] Select2 field in task form to allow search for a user (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/167)
|
||||
* remove "search by phone configuration option": search by phone is now executed by default
|
||||
* remplacer le classement par ordre alphabétique par un classement par ordre de pertinence, qui tient compte:
|
||||
* de la présence d'une string avec le nom de la ville;
|
||||
* de la similarité;
|
||||
* du fait que la recherche commence par une partie du mot recherché
|
||||
* ajouter la recherche par numéro de téléphone directement dans la barre de recherche et dans le formulaire recherche avancée;
|
||||
* ajouter la recherche par date de naissance directement dans la barre de recherche;
|
||||
* ajouter la recherche par ville dans la recherche avancée
|
||||
* ajouter un lien vers le ménage dans les résultats de recherche
|
||||
* ajouter l'id du parcours dans les résultats de recherche
|
||||
* ajouter le demandeur dans les résultats de recherche
|
||||
* ajout d'un bouton "recherche avancée" sur la page d'accueil
|
||||
* [person] create an accompanying course: add client-side validation if no origin (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/210)
|
||||
* [person] fix bounds for computing current person address: the new address appears immediatly
|
||||
* [docgen] create a normalizer and serializer for normalization on doc format
|
||||
* [person normalization] the key center is now "centers" and is an array. Empty array if no center
|
||||
* [accompanyingCourse] Ability to close accompanying course (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/296)
|
||||
* [task] Select2 field in task form to allow search for a user (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/167)
|
||||
* [list result] show all courses, except ones with period closed
|
||||
* [accompanyingCourse] improve banner with small carousel to display slide social-issues or slide associated persons (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/69)
|
||||
|
||||
### Test release 2021-11-15
|
||||
|
||||
* [main] fix adding multiple AddresseDeRelais (combine PickAddressType with ChillCollection)
|
||||
* [person]: do not suggest the current household of the person (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/51)
|
||||
* [person]: display other phone numbers in view + add message in case no others phone numbers (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/184)
|
||||
* unnecessary whitespace removed from person banner after person-id + double parentheses removed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/290)
|
||||
* [person]: delete accompanying period work, including related objects (cascade) (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/36)
|
||||
* [address]: Display of incomplete address adjusted.
|
||||
* [household]: improve relationship graph
|
||||
* add form to create/edit/delete relationship link,
|
||||
* improve graph refresh mechanism
|
||||
* add feature to export canvas as image (png)
|
||||
* [person suggest] In widget "add person", improve the pertinence of persons when one of the names starts with the pattern;
|
||||
* [person] do not ask for center any more on person creation
|
||||
* [3party] do not ask for center any more on 3party creation
|
||||
|
||||
## Test releases
|
||||
|
||||
### Test release 2021-11-08
|
||||
|
||||
* [person]: Display the name of a user when searching after a User (TMS)
|
||||
* [person]: Add civility to the person
|
||||
* [person]: Various improvements on the edit person form
|
||||
* [person]: Set available_languages and available_countries as parameters for use in the edit person form
|
||||
* [activity] Bugfix: documents can now be added to an activity.
|
||||
* [tasks] improve tasks with filter order
|
||||
* [tasks] refactor singleControllerTasks: limit the number of conditions from the context
|
||||
* [validations] validation of accompanying period added: no duplicate participations or resources (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/60).
|
||||
* [renderbox] If gender of person is not defined, no icon is displayed instead of neuter-icon (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/129).
|
||||
* [confidential information] module added to blur confidential information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/248).
|
||||
* refactor `AuthorizationHelper` and `UserACLAwareRepository` to fix constructor, and separate logic for parent role helper into `ParentRoleHelper`
|
||||
* [main]: filter location and locationType in backend: exclude NULL names, only active and availableToUsers
|
||||
* [activity]: perform client-side validation & show/hide fields in the "new location" modal
|
||||
* [person]: normalize person with CenterResolverDispatcher and handle case where center is null or multiple in PersonRenderBox
|
||||
* [docstore] voter for PersonDocument and AccompanyingCourseDocument on the 2.0 way (using VoterHelperFactory)
|
||||
* [docstore] add authorization check inside controller and menu
|
||||
* [activity]: fix inheritance for role `ACTIVITY FULL` and add missing acl in menu
|
||||
* [person] show current address in search results
|
||||
* [person] show alt names in search results
|
||||
* [admin]: links to activity admin section added again.
|
||||
* [household]: endDate field deleted from household edit form.
|
||||
* [household]: View accompanying periods of current and old household members.
|
||||
* [tasks]: different layout for task list / my tasks, and fix link to tasks in alert or in warning
|
||||
* [admin]: links to activity admin section added again.
|
||||
* [household]: household addresses ordered by ValidFrom date and by id to show the last created address on top.
|
||||
* [socialWorkAction]: display of social issue and parent issues + banner context added.
|
||||
* [DBAL dependencies] Upgrade to DBAL 3.1
|
||||
|
||||
### Test release 2021-10-27
|
||||
|
||||
* [person]: delete double actions buttons on search person page
|
||||
* [person]: accompanying course work: remove creation date display the list of work + handle case when end date is null
|
||||
* [main]: Add new pages with a menu for managing location and location type in the admin
|
||||
* [main]: Add some fixtures for location type
|
||||
* [calendar]: Pass the location when transforming a calendar item (rdv) into an activity
|
||||
* [calendar]: Add a user menu for "my calendar"
|
||||
|
||||
### Test release 2021-10-18
|
||||
|
||||
* [3party]: french translation of contact and company
|
||||
* [3party]: show parent in list
|
||||
* [3party]: change color for badge "child"
|
||||
* [3party]: fix address creation
|
||||
* [household members editor] finalisation of editor
|
||||
* [AccompanyingCourse banner]: replace translation referrer (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/70)
|
||||
* [Location]: add location system in activity and RV (calendar). User can choose in location list or create a new location.
|
||||
* [household]: add relationship page with dynamic data visualisation graph
|
||||
|
||||
## Test releases
|
||||
|
||||
### Test release 2021-10-11
|
||||
|
||||
* Address: zoom on postal code geometry + fix origin of manually entered postal code
|
||||
|
||||
* in the Address vue component, order the postal code and street address by alphabetic and numeric order
|
||||
|
||||
* add 3 new fields to PostalCode and adapt postal code command and fixtures
|
||||
|
||||
* [Aside activity] Fixes for aside activity
|
||||
|
||||
* categories with child
|
||||
* fast creation buttons
|
||||
* add ordering for types
|
||||
|
||||
* [AccompanyingCourse Resume page] dashboard for AccompanyingCourseWork and for Activities;
|
||||
* Improve badges behaviour with small screens;
|
||||
|
||||
* [ThirdParty]:
|
||||
|
||||
* third party list
|
||||
* create a kind contact/institution when create a new thirdparty, and set contact embedded as kind=child;
|
||||
* filter thirdparties in list
|
||||
|
||||
* [FilterOrder]: add development kit for generating filter and ordering in list
|
||||
* [Capitalization of names] person names are capitalized on creation, on prePersist event
|
||||
* [On-The-Fly] modale works for showing, editing and creating person or thirdparty ;
|
||||
* [AccompanyingCourse Resume page] associated persons list, can see household when hover, and with show on-the-fly modale when clicking person ;
|
||||
|
||||
### test release 2021-10-04
|
||||
|
||||
* [Household editor][UI] Update how household suggestion and addresses are picked;
|
||||
|
||||
See https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/80
|
||||
* [AddAddress] Handle address suggestion;
|
||||
* [CenterType][Create a person] when overriding the ACL rules, allow to show a PickCenterType
|
||||
when no centers are reachable by the default ACL.
|
||||
* [Household] Show comment event if no address are associated with the household;
|
||||
* [Person results] Add requestor into search results:
|
||||
|
||||
* a badge "requestor" is shown into search results;
|
||||
* periods where the person is only requestor (without participating) are also shown;
|
||||
|
||||
Issues:
|
||||
|
||||
* https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/13
|
||||
* https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/199
|
||||
* [Person form] "accept sms" not required:
|
||||
|
||||
https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/37
|
||||
https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/221
|
||||
|
||||
* [Household editor] suggest only temporarily addresses;
|
||||
See https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/82
|
||||
* On-The-Fly modale works for showing, editing and creating person and thirdparty ;
|
||||
* AccompanyingCourse Resume page: list associated persons by household, see household when hover, and show on-the-fly modale when clicking on person ;
|
||||
* [AddAddress] Handle address suggestion;
|
||||
* [AddAddress][Entity address]: add a link between address and address reference;
|
||||
* [Household editor] suggest household by comparing the temporary addresses from courses;
|
||||
|
||||
See https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/81
|
||||
* On-The-Fly modale works for showing, editing and creating person and thirdparty
|
||||
|
||||
|
||||
## Test released
|
||||
|
||||
<!--
|
||||
|
||||
Coming soon...
|
||||
|
||||
DO NOT ADD unreleased items here. Add them under "Unreleased" title
|
||||
|
||||
### Test release yyyy-mm-dd
|
||||
|
||||
-->
|
||||
|
||||
## Stable releases
|
||||
|
||||
No stable releases for v2+
|
||||
|
427
CONVENTIONS.md
427
CONVENTIONS.md
@@ -1,427 +0,0 @@
|
||||
# Conventions Chill
|
||||
|
||||
en cours de rédaction
|
||||
|
||||
## Translations
|
||||
|
||||
|
||||
Par bundle, toutes les traductions des pages twig se trouvent dans un seul fichier `translations/messages.fr.yaml`.
|
||||
|
||||
## Emplacement des fichiers
|
||||
|
||||
Les controllers, form type & templates twig sont placés à la racine des dossiers `Controller`, `Form` & `Ressources/views`, respectivement. Pour les pages Admin, on ne les mets plus dans des sous-dossiers Admin.
|
||||
## Assets: nommage des entrypoints
|
||||
|
||||
Trois types d'entrypoint:
|
||||
|
||||
* application vue (souvent spécifique à une page) -> préfixé par `vue_`;
|
||||
* code js/css qui est réutilisé à plusieurs endroits:
|
||||
* ckeditor
|
||||
* async_upload (utilisé pour un formulaire)
|
||||
* bootstrap
|
||||
* chill.js
|
||||
* ...
|
||||
|
||||
=> on préfixe `mod_`
|
||||
* code css ou js pour une seule page
|
||||
* ré-utilise parfois des "foncitionnalités": ShowHide, ...
|
||||
=> on préfixe `page_`
|
||||
|
||||
|
||||
Arborescence:
|
||||
|
||||
```
|
||||
# Sous Resources/public
|
||||
|
||||
- chill/ => theme (chill)
|
||||
- chillmain.scss -> push dans l'entrypoint chill
|
||||
- lib/ => ne vont jamais dans un entrypoint, mais sont ré-utilisés par d'autres
|
||||
- ShowHide
|
||||
- Collection
|
||||
- Select2
|
||||
- module/ => termine dans des entrypoints ré-utilisables (mod_)
|
||||
- bootstrap
|
||||
- custom.scss
|
||||
- custom/
|
||||
- variables.scss
|
||||
- ..
|
||||
- forkawesome
|
||||
- AsyncUpload
|
||||
- vue/ => uniquement application vue (vue_)
|
||||
- _components
|
||||
- app
|
||||
- page/ => uniquement pour une seule page (page_)
|
||||
- login
|
||||
- person
|
||||
- personvendee
|
||||
- household_edit_metadata
|
||||
- index.js
|
||||
```
|
||||
|
||||
## Organisation des feuilles de styles
|
||||
|
||||
Comment s'échaffaudent les styles dans Chill ?
|
||||
|
||||
|
||||
1. l'entrypoint **mod_bootstrap** (module bootstrap) est le premier niveau. Toutes les parties(modules) de bootstrap sont convoquées dans le fichier ```bootstrap.js``` situé dans ```ChillMainBundle/Resources/public/module/bootstrap```.
|
||||
* Au début, ce fichier importe le fichier ```variables.scss``` qui détermine la plupart des réglages bootstrap tels qu'on les a personnalisés. Ce fichier surcharge l'original, et de nombreuses variables y sont adaptées pour Chill.
|
||||
* On veillera à ce qu'on puisse toujours comparer ce fichier à l'original de bootstrap. En cas de mise à jour de bootstrap, il faudra générer un diff, et adapter ce diff sur le fichier variable de la nouvelle version.
|
||||
* A la fin on importe le fichier ```custom.scss```, qui comprends des adaptations de bootstrap pour le préparer à notre thème Chill.
|
||||
* ce ```custom.scss``` peut être splitté en plus petits fichiers avec des ```@import 'custom/...'```
|
||||
* L'idée est que cette première couche bootstrap règle un partie importante des styles de l'application, en particulier ce qui touche aux position du layout, aux points de bascules responsive, aux marges et écarts appliqués par défauts aux éléments qu'on manipule.
|
||||
|
||||
2. l'entrypoint **chill** est le second niveau. Il contient le thème Chill qui est reconnaissable à l'application.
|
||||
* Chaque bundle a un dossier ```Resources/public/chill``` dans lequel on peut trouver une feuille sass principale, qui est éventuellement splittée avec des ```@imports```. Toutes ces feuilles sont compilées dans un unique entrypoint Chill, c'est le thème de l'application. Celui-ci surcharge bootstrap.
|
||||
* La feuille chillmain.scss devrait contenir les cascades de styles les plus générales, celles qui sont appliquées à de nombreux endroits de l'application.
|
||||
* La feuille chillperson.scss va aussi retrouver des styles propres aux différents contextes des personnes: person, household et accompanyingcourse.
|
||||
* Certains bundles plus secondaires ne contiennent que des styles spécifiques à leur fonctionnement.
|
||||
|
||||
3. les entrypoints **vue_** sont utilisés pour des composants vue. Les fichiers vue peuvent contenir un bloc de styles scss. Ce sont des styles qui ne concernent que le composant et son héritage, le tag ```scoped``` précise justement sa portée (voir la doc).
|
||||
|
||||
4. les entrypoints **page_** sont utilisés pour ajouter des assets spécifiques à certaines pages, le plus souvent des scripts et des styles.
|
||||
|
||||
|
||||
## Taguer du code html et construire la cascade de styles
|
||||
|
||||
L'exemple suivant montre comment taguer sans excès un élément de code. On remarque que:
|
||||
* il n'est pas nécessaire de taguer toutes les classes intérieures,
|
||||
* il ne faut pas répéter la classe parent dans toutes les classes enfants. La cascade sass va permettre de saisir le html avec souplesse sans alourdir la structure des balises.
|
||||
* souvent la première classe sera déclinée par plusieurs classes qui commencent de la même manière: ```bloc-dark``` ajoute juste la version sombre de ```bloc```, on ne met pas ```bloc dark```, car on ne souhaite pas que la classe ```dark``` de ```bloc``` interagisse avec la même classe ```dark``` de ```table```. On aura donc un élément ```bloc bloc-dark``` et un élément ```table table-dark```.
|
||||
|
||||
```html
|
||||
<div class="bloc bloc-dark mon-bloc">
|
||||
<h3>mon titre</h3>
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a class="btn btn-edit"></a>
|
||||
</li>
|
||||
<li></li>
|
||||
<li></li>
|
||||
</ul>
|
||||
</div>
|
||||
```
|
||||
|
||||
Finalement, il importe ici de définir ce qu'est un bloc, ce qu'est une zone d'actions et ce qu'est un bouton. Ces 3 éléments existent de manière autonome, ce sont les seuls qu'on tagge.
|
||||
|
||||
Par exemple pour mettre un style au titre on précise juste h3 dans la cascade bloc.
|
||||
|
||||
```scss
|
||||
div.bloc {
|
||||
// un bloc générique, utilisé à plusieurs endroits
|
||||
&.bloc-dark {
|
||||
// la version sombre du bloc
|
||||
}
|
||||
h3 {}
|
||||
ul {
|
||||
// une liste standard dans bloc
|
||||
li {
|
||||
// des items de liste standard dans bloc
|
||||
}
|
||||
}
|
||||
}
|
||||
div.mon-bloc {
|
||||
// des exceptions spécifiques à mon-bloc,
|
||||
// qui sont des adaptations de bloc
|
||||
}
|
||||
|
||||
ul.record_actions {
|
||||
// va uniformiser tous les record_actions de l'application
|
||||
li {
|
||||
//...
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
// les boutons de bootstrap
|
||||
.btn-edit {
|
||||
// chill étends les boutons bootstrap pour ses propres besoins
|
||||
}
|
||||
}
|
||||
</style>
|
||||
```
|
||||
|
||||
## Render box
|
||||
|
||||
|
||||
## URL
|
||||
|
||||
### Nommage des routes
|
||||
|
||||
:::warning
|
||||
Ces règles n'ont pas toujours été utilisées par le passé. Elles sont souhaitées pour le futur.
|
||||
:::
|
||||
|
||||
Les routes sont nommées de cette manière:
|
||||
|
||||
`chill_(api|crud)_bundle_(api)_entite_action`
|
||||
|
||||
1. d'abord chill_ (pour tous les modules chill)
|
||||
2. ensuite `crud` ou `api`, optionnel, automatiquement ajouté si la route est générée par la configuration
|
||||
3. ensuite une string qui indique le bundle (`main`, `person`, `activity`, ...)
|
||||
4. ensuite, `api`, si la route est une route d'api.
|
||||
5. ensuite une string qui indique sur quelle entité porte la route, voire également les sous-entités
|
||||
6. ensuite une action (`list`, `view`, `edit`, `new`, ...)
|
||||
|
||||
Le fait d'indiquer `api` en quatrième position permet de distinguer les routes d'api qui sont générées par la configuration (qui sont toutes préfixées par `chill_api`, de celles générées manuellement. (Exemple: `chill_api_household__index`, et `chill_person_api_household_members_move`)
|
||||
|
||||
Si les points 4 et 5 sont inexistants, alors ils sont remplacés par d'autres éléments de manière à garantir l'unicité de la route, et sa bonne compréhension.
|
||||
|
||||
### Nommage des URL
|
||||
|
||||
Les URL respectent également une convention:
|
||||
|
||||
#### Pour les pages html
|
||||
|
||||
:::warning
|
||||
Ces règles n'ont pas toujours été utilisées par le passé. Elles sont souhaitées pour le futur.
|
||||
:::
|
||||
|
||||
Syntaxe:
|
||||
|
||||
```
|
||||
/{_locale}/bundle/entity/{id}/action
|
||||
/{_locale}/bundle/entity/sub-entity/{id}/action
|
||||
```
|
||||
|
||||
Les éléments suivants devraient se trouver dans la liste:
|
||||
|
||||
1. la locale;
|
||||
2. un identifiant du bundle
|
||||
3. l'entité auquel il se rapporte
|
||||
4. les éventuelles sous-entités auxquelles l'url se rapport
|
||||
5. l'action
|
||||
|
||||
Ces éléments peuvent être entrecoupés de l'identifiant d'une entité. Dans ce cas, cet identifiant se place juste après l'entité auquel il se rapporte.
|
||||
|
||||
Exemple:
|
||||
|
||||
```
|
||||
# liste des échanges pour une personne
|
||||
/fr/activity/person/25/activity/list
|
||||
|
||||
# nouvelle activité
|
||||
/fr/activity/activity/new?person_id=25
|
||||
|
||||
```
|
||||
|
||||
#### Pour les API
|
||||
|
||||
:::info
|
||||
Les routes générées automatiquement sont préfixées par chill_api
|
||||
:::
|
||||
|
||||
Syntaxe:
|
||||
|
||||
```
|
||||
/api/1.0/bundle/entity/{id}/action
|
||||
/api/1.0/bundle/entity/sub-entity/{id}/action
|
||||
```
|
||||
|
||||
Les éléments suivants devraient se trouver dans la liste:
|
||||
|
||||
1. la string `/api/` et puis la version (1.0)
|
||||
2. un identifiant du bundle
|
||||
3. l'entité auquel il se rapporte
|
||||
4. les éventuelles sous-entités auxquelles l'url se rapport
|
||||
5. l'action
|
||||
|
||||
Ces éléments peuvent être entrecoupés de l'identifiant d'une entité. Dans ce cas, cet identifiant se place juste après l'entité auquel il se rapporte.
|
||||
|
||||
#### Pour les URL de l'espace Admin
|
||||
|
||||
Même conventions que dans les autres pages html de l'application, **mais `admin` est ajouté en deuxième position**. Soit:
|
||||
|
||||
|
||||
`/{_locale}/admin/bundle/entity/{id}/action`
|
||||
|
||||
|
||||
## Règles UI chill
|
||||
|
||||
### Titre des pages
|
||||
|
||||
#### Chaque page contient un titre
|
||||
|
||||
Chaque page contient un titre dans la balise head. Ce titre est normalement identique à celui de l'entête de la page.
|
||||
|
||||
Astuce: il est possible d'utiliser la fonction `block` de twig pour cela:
|
||||
|
||||
```htmlmixed=
|
||||
{% block title "Titre de la page" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>
|
||||
{{ block('title')}}
|
||||
</h1>
|
||||
{% endblock %}
|
||||
```
|
||||
|
||||
|
||||
### Utilisation des `entity_render`
|
||||
|
||||
#### En twig
|
||||
|
||||
Les templates twig doivent toujours utiliser la fonction chill_entity_render_box pour effectuer le rendu des éléments suivants:
|
||||
|
||||
* User
|
||||
* Person
|
||||
* SocialIssue
|
||||
* SocialAction
|
||||
* Address
|
||||
* ThirdParty
|
||||
* ...
|
||||
|
||||
Exemple:
|
||||
|
||||
```
|
||||
address|chill_entity_render_box
|
||||
```
|
||||
|
||||
Justification:
|
||||
|
||||
* des éléments sont parfois personnalisés par installation (par exemple, le nom de chaque utilisateur sera suivi par le nom du service)
|
||||
* pour rationaliser et rendre semblable les affichages
|
||||
* pour simplifier le code twig
|
||||
|
||||
A prevoir:
|
||||
|
||||
* toujours trois positions:
|
||||
* inline
|
||||
* block
|
||||
* item (dans un tableau, une ligne)
|
||||
|
||||
> block et item sont en fait la même option passée au render_box: render: bloc. Il y a aussi ‘raw’ pour le inline, et ‘label’ pour une titraille configurable avec des options.
|
||||
|
||||
> quand on passe l’option render: bloc, on peut placer le render_box dans une boucle for plus large qui fonctionne avec la classe flex-table ou la classe flex-bloc, ce qui donnera un affichage en rangée (table) ou en blocs. [name=Mathieu]
|
||||
|
||||
|
||||
|
||||
#### En vue
|
||||
|
||||
Il existe systématiquement une "box" équivalente en vue.
|
||||
|
||||
#### Lien vers des sections
|
||||
|
||||
A chaque fois qu'on indique le nom d'une personne, un parcours, un ménage, il y a toujours:
|
||||
|
||||
* un lien pour accéder à son dossier (pour autant que l'utilisateur ait les droits d'accès);
|
||||
* à moins qu'il ne soit indiqué dans une phrase, l'icône de son dossier avant ou après (donc un bonhomme pour la personne, une maison pour le ménage, un fa-random pour les parcours);
|
||||
|
||||
Ces éléments sont toujours proposé par des `render_box` par défaut. Des options permettent de les désactiver dans des cas particuliers
|
||||
|
||||
> à discuter, quelques réflexion:
|
||||
> quelle est la logique qui domine pour les boutons ? on a symbolisé les 4 actions du crud par des couleurs: bleu(show) orange(edit) vert(create) et rouge(delete).
|
||||
> Est-ce que c'est ça qui prime, et comment ça s'articule avec la logique des pictos ?
|
||||
> Par exemple, il pourrait être logique d'utiliser l'oeil bleu pour voir l'objet, qu'il s'agisse d'une personne ou d'un parcours, ce serait plutôt le contexte, et l'infobulle (title) qui préciserait le contexte.
|
||||
> Je pense que les pictos de boutons doivent faire référence à l'action, mais pas à l'objet. Autrement dit je n'utiliserais jamais l'icone du ménage ou du parcours dans les boutons.
|
||||
> Pour représenter les ménages et les parcours, je pense qu'il faudrait trouver autre chose que forkawesome. Si c'est des pictos, trouver un motif différents et de tailles différente. Réfléchir à un couplage picto-couleur-forme différent, qui exprime le contexte et qui se distingue bien des boutons.
|
||||
> Idem pour les badges, il faut une palette de badge qui couvre tous les besoins: socialIssue, socialActions, socialReason, members, etc. [name=Mathieu]
|
||||
|
||||
### Formulaires
|
||||
|
||||
#### Vocabulaire:
|
||||
|
||||
Utiliser toujours:
|
||||
|
||||
* `Créer` dans un `bt bt-create` pour les **liens** vers le formulairep pour créer une entité (pour parvenir au formulaire);
|
||||
* `Enregistrer` dans un `bt bt-save` pour les boutons "Enregistrer" (dans un formulaire édition **ou** création);
|
||||
* `Enregistrer et nouveau`
|
||||
* `Enregistrer et voir`
|
||||
* `Modifier` dans un `bt bt-edit` pour les **liens** vers le formulaire d'édition
|
||||
* `Dupliquer` (préciser là où on peut le voir)
|
||||
* `Annuler` pour quitter une page d'édition avec un lien vers la liste, ou le `returnPath`
|
||||
|
||||
#### Retour après un enregistrement
|
||||
|
||||
Après avoir cliqué sur "Créer" ou "Sauver", la page devrait revenir:
|
||||
|
||||
* vers le returnPath, s'il existe;
|
||||
* sinon, vers la page "vue".
|
||||
|
||||
|
||||
### Bandeaux contenant les boutons d'actions
|
||||
|
||||
Les boutons sont toujours dans un bandeau "sticky-form" dans le bas du formulaire ou de la page de liste.
|
||||
|
||||
Si pertinent:
|
||||
|
||||
* Le bandeau contient un bouton "Annuler" qui retourne à la page précédente. Il est obligatoire pour les formulaires, optionnel pour les listes ou les pages "résumés"
|
||||
* Ce bouton "annuler" est toujours à gauche
|
||||
|
||||
```
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a href="{{ chill_entity_return_path('route_name' { 'route': 'option' } )}}">{{ return_path_label }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<!-- action 1 -->
|
||||
</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
### Messages flash
|
||||
|
||||
#### A la création d'une entité
|
||||
|
||||
A chaque fois qu'un élément est créé par un formulaire, un message flash doit apparaitre. Il indique:
|
||||
|
||||
> "L'élément a été créé"
|
||||
|
||||
Le nom de l'élément peut être remplacé par quelque chose de plus pertinent:
|
||||
|
||||
> * L'activité a été créée
|
||||
> * Le rendez-vous a été créé
|
||||
> * ...
|
||||
|
||||
|
||||
#### A l'enregistrement d'une entité
|
||||
|
||||
A chaque fois qu'un élément est enregistré, un message flash doit apparaitre:
|
||||
|
||||
> * Les données ont été modifiées
|
||||
>
|
||||
|
||||
#### Erreur sur un formulaire (erreur de validation)
|
||||
|
||||
En tête d'un formulaire, un message flash doit indiquer que des validations n'ont pas réussi:
|
||||
|
||||
> Ce formulaire contient des erreurs
|
||||
|
||||
Les erreurs doivent apparaitre attachée au champ qui les concerne. Toutefois, il est acceptable d'afficher les erreurs à la racine du formulaire s'il était complexe, techniquement, d'attacher les erreurs.
|
||||
|
||||
### Liens de retour
|
||||
|
||||
A chaque fois qu'un lien est indiqué, vérifier si on ne doit pas utiliser la fonction `chill_return_path`, `chill_forward_return_path` ou `chill_return_path_or`.
|
||||
|
||||
* depuis la page liste, vers l'ouverture d'un élément, ou le bouton création => utiliser `chill_path_add_return_path`
|
||||
* dans ces pages d'éditions,
|
||||
* utiliser `chill_return_path_or` dans le bouton "Cancel";
|
||||
* pour les boutons "enregistrer et voir" et "Enregistrer et fermer" => ?
|
||||
|
||||
### Assets pour les listes de suggestion
|
||||
|
||||
Créer une liste de suggestions à ajouter (tout l'item est cliquable)
|
||||
```html
|
||||
<ul class="list-suggest add-items">
|
||||
<li>
|
||||
<span>item</span>
|
||||
</li>
|
||||
</ul>
|
||||
```
|
||||
Créer une liste de suggestions à enlever (avec une croix rouge cliquable, l'ancre a est vide)
|
||||
```html
|
||||
<ul class="list-suggest remove-items">
|
||||
<li>
|
||||
<span>
|
||||
item
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
```
|
||||
Créer un titre enlevable (avec une croix rouge cliquable, l'ancre a est vide)
|
||||
```html
|
||||
<div class="item-title">
|
||||
<span>title</span>
|
||||
</div>
|
||||
```
|
||||
Les classes `cols` ou `inline` peuvent être ajoutées à côté de `list-suggest` pour modifier la disposition de la liste.
|
||||
Dans le dernier exemple, on met une classe `removable` sur le span, si on veut pouvoir enlever l'élément.
|
@@ -1,9 +0,0 @@
|
||||
# Chill framework
|
||||
|
||||
Documentation of the Chill software.
|
||||
|
||||
The online documentation can be found at http://docs.chill.social
|
||||
|
||||
See the [`docs`][1] directory for more.
|
||||
|
||||
[1]: docs/README.md
|
155
composer.json
155
composer.json
@@ -1,87 +1,14 @@
|
||||
{
|
||||
"name": "chill-project/chill-bundles",
|
||||
"description": "Most used bundles for chill-project",
|
||||
"license": "AGPL-3.0-only",
|
||||
"type": "library",
|
||||
"keywords": [
|
||||
"chill",
|
||||
"social worker"
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.4",
|
||||
"champs-libres/async-uploader-bundle": "dev-sf4#d57134aee8e504a83c902ff0cf9f8d36ac418290",
|
||||
"champs-libres/wopi-bundle": "dev-master#6dd8e0a14e00131eb4b889ecc30270ee4a0e5224",
|
||||
"champs-libres/wopi-lib": "dev-master#8615f4a45a39fc2b6a98765ea835fcfd39618787",
|
||||
"doctrine/doctrine-bundle": "^2.1",
|
||||
"doctrine/doctrine-migrations-bundle": "^3.0",
|
||||
"doctrine/orm": "^2.7",
|
||||
"erusev/parsedown": "^1.7",
|
||||
"graylog2/gelf-php": "^1.5",
|
||||
"knplabs/knp-menu-bundle": "^3.0",
|
||||
"knplabs/knp-time-bundle": "^1.12",
|
||||
"league/csv": "^9.7.1",
|
||||
"nyholm/psr7": "^1.4",
|
||||
"ocramius/package-versions": "^1.10 || ^2",
|
||||
"odolbeau/phone-number-bundle": "^3.6",
|
||||
"phpoffice/phpspreadsheet": "^1.16",
|
||||
"ramsey/uuid-doctrine": "^1.7",
|
||||
"sensio/framework-extra-bundle": "^5.5",
|
||||
"spomky-labs/base64url": "^2.0",
|
||||
"symfony/asset": "^4.4",
|
||||
"symfony/browser-kit": "^4.4",
|
||||
"symfony/css-selector": "^4.4",
|
||||
"symfony/expression-language": "^4.4",
|
||||
"symfony/form": "^4.4",
|
||||
"symfony/framework-bundle": "^4.4",
|
||||
"symfony/http-foundation": "^4.4",
|
||||
"symfony/intl": "^4.4",
|
||||
"symfony/mailer": "^5.4",
|
||||
"symfony/mime": "^5.4",
|
||||
"symfony/monolog-bundle": "^3.5",
|
||||
"symfony/security-bundle": "^4.4",
|
||||
"symfony/serializer": "^5.3",
|
||||
"symfony/swiftmailer-bundle": "^3.5",
|
||||
"symfony/templating": "^4.4",
|
||||
"symfony/translation": "^4.4",
|
||||
"symfony/twig-bundle": "^4.4",
|
||||
"symfony/validator": "^4.4",
|
||||
"symfony/web-link": "*",
|
||||
"symfony/webpack-encore-bundle": "^1.11",
|
||||
"symfony/workflow": "^4.4",
|
||||
"symfony/yaml": "^4.4",
|
||||
"twig/extra-bundle": "^3.0",
|
||||
"twig/intl-extra": "^3.0",
|
||||
"twig/markdown-extra": "^3.3",
|
||||
"twig/string-extra": "^3.3",
|
||||
"twig/twig": "^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/doctrine-fixtures-bundle": "^3.3",
|
||||
"drupol/php-conventions": "^5",
|
||||
"fakerphp/faker": "^1.13",
|
||||
"nelmio/alice": "^3.8",
|
||||
"phpspec/prophecy-phpunit": "^2.0",
|
||||
"phpstan/phpstan-strict-rules": "^1.0",
|
||||
"phpunit/phpunit": ">= 7.5",
|
||||
"symfony/debug-bundle": "^5.1",
|
||||
"symfony/dotenv": "^4.4",
|
||||
"symfony/maker-bundle": "^1.20",
|
||||
"symfony/phpunit-bridge": "^4.4",
|
||||
"symfony/stopwatch": "^4.4",
|
||||
"symfony/var-dumper": "^4.4",
|
||||
"symfony/web-profiler-bundle": "^4.4"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/symfony": "*"
|
||||
},
|
||||
"description": "Most used bundles for chill-project",
|
||||
"keywords": ["chill", "social worker"],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Chill\\ActivityBundle\\": "src/Bundle/ChillActivityBundle",
|
||||
"Chill\\AsideActivityBundle\\": "src/Bundle/ChillAsideActivityBundle/src",
|
||||
"Chill\\BudgetBundle\\": "src/Bundle/ChillBudgetBundle",
|
||||
"Chill\\CalendarBundle\\": "src/Bundle/ChillCalendarBundle",
|
||||
"Chill\\CustomFieldsBundle\\": "src/Bundle/ChillCustomFieldsBundle",
|
||||
"Chill\\DocGeneratorBundle\\": "src/Bundle/ChillDocGeneratorBundle",
|
||||
"Chill\\DocStoreBundle\\": "src/Bundle/ChillDocStoreBundle",
|
||||
"Chill\\EventBundle\\": "src/Bundle/ChillEventBundle",
|
||||
"Chill\\FamilyMemberBundle\\": "src/Bundle/ChillFamilyMemberBundle",
|
||||
@@ -89,35 +16,73 @@
|
||||
"Chill\\PersonBundle\\": "src/Bundle/ChillPersonBundle",
|
||||
"Chill\\ReportBundle\\": "src/Bundle/ChillReportBundle",
|
||||
"Chill\\TaskBundle\\": "src/Bundle/ChillTaskBundle",
|
||||
"Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle",
|
||||
"Chill\\WopiBundle\\": "src/Bundle/ChillWopiBundle/src"
|
||||
"Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"App\\": "tests/app/src/",
|
||||
"Chill\\DocGeneratorBundle\\Tests\\": "src/Bundle/ChillDocGeneratorBundle/tests",
|
||||
"Chill\\WopiBundle\\Tests\\": "src/Bundle/ChillDocGeneratorBundle/tests"
|
||||
"App\\": "tests/app/src/"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"composer/package-versions-deprecated": true,
|
||||
"ergebnis/composer-normalize": true,
|
||||
"ocramius/package-versions": true,
|
||||
"phpro/grumphp": true,
|
||||
"phpstan/extension-installer": true,
|
||||
"roave/you-are-using-it-wrong": true
|
||||
},
|
||||
"bin-dir": "bin",
|
||||
"optimize-autoloader": true,
|
||||
"sort-packages": true,
|
||||
"vendor-dir": "tests/app/vendor"
|
||||
"require": {
|
||||
"champs-libres/async-uploader-bundle": "dev-sf4",
|
||||
"graylog2/gelf-php": "^1.5",
|
||||
"symfony/form": "4.*",
|
||||
"symfony/twig-bundle": "^4.4",
|
||||
"twig/extra-bundle": "^2.12|^3.0",
|
||||
"twig/twig": "^2.12|^3.0",
|
||||
"composer/package-versions-deprecated": "^1.10",
|
||||
"doctrine/doctrine-bundle": "^2.1",
|
||||
"doctrine/doctrine-migrations-bundle": "^3.0",
|
||||
"doctrine/orm": "^2.7",
|
||||
"symfony/asset": "4.*",
|
||||
"symfony/monolog-bundle": "^3.5",
|
||||
"symfony/security-bundle": "4.*",
|
||||
"symfony/translation": "4.*",
|
||||
"symfony/validator": "4.*",
|
||||
"sensio/framework-extra-bundle": "^5.5",
|
||||
"symfony/yaml": "4.*",
|
||||
"symfony/webpack-encore-bundle": "^1.11",
|
||||
"knplabs/knp-menu": "^3.1",
|
||||
"knplabs/knp-menu-bundle": "^3.0",
|
||||
"symfony/templating": "4.*",
|
||||
"twig/intl-extra": "^3.0",
|
||||
"symfony/workflow": "4.*",
|
||||
"symfony/expression-language": "4.*",
|
||||
"knplabs/knp-time-bundle": "^1.12",
|
||||
"symfony/intl": "4.*",
|
||||
"symfony/swiftmailer-bundle": "^3.5",
|
||||
"league/csv": "^9.6",
|
||||
"phpoffice/phpspreadsheet": "^1.16",
|
||||
"symfony/browser-kit": "^5.2",
|
||||
"symfony/css-selector": "^5.2",
|
||||
"twig/markdown-extra": "^3.3",
|
||||
"erusev/parsedown": "^1.7",
|
||||
"symfony/serializer": "^5.2"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/symfony": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"drupol/php-conventions": "4.*",
|
||||
"fakerphp/faker": "^1.13",
|
||||
"phpunit/phpunit": "^7.0",
|
||||
"symfony/dotenv": "^5.1",
|
||||
"symfony/maker-bundle": "^1.20",
|
||||
"doctrine/doctrine-fixtures-bundle": "^3.3",
|
||||
"symfony/stopwatch": "^5.1",
|
||||
"symfony/web-profiler-bundle": "^5.0",
|
||||
"symfony/var-dumper": "4.*",
|
||||
"symfony/debug-bundle": "^5.1",
|
||||
"symfony/phpunit-bridge": "^5.2"
|
||||
},
|
||||
"scripts": {
|
||||
"auto-scripts": {
|
||||
"assets:install %PUBLIC_DIR%": "symfony-cmd",
|
||||
"cache:clear": "symfony-cmd"
|
||||
"cache:clear": "symfony-cmd",
|
||||
"assets:install %PUBLIC_DIR%": "symfony-cmd"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"bin-dir": "bin"
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
@@ -54,13 +56,13 @@ class CountPerson implements ExportInterface
|
||||
return function ($value) {
|
||||
switch ($value) {
|
||||
case '_header':
|
||||
// we have to process specifically the '_header' string,
|
||||
// which will be used by the formatter to show a column title
|
||||
// we have to process specifically the '_header' string,
|
||||
// which will be used by the formatter to show a column title
|
||||
return $this->getTitle();
|
||||
|
||||
default:
|
||||
// for all value, we do not process them and return them
|
||||
// immediatly
|
||||
// for all value, we do not process them and return them
|
||||
// immediatly
|
||||
return $value;
|
||||
}
|
||||
};
|
||||
|
@@ -23,196 +23,15 @@ Every time an entity is created, viewed or updated, the software check if the us
|
||||
|
||||
The user must be granted access to the action on this particular entity, with this scope and center.
|
||||
|
||||
TL;DR
|
||||
=====
|
||||
|
||||
Resolve scope and center
|
||||
------------------------
|
||||
|
||||
In a service, resolve the center and scope of an entity
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher;
|
||||
use Chill\MainBundle\Security\Resolver\ScopeResolverDispatcher;
|
||||
|
||||
|
||||
class MyService {
|
||||
private ScopeResolverDispatcher $scopeResolverDispatcher;
|
||||
private CenterResolverDispatcher $centerResolverDispatcher;
|
||||
|
||||
public function myFunction($entity) {
|
||||
/** @var null|Center[]|Center $center */
|
||||
$center = $this->centerResolverDispatcher->resolveCenter($entity);
|
||||
// $center may be null, an array of center, or an instance of Center
|
||||
|
||||
if ($this->scopeResolverDispatcher->isConcerned($entity) {
|
||||
/** @var null|Scope[]|Scope */
|
||||
$scope = $this-scopeResolverDispatcher->resolveScope($entity);
|
||||
// $scope may be null, an array of Scope, or an instance of Scope
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
In twig template, resolve the center:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{# resolve a center #}
|
||||
|
||||
{% if person|chill_resolve_center is not null%}
|
||||
|
||||
{% if person|chill_resolve_center is iterable %}
|
||||
{% set centers = person|chill_resolve_center %}
|
||||
{% else %}
|
||||
{% set centers = [ person|chill_resolve_center ] %}
|
||||
{% endif %}
|
||||
|
||||
<span class="open_sansbold">
|
||||
{{ 'Center'|trans|upper}} :
|
||||
</span>
|
||||
{% for c in centers %}
|
||||
{{ c.name|upper }}
|
||||
{% if not loop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
{%- endif -%}
|
||||
|
||||
In twig template, resolve the scope:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{% if entity|chill_is_scope_concerned %}
|
||||
|
||||
{% if entity|chill_resolve_scope is iterable %}
|
||||
{% set scopes = entity|chill_resolve_scope %}
|
||||
{% else %}
|
||||
{% set scopes = [ entity|chill_resolve_scope ] %}
|
||||
{% endif %}
|
||||
|
||||
<span>Scopes :</span>
|
||||
{% for s in scopes %}
|
||||
{{ c.name|localize_translatable_string }}
|
||||
{% if not loop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
{%- endif -%}
|
||||
|
||||
Build a ``Voter``
|
||||
-----------------
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
<?php
|
||||
|
||||
namespace Chill\DocStoreBundle\Security\Authorization;
|
||||
|
||||
use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
|
||||
use Chill\MainBundle\Security\Authorization\VoterHelperFactoryInterface;
|
||||
use Chill\MainBundle\Security\Authorization\VoterHelperInterface;
|
||||
use Chill\MainBundle\Security\ProvideRoleHierarchyInterface;
|
||||
use Chill\DocStoreBundle\Entity\PersonDocument;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
class PersonDocumentVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
|
||||
{
|
||||
// roles should be stored into constants:
|
||||
|
||||
const CREATE = 'CHILL_PERSON_DOCUMENT_CREATE';
|
||||
const SEE = 'CHILL_PERSON_DOCUMENT_SEE';
|
||||
const SEE_DETAILS = 'CHILL_PERSON_DOCUMENT_SEE_DETAILS';
|
||||
const UPDATE = 'CHILL_PERSON_DOCUMENT_UPDATE';
|
||||
const DELETE = 'CHILL_PERSON_DOCUMENT_DELETE';
|
||||
|
||||
protected Security $security;
|
||||
protected VoterHelperInterface $voterHelper;
|
||||
|
||||
public function __construct(
|
||||
Security $security,
|
||||
VoterHelperFactoryInterface $voterHelperFactory
|
||||
) {
|
||||
$this->security = $security;
|
||||
|
||||
// we build here a voter helper. This will ease the operations below.
|
||||
// when the authorization model is changed, it will be easy to make a different implementation
|
||||
// of the helper, instead of writing all Voters
|
||||
|
||||
$this->voterHelper = $voterHelperFactory
|
||||
// create a builder with some context
|
||||
->generate(self::class)
|
||||
// add the support of given roles for given class:
|
||||
->addCheckFor(Person::class, [self::SEE, self::CREATE])
|
||||
->addCheckFor(PersonDocument::class, $this->getRoles())
|
||||
->build();
|
||||
}
|
||||
|
||||
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
return $this->voterHelper->supports($attribute, $subject);
|
||||
}
|
||||
|
||||
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
|
||||
{
|
||||
// basic check
|
||||
if (!$token->getUser() instanceof User) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// we first check the acl for associated elements.
|
||||
// here, we must be able to see the person associated to the document:
|
||||
if ($subject instanceof PersonDocument
|
||||
&& !$this->security->isGranted(PersonVoter::SEE, $subject->getPerson())) {
|
||||
|
||||
// not possible to see the associated person ? Then, not possible to see the document!
|
||||
return false;
|
||||
}
|
||||
|
||||
// the voter helper will implements the logic:
|
||||
return $this->voterHelper->voteOnAttribute($attribute, $subject, $token);
|
||||
}
|
||||
|
||||
// all the method below are used to register roles into the admin part
|
||||
public function getRoles()
|
||||
{
|
||||
return [
|
||||
self::CREATE,
|
||||
self::SEE,
|
||||
self::SEE_DETAILS,
|
||||
self::UPDATE,
|
||||
self::DELETE
|
||||
];
|
||||
}
|
||||
|
||||
public function getRolesWithoutScope()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
public function getRolesWithHierarchy()
|
||||
{
|
||||
return ['PersonDocument' => $this->getRoles() ];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
From an user point of view
|
||||
==========================
|
||||
--------------------------
|
||||
|
||||
The software is design to allow fine tuned access rights for complicated installation and team structure. The administrators may also decide that every user has the right to see all resources, where team have a more simple structure.
|
||||
|
||||
Here is an overview of the model.
|
||||
|
||||
Chill can be multi-center
|
||||
-------------------------
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Chill is designed to be installed once for social center who work with multiple teams separated, or for social services's federation who would like to share the same installation of the software for all their members.
|
||||
|
||||
@@ -223,7 +42,7 @@ Otherwise, it is not required to create multiple center: Chill can also work for
|
||||
Obviously, users working in the different centers are not allowed to see the entities (_persons_, _reports_, _activities_) of other centers. But users may be attached to multiple centers: consequently they will be able to see the entities of the multiple centers they are attached to.
|
||||
|
||||
Inside center, scope divide team
|
||||
--------------------------------
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Users are attached to one or more center and, inside to those center, there may exists differents scopes. The aim of those _scopes_ is to divide the whole team of social worker amongst different departement, for instance: the social team, the psychologist team, the nurse team, the administrative team, ... Each team is granted of different rights amongst scope. For instance, the social team may not see the _activities_ of the psychologist team. The administrative team may see the date & time's activities, but is not allowed to see the detail of those entities (the personal notes, ...).
|
||||
|
||||
@@ -233,38 +52,8 @@ As entities have only one scopes, if some entities must be shared across two dif
|
||||
|
||||
Example: if some activities must be seen and updated between nurses and psychologists, the administrator will create a scope "nurse and psy" and add the ability for both team "nurse" and "psychologist" to "create", "see", and "update" the activities belonging to scope "nurse and psy".
|
||||
|
||||
|
||||
Where does the ``scope`` and ``center`` comes from ?
|
||||
====================================================
|
||||
|
||||
Most often, scope and center comes from user's input:
|
||||
|
||||
* when person is created, Chill asks the associated center to the user. Then, every entity associated to the user (Activity, ...) is associated to this center;
|
||||
* when an entity is created, Chill asks the associated scope.
|
||||
|
||||
The UI check the model before adding those input into form. If the user hae access to only one center or scope, this scope or center is filled automatically, and the UI does not ask the user. Most of the times, the user does not see "Pick a scope" and "Pick a center" inputs.
|
||||
|
||||
Scope and Center are associated to entities through ``ManyToOne`` properties, which are then mapped to ``FOREIGN KEY`` in tables, ...
|
||||
|
||||
But sometimes, this implementation does not fits the needs:
|
||||
|
||||
* persons are associated to center *geographically*: the address of each person contains lat/lon coordinates, and the center is resolved from this coordinated;
|
||||
* some would like to associated persons to multiple center, or one center;
|
||||
* entities are associated to scope through the job reached by "creator" (an user);
|
||||
* some would like not to use scope at all;
|
||||
* …
|
||||
|
||||
For this reasons, associated center and scopes must be resolved programmatically. The default implementation rely on the model association, as described above. But it becomes possible to change the behaviour on different implementations.
|
||||
|
||||
Is my entity "concerned" by scopes ?
|
||||
------------------------------------
|
||||
|
||||
Some entities are concerned by scope, some not.
|
||||
|
||||
This is also programmatically resolved.
|
||||
|
||||
The concepts translated into code
|
||||
===================================
|
||||
-----------------------------------
|
||||
|
||||
.. figure:: /_static/access_control_model.png
|
||||
|
||||
@@ -292,7 +81,7 @@ At each step of his lifetime (creation, view of the entity and eventually of his
|
||||
All those action are executed through symfony voters and helpers.
|
||||
|
||||
How to check authorization ?
|
||||
============================
|
||||
----------------------------
|
||||
|
||||
Just use the symfony way-of-doing, but do not forget to associate the entity you want to check access. For instance, in controller :
|
||||
|
||||
@@ -311,23 +100,34 @@ Just use the symfony way-of-doing, but do not forget to associate the entity you
|
||||
|
||||
And in template :
|
||||
|
||||
.. code-block:: twig
|
||||
.. code-block:: html+jinja
|
||||
|
||||
{{ if is_granted('CHILL_ENTITY_SEE', entity) %}print something{% endif %}
|
||||
|
||||
Retrieving reachable scopes and centers for a user
|
||||
--------------------------------------------------
|
||||
Retrieving reachable scopes and centers
|
||||
----------------------------------------
|
||||
|
||||
The class :class:`Chill\\MainBundle\\Security\\Authorization\\AuthorizationHelperInterface` helps you to get centers and scope reachable by a user.
|
||||
The class :class:`Chill\\MainBundle\\Security\\Authorization\\AuthorizationHelper` helps you to get centers and scope reachable by a user.
|
||||
|
||||
Those methods are intentionnaly build to give information about user rights:
|
||||
|
||||
- getReachableCenters: to get reachable centers for a user
|
||||
- getReachableScopes : to get reachable scopes for a user
|
||||
|
||||
.. note::
|
||||
|
||||
The service is reachable through the Depedency injection with the key `chill.main.security.authorization.helper`. Example :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$helper = $container->get('chill.main.security.authorization.helper');
|
||||
|
||||
.. todo::
|
||||
|
||||
Waiting for a link between our api and this doc, we invite you to read the method signatures `here <https://github.com/Chill-project/Main/blob/add_acl/Security/Authorization/AuthorizationHelper.php>`_
|
||||
|
||||
Adding your own roles
|
||||
---------------------
|
||||
=====================
|
||||
|
||||
Extending Chill will requires you to define your own roles and rules for your entities. You will have to define your own voter to do so.
|
||||
|
||||
@@ -352,7 +152,7 @@ To create your own roles, you should:
|
||||
|
||||
|
||||
Declare your role
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
------------------
|
||||
|
||||
To declare new role, implement the class :class:`Chill\\MainBundle\\Security\\ProvideRoleInterface`.
|
||||
|
||||
@@ -412,8 +212,69 @@ Example of an implementation of :class:`Chill\\MainBundle\\Security\\ProvideRole
|
||||
|
||||
}
|
||||
|
||||
Implement your voter
|
||||
--------------------
|
||||
|
||||
Inside this class, you might use the :class:`Chill\\MainBundle\\Security\\Authorization\\AuthorizationHelper` to check permission (do not re-invent the wheel). This is a real-world example:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\ReportBundle\Security\Authorization;
|
||||
use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
|
||||
|
||||
class ReportVoter extends AbstractChillVoter
|
||||
{
|
||||
const CREATE = 'CHILL_REPORT_CREATE';
|
||||
const SEE = 'CHILL_REPORT_SEE';
|
||||
const UPDATE = 'CHILL_REPORT_UPDATE';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var AuthorizationHelper
|
||||
*/
|
||||
protected $helper;
|
||||
|
||||
public function __construct(AuthorizationHelper $helper)
|
||||
{
|
||||
$this->helper = $helper;
|
||||
}
|
||||
|
||||
protected function getSupportedAttributes()
|
||||
{
|
||||
return array(self::CREATE, self::SEE, self::UPDATE);
|
||||
}
|
||||
protected function getSupportedClasses()
|
||||
{
|
||||
return array('Chill\ReportBundle\Entity\Report');
|
||||
}
|
||||
protected function isGranted($attribute, $report, $user = null)
|
||||
{
|
||||
if (! $user instanceof \Chill\MainBundle\Entity\User){
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->helper->userHasAccess($user, $report, $attribute);
|
||||
}
|
||||
}
|
||||
|
||||
Then, you will have to declare the service and tag it as a voter :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
services:
|
||||
chill.report.security.authorization.report_voter:
|
||||
class: Chill\ReportBundle\Security\Authorization\ReportVoter
|
||||
arguments:
|
||||
- "@chill.main.security.authorization.helper"
|
||||
tags:
|
||||
- { name: security.voter }
|
||||
|
||||
|
||||
Adding role hierarchy
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
---------------------
|
||||
|
||||
You should prepend Symfony's security component directly from your code.
|
||||
|
||||
@@ -451,484 +312,3 @@ You should prepend Symfony's security component directly from your code.
|
||||
}
|
||||
|
||||
|
||||
|
||||
Implement your voter
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Most of the time, Voter will check that:
|
||||
|
||||
1. The given role is reachable (= ``$attribute``)
|
||||
2. for the given center,
|
||||
3. and, if any, for the given role
|
||||
4. if the entity is associated to another entity, this entity should be, at least, viewable by the user.
|
||||
|
||||
Thats what we call the "autorization logic". But this logic may be replace by a new one, and developers should take care of it.
|
||||
|
||||
|
||||
Then voter implementation should take care of:
|
||||
|
||||
* check the access to associated entities. For instance, if an ``Activity`` is associated to a ``Person``, the voter should first check that the user can show the associated ``Person``;
|
||||
* as far as possible, delegates the check for associated center, scopes, and check for authorization using the authorization logic. VoterHelper will ease the most common operation of this logic.
|
||||
|
||||
This is an example of implementation:
|
||||
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
<?php
|
||||
|
||||
namespace Chill\DocStoreBundle\Security\Authorization;
|
||||
|
||||
use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
|
||||
use Chill\MainBundle\Security\Authorization\VoterHelperFactoryInterface;
|
||||
use Chill\MainBundle\Security\Authorization\VoterHelperInterface;
|
||||
use Chill\DocStoreBundle\Entity\PersonDocument;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
class PersonDocumentVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
|
||||
{
|
||||
protected Security $security;
|
||||
protected VoterHelperInterface $voterHelper;
|
||||
|
||||
public function __construct(
|
||||
Security $security,
|
||||
VoterHelperFactoryInterface $voterHelperFactory
|
||||
) {
|
||||
$this->security = $security;
|
||||
|
||||
// we build here a voter helper. This will ease the operations below.
|
||||
// when the authorization model is changed, it will be easy to make a different implementation
|
||||
// of the helper, instead of writing all Voters
|
||||
|
||||
$this->voterHelper = $voterHelperFactory
|
||||
// create a builder with some context
|
||||
->generate(self::class)
|
||||
// add the support of given roles for given class:
|
||||
->addCheckFor(Person::class, [self::SEE, self::CREATE])
|
||||
->addCheckFor(PersonDocument::class, $this->getRoles())
|
||||
->build();
|
||||
}
|
||||
|
||||
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
return $this->voterHelper->supports($attribute, $subject);
|
||||
}
|
||||
|
||||
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
|
||||
{
|
||||
// basic check
|
||||
if (!$token->getUser() instanceof User) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// we first check the acl for associated elements.
|
||||
// here, we must be able to see the person associated to the document:
|
||||
if ($subject instanceof PersonDocument
|
||||
&& !$this->security->isGranted(PersonVoter::SEE, $subject->getPerson())) {
|
||||
|
||||
// not possible to see the associated person ? Then, not possible to see the document!
|
||||
return false;
|
||||
}
|
||||
|
||||
// the voter helper will implements the logic of checking:
|
||||
// 1. that the center is reachable
|
||||
// 2. for this given entity
|
||||
// 3. for this given scope
|
||||
// 4. and for the given role
|
||||
return $this->voterHelper->voteOnAttribute($attribute, $subject, $token);
|
||||
}
|
||||
|
||||
public function getRoles()
|
||||
{
|
||||
// ...
|
||||
}
|
||||
|
||||
public function getRolesWithoutScope()
|
||||
{
|
||||
// ...
|
||||
}
|
||||
|
||||
|
||||
public function getRolesWithHierarchy()
|
||||
{
|
||||
// ...
|
||||
}
|
||||
}
|
||||
|
||||
Then, you will have to declare the service and tag it as a voter :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
services:
|
||||
chill.report.security.authorization.report_voter:
|
||||
class: Chill\ReportBundle\Security\Authorization\ReportVoter
|
||||
arguments:
|
||||
- "@chill.main.security.authorization.helper"
|
||||
tags:
|
||||
- { name: security.voter }
|
||||
|
||||
|
||||
How to resolve scope and center programmatically ?
|
||||
==================================================
|
||||
|
||||
In a service, resolve the center and scope of an entity
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher;
|
||||
use Chill\MainBundle\Security\Resolver\ScopeResolverDispatcher;
|
||||
|
||||
|
||||
class MyService {
|
||||
private ScopeResolverDispatcher $scopeResolverDispatcher;
|
||||
private CenterResolverDispatcher $centerResolverDispatcher;
|
||||
|
||||
public function myFunction($entity) {
|
||||
/** @var null|Center[]|Center $center */
|
||||
$center = $this->centerResolverDispatcher->resolveCenter($entity);
|
||||
// $center may be null, an array of center, or an instance of Center
|
||||
|
||||
if ($this->scopeResolverDispatcher->isConcerned($entity) {
|
||||
/** @var null|Scope[]|Scope */
|
||||
$scope = $this-scopeResolverDispatcher->resolveScope($entity);
|
||||
// $scope may be null, an array of Scope, or an instance of Scope
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
In twig template, resolve the center:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{# resolve a center #}
|
||||
|
||||
{% if person|chill_resolve_center is not null%}
|
||||
|
||||
{% if person|chill_resolve_center is iterable %}
|
||||
{% set centers = person|chill_resolve_center %}
|
||||
{% else %}
|
||||
{% set centers = [ person|chill_resolve_center ] %}
|
||||
{% endif %}
|
||||
|
||||
<span class="open_sansbold">
|
||||
{{ 'Center'|trans|upper}} :
|
||||
</span>
|
||||
{% for c in centers %}
|
||||
{{ c.name|upper }}
|
||||
{% if not loop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
{%- endif -%}
|
||||
|
||||
In twig template, resolve the scope:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{% if entity|chill_is_scope_concerned %}
|
||||
|
||||
{% if entity|chill_resolve_scope is iterable %}
|
||||
{% set scopes = entity|chill_resolve_scope %}
|
||||
{% else %}
|
||||
{% set scopes = [ entity|chill_resolve_scope ] %}
|
||||
{% endif %}
|
||||
|
||||
<span>Scopes :</span>
|
||||
{% for s in scopes %}
|
||||
{{ c.name|localize_translatable_string }}
|
||||
{% if not loop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
{%- endif -%}
|
||||
|
||||
What is the default implementation of Scope and Center resolver ?
|
||||
-----------------------------------------------------------------
|
||||
|
||||
By default, the implementation rely on association into entities.
|
||||
|
||||
* implements ``Chill\MainBundle\Entity\HasCenterInterface`` on entities which have one or any center;
|
||||
* implements ``Chill\MainBundle\Entity\HasCentersInterface`` on entities which have one, multiple or any centers;
|
||||
* implements ``Chill\MainBundle\Entity\HasScopeInterface`` on entities which have one or any scope;
|
||||
* implements ``Chill\MainBundle\Entity\HasScopesInterface`` on entities which have one or any scopes;
|
||||
|
||||
Then, the default implementation will resolve the center and scope based on the implementation in your model.
|
||||
|
||||
How to change the default behaviour ?
|
||||
-------------------------------------
|
||||
|
||||
Implements those interface into services:
|
||||
|
||||
* ``Chill\MainBundle\Security\Resolver\CenterResolverInterface``;
|
||||
* ``Chill\MainBundle\Security\Resolver\ScopeResolverInterface``;
|
||||
|
||||
Authorization into lists and index pages
|
||||
========================================
|
||||
|
||||
Due to the fact that authorization model may be overriden, "list" and "index" pages should not rely on center and scope from controller. This must be delegated to dedicated service, which will be aware of the authorization model. We call them ``ACLAwareRepository``. This service must implements an interface, in order to allow to change the implementation.
|
||||
|
||||
The controller **must not** performs any DQL or SQL query.
|
||||
|
||||
Example in a controller:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\TaskBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Chill\TaskBundle\Repository\SingleTaskAclAwareRepositoryInterface;
|
||||
|
||||
|
||||
final class SingleTaskController extends AbstractController
|
||||
{
|
||||
|
||||
private SingleTaskAclAwareRepositoryInterface $singleTaskAclAwareRepository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @Route(
|
||||
* "/{_locale}/task/single-task/list",
|
||||
* name="chill_task_singletask_list"
|
||||
* )
|
||||
*/
|
||||
public function listAction(
|
||||
Request $request
|
||||
) {
|
||||
$this->denyAccessUnlessGranted(TaskVoter::SHOW, null);
|
||||
|
||||
$nb = $this->singleTaskAclAwareRepository->countByAllViewable(
|
||||
'', // search pattern
|
||||
[] // search flags
|
||||
);
|
||||
$paginator = $this->paginatorFactory->create($nb);
|
||||
|
||||
if (0 < $nb) {
|
||||
$tasks = $this->singleTaskAclAwareRepository->findByAllViewable(
|
||||
'', // search pattern
|
||||
[] // search flags
|
||||
$paginator->getCurrentPageFirstItemNumber(),
|
||||
$paginator->getItemsPerPage(),
|
||||
// ordering:
|
||||
[
|
||||
'startDate' => 'DESC',
|
||||
'endDate' => 'DESC',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$tasks = [];
|
||||
}
|
||||
|
||||
return $this->render('@ChillTask/SingleTask/List/index.html.twig', [
|
||||
'tasks' => $tasks,
|
||||
'paginator' => $paginator,
|
||||
'filter_order' => $filterOrder
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Writing ``ACLAwareRepository``
|
||||
------------------------------
|
||||
|
||||
The ACLAwareRepository should rely on interfaces
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
As described above, the ACLAwareRepository will perform the query for listing entities, and take care of authorization.
|
||||
|
||||
Those "ACLAwareRepositories" must be described into ``interfaces``.
|
||||
|
||||
The service must rely on this interface, and not on the default implementation.
|
||||
|
||||
Example: at first, we design an interface for listing ``SingleTask`` entities:
|
||||
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
<?php
|
||||
|
||||
namespace Chill\TaskBundle\Repository;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
|
||||
interface SingleTaskAclAwareRepositoryInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return SingleTask[]|array
|
||||
*/
|
||||
public function findByCurrentUsersTasks(?string $pattern = null, ?array $flags = [], ?int $start = 0, ?int $limit = 50, ?array $orderBy = []): array;
|
||||
|
||||
public function countByCurrentUsersTasks(?string $pattern = null, ?array $flags = []): int;
|
||||
|
||||
public function countByAllViewable(
|
||||
?string $pattern = null,
|
||||
?array $flags = []
|
||||
): int;
|
||||
|
||||
/**
|
||||
* @return SingleTask[]|array
|
||||
*/
|
||||
public function findByAllViewable(
|
||||
?string $pattern = null,
|
||||
?array $flags = [],
|
||||
?int $start = 0,
|
||||
?int $limit = 50,
|
||||
?array $orderBy = []
|
||||
): array;
|
||||
}
|
||||
|
||||
Implements this interface and register the interface as an alias for the implementation.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
services:
|
||||
Chill\TaskBundle\Repository\SingleTaskAclAwareRepository:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
|
||||
Chill\TaskBundle\Repository\SingleTaskAclAwareRepositoryInterface: '@Chill\TaskBundle\Repository\SingleTaskAclAwareRepository'
|
||||
|
||||
Write the basic implementation for re-use: separate authorization logic and search logic
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The logic of such repository may be separated into two logic:
|
||||
|
||||
* the authorization logic (show only entities that the user is allowed to see);
|
||||
* the search logic (filter entities on some criterias).
|
||||
|
||||
This logic should be separated into your implementation.
|
||||
|
||||
Considering this simple interface:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
interface MyEntityACLAwareRepositoryInterface {
|
||||
|
||||
public function countByAuthorized(array $criterias): int;
|
||||
|
||||
public function findByAuthorized(array $criteria, int $start, int $limit, array $orderBy): array;
|
||||
|
||||
}
|
||||
|
||||
The base implementation should separate the logic to allow an easy reuse. Here, the method ``buildQuery`` build a basic query without authorization logic, which can be re-used. The authorization logic is dedicated to a private method. For ease of user, the logic of adding ordering criterias and pagination parameters (``$start`` and ``$limit``) are also delegated to a public method.
|
||||
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\MyBundle\Repository;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
|
||||
|
||||
final class MyEntityACLAwareRepository implements MyEntityACLAwareRepositoryInterface {
|
||||
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
// constructor omitted
|
||||
|
||||
public function countByAuthorized(array $criterias): int
|
||||
{
|
||||
$qb = $this->buildQuery($criterias);
|
||||
|
||||
return $this->addAuthorizations($qb)->select("COUNT(e)")->getQuery()->getResult()->getSingleScalarResult();
|
||||
}
|
||||
|
||||
public function findByAuthorized(array $criteria, int $start, int $limit, array $orderBy): array
|
||||
{
|
||||
$qb = $this->buildQuery($criterias);
|
||||
|
||||
return $this->getResult($this->addAuthorizations($qb), $start, $limit, $orderBy);
|
||||
}
|
||||
|
||||
public function getResult(QueryBuilder $qb, int $start, int $limit, array $orderBy): array
|
||||
{
|
||||
$qb
|
||||
->setFirstResult($start)
|
||||
->setMaxResults($limit)
|
||||
;
|
||||
|
||||
// add order by logic
|
||||
|
||||
return $qb->getQuery()->getResult();
|
||||
}
|
||||
|
||||
public function buildQuery(array $criterias): QueryBuilder
|
||||
{
|
||||
$qb = $this->em->createQueryBuilder();
|
||||
|
||||
// implement you logic with search criteria here
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
private function addAuthorizations(QueryBuilder $qb): QueryBuilder
|
||||
{
|
||||
// add authorization logic here
|
||||
return $qb;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Once this logic is executed, it becomes easy to make a new implementation of the repository:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\MyOtherBundle\Repository;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Chill\MyBundle\Repository\MyEntityACLAwareRepository
|
||||
|
||||
|
||||
final class AnotherEntityACLAwareRepository implements MyEntityACLAwareRepositoryInterface {
|
||||
|
||||
private EntityManagerInterface $em;
|
||||
private \Chill\MyBundle\Repository\MyEntityACLAwareRepository $initial;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
\Chill\MyBundle\Repository\MyEntityACLAwareRepository $initial
|
||||
) {
|
||||
$this->em = $em;
|
||||
$this->initial = $initial;
|
||||
}
|
||||
|
||||
public function countByAuthorized(array $criterias): int
|
||||
{
|
||||
$qb = $this->initial->buildQuery($criterias);
|
||||
|
||||
return $this->addAuthorizations($qb)->select("COUNT(e)")->getQuery()->getResult()->getSingleScalarResult();
|
||||
}
|
||||
|
||||
public function findByAuthorized(array $criteria, int $start, int $limit, array $orderBy): array
|
||||
{
|
||||
$qb = $this->initial->buildQuery($criterias);
|
||||
|
||||
return $this->initial->getResult($this->addAuthorizations($qb), $start, $limit, $orderBy);
|
||||
}
|
||||
|
||||
private function addAuthorizations(QueryBuilder $qb): QueryBuilder
|
||||
{
|
||||
// add a different authorization logic here
|
||||
return $qb;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Then, register this service and decorates the old one:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
services:
|
||||
Chill\MyOtherBundle\Repository\AnotherEntityACLAwareRepository:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
decorates: Chill\MyBundle\Repository\MyEntityACLAwareRepositoryInterface:
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -1,747 +0,0 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
.. _api:
|
||||
|
||||
API
|
||||
###
|
||||
|
||||
Chill provides a basic framework to build REST api.
|
||||
|
||||
Basic configuration
|
||||
*******************
|
||||
|
||||
Configure a route
|
||||
=================
|
||||
|
||||
Follow those steps to build a REST api:
|
||||
|
||||
1. Create your model;
|
||||
2. Configure the API;
|
||||
|
||||
You can also:
|
||||
|
||||
* hook into the controller to customize some steps;
|
||||
* add more route and steps
|
||||
|
||||
.. note::
|
||||
|
||||
Useful links:
|
||||
|
||||
* `How to use annotation to configure serialization <https://symfony.com/doc/current/serializer.html>`_
|
||||
* `How to create your custom normalizer <https://symfony.com/doc/current/serializer/custom_normalizer.html>`_
|
||||
|
||||
Auto-loading the routes
|
||||
=======================
|
||||
|
||||
Ensure that those lines are present in your file `app/config/routing.yml`:
|
||||
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_cruds:
|
||||
resource: 'chill_main_crud_route_loader:load'
|
||||
type: service
|
||||
|
||||
|
||||
Create your model
|
||||
=================
|
||||
|
||||
Create your model on the usual way:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\OriginRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass=OriginRepository::class)
|
||||
* @ORM\Table(name="chill_person_accompanying_period_origin")
|
||||
*/
|
||||
class Origin
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json")
|
||||
*/
|
||||
private $label;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="date_immutable", nullable=true)
|
||||
*/
|
||||
private $noActiveAfter;
|
||||
|
||||
// .. getters and setters
|
||||
|
||||
}
|
||||
|
||||
|
||||
Configure api
|
||||
=============
|
||||
|
||||
Configure the api using Yaml (see the full configuration: :ref:`api_full_configuration`):
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
# config/packages/chill_main.yaml
|
||||
chill_main:
|
||||
apis:
|
||||
accompanying_period_origin:
|
||||
base_path: '/api/1.0/person/accompanying-period/origin'
|
||||
class: 'Chill\PersonBundle\Entity\AccompanyingPeriod\Origin'
|
||||
name: accompanying_period_origin
|
||||
base_role: 'ROLE_USER'
|
||||
actions:
|
||||
_index:
|
||||
methods:
|
||||
GET: true
|
||||
HEAD: true
|
||||
_entity:
|
||||
methods:
|
||||
GET: true
|
||||
HEAD: true
|
||||
|
||||
.. note::
|
||||
|
||||
If you are working on a shared bundle (aka "The chill bundles"), you should define your configuration inside the class :code:`ChillXXXXBundleExtension`, using the "prependConfig" feature:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Class ChillPersonExtension
|
||||
* Loads and manages your bundle configuration
|
||||
*
|
||||
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
|
||||
* @package Chill\PersonBundle\DependencyInjection
|
||||
*/
|
||||
class ChillPersonExtension extends Extension implements PrependExtensionInterface
|
||||
{
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
$this->prependCruds($container);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContainerBuilder $container
|
||||
*/
|
||||
protected function prependCruds(ContainerBuilder $container)
|
||||
{
|
||||
$container->prependExtensionConfig('chill_main', [
|
||||
'apis' => [
|
||||
[
|
||||
'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\Origin::class,
|
||||
'name' => 'accompanying_period_origin',
|
||||
'base_path' => '/api/1.0/person/accompanying-period/origin',
|
||||
'controller' => \Chill\PersonBundle\Controller\OpeningApiController::class,
|
||||
'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
|
||||
]
|
||||
],
|
||||
]
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
The :code:`_index` and :code:`_entity` action
|
||||
*********************************************
|
||||
|
||||
The :code:`_index` and :code:`_entity` action are default actions:
|
||||
|
||||
* they will call a specific method in the default controller;
|
||||
* they will generate defined routes:
|
||||
|
||||
Index:
|
||||
Name: :code:`chill_api_single_accompanying_period_origin__index`
|
||||
|
||||
Path: :code:`/api/1.0/person/accompanying-period/origin.{_format}`
|
||||
|
||||
Entity:
|
||||
Name: :code:`chill_api_single_accompanying_period_origin__entity`
|
||||
|
||||
Path: :code:`/api/1.0/person/accompanying-period/origin/{id}.{_format}`
|
||||
|
||||
Role
|
||||
****
|
||||
|
||||
By default, the key `base_role` is used to check ACL. Take care of creating the :code:`Voter` required to take that into account.
|
||||
|
||||
For index action, the role will be called with :code:`NULL` as :code:`$subject`. The retrieved entity will be the subject for single queries.
|
||||
|
||||
You can also define a role for each method. In this case, this role is used for the given method, and, if any, the base role is taken into account.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
# config/packages/chill_main.yaml
|
||||
chill_main:
|
||||
apis:
|
||||
accompanying_period_origin:
|
||||
base_path: '/api/1.0/person/bla/bla'
|
||||
class: 'Chill\PersonBundle\Entity\Blah'
|
||||
name: bla
|
||||
actions:
|
||||
_entity:
|
||||
methods:
|
||||
GET: true
|
||||
HEAD: true
|
||||
roles:
|
||||
GET: MY_ROLE_SEE
|
||||
HEAD: MY ROLE_SEE
|
||||
|
||||
Customize the controller
|
||||
************************
|
||||
|
||||
You can customize the controller by hooking into the default actions. Take care of extending :code:`Chill\MainBundle\CRUD\Controller\ApiController`.
|
||||
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class OpeningApiController extends ApiController
|
||||
{
|
||||
protected function customizeQuery(string $action, Request $request, $qb): void
|
||||
{
|
||||
$qb->where($qb->expr()->gt('e.noActiveAfter', ':now'))
|
||||
->orWhere($qb->expr()->isNull('e.noActiveAfter'));
|
||||
$qb->setParameter('now', new \DateTime('now'));
|
||||
}
|
||||
}
|
||||
|
||||
And set your controller in configuration:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_main:
|
||||
apis:
|
||||
accompanying_period_origin:
|
||||
base_path: '/api/1.0/person/accompanying-period/origin'
|
||||
class: 'Chill\PersonBundle\Entity\AccompanyingPeriod\Origin'
|
||||
name: accompanying_period_origin
|
||||
# add a controller
|
||||
controller: 'Chill\PersonBundle\Controller\OpeningApiController'
|
||||
base_role: 'ROLE_USER'
|
||||
actions:
|
||||
_index:
|
||||
methods:
|
||||
GET: true
|
||||
HEAD: true
|
||||
_entity:
|
||||
methods:
|
||||
GET: true
|
||||
HEAD: true
|
||||
|
||||
Create your own actions
|
||||
***********************
|
||||
|
||||
You can add your own actions:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_main:
|
||||
apis:
|
||||
-
|
||||
class: Chill\PersonBundle\Entity\AccompanyingPeriod
|
||||
name: accompanying_course
|
||||
base_path: /api/1.0/person/accompanying-course
|
||||
controller: Chill\PersonBundle\Controller\AccompanyingCourseApiController
|
||||
actions:
|
||||
# add a custom participation:
|
||||
participation:
|
||||
methods:
|
||||
POST: true
|
||||
DELETE: true
|
||||
GET: false
|
||||
HEAD: false
|
||||
PUT: false
|
||||
roles:
|
||||
POST: CHILL_PERSON_ACCOMPANYING_PERIOD_SEE
|
||||
DELETE: CHILL_PERSON_ACCOMPANYING_PERIOD_SEE
|
||||
GET: null
|
||||
HEAD: null
|
||||
PUT: null
|
||||
single-collection: single
|
||||
|
||||
The key :code:`single-collection` with value :code:`single` will add a :code:`/{id}/ + "action name"` (in this example, :code:`/{id}/participation`) into the path, after the base path. If the value is :code:`collection`, no id will be set, but the action name will be append to the path.
|
||||
|
||||
Then, create the corresponding action into your controller:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Symfony\Component\HttpFoundation\Exception\BadRequestException;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
use Chill\PersonBundle\Privacy\AccompanyingPeriodPrivacyEvent;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
|
||||
class AccompanyingCourseApiController extends ApiController
|
||||
{
|
||||
protected EventDispatcherInterface $eventDispatcher;
|
||||
|
||||
protected ValidatorInterface $validator;
|
||||
|
||||
public function __construct(EventDispatcherInterface $eventDispatcher, $validator)
|
||||
{
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->validator = $validator;
|
||||
}
|
||||
|
||||
public function participationApi($id, Request $request, $_format)
|
||||
{
|
||||
/** @var AccompanyingPeriod $accompanyingPeriod */
|
||||
$accompanyingPeriod = $this->getEntity('participation', $id, $request);
|
||||
$person = $this->getSerializer()
|
||||
->deserialize($request->getContent(), Person::class, $_format, []);
|
||||
|
||||
if (NULL === $person) {
|
||||
throw new BadRequestException('person id not found');
|
||||
}
|
||||
|
||||
$this->onPostCheckACL('participation', $request, $accompanyingPeriod, $_format);
|
||||
|
||||
switch ($request->getMethod()) {
|
||||
case Request::METHOD_POST:
|
||||
$participation = $accompanyingPeriod->addPerson($person);
|
||||
break;
|
||||
case Request::METHOD_DELETE:
|
||||
$participation = $accompanyingPeriod->removePerson($person);
|
||||
break;
|
||||
default:
|
||||
throw new BadRequestException("This method is not supported");
|
||||
}
|
||||
|
||||
$errors = $this->validator->validate($accompanyingPeriod);
|
||||
|
||||
if ($errors->count() > 0) {
|
||||
// only format accepted
|
||||
return $this->json($errors);
|
||||
}
|
||||
|
||||
$this->getDoctrine()->getManager()->flush();
|
||||
|
||||
return $this->json($participation);
|
||||
}
|
||||
}
|
||||
|
||||
Managing association
|
||||
********************
|
||||
|
||||
ManyToOne association
|
||||
=====================
|
||||
|
||||
In ManyToOne association, you can add associated entities using the :code:`PATCH` request. By default, the serializer deserialize entities only with their id and discriminator type, if any.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
curl -X 'PATCH' \
|
||||
'http://localhost:8001/api/1.0/person/accompanying-course/2668.json' \
|
||||
-H 'accept: */*' \
|
||||
-H 'Content-Type: application/json' \
|
||||
# see the data sent to the server: \
|
||||
-d '{
|
||||
"type": "accompanying_period",
|
||||
"id": 2668,
|
||||
"origin": { "id": 11 }
|
||||
}'
|
||||
|
||||
ManyToMany associations
|
||||
=======================
|
||||
|
||||
In OneToMany association, you can easily create route for adding and removing entities, using :code:`POST` and :code:`DELETE` requests.
|
||||
|
||||
Prepare your entity, creating the methods :code:`addYourEntity` and :code:`removeYourEntity`:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Entity;
|
||||
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
||||
|
||||
/**
|
||||
* AccompanyingPeriod Class
|
||||
*
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="chill_person_accompanying_period")
|
||||
* @DiscriminatorMap(typeProperty="type", mapping={
|
||||
* "accompanying_period"=AccompanyingPeriod::class
|
||||
* })
|
||||
*/
|
||||
class AccompanyingPeriod
|
||||
{
|
||||
/**
|
||||
* @var Collection
|
||||
* @ORM\ManyToMany(
|
||||
* targetEntity=Scope::class,
|
||||
* cascade={}
|
||||
* )
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
private $scopes;
|
||||
|
||||
public function addScope(Scope $scope): self
|
||||
{
|
||||
$this->scopes[] = $scope;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeScope(Scope $scope): void
|
||||
{
|
||||
$this->scopes->removeElement($scope);
|
||||
}
|
||||
|
||||
|
||||
Create your route into the configuration:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_main:
|
||||
apis:
|
||||
-
|
||||
class: Chill\PersonBundle\Entity\AccompanyingPeriod
|
||||
name: accompanying_course
|
||||
base_path: /api/1.0/person/accompanying-course
|
||||
controller: Chill\PersonBundle\Controller\AccompanyingCourseApiController
|
||||
actions:
|
||||
scope:
|
||||
methods:
|
||||
POST: true
|
||||
DELETE: true
|
||||
GET: false
|
||||
HEAD: false
|
||||
PUT: false
|
||||
PATCH: false
|
||||
roles:
|
||||
POST: CHILL_PERSON_ACCOMPANYING_PERIOD_SEE
|
||||
DELETE: CHILL_PERSON_ACCOMPANYING_PERIOD_SEE
|
||||
GET: null
|
||||
HEAD: null
|
||||
PUT: null
|
||||
PATCH: null
|
||||
controller_action: null
|
||||
path: null
|
||||
single-collection: single
|
||||
|
||||
This will create a new route, which will accept two methods: DELETE and POST:
|
||||
|
||||
.. code-block:: raw
|
||||
|
||||
+--------------+---------------------------------------------------------------------------------------+
|
||||
| Property | Value |
|
||||
+--------------+---------------------------------------------------------------------------------------+
|
||||
| Route Name | chill_api_single_accompanying_course_scope |
|
||||
| Path | /api/1.0/person/accompanying-course/{id}/scope.{_format} |
|
||||
| Path Regex | {^/api/1\.0/person/accompanying\-course/(?P<id>[^/]++)/scope\.(?P<_format>[^/]++)$}sD |
|
||||
| Host | ANY |
|
||||
| Host Regex | |
|
||||
| Scheme | ANY |
|
||||
| Method | POST|DELETE |
|
||||
| Requirements | {id}: \d+ |
|
||||
| Class | Symfony\Component\Routing\Route |
|
||||
| Defaults | _controller: csapi_accompanying_course_controller:scopeApi |
|
||||
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
|
||||
+--------------+---------------------------------------------------------------------------------------+
|
||||
|
||||
|
||||
|
||||
Then, create the controller action. Call the method:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
|
||||
class MyController extends ApiController
|
||||
{
|
||||
public function scopeApi($id, Request $request, string $_format): Response
|
||||
{
|
||||
return $this->addRemoveSomething('scope', $id, $request, $_format, 'scope', Scope::class, [ 'groups' => [ 'read' ] ]);
|
||||
}
|
||||
}
|
||||
|
||||
This will allow to add a scope by his id, and delete them.
|
||||
|
||||
Curl requests:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# add a scope with id 5
|
||||
curl -X 'POST' \
|
||||
'http://localhost:8001/api/1.0/person/accompanying-course/2868/scope.json' \
|
||||
-H 'accept: */*' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"type": "scope",
|
||||
"id": 5
|
||||
}'
|
||||
|
||||
# remove a scope with id 5
|
||||
curl -X 'DELETE' \
|
||||
'http://localhost:8001/api/1.0/person/accompanying-course/2868/scope.json' \
|
||||
-H 'accept: */*' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"id": 5,
|
||||
"type": "scope"
|
||||
}'
|
||||
|
||||
Deserializing an association where multiple types are allowed
|
||||
=============================================================
|
||||
|
||||
Sometimes, multiples types are allowed as association to one entity:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
class Resource
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*/
|
||||
private $thirdParty;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Person::class)
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*/
|
||||
private $person;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $resource Person|ThirdParty
|
||||
*/
|
||||
public function setResource($resource): self
|
||||
{
|
||||
// ...
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return ThirdParty|Person
|
||||
* @Groups({"read", "write"})
|
||||
*/
|
||||
public function getResource()
|
||||
{
|
||||
return $this->person ?? $this->thirdParty;
|
||||
}
|
||||
}
|
||||
|
||||
This is not well taken into account by the Symfony serializer natively.
|
||||
|
||||
You must, then, create your own CustomNormalizer. You can help yourself using this:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Serializer\Normalizer;
|
||||
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\Resource;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\ResourceRepository;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait;
|
||||
use Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait;
|
||||
use Symfony\Component\Serializer\Exception;
|
||||
use Chill\MainBundle\Serializer\Normalizer\DiscriminatedObjectDenormalizer;
|
||||
|
||||
|
||||
class AccompanyingPeriodResourceNormalizer implements DenormalizerInterface, DenormalizerAwareInterface
|
||||
{
|
||||
use DenormalizerAwareTrait;
|
||||
use ObjectToPopulateTrait;
|
||||
|
||||
public function __construct(ResourceRepository $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
public function denormalize($data, string $type, string $format = null, array $context = [])
|
||||
{
|
||||
// .. snipped for brevity
|
||||
|
||||
if ($resource === NULL) {
|
||||
$resource = new Resource();
|
||||
}
|
||||
|
||||
if (\array_key_exists('resource', $data)) {
|
||||
$res = $this->denormalizer->denormalize(
|
||||
$data['resource'],
|
||||
// call for a "multiple type"
|
||||
DiscriminatedObjectDenormalizer::TYPE,
|
||||
$format,
|
||||
// into the context, we add the list of allowed types:
|
||||
[
|
||||
DiscriminatedObjectDenormalizer::ALLOWED_TYPES =>
|
||||
[
|
||||
Person::class, ThirdParty::class
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$resource->setResource($res);
|
||||
}
|
||||
|
||||
return $resource;
|
||||
}
|
||||
|
||||
|
||||
public function supportsDenormalization($data, string $type, string $format = null)
|
||||
{
|
||||
return $type === Resource::class;
|
||||
}
|
||||
}
|
||||
|
||||
Serialization for collection
|
||||
****************************
|
||||
|
||||
A specific model has been defined for returning collection:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"count": 49,
|
||||
"results": [
|
||||
],
|
||||
"pagination": {
|
||||
"more": true,
|
||||
"next": "/api/1.0/search.json&q=xxxx......&page=2",
|
||||
"previous": null,
|
||||
"first": 0,
|
||||
"items_per_page": 1
|
||||
}
|
||||
}
|
||||
|
||||
Where this is relevant, this model should be re-used in custom controller actions.
|
||||
|
||||
In custom actions, this can be achieved quickly by assembling results into a :code:`Chill\MainBundle\Serializer\Model\Collection`. The pagination information is given by using :code:`Paginator` (see :ref:`Pagination <pagination-ref>`).
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
|
||||
class MyController extends AbstractController
|
||||
{
|
||||
|
||||
protected function serializeCollection(PaginatorInterface $paginator, $entities): Response
|
||||
{
|
||||
$model = new Collection($entities, $paginator);
|
||||
|
||||
return $this->json($model, Response::HTTP_OK, [], $context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.. _api_full_configuration:
|
||||
|
||||
Full configuration example
|
||||
**************************
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
apis:
|
||||
-
|
||||
class: Chill\PersonBundle\Entity\AccompanyingPeriod
|
||||
name: accompanying_course
|
||||
base_path: /api/1.0/person/accompanying-course
|
||||
controller: Chill\PersonBundle\Controller\AccompanyingCourseApiController
|
||||
actions:
|
||||
_entity:
|
||||
roles:
|
||||
GET: CHILL_PERSON_ACCOMPANYING_PERIOD_SEE
|
||||
HEAD: null
|
||||
POST: null
|
||||
DELETE: null
|
||||
PUT: null
|
||||
controller_action: null
|
||||
path: null
|
||||
single-collection: single
|
||||
methods:
|
||||
GET: true
|
||||
HEAD: true
|
||||
POST: false
|
||||
DELETE: false
|
||||
PUT: false
|
||||
participation:
|
||||
methods:
|
||||
POST: true
|
||||
DELETE: true
|
||||
GET: false
|
||||
HEAD: false
|
||||
PUT: false
|
||||
roles:
|
||||
POST: CHILL_PERSON_ACCOMPANYING_PERIOD_SEE
|
||||
DELETE: CHILL_PERSON_ACCOMPANYING_PERIOD_SEE
|
||||
GET: null
|
||||
HEAD: null
|
||||
PUT: null
|
||||
controller_action: null
|
||||
# the requirements for the route. Will be set to `[ 'id' => '\d+' ]` if left empty.
|
||||
requirements: []
|
||||
path: null
|
||||
single-collection: single
|
||||
base_role: null
|
||||
|
||||
|
@@ -10,17 +10,17 @@
|
||||
Exports
|
||||
*******
|
||||
|
||||
Export is an important issue within the Chill software : users should be able to :
|
||||
Export is an important issue for the Chill software : users should be able to :
|
||||
|
||||
- compute statistics about their activity ;
|
||||
- list "things" which are a part of their activities.
|
||||
- list "things" which make part of their activities.
|
||||
|
||||
The `main bundle`_ provides a powerful framework to build custom queries with re-usable parts across differents bundles.
|
||||
|
||||
.. contents:: Table of content
|
||||
:local:
|
||||
|
||||
.. seealso::
|
||||
.. seealso::
|
||||
|
||||
`The issue where this framework was discussed <https://git.framasoft.org/Chill-project/Chill-Main/issues/9>`_
|
||||
Provides some information about the pursued features and architecture.
|
||||
@@ -32,37 +32,37 @@ Concepts
|
||||
Some vocabulary: 3 "Export elements"
|
||||
------------------------------------
|
||||
|
||||
Four terms are used for this framework :
|
||||
Four terms are used for this framework :
|
||||
|
||||
Exports
|
||||
provide some basic operation on the data. Two kinds of exports are available :
|
||||
exports
|
||||
provides some basic operation on the date. Two kind of exports are available :
|
||||
|
||||
- computed data : it may be "the number of people", "the number of activities", "the duration of activities", ...
|
||||
- list data : it may be "the list of people", "the list of activities", ...
|
||||
- list data : it may be "the list of people", "the list of activity", ...
|
||||
|
||||
Filters
|
||||
The filters create a filter on the data: it removes some information the user doesn't want to introduce in the computation done by the export.
|
||||
filters
|
||||
The filters make a filter on the date: it removes some information the user doesn't want to introduce in the computation done by export. In other word, filters make a filter...
|
||||
|
||||
Example of a filter: "people under 18 years olds", "activities between the 1st of June and the 31st December", ...
|
||||
Example of filter: "people under 18 years olds", "activities between the 1st of June and the 31st December", ...
|
||||
|
||||
Aggregators
|
||||
The aggregator aggregates the data into some group (some software use the term 'bucket').
|
||||
aggregators
|
||||
The aggregator aggregates the data into some group (some software use the term 'bucket').
|
||||
|
||||
Example of an aggregator : "group people by gender", "group people by nationality", "group activity by type", ...
|
||||
Example of aggregator : "group people by gender", "group people by nationality", "group activity by type", ...
|
||||
|
||||
Formatters
|
||||
The formatters format the data into a :class:`Symfony\Component\HttpFoundation\Response`, which will be returned "as is" by the controller to the web client.
|
||||
formatters
|
||||
The formatters format the data into a :class:`Symfony\Component\HttpFoundation\Response`, which will be returned "as is" by the controller to the web client.
|
||||
|
||||
Example of a formatter: "format data as CSV", "format data as an ods spreadsheet", ...
|
||||
Example of formatter: "format data as CSV", "format data as ods spreadsheet", ...
|
||||
|
||||
Anatomy of an export
|
||||
---------------------
|
||||
|
||||
An export can be thought of as a sentence where each part of this sentence refers to one or multiple export elements. Examples :
|
||||
An export may be explained as a sentence, where each part of this sentence refers to one or multiple exports element. Examples :
|
||||
|
||||
**Example 1**: Count the number of people having at least one activity in the last 12 month, and group them by nationality and gender, and format them in a CSV spreadsheet.
|
||||
|
||||
Here :
|
||||
Here :
|
||||
|
||||
- *count the number of people* is the export part
|
||||
- *having at least one activity* is the filter part
|
||||
@@ -72,10 +72,10 @@ Here :
|
||||
|
||||
Note that :
|
||||
|
||||
- Aggregators, filters, exports and formatters are cross-bundle. Here the bundle *activity* provides a filter which is applied on an export provided by the person bundle ;
|
||||
- Multiple aggregator or filter for one export may exist. Currently, only one export is allowed.
|
||||
- aggregators, filters, exports and aggregators are cross-bundle. Here the bundle *activity* provides a filter which apply on an export provided by the person bundle ;
|
||||
- there may exists multiple aggregator or filter for one export. Currently, only one export is allowed.
|
||||
|
||||
The result might be :
|
||||
The result might be :
|
||||
|
||||
+-----------------------+----------------+---------------------------+
|
||||
| Nationality | Gender | Number of people |
|
||||
@@ -89,9 +89,9 @@ The result might be :
|
||||
| France | Female | 150 |
|
||||
+-----------------------+----------------+---------------------------+
|
||||
|
||||
**Example 2**: Count the average duration of an activity with type "meeting", which occurs between the 1st of June and the 31st of December, group them by week, and format the data in an OpenDocument spreadsheet.
|
||||
**Example 2**: Count the average duration of an activity with type "meeting", which occurs between the 1st of June and the 31st of December, group them by week, and format the data in a OpenDocument spreadsheet.
|
||||
|
||||
Here :
|
||||
Here :
|
||||
|
||||
- *count the average duration of an activity* is the export part
|
||||
- *activity with type meeting* is a filter part
|
||||
@@ -102,7 +102,7 @@ Here :
|
||||
The result might be :
|
||||
|
||||
+-----------------------+----------------------+
|
||||
| Week | Number of activities |
|
||||
| Week | Number of activities |
|
||||
+=======================+======================+
|
||||
| 2015-10 | 10 |
|
||||
+-----------------------+----------------------+
|
||||
@@ -116,77 +116,77 @@ The result might be :
|
||||
Authorization and exports
|
||||
-------------------------
|
||||
|
||||
Exports, filters and aggregators should not show data the user is not allowed to see within the application.
|
||||
Exports, filters and aggregators should not make see data the user is not allowed to see.
|
||||
|
||||
In other words, developers are required to take care of user authorization for each export.
|
||||
|
||||
There should be a specific role that grants permission to users who are allowed to build exports. For more simplicity, this role should apply on a center, and should not require special circles.
|
||||
It should exists a special role that should be granted to users which are allowed to build exports. For more simplicity, this role should apply on center, and should not requires special circles.
|
||||
|
||||
How does the magic work ?
|
||||
How does the magic works ?
|
||||
===========================
|
||||
|
||||
To build an export, we rely on the capacity of the database to execute queries with aggregate (i.e. GROUP BY) and filter (i.e. WHERE) instructions.
|
||||
|
||||
An export is an SQL query which is initiated by an export, and modified by aggregators and filters.
|
||||
|
||||
.. note::
|
||||
.. note::
|
||||
|
||||
**Example**: Count the number of people having at least one activity in the last 12 month, and group them by nationality and gender
|
||||
|
||||
1. The report initiates the query
|
||||
1. The report initiate the query
|
||||
|
||||
.. code-block:: SQL
|
||||
|
||||
SELECT count(people.*) FROM people
|
||||
|
||||
2. The filter adds a where and join clause :
|
||||
2. The filter add a where and join clause :
|
||||
|
||||
.. code-block:: SQL
|
||||
|
||||
SELECT count(people.*) FROM people
|
||||
RIGHT JOIN activity
|
||||
SELECT count(people.*) FROM people
|
||||
RIGHT JOIN activity
|
||||
WHERE activity.date IS BETWEEN now AND 6 month ago
|
||||
|
||||
3. The aggregator "nationality" adds a GROUP BY clause and a column in the SELECT statement:
|
||||
3. The aggregator "nationality" add a GROUP BY clause and a column in the SELECT statement:
|
||||
|
||||
.. code-block:: sql
|
||||
|
||||
SELECT people.nationality, count(people.*) FROM people
|
||||
RIGHT JOIN activity
|
||||
WHERE activity.date IS BETWEEN now AND 6 month ago
|
||||
SELECT people.nationality, count(people.*) FROM people
|
||||
RIGHT JOIN activity
|
||||
WHERE activity.date IS BETWEEN now AND 6 month ago
|
||||
GROUP BY nationality
|
||||
|
||||
4. The aggregator "gender" does the same job as the nationality aggregator : it adds a GROUP BY clause and a column in the SELECT statement :
|
||||
4. The aggregator "gender" do the same job as the nationality aggregator : it adds a GROUP BY clause and a column in the SELECT statement :
|
||||
|
||||
.. code-block:: sql
|
||||
|
||||
SELECT people.nationality, people.gender, count(people.*)
|
||||
FROM people RIGHT JOIN activity
|
||||
WHERE activity.date IS BETWEEN now AND 6 month ago
|
||||
SELECT people.nationality, people.gender, count(people.*)
|
||||
FROM people RIGHT JOIN activity
|
||||
WHERE activity.date IS BETWEEN now AND 6 month ago
|
||||
GROUP BY nationality, gender
|
||||
|
||||
Each filter, aggregator and filter may collect parameters from the user through a form. This form is appended to the export form. Here is an example.
|
||||
Each filter, aggregator and filter may collect parameters from the user by providing a form. This form is appended to the export form. Here is an example.
|
||||
|
||||
.. figure:: /_static/screenshots/development/export_form-fullpage.png
|
||||
|
||||
The screenshot shows the export form for ``CountPeople`` (Nombre de personnes). The filter by date of birth is checked (*Filtrer par date de naissance de la personne*), which triggers a subform, which is provided by the :class:`Chill\PersonBundle\Export\Filter\BirthdateFilter`. The other unchecked filter does not show the subform.
|
||||
The screenshot show the export form for ``CountPeople`` (Nombre de personnes). The filter by date of birth is checked (*Filtrer par date de naissance de la personne*), which allow to show a subform, which is provided by the :class:`Chill\PersonBundle\Export\Filter\BirthdateFilter`. The other filter, which are unchecked, does not show the subform.
|
||||
|
||||
Two aggregators are also checked : by Country of birth (*Aggréger les personnes par pays de naissance*, the corresponding class is :class:`Chill\PersonBundle\Export\Aggregator\CountryOfBirthAggregator`, which also triggers a subform. The aggregator by gender (*Aggréger les personnes par genre*) is also checked, but there is no corresponding subform.
|
||||
Two aggregators are also checked : by Country of birth (*Aggréger les personnes par pays de naissance*, corresponding class is :class:`Chill\PersonBundle\Export\Aggregator\CountryOfBirthAggregator`, which also open a subform. The aggregator by gender (*Aggréger les personnes par genre*) is also checked, but there is no corresponding subform.
|
||||
|
||||
The Export Manager
|
||||
------------------
|
||||
|
||||
The Export manager (:class:`Chill\MainBundle\Export\ExportManager` is the central class which registers all exports, aggregators, filters and formatters.
|
||||
The Export manager (:class:`Chill\MainBundle\Export\ExportManager` is the central class which register all exports, aggregators, filters and formatters.
|
||||
|
||||
The export manager is also responsible for orchestrating the whole export process, producing a :class:`Symfony\FrameworkBundle\HttpFoundation\Request` for each export request.
|
||||
The export manager is also responsible for orchestrating the whole export process, producing a :class:`Symfony\FrameworkBundle\HttpFoundation\Request` to each export request.
|
||||
|
||||
|
||||
The export form step
|
||||
--------------------
|
||||
|
||||
The form step allows you to build a form, combining different parts of the module.
|
||||
The form step allow to build a form, aggregating different parts of the module.
|
||||
|
||||
The building of forms is split into different subforms, where each one is responsible for rendering their part of the form (aggregators, filters, and export).
|
||||
The building of forms is separated between different subform, which are responsible for rendering their part of the form (aggregators, filters, and export).
|
||||
|
||||
.. figure:: /_static/puml/exports/form_steps.png
|
||||
:scale: 40%
|
||||
@@ -194,12 +194,12 @@ The building of forms is split into different subforms, where each one is respon
|
||||
The formatter form step
|
||||
-----------------------
|
||||
|
||||
The formatter form is processed *after* the user filled the export form. It is built the same way, but receives the data entered by the user on the previous step as parameters (i.e. export form). It may then adapt it accordingly (example: show a list of columns selected in aggregators).
|
||||
The formatter form is processed *after* the user filled the export form. It is built the same way, but receive in parameters the data entered by the user on the previous step (i.e. export form). It may then adapt it accordingly (example: show a list of columns selected in aggregators).
|
||||
|
||||
Processing the export
|
||||
---------------------
|
||||
|
||||
The export process can be explained by this schema :
|
||||
The export process may be explained by this schema :
|
||||
|
||||
.. figure:: /_static/puml/exports/processing_export.png
|
||||
:scale: 40%
|
||||
@@ -219,20 +219,20 @@ This is an example of the ``CountPerson`` export :
|
||||
:language: php
|
||||
:linenos:
|
||||
|
||||
* **Line 36**: the ``getType`` function returns a string. This string will be used to find the aggregtors and filters which will apply to this export.
|
||||
* **Line 41**: a simple description to help users understand what your export does.
|
||||
* **Line 36**: the ``getType`` function return a string. This string will be used to find the aggregtors and filters which will apply to this export.
|
||||
* **Line 41**: a simple description to help user to understand what your export does.
|
||||
* **Line 46**: The title of the export. A summary of what your export does.
|
||||
* **Line 51**: The list of roles required to execute this export.
|
||||
* **Line 51**: The list of roles requires to execute this export.
|
||||
* **Line 56**: We initiate the query here...
|
||||
* **Line 59**: We have to filter the query with centers the users checked in the form. We process the $acl variable to get all ``Center`` objects in one array
|
||||
* **Line 63**: We create the query with a query builder.
|
||||
* **Line 74**: We return the result, but make sure to hydrate the results as an array.
|
||||
* **Line 103**: return the list of formatter types which are allowed to be applied on this filter
|
||||
* **Line 59**: We have to filter the query with centers the users checked in the form. We process the $acl variable to get all ``Center`` object in one array
|
||||
* **Line 63**: We create the query, with a query builder.
|
||||
* **Line 74**: We simply returns the result, but take care of hydrating the results as an array.
|
||||
* **Line 103**: return the list of formatters types which are allowed to apply on this filter
|
||||
|
||||
Filters
|
||||
-------
|
||||
|
||||
This is an example of the *filter by birthdate*. This filter asks some information through a form (`buildForm` is not empty), and this form must be validated. To perform this validation, we implement a new Interface: :class:`Chill\MainBundle\Export\ExportElementValidatedInterface`:
|
||||
This is an example of the *filter by birthdate*. This filter ask some information in a form (`buildForm` is not empty), and this form must be validated. To performs this validations, we implement a new Interface: :class:`Chill\MainBundle\Export\ExportElementValidatedInterface`:
|
||||
|
||||
.. literalinclude:: /_static/code/exports/BirthdateFilter.php
|
||||
:language: php
|
||||
|
@@ -16,7 +16,6 @@ As Chill rely on the `symfony <http://symfony.com>`_ framework, reading the fram
|
||||
|
||||
Instructions to create a new bundle <create-a-new-bundle.rst>
|
||||
CRUD (Create - Update - Delete) for one entity <crud.rst>
|
||||
Helpers for building a REST API <api.rst>
|
||||
Routing <routing.rst>
|
||||
Menus <menus.rst>
|
||||
Forms <forms.rst>
|
||||
|
@@ -7,8 +7,6 @@
|
||||
Free Documentation License".
|
||||
|
||||
|
||||
.. _pagination-ref:
|
||||
|
||||
Pagination
|
||||
##########
|
||||
|
||||
@@ -17,7 +15,7 @@ The Bundle :code:`Chill\MainBundle` provides a **Pagination** api which allow yo
|
||||
A simple example
|
||||
****************
|
||||
|
||||
In the controller, get the :code:`Chill\Main\Pagination\PaginatorFactory` from the `Container` and use this :code:`PaginatorFactory` to create a :code:`Paginator` instance.
|
||||
In the controller, get the :class:`Chill\Main\Pagination\PaginatorFactory` from the `Container` and use this :code:`PaginatorFactory` to create a :code:`Paginator` instance.
|
||||
|
||||
|
||||
.. literalinclude:: pagination/example.php
|
||||
@@ -28,11 +26,11 @@ Then, render the pagination using the dedicated twig function.
|
||||
|
||||
.. code-block:: html+twig
|
||||
|
||||
{% extends "@ChillPerson/Person/layout.html.twig" %}
|
||||
{% extends "ChillPersonBundle::layout.html.twig" %}
|
||||
|
||||
{% block title 'Item list'|trans %}
|
||||
|
||||
{% block content %}
|
||||
{% block personcontent %}
|
||||
|
||||
<table>
|
||||
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
@@ -97,7 +97,7 @@ The has the following signature :
|
||||
*
|
||||
* @param string $context
|
||||
* @param mixed[] $args the argument to the context.
|
||||
* @return TimelineSingleQuery
|
||||
* @return string[]
|
||||
* @throw \LogicException if the context is not supported
|
||||
*/
|
||||
public function fetchQuery($context, array $args);
|
||||
@@ -163,16 +163,18 @@ The has the following signature :
|
||||
The `fetchQuery` function
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The fetchQuery function help to build the UNION query to gather events. This function should return an instance of :code:`TimelineSingleQuery`. For you convenience, this object may be build using an associative array with the following keys:
|
||||
The fetchQuery function help to build the UNION query to gather events. This function should return an associative array MUST have the following key :
|
||||
|
||||
* `id` : the name of the id column
|
||||
* `type`: a string to indicate the type
|
||||
* `date`: the name of the datetime column, used to order entities by date
|
||||
* `FROM`: the FROM clause. May contains JOIN instructions
|
||||
* `WHERE`: the WHERE clause;
|
||||
* `parameters`: the parameters to pass to the query
|
||||
* `FROM` (in capital) : the FROM clause. May contains JOIN instructions
|
||||
|
||||
The parameters should be replaced into the query by :code:`?`. They will be replaced into the query using prepared statements.
|
||||
Those key are optional:
|
||||
|
||||
* `WHERE` (in capital) : the WHERE clause.
|
||||
|
||||
Where relevant, the data must be quoted to avoid SQL injection.
|
||||
|
||||
`$context` and `$args` are defined by the bundle which will call the timeline rendering. You may use them to build a different query depending on this context.
|
||||
|
||||
@@ -184,15 +186,6 @@ For instance, if the context is `'person'`, the args will be this array :
|
||||
'person' => $person //a \Chill\PersonBundle\Entity\Person entity
|
||||
);
|
||||
|
||||
For the context :code:`center`, the args will be:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
array(
|
||||
'centers' => [ ] // an array of \Chill\MainBundle\Entity\Center entities
|
||||
);
|
||||
|
||||
|
||||
You should find in the bundle documentation which contexts are arguments the bundle defines.
|
||||
|
||||
.. note::
|
||||
@@ -206,12 +199,13 @@ Example of an implementation :
|
||||
namespace Chill\ReportBundle\Timeline;
|
||||
|
||||
use Chill\MainBundle\Timeline\TimelineProviderInterface;
|
||||
use Chill\MainBundle\Timeline\TimelineSingleQuery;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
/**
|
||||
* Provide report for inclusion in timeline
|
||||
*
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
* @author Champs Libres <info@champs-libres.coop>
|
||||
*/
|
||||
class TimelineReportProvider implements TimelineProviderInterface
|
||||
{
|
||||
@@ -233,17 +227,16 @@ Example of an implementation :
|
||||
|
||||
$metadata = $this->em->getClassMetadata('ChillReportBundle:Report');
|
||||
|
||||
return TimelineSingleQuery::fromArray([
|
||||
return array(
|
||||
'id' => $metadata->getColumnName('id'),
|
||||
'type' => 'report',
|
||||
'date' => $metadata->getColumnName('date'),
|
||||
'FROM' => $metadata->getTableName(),
|
||||
'WHERE' => sprintf('%s = ?',
|
||||
'WHERE' => sprintf('%s = %d',
|
||||
$metadata
|
||||
->getAssociationMapping('person')['joinColumns'][0]['name'])
|
||||
)
|
||||
'parameters' => [ $args['person']->getId() ]
|
||||
]);
|
||||
->getAssociationMapping('person')['joinColumns'][0]['name'],
|
||||
$args['person']->getId())
|
||||
);
|
||||
}
|
||||
|
||||
//....
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
@@ -149,14 +149,14 @@ It proposes a new block :
|
||||
|
||||
* where to display the admin content
|
||||
|
||||
@ChillPersonBundle/Person/layout.html.twig
|
||||
ChillPersonBundle::layout.html.twig
|
||||
-----------------------------------
|
||||
|
||||
This layout extend `ChillMainBundle::layoutWithVerticalMenu.html.twig` add the person details in the block `top_banner`, set the menu `person` as the vertical menu.
|
||||
|
||||
It proposes 1 new block :
|
||||
|
||||
* content
|
||||
* personcontent
|
||||
|
||||
* where to display the information of the person
|
||||
|
||||
|
@@ -1,20 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
// Chill\MainBundle\DependencyInjection\Configuration.php
|
||||
|
||||
namespace Chill\MainBundle\DependencyInjection;
|
||||
|
||||
use Chill\MainBundle\DependencyInjection\Widget\AddWidgetConfigurationTrait;
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Chill\MainBundle\DependencyInjection\Widget\AddWidgetConfigurationTrait;
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* Configure the main bundle.
|
||||
@@ -38,6 +42,9 @@ class ChillMainConfiguration implements ConfigurationInterface
|
||||
$this->containerBuilder = $containerBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getConfigTreeBuilder()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder();
|
||||
|
@@ -1,14 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
//Chill\MainBundle\DependencyInjection\ChillMainExtension.php
|
||||
|
||||
namespace Chill\MainBundle\DependencyInjection;
|
||||
|
||||
use Chill\MainBundle\DependencyInjection\Widget\Factory\WidgetFactoryInterface;
|
||||
|
@@ -1,14 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
// Chill/PersonBundle/Widget/PersonListWidgetFactory
|
||||
|
||||
namespace Chill\PersonBundle\Widget;
|
||||
|
||||
use Chill\MainBundle\DependencyInjection\Widget\Factory\AbstractWidgetFactory;
|
||||
|
@@ -1,14 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
// Chill/PersonBundle/Widget/PersonListWidget.php
|
||||
|
||||
namespace Chill\PersonBundle\Widget;
|
||||
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
|
@@ -1,14 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
// Chill/PersonBundle/DependencyInjection/ChillPersonExtension.php
|
||||
|
||||
namespace Chill\PersonBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
@@ -22,6 +26,9 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
*/
|
||||
class ChillPersonExtension extends Extension implements PrependExtensionInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
// ...
|
||||
|
@@ -65,17 +65,6 @@ This script will :
|
||||
4. build assets
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
In some cases it can happen that an old image (chill_base_php or chill_php) stored in the docker cache will make the script fail. To solve this problem you have to delete the image and the container, before the make init :
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
docker-compose images php
|
||||
docker rmi -f chill_php:prod
|
||||
docker-compose rm php
|
||||
|
||||
|
||||
4. Start the project
|
||||
====================
|
||||
|
||||
@@ -93,7 +82,7 @@ Chill will be available at ``http://localhost:8001.`` Currently, there isn't any
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
docker-compose exec --user $(id -u) php bin/console doctrine:fixtures:load --purge-with-truncate
|
||||
docker-compose exec --user $(id -u) php bin/console doctrine:fixtures:load
|
||||
|
||||
There are several users available:
|
||||
|
||||
@@ -104,29 +93,6 @@ The password is always ``password``.
|
||||
|
||||
Now, read `Operations` below.
|
||||
|
||||
Prepare for development
|
||||
***********************
|
||||
|
||||
Add a Gitlab token to ensure that you get always the source code:
|
||||
|
||||
1. generate a gitlab token there: https://gitlab.com/oauth/token
|
||||
2. run this command (in php container, at the app's root): :code:`composer config gitlab-token.gitlab.com <your token>`
|
||||
|
||||
The auth token should appears now in the directory :code:`.composer`:
|
||||
|
||||
.. code-block: bash
|
||||
|
||||
$ cat .composer/auth.json
|
||||
{
|
||||
"gitlab-token": {
|
||||
"gitlab.com": "<your token>"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
See also "how to switch branch and get new dependencies".
|
||||
|
||||
|
||||
Operations
|
||||
**********
|
||||
|
||||
@@ -234,25 +200,6 @@ How to run webpack interactively
|
||||
|
||||
Executing :code:`bash docker-node.sh` will open a terminal in a node container, with volumes mounted.
|
||||
|
||||
How to switch the branch for chill-bundles, and get new dependencies
|
||||
====================================================================
|
||||
|
||||
During development, you will switch to new branches for chill-bundles. As long as the dependencies are equals, this does not cause any problem. But sometimes, a new branch introduces a new dependency, and you must download it.
|
||||
|
||||
In order to do that without pain, use those steps:
|
||||
|
||||
0. Ensuire you have a token, set
|
||||
1. at the app's root, update the `composer.json` to your current branch:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"require": {
|
||||
"chill-bundles": "dev-<my-branch>@dev"
|
||||
}
|
||||
|
||||
2. mount into the php container, and run `composer update`
|
||||
|
||||
Build the documentation API
|
||||
===========================
|
||||
|
||||
|
42
grumphp.yml
42
grumphp.yml
@@ -1,40 +1,8 @@
|
||||
imports:
|
||||
- {
|
||||
resource: tests/app/vendor/drupol/php-conventions/config/php73/grumphp.yml,
|
||||
}
|
||||
- { resource: vendor/drupol/php-conventions/config/php73/grumphp.yml }
|
||||
|
||||
parameters:
|
||||
tasks.phpcsfixer.config: .php_cs.dist.php
|
||||
tasks.license.name: AGPL-3.0
|
||||
tasks.license.holder: Champs-Libres
|
||||
tasks.license.date_from: 2001
|
||||
|
||||
tasks.phpcsfixer.allow_risky: true
|
||||
tasks.phpcsfixer.diff: true
|
||||
tasks.phpstan.level: 1
|
||||
tasks.phpstan.blocking: true
|
||||
tasks.phpstan.ignore_patterns:
|
||||
- "/.github/"
|
||||
- "/.idea/"
|
||||
- "/build/"
|
||||
- "/benchmarks/"
|
||||
- "/docs/"
|
||||
- "/node_modules/"
|
||||
- "/resource/"
|
||||
- "/spec/"
|
||||
- "/var/"
|
||||
- "/vendor/"
|
||||
- "/tests/app"
|
||||
|
||||
# Psalm
|
||||
tasks.psalm.blocking: true
|
||||
tasks.psalm.ignore_patterns:
|
||||
- "/.github/"
|
||||
- "/.idea/"
|
||||
- "/build/"
|
||||
- "/benchmarks/"
|
||||
- "/node_modules/"
|
||||
- "/resource/"
|
||||
- "/spec/"
|
||||
- "/var/"
|
||||
- "/vendor/"
|
||||
tasks.phpcsfixer.config: .php_cs.dist
|
||||
tasks.license.name: AGPL-3.0
|
||||
tasks.license.holder: Champs-Libres
|
||||
tasks.license.date_from: 2001
|
||||
|
@@ -1,96 +0,0 @@
|
||||
parameters:
|
||||
ignoreErrors:
|
||||
-
|
||||
message: "#^Variable property access on \\$this\\(Chill\\\\ActivityBundle\\\\Entity\\\\ActivityType\\)\\.$#"
|
||||
count: 3
|
||||
path: src/Bundle/ChillActivityBundle/Entity/ActivityType.php
|
||||
|
||||
-
|
||||
message: "#^Foreach overwrites \\$key with its key variable\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php
|
||||
|
||||
-
|
||||
message: "#^Variable \\$participation might not be defined\\.$#"
|
||||
count: 3
|
||||
path: src/Bundle/ChillEventBundle/Controller/ParticipationController.php
|
||||
|
||||
-
|
||||
message: "#^Foreach overwrites \\$value with its value variable\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillEventBundle/Form/ChoiceLoader/EventChoiceLoader.php
|
||||
|
||||
-
|
||||
message: "#^Variable method call on object\\.$#"
|
||||
count: 2
|
||||
path: src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot unset offset '_token' on array\\{formatter\\: mixed, export\\: mixed, centers\\: mixed, alias\\: string\\}\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Controller/ExportController.php
|
||||
|
||||
-
|
||||
message: "#^Foreach overwrites \\$line with its value variable\\.$#"
|
||||
count: 2
|
||||
path: src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php
|
||||
|
||||
-
|
||||
message: "#^Foreach overwrites \\$key with its key variable\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php
|
||||
|
||||
-
|
||||
message: "#^Foreach overwrites \\$key with its value variable\\.$#"
|
||||
count: 3
|
||||
path: src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php
|
||||
|
||||
-
|
||||
message: "#^Foreach overwrites \\$value with its value variable\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Form/ChoiceLoader/PostalCodeChoiceLoader.php
|
||||
|
||||
-
|
||||
message: "#^Variable \\$message on left side of \\?\\? always exists and is not nullable\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Templating/ChillTwigHelper.php
|
||||
|
||||
-
|
||||
message: "#^Variable \\$sqls on left side of \\?\\? always exists and is not nullable\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php
|
||||
|
||||
-
|
||||
message: "#^Class Chill\\\\PersonBundle\\\\Entity\\\\Person constructor invoked with 1 parameter, 0 required\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
||||
|
||||
-
|
||||
message: "#^Variable \\$street1Value might not be defined\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
||||
|
||||
-
|
||||
message: "#^Variable method call on mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php
|
||||
|
||||
-
|
||||
message: "#^Foreach overwrites \\$value with its value variable\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php
|
||||
|
||||
-
|
||||
message: "#^Foreach overwrites \\$action with its value variable\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php
|
||||
|
||||
-
|
||||
message: "#^Foreach overwrites \\$action with its value variable\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Repository/SocialWork/ResultRepository.php
|
||||
|
||||
-
|
||||
message: "#^Foreach overwrites \\$value with its value variable\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillThirdPartyBundle/Form/ChoiceLoader/ThirdPartyChoiceLoader.php
|
@@ -1,86 +0,0 @@
|
||||
parameters:
|
||||
ignoreErrors:
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$centers might not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
|
||||
|
||||
-
|
||||
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Entity\\\\Household\\\\PersonHouseholdAddress\\:\\:\\$relation\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Entity/Household/PersonHouseholdAddress.php
|
||||
|
||||
-
|
||||
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Entity\\\\AccompanyingPeriod\\:\\:\\$work\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
|
||||
|
||||
-
|
||||
message: "#^Undefined variable\\: \\$person$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php
|
||||
|
||||
-
|
||||
message: "#^Variable variables are not allowed\\.$#"
|
||||
count: 4
|
||||
path: src/Bundle/ChillPersonBundle/Search/PersonSearch.php
|
||||
|
||||
-
|
||||
message: "#^Function Chill\\\\PersonBundle\\\\Serializer\\\\Normalizer\\\\·\\\\is_array not found\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php
|
||||
|
||||
-
|
||||
message: "#^Undefined variable\\: \\$choiceSlug$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php
|
||||
|
||||
-
|
||||
message: "#^Undefined variable\\: \\$choiceSlug$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php
|
||||
|
||||
-
|
||||
message: "#^Undefined variable\\: \\$type$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillTaskBundle/Controller/TaskController.php
|
||||
|
||||
-
|
||||
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\AbstractCRUDController\\:\\:getRoleFor\\(\\)\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php
|
||||
|
||||
-
|
||||
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Controller\\\\UserController\\:\\:createEditForm\\(\\)\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Controller/UserController.php
|
||||
|
||||
-
|
||||
message: "#^Undefined variable\\: \\$current$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Pagination/PageGenerator.php
|
||||
|
||||
-
|
||||
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AbstractChillVoter\\:\\:getSupportedAttributes\\(\\)\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php
|
||||
|
||||
-
|
||||
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AbstractChillVoter\\:\\:getSupportedClasses\\(\\)\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php
|
||||
|
||||
-
|
||||
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AbstractChillVoter\\:\\:isGranted\\(\\)\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php
|
||||
|
||||
-
|
||||
message: "#^Access to an undefined property Chill\\\\PersonBundle\\\\Controller\\\\PersonController\\:\\:\\$security\\.$#"
|
||||
count: 3
|
||||
path: src/Bundle/ChillPersonBundle/Controller/PersonController.php
|
||||
|
||||
-
|
||||
message: "#^Call to an undefined method Chill\\\\ThirdPartyBundle\\\\Form\\\\Type\\\\PickThirdPartyTypeCategoryType\\:\\:transform\\(\\)\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php
|
@@ -1,940 +0,0 @@
|
||||
parameters:
|
||||
ignoreErrors:
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 2
|
||||
path: src/Bundle/ChillActivityBundle/Controller/ActivityController.php
|
||||
|
||||
-
|
||||
message: "#^Call to deprecated method setType\\(\\) of class Chill\\\\ActivityBundle\\\\Entity\\\\Activity\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Entity/ActivityReason.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\ActivityBundle\\\\Export\\\\Aggregator\\\\ActivityReasonAggregator\\:\\:addRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\ActivityBundle\\\\Export\\\\Aggregator\\\\ActivityTypeAggregator\\:\\:addRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\ActivityBundle\\\\Export\\\\Aggregator\\\\ActivityUserAggregator\\:\\:addRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\ActivityBundle\\\\Export\\\\Export\\\\CountActivity\\:\\:requiredRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\ActivityBundle\\\\Export\\\\Export\\\\ListActivity\\:\\:requiredRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\ActivityBundle\\\\Export\\\\Export\\\\StatActivityDuration\\:\\:requiredRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\ActivityBundle\\\\Export\\\\Filter\\\\ActivityDateFilter\\:\\:addRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\ActivityBundle\\\\Export\\\\Filter\\\\ActivityReasonFilter\\:\\:addRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\ActivityBundle\\\\Export\\\\Filter\\\\ActivityTypeFilter\\:\\:addRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\ActivityBundle\\\\Export\\\\Filter\\\\PersonHavingActivityBetweenDateFilter\\:\\:addRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Export/Filter/PersonHavingActivityBetweenDateFilter.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Form/ActivityType.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Call to deprecated method getReachableScopes\\(\\) of class Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AuthorizationHelper\\:
|
||||
Use getReachableCircles$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$centerResolverDispatcher of method Chill\\\\ActivityBundle\\\\Repository\\\\ActivityACLAwareRepository\\:\\:__construct\\(\\) has typehint with deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\:
|
||||
Use CenterResolverManager and its interface CenterResolverManagerInterface$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$templating of method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldChoice\\:\\:__construct\\(\\) has typehint with deprecated class Symfony\\\\Bridge\\\\Twig\\\\TwigEngine\\:
|
||||
since version 4\\.3, to be removed in 5\\.0; use Twig instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php
|
||||
|
||||
-
|
||||
message: "#^Used function LogicException not found\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$templating of method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldDate\\:\\:__construct\\(\\) has typehint with deprecated class Symfony\\\\Bundle\\\\TwigBundle\\\\TwigEngine\\:
|
||||
since version 4\\.3, to be removed in 5\\.0; use Twig instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$twigEngine of method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldLongChoice\\:\\:__construct\\(\\) has typehint with deprecated class Symfony\\\\Bridge\\\\Twig\\\\TwigEngine\\:
|
||||
since version 4\\.3, to be removed in 5\\.0; use Twig instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$templating of method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldNumber\\:\\:__construct\\(\\) has typehint with deprecated class Symfony\\\\Bundle\\\\TwigBundle\\\\TwigEngine\\:
|
||||
since version 4\\.3, to be removed in 5\\.0; use Twig instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$templating of method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldText\\:\\:__construct\\(\\) has typehint with deprecated class Symfony\\\\Bundle\\\\TwigBundle\\\\TwigEngine\\:
|
||||
since version 4\\.3, to be removed in 5\\.0; use Twig instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$templating of method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldTitle\\:\\:__construct\\(\\) has typehint with deprecated class Symfony\\\\Bundle\\\\TwigBundle\\\\TwigEngine\\:
|
||||
since version 4\\.3, to be removed in 5\\.0; use Twig instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 6
|
||||
path: src/Bundle/ChillEventBundle/Controller/EventController.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillEventBundle/Form/EventType.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillEventBundle/Form/Type/PickEventType.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Call to deprecated method getReachableScopes\\(\\) of class Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AuthorizationHelper\\:
|
||||
Use getReachableCircles$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillEventBundle/Search/EventSearch.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillFamilyMembersBundle/Security/Voter/FamilyMemberVoter.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$role of method Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\CRUDController\\:\\:getReachableCenters\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Call to deprecated method getLanguageBundle\\(\\) of class Symfony\\\\Component\\\\Intl\\\\Intl\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use \\{@see Languages\\} or \\{@see Scripts\\} instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Call to deprecated method getRegionBundle\\(\\) of class Symfony\\\\Component\\\\Intl\\\\Intl\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use \\{@see Countries\\} instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$role of anonymous function has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Call to deprecated method getLanguageBundle\\(\\) of class Symfony\\\\Component\\\\Intl\\\\Intl\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use \\{@see Languages\\} or \\{@see Scripts\\} instead\\.$#
|
||||
"""
|
||||
count: 2
|
||||
path: src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Class Chill\\\\MainBundle\\\\Entity\\\\User implements deprecated interface Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\AdvancedUserInterface\\:
|
||||
since Symfony 4\\.1$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Entity/User.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\MainBundle\\\\Entity\\\\User\\:\\:getRoles\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Entity/User.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\MainBundle\\\\Export\\\\DirectExportInterface\\:\\:requiredRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Export/DirectExportInterface.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\MainBundle\\\\Export\\\\ExportInterface\\:\\:requiredRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Export/ExportInterface.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Call to deprecated method getReachableScopes\\(\\) of class Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AuthorizationHelper\\:
|
||||
Use getReachableCircles$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Export/ExportManager.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\MainBundle\\\\Export\\\\ModifierInterface\\:\\:addRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Export/ModifierInterface.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Class Chill\\\\MainBundle\\\\Form\\\\Event\\\\CustomizeFormEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\:
|
||||
since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Form/Type/UserPickerType.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
||||
count: 2
|
||||
path: src/Bundle/ChillMainBundle/Repository/NotificationRepository.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$attribute of method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AuthorizationHelper\\:\\:userHasAccess\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$centerResolverDispatcher of method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AuthorizationHelper\\:\\:__construct\\(\\) has typehint with deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\:
|
||||
Use CenterResolverManager and its interface CenterResolverManagerInterface$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$role of method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AuthorizationHelper\\:\\:getReachableCircles\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$centerResolverDispatcher of method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\DefaultVoterHelper\\:\\:__construct\\(\\) has typehint with deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\:
|
||||
Use CenterResolverManager and its interface CenterResolverManagerInterface$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelper.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$centerResolverDispatcher of method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\DefaultVoterHelperFactory\\:\\:__construct\\(\\) has typehint with deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\:
|
||||
Use CenterResolverManager and its interface CenterResolverManagerInterface$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperFactory.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$centerResolverDispatcher of method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\DefaultVoterHelperGenerator\\:\\:__construct\\(\\) has typehint with deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\:
|
||||
Use CenterResolverManager and its interface CenterResolverManagerInterface$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperGenerator.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Class Chill\\\\MainBundle\\\\Security\\\\PasswordRecover\\\\PasswordRecoverEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\:
|
||||
since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Class Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcher implements deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\:
|
||||
Use CenterResolverManager and its interface CenterResolverManagerInterface$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverDispatcher.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Class Chill\\\\MainBundle\\\\Templating\\\\Events\\\\DelegatedBlockRenderingEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\:
|
||||
since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Templating/Events/DelegatedBlockRenderingEvent.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Class Chill\\\\PersonBundle\\\\Actions\\\\ActionEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\:
|
||||
since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Actions/ActionEvent.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Call to deprecated method getCurrentAccompanyingPeriod\\(\\) of class Chill\\\\PersonBundle\\\\Entity\\\\Person\\:
|
||||
since 1\\.1 use `getOpenedAccompanyingPeriod instead$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\:
|
||||
since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Class Chill\\\\PersonBundle\\\\Controller\\\\AccompanyingCourseController extends deprecated class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\Controller\\:
|
||||
since Symfony 4\\.2, use "Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController" instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Call to deprecated method getCurrentAccompanyingPeriod\\(\\) of class Chill\\\\PersonBundle\\\\Entity\\\\Person\\:
|
||||
since 1\\.1 use `getOpenedAccompanyingPeriod instead$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Class Chill\\\\PersonBundle\\\\Controller\\\\PersonDuplicateController extends deprecated class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\Controller\\:
|
||||
since Symfony 4\\.2, use "Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController" instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php
|
||||
|
||||
-
|
||||
message: "#^Access to deprecated property \\$proxyAccompanyingPeriodOpenState of class Chill\\\\PersonBundle\\\\Entity\\\\Person\\.$#"
|
||||
count: 2
|
||||
path: src/Bundle/ChillPersonBundle/Entity/Person.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\PersonBundle\\\\Export\\\\Aggregator\\\\AgeAggregator\\:\\:addRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Aggregator/AgeAggregator.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\PersonBundle\\\\Export\\\\Aggregator\\\\CountryOfBirthAggregator\\:\\:addRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Aggregator/CountryOfBirthAggregator.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\PersonBundle\\\\Export\\\\Aggregator\\\\GenderAggregator\\:\\:addRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Aggregator/GenderAggregator.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\PersonBundle\\\\Export\\\\Aggregator\\\\NationalityAggregator\\:\\:addRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Aggregator/NationalityAggregator.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\PersonBundle\\\\Export\\\\Export\\\\CountPerson\\:\\:requiredRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\PersonBundle\\\\Export\\\\Export\\\\ListPerson\\:\\:requiredRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Call to deprecated method execute\\(\\) of class Doctrine\\\\DBAL\\\\Statement\\:
|
||||
Statement\\:\\:execute\\(\\) is deprecated, use Statement\\:\\:executeQuery\\(\\) or executeStatement\\(\\) instead$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\PersonBundle\\\\Export\\\\Export\\\\ListPersonDuplicate\\:\\:requiredRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\PersonBundle\\\\Export\\\\Filter\\\\AccompanyingPeriodClosingFilter\\:\\:addRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodClosingFilter.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\PersonBundle\\\\Export\\\\Filter\\\\AccompanyingPeriodFilter\\:\\:addRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodFilter.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\PersonBundle\\\\Export\\\\Filter\\\\AccompanyingPeriodOpeningFilter\\:\\:addRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodOpeningFilter.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\PersonBundle\\\\Export\\\\Filter\\\\BirthdateFilter\\:\\:addRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Filter/BirthdateFilter.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\PersonBundle\\\\Export\\\\Filter\\\\GenderFilter\\:\\:addRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Filter/GenderFilter.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\PersonBundle\\\\Export\\\\Filter\\\\NationalityFilter\\:\\:addRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Filter/NationalityFilter.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Form/AccompanyingPeriodType.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Form/PersonType.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Form/Type/PickPersonType.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Class Chill\\\\PersonBundle\\\\Privacy\\\\AccompanyingPeriodPrivacyEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\:
|
||||
since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Class Chill\\\\PersonBundle\\\\Privacy\\\\PrivacyEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\:
|
||||
since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$centerResolverDispatcher of method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriodACLAwareRepository\\:\\:__construct\\(\\) has typehint with deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\:
|
||||
Use CenterResolverManager and its interface CenterResolverManagerInterface$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Widget/PersonListWidget.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Call to deprecated method getReachableScopes\\(\\) of class Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AuthorizationHelper\\:
|
||||
Use getReachableCircles$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillReportBundle/Controller/ReportController.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 3
|
||||
path: src/Bundle/ChillReportBundle/Controller/ReportController.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\ReportBundle\\\\Export\\\\Export\\\\ReportList\\:\\:requiredRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Return type of method Chill\\\\ReportBundle\\\\Export\\\\Filter\\\\ReportDateFilter\\:\\:addRole\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillReportBundle/Export/Filter/ReportDateFilter.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Call to deprecated method getReachableScopes\\(\\) of class Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AuthorizationHelper\\:
|
||||
Use getReachableCircles$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillReportBundle/Form/ReportType.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$role of method Chill\\\\ReportBundle\\\\Form\\\\ReportType\\:\\:appendScopeChoices\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillReportBundle/Form/ReportType.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Call to deprecated method getReachableScopes\\(\\) of class Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AuthorizationHelper\\:
|
||||
Use getReachableCircles$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillReportBundle/Search/ReportSearch.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillReportBundle/Search/ReportSearch.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Call to deprecated method getReachableScopes\\(\\) of class Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AuthorizationHelper\\:
|
||||
Use getReachableCircles$#
|
||||
"""
|
||||
count: 2
|
||||
path: src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 2
|
||||
path: src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$centerResolverDispatcher of method Chill\\\\TaskBundle\\\\Controller\\\\SingleTaskController\\:\\:__construct\\(\\) has typehint with deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\:
|
||||
Use CenterResolverManager and its interface CenterResolverManagerInterface$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$role of method Chill\\\\TaskBundle\\\\Controller\\\\SingleTaskController\\:\\:setCreateForm\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Class Chill\\\\TaskBundle\\\\Event\\\\TaskEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\:
|
||||
since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillTaskBundle/Event/TaskEvent.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Class Chill\\\\TaskBundle\\\\Event\\\\UI\\\\UIEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\:
|
||||
since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillTaskBundle/Event/UI/UIEvent.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 4
|
||||
path: src/Bundle/ChillTaskBundle/Form/SingleTaskListType.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillTaskBundle/Form/SingleTaskType.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$centerResolverDispatcher of method Chill\\\\TaskBundle\\\\Form\\\\SingleTaskType\\:\\:__construct\\(\\) has typehint with deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\:
|
||||
Use CenterResolverManager and its interface CenterResolverManagerInterface$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillTaskBundle/Form/SingleTaskType.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Parameter \\$centerResolverDispatcher of method Chill\\\\TaskBundle\\\\Repository\\\\SingleTaskAclAwareRepository\\:\\:__construct\\(\\) has typehint with deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\:
|
||||
Use CenterResolverManager and its interface CenterResolverManagerInterface$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Class Chill\\\\TaskBundle\\\\Security\\\\Authorization\\\\AuthorizationEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\:
|
||||
since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 3
|
||||
path: src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php
|
||||
|
||||
-
|
||||
message: """
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php
|
||||
|
@@ -1,447 +0,0 @@
|
||||
parameters:
|
||||
ignoreErrors:
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Entity/ActivityReason.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\ActivityBundle\\\\Export\\\\Export\\\\StatActivityDuration\\:\\:getDescription\\(\\) should return string but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\ActivityBundle\\\\Export\\\\Export\\\\StatActivityDuration\\:\\:getTitle\\(\\) should return string but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillActivityBundle/Form/ActivityType.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
||||
count: 3
|
||||
path: src/Bundle/ChillBudgetBundle/Form/ChargeType.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
||||
count: 2
|
||||
path: src/Bundle/ChillBudgetBundle/Form/ResourceType.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/AbstractCustomField.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 4
|
||||
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldChoice\\:\\:buildForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\FormTypeInterface but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldDate\\:\\:buildForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\FormTypeInterface but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldLongChoice\\:\\:buildForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\FormTypeInterface but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldNumber\\:\\:buildForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\FormTypeInterface but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldText\\:\\:buildForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\FormTypeInterface but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldTitle\\:\\:buildForm\\(\\) should return Symfony\\\\Component\\\\Form\\\\FormTypeInterface but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillDocStoreBundle/Entity/DocumentCategory.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\EventBundle\\\\Entity\\\\Participation\\:\\:offsetGet\\(\\) should return mixed but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillEventBundle/Entity/Participation.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillEventBundle/Form/ChoiceLoader/EventChoiceLoader.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\$resolver of method Chill\\\\EventBundle\\\\Form\\\\EventTypeType\\:\\:setDefaultOptions\\(\\) has invalid type Symfony\\\\Component\\\\OptionsResolver\\\\OptionsResolverInterface\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillEventBundle/Form/EventTypeType.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\$resolver of method Chill\\\\EventBundle\\\\Form\\\\RoleType\\:\\:setDefaultOptions\\(\\) has invalid type Symfony\\\\Component\\\\OptionsResolver\\\\OptionsResolverInterface\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillEventBundle/Form/RoleType.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\$resolver of method Chill\\\\EventBundle\\\\Form\\\\StatusType\\:\\:setDefaultOptions\\(\\) has invalid type Symfony\\\\Component\\\\OptionsResolver\\\\OptionsResolverInterface\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillEventBundle/Form/StatusType.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 2
|
||||
path: src/Bundle/ChillEventBundle/Search/EventSearch.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\EventBundle\\\\Search\\\\EventSearch\\:\\:renderResult\\(\\) should return string but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillEventBundle/Search/EventSearch.php
|
||||
|
||||
-
|
||||
message: "#^Casting to string something that's already string\\.$#"
|
||||
count: 5
|
||||
path: src/Bundle/ChillFamilyMembersBundle/Entity/AbstractFamilyMember.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
||||
count: 2
|
||||
path: src/Bundle/ChillFamilyMembersBundle/Form/FamilyMemberType.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\$scope of method Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\CRUDController\\:\\:getReachableCenters\\(\\) has invalid type Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\Scope\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/CRUD/Resolver/Resolver.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\MainBundle\\\\CRUD\\\\Resolver\\\\Resolver\\:\\:getConfigValue\\(\\) should return string but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/CRUD/Resolver/Resolver.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\MainBundle\\\\Command\\\\ChillImportUsersCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\MainBundle\\\\Command\\\\ChillUserSendRenewPasswordCodeCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\MainBundle\\\\Command\\\\LoadAndUpdateLanguagesCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#"
|
||||
count: 2
|
||||
path: src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\MainBundle\\\\Command\\\\LoadCountriesCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\MainBundle\\\\Command\\\\LoadPostalCodesCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\MainBundle\\\\Command\\\\SetPasswordCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Controller/PasswordController.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Controller/PostalCodeController.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Entity/Address.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Entity/User.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in a ternary operator condition, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Form/ChoiceLoader/PostalCodeChoiceLoader.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Form/DataMapper/AddressDataMapper.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#"
|
||||
count: 2
|
||||
path: src/Bundle/ChillMainBundle/Form/Type/AddressType.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
||||
count: 2
|
||||
path: src/Bundle/ChillMainBundle/Form/Type/AddressType.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Form/Type/ChillTextareaType.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 3
|
||||
path: src/Bundle/ChillMainBundle/Form/Type/DataTransformer/DateIntervalTransformer.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 2
|
||||
path: src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Security/PasswordRecover/TokenManager.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\MainBundle\\\\Timeline\\\\TimelineBuilder\\:\\:getTemplateData\\(\\) should return array but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/CRUD/Controller/OneToOneEntityPersonCRUDController.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\PersonBundle\\\\Command\\\\ChillPersonMoveCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 6
|
||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Aggregator/CountryOfBirthAggregator.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Aggregator/NationalityAggregator.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 2
|
||||
path: src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in a ternary operator condition, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 3
|
||||
path: src/Bundle/ChillPersonBundle/Search/PersonSearch.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\PersonBundle\\\\Search\\\\PersonSearch\\:\\:renderResult\\(\\) should return string but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Search/PersonSearch.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 2
|
||||
path: src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\ReportBundle\\\\DataFixtures\\\\ORM\\\\LoadReports\\:\\:getRandomChoice\\(\\) should return array\\<string\\>\\|string but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 2
|
||||
path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\ReportBundle\\\\Security\\\\Authorization\\\\ReportVoter\\:\\:supports\\(\\) should return bool but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillReportBundle/Security/Authorization/ReportVoter.php
|
||||
|
||||
-
|
||||
message: "#^Casting to string something that's already string\\.$#"
|
||||
count: 3
|
||||
path: src/Bundle/ChillTaskBundle/Entity/AbstractTask.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
||||
count: 2
|
||||
path: src/Bundle/ChillTaskBundle/Form/SingleTaskListType.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 5
|
||||
path: src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\TaskBundle\\\\Timeline\\\\SingleTaskTaskLifeCycleEventTimelineProvider\\:\\:getTransitionByName\\(\\) should return Symfony\\\\Component\\\\Workflow\\\\Transition but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillTaskBundle/Timeline/SingleTaskTaskLifeCycleEventTimelineProvider.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\TaskBundle\\\\Timeline\\\\TaskLifeCycleEventTimelineProvider\\:\\:getTransitionByName\\(\\) should return Symfony\\\\Component\\\\Workflow\\\\Transition but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillThirdPartyBundle/Form/ChoiceLoader/ThirdPartyChoiceLoader.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\ThirdPartyBundle\\\\Search\\\\ThirdPartySearch\\:\\:renderResult\\(\\) should return string but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php
|
||||
|
@@ -1,27 +0,0 @@
|
||||
parameters:
|
||||
level: 1
|
||||
paths:
|
||||
- src/
|
||||
excludePaths:
|
||||
- .php_cs*
|
||||
- docs/
|
||||
- src/Bundle/*/Tests/*
|
||||
- src/Bundle/*/tests/*
|
||||
- src/Bundle/*/Test/*
|
||||
- src/Bundle/*/config/*
|
||||
- src/Bundle/*/migrations/*
|
||||
- src/Bundle/*/translations/*
|
||||
- src/Bundle/*/Resources/*
|
||||
- src/Bundle/*/src/Tests/*
|
||||
- src/Bundle/*/src/Test/*
|
||||
- src/Bundle/*/src/config/*
|
||||
- src/Bundle/*/src/migrations/*
|
||||
- src/Bundle/*/src/translations/*
|
||||
- src/Bundle/*/src/Resources/*
|
||||
|
||||
includes:
|
||||
- phpstan-baseline.neon
|
||||
- phpstan-critical.neon
|
||||
- phpstan-deprecations.neon
|
||||
- phpstan-types.neon
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="tests/app/vendor/phpunit/phpunit/phpunit.xsd"
|
||||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
colors="true"
|
||||
bootstrap="tests/app/tests/bootstrap.php"
|
||||
@@ -10,7 +10,7 @@
|
||||
<php>
|
||||
<ini name="error_reporting" value="-1" />
|
||||
<server name="APP_ENV" value="test" force="true" />
|
||||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
|
||||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
|
||||
<server name="SHELL_VERBOSITY" value="-1" />
|
||||
</php>
|
||||
|
||||
@@ -18,32 +18,12 @@
|
||||
<testsuite name="MainBundle">
|
||||
<directory suffix="Test.php">src/Bundle/ChillMainBundle/Tests/</directory>
|
||||
</testsuite>
|
||||
|
||||
<testsuite name="PersonBundle">
|
||||
<directory suffix="Test.php">src/Bundle/ChillPersonBundle/Tests/</directory>
|
||||
<!-- test for export will be runned later -->
|
||||
<exclude>src/Bundle/ChillPersonBundle/Tests/Export/*</exclude>
|
||||
<!-- we are rewriting accompanying periods... Work in progress -->
|
||||
<exclude>src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingPeriodControllerTest.php</exclude>
|
||||
<!-- we are rewriting address, Work in progress -->
|
||||
<exclude>src/Bundle/ChillPersonBundle/Tests/Controller/PersonAddressControllerTest.php</exclude>
|
||||
<!-- find a solution to create multiple configs -->
|
||||
<exclude>src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateWithHiddenFieldsTest.php</exclude>
|
||||
<!-- temporarily removed, the time to find a fix -->
|
||||
<exclude>src/Bundle/ChillPersonBundle/Tests/Controller/PersonDuplicateControllerViewTest.php</exclude>
|
||||
</testsuite>
|
||||
<testsuite name="AsideActivityBundle">
|
||||
<directory suffix="Test.php">src/Bundle/ChillAsideActivityBundle/src/Tests/</directory>
|
||||
</testsuite>
|
||||
<testsuite name="CalendarBundle">
|
||||
<directory suffix="Test.php">src/Bundle/ChillCalendarBundle/Tests/</directory>
|
||||
</testsuite>
|
||||
<testsuite name="DocGeneratorBundle">
|
||||
<directory suffix="Test.php">src/Bundle/ChillDocGeneratorBundle/tests/</directory>
|
||||
</testsuite>
|
||||
<testsuite name="WopiBundle">
|
||||
<directory suffix="Test.php">src/Bundle/ChillWopiBundle/tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
</testsuites>
|
||||
|
||||
<listeners>
|
||||
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
|
||||
|
1523
psalm-baseline.xml
1523
psalm-baseline.xml
File diff suppressed because it is too large
Load Diff
28
psalm.xml
28
psalm.xml
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<psalm
|
||||
errorLevel="7"
|
||||
resolveFromConfigFile="true"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="https://getpsalm.org/schema/config"
|
||||
xsi:schemaLocation="https://getpsalm.org/schema/config tests/app/vendor/vimeo/psalm/config.xsd"
|
||||
errorBaseline="psalm-baseline.xml"
|
||||
cacheDirectory="./.psalm"
|
||||
>
|
||||
<projectFiles>
|
||||
<directory name="src" />
|
||||
<ignoreFiles>
|
||||
<directory name="./tests/" />
|
||||
</ignoreFiles>
|
||||
</projectFiles>
|
||||
|
||||
<!-- suppress error around parameter bags - see https://github.com/symfony/symfony/issues/45609#issuecomment-1056816975 -->
|
||||
<!-- maybe to desactivate with php 8.1 ? -->
|
||||
<issueHandlers>
|
||||
<UndefinedDocblockClass>
|
||||
<errorLevel type="suppress">
|
||||
<referencedClass name="UnitEnum" />
|
||||
</errorLevel>
|
||||
</UndefinedDocblockClass>
|
||||
</issueHandlers>
|
||||
|
||||
</psalm>
|
@@ -1,5 +1,6 @@
|
||||
Chill is a software for social workers
|
||||
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.
|
||||
|
||||
@see https://www.champs-libres.coop/
|
||||
|
@@ -27,4 +27,3 @@ Version 1.5.5
|
||||
=============
|
||||
|
||||
- [activity] replace dropdown for selecting reasons and use chillEntity for reason rendering
|
||||
- fix bug: error when trying to edit activity of which the type has been deactivated
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
@@ -12,125 +14,132 @@ declare(strict_types=1);
|
||||
namespace Chill\ActivityBundle\Controller;
|
||||
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||
use Chill\ActivityBundle\Form\ActivityType;
|
||||
use Chill\ActivityBundle\Repository\ActivityACLAwareRepositoryInterface;
|
||||
use Chill\ActivityBundle\Repository\ActivityRepository;
|
||||
use Chill\ActivityBundle\Repository\ActivityTypeCategoryRepository;
|
||||
use Chill\ActivityBundle\Repository\ActivityTypeRepository;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
|
||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||
use Chill\MainBundle\Repository\LocationRepository;
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriodRepository;
|
||||
use Chill\PersonBundle\Repository\PersonRepository;
|
||||
use Chill\ThirdPartyBundle\Repository\ThirdPartyRepository;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use InvalidArgumentException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
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\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
use function array_key_exists;
|
||||
|
||||
final class ActivityController extends AbstractController
|
||||
class ActivityController extends AbstractController
|
||||
{
|
||||
private AccompanyingPeriodRepository $accompanyingPeriodRepository;
|
||||
/**
|
||||
* @var AuthorizationHelper
|
||||
*/
|
||||
protected $authorizationHelper;
|
||||
|
||||
private ActivityACLAwareRepositoryInterface $activityACLAwareRepository;
|
||||
/**
|
||||
* @var EventDispatcherInterface
|
||||
*/
|
||||
protected $eventDispatcher;
|
||||
|
||||
private ActivityRepository $activityRepository;
|
||||
|
||||
private ActivityTypeCategoryRepository $activityTypeCategoryRepository;
|
||||
|
||||
private ActivityTypeRepository $activityTypeRepository;
|
||||
|
||||
private CenterResolverManagerInterface $centerResolver;
|
||||
|
||||
private EntityManagerInterface $entityManager;
|
||||
|
||||
private EventDispatcherInterface $eventDispatcher;
|
||||
|
||||
private LocationRepository $locationRepository;
|
||||
|
||||
private LoggerInterface $logger;
|
||||
|
||||
private PersonRepository $personRepository;
|
||||
|
||||
private SerializerInterface $serializer;
|
||||
|
||||
private ThirdPartyRepository $thirdPartyRepository;
|
||||
/**
|
||||
* @var LoggerInterface
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* ActivityController constructor.
|
||||
*/
|
||||
public function __construct(
|
||||
ActivityACLAwareRepositoryInterface $activityACLAwareRepository,
|
||||
ActivityTypeRepository $activityTypeRepository,
|
||||
ActivityTypeCategoryRepository $activityTypeCategoryRepository,
|
||||
PersonRepository $personRepository,
|
||||
ThirdPartyRepository $thirdPartyRepository,
|
||||
LocationRepository $locationRepository,
|
||||
ActivityRepository $activityRepository,
|
||||
AccompanyingPeriodRepository $accompanyingPeriodRepository,
|
||||
EntityManagerInterface $entityManager,
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
LoggerInterface $logger,
|
||||
SerializerInterface $serializer,
|
||||
CenterResolverManagerInterface $centerResolver
|
||||
AuthorizationHelper $authorizationHelper,
|
||||
LoggerInterface $logger
|
||||
) {
|
||||
$this->activityACLAwareRepository = $activityACLAwareRepository;
|
||||
$this->activityTypeRepository = $activityTypeRepository;
|
||||
$this->activityTypeCategoryRepository = $activityTypeCategoryRepository;
|
||||
$this->personRepository = $personRepository;
|
||||
$this->thirdPartyRepository = $thirdPartyRepository;
|
||||
$this->locationRepository = $locationRepository;
|
||||
$this->activityRepository = $activityRepository;
|
||||
$this->accompanyingPeriodRepository = $accompanyingPeriodRepository;
|
||||
$this->entityManager = $entityManager;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->authorizationHelper = $authorizationHelper;
|
||||
$this->logger = $logger;
|
||||
$this->serializer = $serializer;
|
||||
$this->centerResolver = $centerResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Activity entity.
|
||||
*
|
||||
* @param mixed $person_id
|
||||
*/
|
||||
public function createAction($person_id, Request $request)
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
||||
|
||||
if (null === $person) {
|
||||
throw $this->createNotFoundException('person not found');
|
||||
}
|
||||
|
||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||
|
||||
$entity = new Activity();
|
||||
$entity->setPerson($person);
|
||||
$form = $this->createCreateForm($entity, $person);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isValid()) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$this->denyAccessUnlessGranted(
|
||||
'CHILL_ACTIVITY_CREATE',
|
||||
$entity,
|
||||
'creation of this activity not allowed'
|
||||
);
|
||||
|
||||
$em->persist($entity);
|
||||
$em->flush();
|
||||
|
||||
$this->get('session')
|
||||
->getFlashBag()
|
||||
->add(
|
||||
'success',
|
||||
$this->get('translator')
|
||||
->trans('Success : activity created!')
|
||||
);
|
||||
|
||||
return $this->redirect(
|
||||
$this->generateUrl(
|
||||
'chill_activity_activity_show',
|
||||
['id' => $entity->getId(), 'person_id' => $person_id]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$this->get('session')
|
||||
->getFlashBag()->add(
|
||||
'danger',
|
||||
$this->get('translator')
|
||||
->trans('The form is not valid. The activity has not been created !')
|
||||
);
|
||||
|
||||
return $this->render('ChillActivityBundle:Activity:new.html.twig', [
|
||||
'entity' => $entity,
|
||||
'form' => $form->createView(),
|
||||
'person' => $person,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a Activity entity.
|
||||
*
|
||||
* @param mixed $id
|
||||
* @param mixed $person_id
|
||||
*/
|
||||
public function deleteAction(Request $request, $id)
|
||||
public function deleteAction(Request $request, $id, $person_id)
|
||||
{
|
||||
$view = null;
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
||||
|
||||
$activity = $this->activityRepository->find($id);
|
||||
/** @var Activity $activity */
|
||||
$activity = $em->getRepository('ChillActivityBundle:Activity')
|
||||
->find($id);
|
||||
$person = $activity->getPerson();
|
||||
|
||||
if (!$activity) {
|
||||
throw $this->createNotFoundException('Unable to find Activity entity.');
|
||||
}
|
||||
|
||||
if ($activity->getAccompanyingPeriod() instanceof AccompanyingPeriod) {
|
||||
$view = 'ChillActivityBundle:Activity:confirm_deleteAccompanyingCourse.html.twig';
|
||||
$accompanyingPeriod = $activity->getAccompanyingPeriod();
|
||||
} else {
|
||||
$view = 'ChillActivityBundle:Activity:confirm_deletePerson.html.twig';
|
||||
}
|
||||
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_DELETE', $activity);
|
||||
|
||||
// TODO
|
||||
// $this->denyAccessUnlessGranted('CHILL_ACTIVITY_DELETE', $activity);
|
||||
|
||||
$form = $this->createDeleteForm($activity->getId(), $person, $accompanyingPeriod);
|
||||
$form = $this->createDeleteForm($id, $person);
|
||||
|
||||
if ($request->getMethod() === Request::METHOD_DELETE) {
|
||||
$form->handleRequest($request);
|
||||
@@ -139,507 +148,321 @@ final class ActivityController extends AbstractController
|
||||
$this->logger->notice('An activity has been removed', [
|
||||
'by_user' => $this->getUser()->getUsername(),
|
||||
'activity_id' => $activity->getId(),
|
||||
'person_id' => $activity->getPerson() ? $activity->getPerson()->getId() : null,
|
||||
'person_id' => $activity->getPerson()->getId(),
|
||||
'comment' => $activity->getComment()->getComment(),
|
||||
'scope_id' => $activity->getScope() ? $activity->getScope()->getId() : null,
|
||||
'scope_id' => $activity->getScope()->getId(),
|
||||
'reasons_ids' => $activity->getReasons()
|
||||
->map(
|
||||
static fn (ActivityReason $ar): int => $ar->getId()
|
||||
)
|
||||
->map(static function ($ar) {
|
||||
return $ar->getId();
|
||||
})
|
||||
->toArray(),
|
||||
'type_id' => $activity->getActivityType()->getId(),
|
||||
'duration' => $activity->getDurationTime() ? $activity->getDurationTime()->format('U') : null,
|
||||
'type_id' => $activity->getType()->getId(),
|
||||
'duration' => $activity->getDurationTime()->format('U'),
|
||||
'date' => $activity->getDate()->format('Y-m-d'),
|
||||
'attendee' => $activity->getAttendee(),
|
||||
]);
|
||||
|
||||
$this->entityManager->remove($activity);
|
||||
$this->entityManager->flush();
|
||||
$em->remove($activity);
|
||||
$em->flush();
|
||||
|
||||
$this->addFlash('success', $this->get('translator')
|
||||
->trans('The activity has been successfully removed.'));
|
||||
|
||||
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
||||
|
||||
return $this->redirectToRoute('chill_activity_activity_list', $params);
|
||||
return $this->redirect($this->generateUrl(
|
||||
'chill_activity_activity_list',
|
||||
[
|
||||
'person_id' => $person_id,
|
||||
]
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if (null === $view) {
|
||||
throw $this->createNotFoundException('Template not found');
|
||||
}
|
||||
|
||||
return $this->render($view, [
|
||||
return $this->render('ChillActivityBundle:Activity:confirm_delete.html.twig', [
|
||||
'activity' => $activity,
|
||||
'delete_form' => $form->createView(),
|
||||
'person' => $person,
|
||||
'accompanyingCourse' => $accompanyingPeriod,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a form to edit an existing Activity entity.
|
||||
*
|
||||
* @param mixed $person_id
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function editAction(int $id, Request $request): Response
|
||||
public function editAction($person_id, $id)
|
||||
{
|
||||
$view = null;
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
||||
|
||||
$entity = $this->activityRepository->find($id);
|
||||
if (!$person) {
|
||||
throw $this->createNotFoundException('person not found');
|
||||
}
|
||||
|
||||
if (null === $entity) {
|
||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||
|
||||
$entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
|
||||
|
||||
if (!$entity) {
|
||||
throw $this->createNotFoundException('Unable to find Activity entity.');
|
||||
}
|
||||
|
||||
$accompanyingPeriod = $entity->getAccompanyingPeriod();
|
||||
$person = $entity->getPerson();
|
||||
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_UPDATE', $entity);
|
||||
|
||||
if ($entity->getAccompanyingPeriod() instanceof AccompanyingPeriod) {
|
||||
$view = 'ChillActivityBundle:Activity:editAccompanyingCourse.html.twig';
|
||||
$accompanyingPeriod = $entity->getAccompanyingPeriod();
|
||||
} else {
|
||||
$view = 'ChillActivityBundle:Activity:editPerson.html.twig';
|
||||
}
|
||||
// TODO
|
||||
// $this->denyAccessUnlessGranted('CHILL_ACTIVITY_UPDATE', $entity);
|
||||
$editForm = $this->createEditForm($entity);
|
||||
$deleteForm = $this->createDeleteForm($id, $person);
|
||||
|
||||
$form = $this->createForm(ActivityType::class, $entity, [
|
||||
'center' => $this->centerResolver->resolveCenters($entity)[0] ?? null,
|
||||
'role' => new Role('CHILL_ACTIVITY_UPDATE'),
|
||||
'activityType' => $entity->getActivityType(),
|
||||
'accompanyingPeriod' => $accompanyingPeriod,
|
||||
]);
|
||||
|
||||
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()) {
|
||||
$this->entityManager->persist($entity);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
||||
$params['id'] = $entity->getId();
|
||||
|
||||
if ($form->has('gendocTemplateId') && null !== $form['gendocTemplateId']->getData()) {
|
||||
return $this->redirectToRoute(
|
||||
'chill_docgenerator_generate_from_template',
|
||||
[
|
||||
'template' => $form->get('gendocTemplateId')->getData(),
|
||||
'entityClassName' => Activity::class,
|
||||
'entityId' => $entity->getId(),
|
||||
'returnPath' => $this->generateUrl('chill_activity_activity_edit', $params),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$this->addFlash('success', $this->get('translator')->trans('Success : activity updated!'));
|
||||
|
||||
return $this->redirectToRoute('chill_activity_activity_show', $params);
|
||||
}
|
||||
|
||||
$deleteForm = $this->createDeleteForm($entity->getId(), $person, $accompanyingPeriod);
|
||||
|
||||
/*
|
||||
* TODO
|
||||
$event = new PrivacyEvent($person, array(
|
||||
$event = new PrivacyEvent($person, [
|
||||
'element_class' => Activity::class,
|
||||
'element_id' => $entity->getId(),
|
||||
'action' => 'edit'
|
||||
));
|
||||
'action' => 'edit',
|
||||
]);
|
||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||
*/
|
||||
|
||||
if (null === $view) {
|
||||
throw $this->createNotFoundException('Template not found');
|
||||
}
|
||||
|
||||
$activity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
|
||||
|
||||
return $this->render($view, [
|
||||
return $this->render('ChillActivityBundle:Activity:edit.html.twig', [
|
||||
'entity' => $entity,
|
||||
'edit_form' => $form->createView(),
|
||||
'edit_form' => $editForm->createView(),
|
||||
'delete_form' => $deleteForm->createView(),
|
||||
'person' => $person,
|
||||
'accompanyingCourse' => $accompanyingPeriod,
|
||||
'activity_json' => $activity_array,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all Activity entities.
|
||||
*
|
||||
* @param mixed $person_id
|
||||
*/
|
||||
public function listAction(Request $request): Response
|
||||
public function listAction($person_id, Request $request)
|
||||
{
|
||||
$view = null;
|
||||
$activities = [];
|
||||
// TODO: add pagination
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
||||
|
||||
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
||||
|
||||
if ($person instanceof Person) {
|
||||
$this->denyAccessUnlessGranted(ActivityVoter::SEE, $person);
|
||||
$activities = $this->activityACLAwareRepository
|
||||
->findByPerson($person, ActivityVoter::SEE, 0, null, ['date' => 'DESC', 'id' => 'DESC']);
|
||||
|
||||
$event = new PrivacyEvent($person, [
|
||||
'element_class' => Activity::class,
|
||||
'action' => 'list',
|
||||
]);
|
||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||
|
||||
$view = 'ChillActivityBundle:Activity:listPerson.html.twig';
|
||||
} elseif ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||
$this->denyAccessUnlessGranted(ActivityVoter::SEE, $accompanyingPeriod);
|
||||
|
||||
$activities = $this->activityACLAwareRepository
|
||||
->findByAccompanyingPeriod($accompanyingPeriod, ActivityVoter::SEE, 0, null, ['date' => 'DESC', 'id' => 'DESC']);
|
||||
|
||||
$view = 'ChillActivityBundle:Activity:listAccompanyingCourse.html.twig';
|
||||
if (null === $person) {
|
||||
throw $this->createNotFoundException('Person not found');
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
$view,
|
||||
[
|
||||
'activities' => $activities,
|
||||
'person' => $person,
|
||||
'accompanyingCourse' => $accompanyingPeriod,
|
||||
]
|
||||
);
|
||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||
|
||||
$reachableScopes = $this->authorizationHelper
|
||||
->getReachableScopes(
|
||||
$this->getUser(),
|
||||
new Role('CHILL_ACTIVITY_SEE'),
|
||||
$person->getCenter()
|
||||
);
|
||||
|
||||
$activities = $em->getRepository('ChillActivityBundle:Activity')
|
||||
->findBy(
|
||||
['person' => $person, 'scope' => $reachableScopes],
|
||||
['date' => 'DESC']
|
||||
);
|
||||
|
||||
$event = new PrivacyEvent($person, [
|
||||
'element_class' => Activity::class,
|
||||
'action' => 'list',
|
||||
]);
|
||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||
|
||||
return $this->render('ChillActivityBundle:Activity:list.html.twig', [
|
||||
'activities' => $activities,
|
||||
'person' => $person,
|
||||
]);
|
||||
}
|
||||
|
||||
public function newAction(Request $request): Response
|
||||
/**
|
||||
* Displays a form to create a new Activity entity.
|
||||
*
|
||||
* @param mixed $person_id
|
||||
*/
|
||||
public function newAction($person_id)
|
||||
{
|
||||
$view = null;
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
||||
|
||||
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
||||
|
||||
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||
$view = 'ChillActivityBundle:Activity:newAccompanyingCourse.html.twig';
|
||||
} elseif ($person instanceof Person) {
|
||||
$view = 'ChillActivityBundle:Activity:newPerson.html.twig';
|
||||
if (null === $person) {
|
||||
throw $this->createNotFoundException('Person not found');
|
||||
}
|
||||
|
||||
$activityType_id = $request->get('activityType_id', 0);
|
||||
$activityType = $this->activityTypeRepository->find($activityType_id);
|
||||
|
||||
if (isset($activityType) && !$activityType->isActive()) {
|
||||
throw new InvalidArgumentException('Activity type must be active');
|
||||
}
|
||||
|
||||
$activityData = null;
|
||||
|
||||
if ($request->query->has('activityData')) {
|
||||
$activityData = $request->query->get('activityData');
|
||||
}
|
||||
|
||||
if (
|
||||
!$activityType instanceof \Chill\ActivityBundle\Entity\ActivityType
|
||||
|| !$activityType->isActive()
|
||||
) {
|
||||
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
||||
|
||||
if (null !== $activityData) {
|
||||
$params['activityData'] = $activityData;
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('chill_activity_activity_select_type', $params);
|
||||
}
|
||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||
|
||||
$entity = new Activity();
|
||||
$entity->setUser($this->getUser());
|
||||
|
||||
if ($person instanceof Person) {
|
||||
$entity->setPerson($person);
|
||||
}
|
||||
|
||||
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||
$entity->setAccompanyingPeriod($accompanyingPeriod);
|
||||
}
|
||||
|
||||
$entity->setActivityType($activityType);
|
||||
$entity->setUser($this->get('security.token_storage')->getToken()->getUser());
|
||||
$entity->setPerson($person);
|
||||
$entity->setDate(new DateTime('now'));
|
||||
|
||||
if ($request->query->has('activityData')) {
|
||||
$activityData = $request->query->get('activityData');
|
||||
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_CREATE', $entity);
|
||||
|
||||
if (array_key_exists('durationTime', $activityData)) {
|
||||
$durationTimeInMinutes = $activityData['durationTime'];
|
||||
$hours = floor($durationTimeInMinutes / 60);
|
||||
$minutes = $durationTimeInMinutes % 60;
|
||||
$duration = DateTime::createFromFormat('H:i', $hours . ':' . $minutes);
|
||||
$form = $this->createCreateForm($entity, $person);
|
||||
|
||||
if ($duration) {
|
||||
$entity->setDurationTime($duration);
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists('date', $activityData)) {
|
||||
$date = DateTime::createFromFormat('Y-m-d', $activityData['date']);
|
||||
|
||||
if ($date) {
|
||||
$entity->setDate($date);
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists('personsId', $activityData)) {
|
||||
foreach ($activityData['personsId'] as $personId) {
|
||||
$concernedPerson = $this->personRepository->find($personId);
|
||||
$entity->addPerson($concernedPerson);
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists('professionalsId', $activityData)) {
|
||||
foreach ($activityData['professionalsId'] as $professionalsId) {
|
||||
$professional = $this->thirdPartyRepository->find($professionalsId);
|
||||
$entity->addThirdParty($professional);
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists('location', $activityData)) {
|
||||
$location = $this->locationRepository->find($activityData['location']);
|
||||
$entity->setLocation($location);
|
||||
}
|
||||
|
||||
if (array_key_exists('comment', $activityData)) {
|
||||
$comment = new CommentEmbeddable();
|
||||
$comment->setComment($activityData['comment']);
|
||||
$comment->setUserId($this->getUser()->getid());
|
||||
$comment->setDate(new DateTime('now'));
|
||||
$entity->setComment($comment);
|
||||
}
|
||||
}
|
||||
|
||||
$this->denyAccessUnlessGranted(ActivityVoter::CREATE, $entity);
|
||||
|
||||
$form = $this->createForm(ActivityType::class, $entity, [
|
||||
'center' => $this->centerResolver->resolveCenters($entity)[0] ?? null,
|
||||
'role' => new Role('CHILL_ACTIVITY_CREATE'),
|
||||
'activityType' => $entity->getActivityType(),
|
||||
'accompanyingPeriod' => $accompanyingPeriod,
|
||||
]);
|
||||
|
||||
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()) {
|
||||
$this->entityManager->persist($entity);
|
||||
$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(),
|
||||
'returnPath' => $this->generateUrl('chill_activity_activity_edit', [
|
||||
'id' => $entity->getId(),
|
||||
]),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$this->addFlash('success', $this->get('translator')->trans('Success : activity created!'));
|
||||
|
||||
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
||||
|
||||
$params['id'] = $entity->getId();
|
||||
|
||||
return $this->redirectToRoute('chill_activity_activity_show', $params);
|
||||
}
|
||||
|
||||
if (null === $view) {
|
||||
throw $this->createNotFoundException('Template not found');
|
||||
}
|
||||
|
||||
$activity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
|
||||
|
||||
$defaultLocation = $this->getUser()->getCurrentLocation();
|
||||
|
||||
return $this->render($view, [
|
||||
return $this->render('ChillActivityBundle:Activity:new.html.twig', [
|
||||
'person' => $person,
|
||||
'accompanyingCourse' => $accompanyingPeriod,
|
||||
'entity' => $entity,
|
||||
'form' => $form->createView(),
|
||||
'activity_json' => $activity_array,
|
||||
'default_location' => $defaultLocation,
|
||||
]);
|
||||
}
|
||||
|
||||
public function selectTypeAction(Request $request): Response
|
||||
/**
|
||||
* Finds and displays a Activity entity.
|
||||
*
|
||||
* @param mixed $person_id
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function showAction($person_id, $id)
|
||||
{
|
||||
$view = null;
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
||||
|
||||
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
||||
|
||||
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||
$view = 'ChillActivityBundle:Activity:selectTypeAccompanyingCourse.html.twig';
|
||||
} elseif ($person instanceof Person) {
|
||||
$view = 'ChillActivityBundle:Activity:selectTypePerson.html.twig';
|
||||
if (!$person) {
|
||||
throw $this->createNotFoundException('person not found');
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||
|
||||
$activityTypeCategories = $this
|
||||
->activityTypeCategoryRepository
|
||||
->findBy(['active' => true], ['ordering' => 'ASC']);
|
||||
$entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
|
||||
|
||||
foreach ($activityTypeCategories as $activityTypeCategory) {
|
||||
$activityTypes = $this
|
||||
->activityTypeRepository
|
||||
->findBy(
|
||||
['active' => true, 'category' => $activityTypeCategory],
|
||||
['ordering' => 'ASC']
|
||||
);
|
||||
|
||||
$data[] = [
|
||||
'activityTypeCategory' => $activityTypeCategory,
|
||||
'activityTypes' => $activityTypes,
|
||||
];
|
||||
}
|
||||
|
||||
if (null === $view) {
|
||||
throw $this->createNotFoundException('Template not found');
|
||||
}
|
||||
|
||||
return $this->render($view, [
|
||||
'person' => $person,
|
||||
'accompanyingCourse' => $accompanyingPeriod,
|
||||
'data' => $data,
|
||||
'activityData' => $request->query->get('activityData', []),
|
||||
]);
|
||||
}
|
||||
|
||||
public function showAction(Request $request, int $id): Response
|
||||
{
|
||||
$entity = $this->activityRepository->find($id);
|
||||
|
||||
if (null === $entity) {
|
||||
if (!$entity) {
|
||||
throw $this->createNotFoundException('Unable to find Activity entity.');
|
||||
}
|
||||
|
||||
$accompanyingPeriod = $entity->getAccompanyingPeriod();
|
||||
$person = $entity->getPerson();
|
||||
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_SEE', $entity);
|
||||
|
||||
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||
$view = 'ChillActivityBundle:Activity:showAccompanyingCourse.html.twig';
|
||||
} elseif ($person instanceof Person) {
|
||||
$view = 'ChillActivityBundle:Activity:showPerson.html.twig';
|
||||
} else {
|
||||
throw new RuntimeException('the activity should be linked with a period or person');
|
||||
}
|
||||
$deleteForm = $this->createDeleteForm($id, $person);
|
||||
|
||||
if (null !== $accompanyingPeriod) {
|
||||
// @TODO: Properties created dynamically.
|
||||
$entity->personsAssociated = $entity->getPersonsAssociated();
|
||||
$entity->personsNotAssociated = $entity->getPersonsNotAssociated();
|
||||
}
|
||||
|
||||
$this->denyAccessUnlessGranted(ActivityVoter::SEE, $entity);
|
||||
|
||||
$deleteForm = $this->createDeleteForm($entity->getId(), $person, $accompanyingPeriod);
|
||||
|
||||
// TODO
|
||||
/*
|
||||
$event = new PrivacyEvent($person, array(
|
||||
$event = new PrivacyEvent($person, [
|
||||
'element_class' => Activity::class,
|
||||
'element_id' => $entity->getId(),
|
||||
'action' => 'show'
|
||||
));
|
||||
'action' => 'show',
|
||||
]);
|
||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||
*/
|
||||
|
||||
if (null === $view) {
|
||||
throw $this->createNotFoundException('Template not found');
|
||||
}
|
||||
|
||||
return $this->render($view, [
|
||||
return $this->render('ChillActivityBundle:Activity:show.html.twig', [
|
||||
'person' => $person,
|
||||
'accompanyingCourse' => $accompanyingPeriod,
|
||||
'entity' => $entity,
|
||||
'delete_form' => $deleteForm->createView(),
|
||||
]);
|
||||
}
|
||||
|
||||
private function buildParamsToUrl(?Person $person, ?AccompanyingPeriod $accompanyingPeriod): array
|
||||
/**
|
||||
* Edits an existing Activity entity.
|
||||
*
|
||||
* @param mixed $person_id
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function updateAction(Request $request, $person_id, $id)
|
||||
{
|
||||
$params = [];
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
if (null !== $person) {
|
||||
$params['person_id'] = $person->getId();
|
||||
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
||||
$entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
|
||||
|
||||
if (!$entity) {
|
||||
throw $this->createNotFoundException('Unable to find Activity entity.');
|
||||
}
|
||||
|
||||
if (null !== $accompanyingPeriod) {
|
||||
$params['accompanying_period_id'] = $accompanyingPeriod->getId();
|
||||
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_UPDATE', $entity);
|
||||
|
||||
$deleteForm = $this->createDeleteForm($id, $person);
|
||||
$editForm = $this->createEditForm($entity);
|
||||
$editForm->handleRequest($request);
|
||||
|
||||
$event = new PrivacyEvent($person, [
|
||||
'element_class' => Activity::class,
|
||||
'element_id' => $entity->getId(),
|
||||
'action' => 'update',
|
||||
]);
|
||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||
|
||||
if ($editForm->isValid()) {
|
||||
$em->flush();
|
||||
|
||||
$this->get('session')
|
||||
->getFlashBag()
|
||||
->add(
|
||||
'success',
|
||||
$this->get('translator')
|
||||
->trans('Success : activity updated!')
|
||||
);
|
||||
|
||||
return $this->redirect($this->generateUrl('chill_activity_activity_show', ['id' => $id, 'person_id' => $person_id]));
|
||||
}
|
||||
|
||||
return $params;
|
||||
$this->get('session')
|
||||
->getFlashBag()
|
||||
->add(
|
||||
'error',
|
||||
$this->get('translator')
|
||||
->trans('This form contains errors')
|
||||
);
|
||||
|
||||
return $this->render('ChillActivityBundle:Activity:edit.html.twig', [
|
||||
'person' => $entity->getPerson(),
|
||||
'entity' => $entity,
|
||||
'edit_form' => $editForm->createView(),
|
||||
'delete_form' => $deleteForm->createView(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a form to create a Activity entity.
|
||||
*
|
||||
* @param Activity $entity The entity
|
||||
*
|
||||
* @return \Symfony\Component\Form\Form The form
|
||||
*/
|
||||
private function createCreateForm(Activity $entity)
|
||||
{
|
||||
return $this->createForm(
|
||||
ActivityType::class,
|
||||
$entity,
|
||||
[
|
||||
'action' => $this->generateUrl('chill_activity_activity_create', [
|
||||
'person_id' => $entity->getPerson()->getId(),
|
||||
]),
|
||||
'method' => 'POST',
|
||||
'center' => $entity->getCenter(),
|
||||
'role' => new Role('CHILL_ACTIVITY_CREATE'),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a form to delete a Activity entity by id.
|
||||
*
|
||||
* @param mixed $id The entity id
|
||||
* @param mixed $person
|
||||
*
|
||||
* @return \Symfony\Component\Form\Form The form
|
||||
*/
|
||||
private function createDeleteForm(int $id, ?Person $person, ?AccompanyingPeriod $accompanyingPeriod): FormInterface
|
||||
private function createDeleteForm($id, $person)
|
||||
{
|
||||
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
||||
$params['id'] = $id;
|
||||
|
||||
return $this->createFormBuilder()
|
||||
->setAction($this->generateUrl('chill_activity_activity_delete', $params))
|
||||
->setAction($this->generateUrl(
|
||||
'chill_activity_activity_delete',
|
||||
['id' => $id, 'person_id' => $person->getId()]
|
||||
))
|
||||
->setMethod('DELETE')
|
||||
->add('submit', SubmitType::class, ['label' => 'Delete'])
|
||||
->getForm();
|
||||
}
|
||||
|
||||
private function getEntity(Request $request): array
|
||||
/**
|
||||
* Creates a form to edit a Activity entity.
|
||||
*
|
||||
* @param Activity $entity The entity
|
||||
*
|
||||
* @return \Symfony\Component\Form\Form The form
|
||||
*/
|
||||
private function createEditForm(Activity $entity)
|
||||
{
|
||||
$person = $accompanyingPeriod = null;
|
||||
|
||||
if ($request->query->has('person_id')) {
|
||||
$person_id = $request->get('person_id');
|
||||
$person = $this->personRepository->find($person_id);
|
||||
|
||||
if (null === $person) {
|
||||
throw $this->createNotFoundException('Person not found');
|
||||
}
|
||||
|
||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||
} elseif ($request->query->has('accompanying_period_id')) {
|
||||
$accompanying_period_id = $request->get('accompanying_period_id');
|
||||
$accompanyingPeriod = $this->accompanyingPeriodRepository->find($accompanying_period_id);
|
||||
|
||||
if (null === $accompanyingPeriod) {
|
||||
throw $this->createNotFoundException('Accompanying Period not found');
|
||||
}
|
||||
|
||||
// TODO Add permission
|
||||
// $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||
} else {
|
||||
throw $this->createNotFoundException('Person or Accompanying Period not found');
|
||||
}
|
||||
|
||||
return [
|
||||
$person,
|
||||
$accompanyingPeriod,
|
||||
];
|
||||
return $this->createForm(ActivityType::class, $entity, [
|
||||
'action' => $this->generateUrl(
|
||||
'chill_activity_activity_update',
|
||||
[
|
||||
'id' => $entity->getId(),
|
||||
'person_id' => $entity->getPerson()->getId(),
|
||||
]
|
||||
),
|
||||
'method' => 'PUT',
|
||||
'center' => $entity->getCenter(),
|
||||
'role' => new Role('CHILL_ACTIVITY_UPDATE'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
@@ -17,9 +19,6 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* ActivityReasonCategory controller.
|
||||
*/
|
||||
class ActivityReasonCategoryController extends AbstractController
|
||||
{
|
||||
/**
|
||||
@@ -54,7 +53,7 @@ class ActivityReasonCategoryController extends AbstractController
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$entity = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReasonCategory::class)->find($id);
|
||||
$entity = $em->getRepository('ChillActivityBundle:ActivityReasonCategory')->find($id);
|
||||
|
||||
if (!$entity) {
|
||||
throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.');
|
||||
@@ -75,7 +74,7 @@ class ActivityReasonCategoryController extends AbstractController
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$entities = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReasonCategory::class)->findAll();
|
||||
$entities = $em->getRepository('ChillActivityBundle:ActivityReasonCategory')->findAll();
|
||||
|
||||
return $this->render('ChillActivityBundle:ActivityReasonCategory:index.html.twig', [
|
||||
'entities' => $entities,
|
||||
@@ -105,7 +104,7 @@ class ActivityReasonCategoryController extends AbstractController
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$entity = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReasonCategory::class)->find($id);
|
||||
$entity = $em->getRepository('ChillActivityBundle:ActivityReasonCategory')->find($id);
|
||||
|
||||
if (!$entity) {
|
||||
throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.');
|
||||
@@ -125,7 +124,7 @@ class ActivityReasonCategoryController extends AbstractController
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$entity = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReasonCategory::class)->find($id);
|
||||
$entity = $em->getRepository('ChillActivityBundle:ActivityReasonCategory')->find($id);
|
||||
|
||||
if (!$entity) {
|
||||
throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.');
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
@@ -17,9 +19,6 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* ActivityReason controller.
|
||||
*/
|
||||
class ActivityReasonController extends AbstractController
|
||||
{
|
||||
/**
|
||||
@@ -54,7 +53,7 @@ class ActivityReasonController extends AbstractController
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$entity = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReason::class)->find($id);
|
||||
$entity = $em->getRepository('ChillActivityBundle:ActivityReason')->find($id);
|
||||
|
||||
if (!$entity) {
|
||||
throw $this->createNotFoundException('Unable to find ActivityReason entity.');
|
||||
@@ -75,7 +74,7 @@ class ActivityReasonController extends AbstractController
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$entities = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReason::class)->findAll();
|
||||
$entities = $em->getRepository('ChillActivityBundle:ActivityReason')->findAll();
|
||||
|
||||
return $this->render('ChillActivityBundle:ActivityReason:index.html.twig', [
|
||||
'entities' => $entities,
|
||||
@@ -105,7 +104,7 @@ class ActivityReasonController extends AbstractController
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$entity = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReason::class)->find($id);
|
||||
$entity = $em->getRepository('ChillActivityBundle:ActivityReason')->find($id);
|
||||
|
||||
if (!$entity) {
|
||||
throw $this->createNotFoundException('Unable to find ActivityReason entity.');
|
||||
@@ -125,7 +124,7 @@ class ActivityReasonController extends AbstractController
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$entity = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReason::class)->find($id);
|
||||
$entity = $em->getRepository('ChillActivityBundle:ActivityReason')->find($id);
|
||||
|
||||
if (!$entity) {
|
||||
throw $this->createNotFoundException('Unable to find ActivityReason entity.');
|
||||
|
@@ -0,0 +1,185 @@
|
||||
<?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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Controller;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityType;
|
||||
use Chill\ActivityBundle\Form\ActivityTypeType;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class ActivityTypeController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* Creates a new ActivityType entity.
|
||||
*/
|
||||
public function createAction(Request $request)
|
||||
{
|
||||
$entity = new ActivityType();
|
||||
$form = $this->createCreateForm($entity);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isValid()) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist($entity);
|
||||
$em->flush();
|
||||
|
||||
return $this->redirect($this->generateUrl('chill_activity_activitytype_show', ['id' => $entity->getId()]));
|
||||
}
|
||||
|
||||
return $this->render('ChillActivityBundle:ActivityType:new.html.twig', [
|
||||
'entity' => $entity,
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a form to edit an existing ActivityType entity.
|
||||
*
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function editAction($id)
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$entity = $em->getRepository('ChillActivityBundle:ActivityType')->find($id);
|
||||
|
||||
if (!$entity) {
|
||||
throw $this->createNotFoundException('Unable to find ActivityType entity.');
|
||||
}
|
||||
|
||||
$editForm = $this->createEditForm($entity);
|
||||
|
||||
return $this->render('ChillActivityBundle:ActivityType:edit.html.twig', [
|
||||
'entity' => $entity,
|
||||
'edit_form' => $editForm->createView(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all ActivityType entities.
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$entities = $em->getRepository('ChillActivityBundle:ActivityType')->findAll();
|
||||
|
||||
return $this->render('ChillActivityBundle:ActivityType:index.html.twig', [
|
||||
'entities' => $entities,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a form to create a new ActivityType entity.
|
||||
*/
|
||||
public function newAction()
|
||||
{
|
||||
$entity = new ActivityType();
|
||||
$form = $this->createCreateForm($entity);
|
||||
|
||||
return $this->render('ChillActivityBundle:ActivityType:new.html.twig', [
|
||||
'entity' => $entity,
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds and displays a ActivityType entity.
|
||||
*
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function showAction($id)
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$entity = $em->getRepository('ChillActivityBundle:ActivityType')->find($id);
|
||||
|
||||
if (!$entity) {
|
||||
throw $this->createNotFoundException('Unable to find ActivityType entity.');
|
||||
}
|
||||
|
||||
return $this->render('ChillActivityBundle:ActivityType:show.html.twig', [
|
||||
'entity' => $entity,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits an existing ActivityType entity.
|
||||
*
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function updateAction(Request $request, $id)
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$entity = $em->getRepository('ChillActivityBundle:ActivityType')->find($id);
|
||||
|
||||
if (!$entity) {
|
||||
throw $this->createNotFoundException('Unable to find ActivityType entity.');
|
||||
}
|
||||
|
||||
$editForm = $this->createEditForm($entity);
|
||||
$editForm->handleRequest($request);
|
||||
|
||||
if ($editForm->isValid()) {
|
||||
$em->flush();
|
||||
|
||||
return $this->redirect($this->generateUrl('chill_activity_activitytype_edit', ['id' => $id]));
|
||||
}
|
||||
|
||||
return $this->render('ChillActivityBundle:ActivityType:edit.html.twig', [
|
||||
'entity' => $entity,
|
||||
'edit_form' => $editForm->createView(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a form to create a ActivityType entity.
|
||||
*
|
||||
* @param ActivityType $entity The entity
|
||||
*
|
||||
* @return \Symfony\Component\Form\Form The form
|
||||
*/
|
||||
private function createCreateForm(ActivityType $entity)
|
||||
{
|
||||
$form = $this->createForm(ActivityTypeType::class, $entity, [
|
||||
'action' => $this->generateUrl('chill_activity_activitytype_create'),
|
||||
'method' => 'POST',
|
||||
]);
|
||||
|
||||
$form->add('submit', SubmitType::class, ['label' => 'Create']);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a form to edit a ActivityType entity.
|
||||
*
|
||||
* @param ActivityType $entity The entity
|
||||
*
|
||||
* @return \Symfony\Component\Form\Form The form
|
||||
*/
|
||||
private function createEditForm(ActivityType $entity)
|
||||
{
|
||||
$form = $this->createForm(ActivityTypeType::class, $entity, [
|
||||
'action' => $this->generateUrl('chill_activity_activitytype_update', ['id' => $entity->getId()]),
|
||||
'method' => 'PUT',
|
||||
]);
|
||||
|
||||
$form->add('submit', SubmitType::class, ['label' => 'Update']);
|
||||
|
||||
return $form;
|
||||
}
|
||||
}
|
@@ -1,30 +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\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class AdminActivityPresenceController extends CRUDController
|
||||
{
|
||||
/**
|
||||
* @param \Doctrine\ORM\QueryBuilder|mixed $query
|
||||
*
|
||||
* @return \Doctrine\ORM\QueryBuilder|mixed
|
||||
*/
|
||||
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
|
||||
{
|
||||
/** @var \Doctrine\ORM\QueryBuilder $query */
|
||||
return $query->orderBy('e.id', 'ASC');
|
||||
}
|
||||
}
|
@@ -1,30 +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\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class AdminActivityTypeCategoryController extends CRUDController
|
||||
{
|
||||
/**
|
||||
* @param \Doctrine\ORM\QueryBuilder|mixed $query
|
||||
*
|
||||
* @return \Doctrine\ORM\QueryBuilder|mixed
|
||||
*/
|
||||
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
|
||||
{
|
||||
/** @var \Doctrine\ORM\QueryBuilder $query */
|
||||
return $query->orderBy('e.ordering', 'ASC');
|
||||
}
|
||||
}
|
@@ -1,31 +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\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class AdminActivityTypeController extends CRUDController
|
||||
{
|
||||
/**
|
||||
* @param \Doctrine\ORM\QueryBuilder|mixed $query
|
||||
*
|
||||
* @return \Doctrine\ORM\QueryBuilder|mixed
|
||||
*/
|
||||
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
|
||||
{
|
||||
/** @var \Doctrine\ORM\QueryBuilder $query */
|
||||
return $query->orderBy('e.ordering', 'ASC')
|
||||
->addOrderBy('e.id', 'ASC');
|
||||
}
|
||||
}
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
@@ -14,28 +16,29 @@ namespace Chill\ActivityBundle\DataFixtures\ORM;
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\MainBundle\DataFixtures\ORM\LoadScopes;
|
||||
use Chill\MainBundle\DataFixtures\ORM\LoadUsers;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Faker\Factory as FakerFactory;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||
|
||||
class LoadActivity extends AbstractFixture implements OrderedFixtureInterface
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
* Load reports into DB.
|
||||
*/
|
||||
class LoadActivity extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface
|
||||
{
|
||||
use \Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
||||
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
/**
|
||||
* @var \Faker\Generator
|
||||
*/
|
||||
private $faker;
|
||||
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
public function __construct()
|
||||
{
|
||||
$this->faker = FakerFactory::create('fr_FR');
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
public function getOrder()
|
||||
@@ -45,25 +48,23 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface
|
||||
|
||||
public function load(ObjectManager $manager)
|
||||
{
|
||||
$persons = $this->em
|
||||
->getRepository(Person::class)
|
||||
$persons = $this->container->get('doctrine.orm.entity_manager')
|
||||
->getRepository('ChillPersonBundle:Person')
|
||||
->findAll();
|
||||
|
||||
foreach ($persons as $person) {
|
||||
$activityNbr = mt_rand(0, 3);
|
||||
|
||||
for ($i = 0; $i < $activityNbr; ++$i) {
|
||||
echo 'Creating an activity type for : ' . $person . "\n";
|
||||
$activity = $this->newRandomActivity($person);
|
||||
|
||||
if (null !== $activity) {
|
||||
$manager->persist($activity);
|
||||
}
|
||||
$manager->persist($activity);
|
||||
}
|
||||
}
|
||||
$manager->flush();
|
||||
}
|
||||
|
||||
public function newRandomActivity($person): ?Activity
|
||||
public function newRandomActivity($person)
|
||||
{
|
||||
$activity = (new Activity())
|
||||
->setUser($this->getRandomUser())
|
||||
@@ -71,18 +72,15 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface
|
||||
->setDate($this->faker->dateTimeThisYear())
|
||||
->setDurationTime($this->faker->dateTime(36000))
|
||||
->setType($this->getRandomActivityType())
|
||||
->setScope($this->getRandomScope());
|
||||
->setScope($this->getRandomScope())
|
||||
->setAttendee($this->faker->boolean());
|
||||
|
||||
// ->setAttendee($this->faker->boolean())
|
||||
$usedId = [];
|
||||
|
||||
for ($i = 0; mt_rand(0, 4) > $i; ++$i) {
|
||||
$reason = $this->getRandomActivityReason();
|
||||
|
||||
if (null !== $reason) {
|
||||
$activity->addReason($reason);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
$reason = $this->getRandomActivityReason($usedId);
|
||||
$usedId[] = $reason->getId();
|
||||
$activity->addReason($reason);
|
||||
}
|
||||
|
||||
return $activity;
|
||||
@@ -93,10 +91,15 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface
|
||||
*
|
||||
* @return \Chill\ActivityBundle\Entity\ActivityReason
|
||||
*/
|
||||
private function getRandomActivityReason()
|
||||
private function getRandomActivityReason(array $excludingIds)
|
||||
{
|
||||
$reasonRef = LoadActivityReason::$references[array_rand(LoadActivityReason::$references)];
|
||||
|
||||
if (in_array($this->getReference($reasonRef)->getId(), $excludingIds, true)) {
|
||||
// we have a reason which should be excluded. Find another...
|
||||
return $this->getRandomActivityReason($excludingIds);
|
||||
}
|
||||
|
||||
return $this->getReference($reasonRef);
|
||||
}
|
||||
|
||||
|
@@ -1,47 +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\DataFixtures\ORM;
|
||||
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\MainBundle\DataFixtures\ORM\LoadAbstractNotificationsTrait;
|
||||
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
||||
|
||||
/**
|
||||
* Load notififications into database.
|
||||
*/
|
||||
class LoadActivityNotifications extends AbstractFixture implements DependentFixtureInterface
|
||||
{
|
||||
use LoadAbstractNotificationsTrait;
|
||||
|
||||
public $notifs = [
|
||||
[
|
||||
'message' => 'Hello !',
|
||||
'entityClass' => Activity::class,
|
||||
'entityRef' => 'activity_gerard depardieu',
|
||||
'sender' => 'center a_social',
|
||||
'addressees' => [
|
||||
'center a_social',
|
||||
'center a_administrative',
|
||||
'center a_direction',
|
||||
'multi_center',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
public function getDependencies()
|
||||
{
|
||||
return [
|
||||
LoadActivity::class,
|
||||
];
|
||||
}
|
||||
}
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
@@ -12,14 +14,14 @@ declare(strict_types=1);
|
||||
namespace Chill\ActivityBundle\DataFixtures\ORM;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityType;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
|
||||
/**
|
||||
* Description of LoadActivityType.
|
||||
*/
|
||||
class LoadActivityType extends Fixture implements OrderedFixtureInterface
|
||||
class LoadActivityType extends AbstractFixture implements OrderedFixtureInterface
|
||||
{
|
||||
public static $references = [];
|
||||
|
||||
@@ -31,37 +33,17 @@ class LoadActivityType extends Fixture implements OrderedFixtureInterface
|
||||
public function load(ObjectManager $manager)
|
||||
{
|
||||
$types = [
|
||||
// Exange
|
||||
[
|
||||
'name' => ['fr' => 'Entretien physique avec l\'usager'],
|
||||
'category' => 'exchange', ],
|
||||
[
|
||||
'name' => ['fr' => 'Appel téléphonique', 'en' => 'Telephone call', 'nl' => 'Telefoon appel'],
|
||||
'category' => 'exchange', ],
|
||||
[
|
||||
'name' => ['fr' => 'Courriel', 'en' => 'Email', 'nl' => 'Email'],
|
||||
'category' => 'exchange', ],
|
||||
// Meeting
|
||||
[
|
||||
'name' => ['fr' => 'Point technique encadrant'],
|
||||
'category' => 'meeting', ],
|
||||
[
|
||||
'name' => ['fr' => 'Réunion avec des partenaires'],
|
||||
'category' => 'meeting', ],
|
||||
[
|
||||
'name' => ['fr' => 'Commission pluridisciplinaire et pluri-institutionnelle'],
|
||||
'category' => 'meeting', ],
|
||||
['name' => ['fr' => 'Appel téléphonique', 'en' => 'Telephone call', 'nl' => 'Telefoon appel']],
|
||||
['name' => ['fr' => 'Entretien', 'en' => 'Interview', 'nl' => 'Vraaggesprek']],
|
||||
['name' => ['fr' => 'Inspection', 'en' => 'Inspection', 'nl' => 'Inspectie']],
|
||||
];
|
||||
|
||||
foreach ($types as $t) {
|
||||
echo 'Creating activity type : ' . $t['name']['fr'] . ' (cat:' . $t['category'] . " \n";
|
||||
echo 'Creating activity type : ' . $t['name']['en'] . "\n";
|
||||
$activityType = (new ActivityType())
|
||||
->setName(($t['name']))
|
||||
->setCategory($this->getReference('activity_type_cat_' . $t['category']))
|
||||
->setSocialIssuesVisible(1)
|
||||
->setSocialActionsVisible(1);
|
||||
->setName(($t['name']));
|
||||
$manager->persist($activityType);
|
||||
$reference = 'activity_type_' . $t['name']['fr'];
|
||||
$reference = 'activity_type_' . $t['name']['en'];
|
||||
$this->addReference($reference, $activityType);
|
||||
static::$references[] = $reference;
|
||||
}
|
||||
|
@@ -1,59 +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\DataFixtures\ORM;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityTypeCategory;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
|
||||
/**
|
||||
* Fixtures for ActivityTypeCategory.
|
||||
*/
|
||||
class LoadActivityTypeCategory extends Fixture implements OrderedFixtureInterface
|
||||
{
|
||||
public static $references = [];
|
||||
|
||||
public function getOrder()
|
||||
{
|
||||
return 16050;
|
||||
}
|
||||
|
||||
public function load(ObjectManager $manager)
|
||||
{
|
||||
$categories = [
|
||||
[
|
||||
'name' => ['fr' => 'Échange avec usager', 'en' => 'Exchange with user'],
|
||||
'ref' => 'exchange',
|
||||
],
|
||||
[
|
||||
'name' => ['fr' => 'Réunion', 'en' => 'Meeting'],
|
||||
'ref' => 'meeting',
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($categories as $cat) {
|
||||
echo 'Creating activity type category : ' . $cat['ref'] . "\n";
|
||||
|
||||
$newCat = (new ActivityTypeCategory())
|
||||
->setName(($cat['name']));
|
||||
|
||||
$manager->persist($newCat);
|
||||
$reference = 'activity_type_cat_' . $cat['ref'];
|
||||
|
||||
$this->addReference($reference, $newCat);
|
||||
static::$references[] = $reference;
|
||||
}
|
||||
|
||||
$manager->flush();
|
||||
}
|
||||
}
|
@@ -1,18 +1,17 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\DataFixtures\ORM;
|
||||
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
|
||||
use Chill\MainBundle\DataFixtures\ORM\LoadPermissionsGroup;
|
||||
use Chill\MainBundle\DataFixtures\ORM\LoadScopes;
|
||||
use Chill\MainBundle\Entity\RoleScope;
|
||||
@@ -22,10 +21,8 @@ use Doctrine\Persistence\ObjectManager;
|
||||
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
* Add a role CHILL_ACTIVITY_UPDATE & CHILL_ACTIVITY_CREATE for all groups except administrative,
|
||||
* and a role CHILL_ACTIVITY_SEE for administrative.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
class LoadActivitytACL extends AbstractFixture implements OrderedFixtureInterface
|
||||
{
|
||||
public function getOrder()
|
||||
@@ -48,7 +45,6 @@ class LoadActivitytACL extends AbstractFixture implements OrderedFixtureInterfac
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'administrative':
|
||||
case 'direction':
|
||||
if (in_array($scope->getName()['en'], ['administrative', 'social'], true)) {
|
||||
@@ -69,10 +65,7 @@ class LoadActivitytACL extends AbstractFixture implements OrderedFixtureInterfac
|
||||
->setScope($scope);
|
||||
$permissionsGroup->addRoleScope($roleScopeUpdate);
|
||||
$roleScopeCreate = (new RoleScope())
|
||||
->setRole(ActivityVoter::CREATE_ACCOMPANYING_COURSE)
|
||||
->setScope($scope);
|
||||
$roleScopeCreate = (new RoleScope())
|
||||
->setRole(ActivityVoter::CREATE_PERSON)
|
||||
->setRole('CHILL_ACTIVITY_CREATE')
|
||||
->setScope($scope);
|
||||
$permissionsGroup->addRoleScope($roleScopeCreate);
|
||||
$roleScopeDelete = (new RoleScope())
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
@@ -25,6 +27,9 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
*/
|
||||
class ChillActivityExtension extends Extension implements PrependExtensionInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$configuration = new Configuration();
|
||||
@@ -37,18 +42,16 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
|
||||
$loader->load('services/export.yaml');
|
||||
$loader->load('services/repositories.yaml');
|
||||
$loader->load('services/fixtures.yaml');
|
||||
$loader->load('services/menu.yaml');
|
||||
$loader->load('services/controller.yaml');
|
||||
$loader->load('services/form.yaml');
|
||||
$loader->load('services/templating.yaml');
|
||||
$loader->load('services/accompanyingPeriodConsistency.yaml');
|
||||
$loader->load('services/doctrine.entitylistener.yaml');
|
||||
}
|
||||
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
$this->prependRoutes($container);
|
||||
$this->prependAuthorization($container);
|
||||
$this->prependCruds($container);
|
||||
}
|
||||
|
||||
public function prependAuthorization(ContainerBuilder $container)
|
||||
@@ -56,14 +59,9 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
|
||||
$container->prependExtensionConfig('security', [
|
||||
'role_hierarchy' => [
|
||||
ActivityVoter::UPDATE => [ActivityVoter::SEE_DETAILS],
|
||||
ActivityVoter::CREATE_PERSON => [ActivityVoter::SEE_DETAILS],
|
||||
ActivityVoter::CREATE_ACCOMPANYING_COURSE => [ActivityVoter::SEE_DETAILS],
|
||||
ActivityVoter::CREATE => [ActivityVoter::SEE_DETAILS],
|
||||
ActivityVoter::DELETE => [ActivityVoter::SEE_DETAILS],
|
||||
ActivityVoter::SEE_DETAILS => [ActivityVoter::SEE],
|
||||
ActivityVoter::FULL => [
|
||||
ActivityVoter::DELETE,
|
||||
ActivityVoter::UPDATE,
|
||||
],
|
||||
],
|
||||
]);
|
||||
}
|
||||
@@ -82,75 +80,4 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
protected function prependCruds(ContainerBuilder $container)
|
||||
{
|
||||
$container->prependExtensionConfig('chill_main', [
|
||||
'cruds' => [
|
||||
[
|
||||
'class' => \Chill\ActivityBundle\Entity\ActivityType::class,
|
||||
'name' => 'activity_type',
|
||||
'base_path' => '/admin/activity/type',
|
||||
'form_class' => \Chill\ActivityBundle\Form\ActivityTypeType::class,
|
||||
'controller' => \Chill\ActivityBundle\Controller\AdminActivityTypeController::class,
|
||||
'actions' => [
|
||||
'index' => [
|
||||
'template' => '@ChillActivity/ActivityType/index.html.twig',
|
||||
'role' => 'ROLE_ADMIN',
|
||||
],
|
||||
'new' => [
|
||||
'role' => 'ROLE_ADMIN',
|
||||
'template' => '@ChillActivity/ActivityType/new.html.twig',
|
||||
],
|
||||
'edit' => [
|
||||
'role' => 'ROLE_ADMIN',
|
||||
'template' => '@ChillActivity/ActivityType/edit.html.twig',
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'class' => \Chill\ActivityBundle\Entity\ActivityTypeCategory::class,
|
||||
'name' => 'activity_type_category',
|
||||
'base_path' => '/admin/activity/type_category',
|
||||
'form_class' => \Chill\ActivityBundle\Form\ActivityTypeCategoryType::class,
|
||||
'controller' => \Chill\ActivityBundle\Controller\AdminActivityTypeCategoryController::class,
|
||||
'actions' => [
|
||||
'index' => [
|
||||
'template' => '@ChillActivity/ActivityTypeCategory/index.html.twig',
|
||||
'role' => 'ROLE_ADMIN',
|
||||
],
|
||||
'new' => [
|
||||
'role' => 'ROLE_ADMIN',
|
||||
'template' => '@ChillActivity/ActivityTypeCategory/new.html.twig',
|
||||
],
|
||||
'edit' => [
|
||||
'role' => 'ROLE_ADMIN',
|
||||
'template' => '@ChillActivity/ActivityTypeCategory/edit.html.twig',
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'class' => \Chill\ActivityBundle\Entity\ActivityPresence::class,
|
||||
'name' => 'activity_presence',
|
||||
'base_path' => '/admin/activity/presence',
|
||||
'form_class' => \Chill\ActivityBundle\Form\ActivityPresenceType::class,
|
||||
'controller' => \Chill\ActivityBundle\Controller\AdminActivityPresenceController::class,
|
||||
'actions' => [
|
||||
'index' => [
|
||||
'template' => '@ChillActivity/ActivityPresence/index.html.twig',
|
||||
'role' => 'ROLE_ADMIN',
|
||||
],
|
||||
'new' => [
|
||||
'role' => 'ROLE_ADMIN',
|
||||
'template' => '@ChillActivity/ActivityPresence/new.html.twig',
|
||||
],
|
||||
'edit' => [
|
||||
'role' => 'ROLE_ADMIN',
|
||||
'template' => '@ChillActivity/ActivityPresence/edit.html.twig',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
@@ -23,6 +25,9 @@ use function is_int;
|
||||
*/
|
||||
class Configuration implements ConfigurationInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getConfigTreeBuilder()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder('chill_activity');
|
||||
|
@@ -1,303 +1,131 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Entity;
|
||||
|
||||
use Chill\ActivityBundle\Validator\Constraints as ActivityValidator;
|
||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||
use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable;
|
||||
use Chill\MainBundle\Entity\HasCentersInterface;
|
||||
use Chill\MainBundle\Entity\HasScopesInterface;
|
||||
use Chill\MainBundle\Entity\Location;
|
||||
use Chill\MainBundle\Entity\HasCenterInterface;
|
||||
use Chill\MainBundle\Entity\HasScopeInterface;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency;
|
||||
use Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodLinkedWithSocialIssuesEntityInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use DateTime;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Serializer\Annotation\SerializedName;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* Class Activity.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="Chill\ActivityBundle\Repository\ActivityRepository")
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="activity")
|
||||
* @ORM\HasLifecycleCallbacks
|
||||
* @DiscriminatorMap(typeProperty="type", mapping={
|
||||
* "activity": Activity::class
|
||||
* })
|
||||
* @ActivityValidator\ActivityValidity
|
||||
*
|
||||
* TODO see if necessary
|
||||
* UserCircleConsistency(
|
||||
* @UserCircleConsistency(
|
||||
* "CHILL_ACTIVITY_SEE_DETAILS",
|
||||
* getUserFunction="getUser",
|
||||
* path="scope")
|
||||
*/
|
||||
class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, HasCentersInterface, HasScopesInterface
|
||||
class Activity implements HasCenterInterface, HasScopeInterface
|
||||
{
|
||||
public const SENTRECEIVED_RECEIVED = 'received';
|
||||
|
||||
public const SENTRECEIVED_SENT = 'sent';
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod")
|
||||
* @Groups({"read"})
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
private ?AccompanyingPeriod $accompanyingPeriod = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
|
||||
* @Groups({"read", "docgen:read"})
|
||||
* @SerializedName("activityType")
|
||||
* @ORM\JoinColumn(name="type_id")
|
||||
*/
|
||||
private ActivityType $activityType;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityPresence")
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
private ?ActivityPresence $attendee = null;
|
||||
private $attendee;
|
||||
|
||||
/**
|
||||
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
private CommentEmbeddable $comment;
|
||||
private $comment;
|
||||
|
||||
/**
|
||||
* @var DateTime
|
||||
* @ORM\Column(type="datetime")
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
private DateTime $date;
|
||||
private $date;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject", cascade={"persist"})
|
||||
* @Assert\Valid(traverse=true)
|
||||
* @var DateTime
|
||||
* @ORM\Column(type="time")
|
||||
*/
|
||||
private Collection $documents;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="time", nullable=true)
|
||||
*/
|
||||
private ?DateTime $durationTime = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean", options={"default": false})
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
private bool $emergency = false;
|
||||
private $durationTime;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location")
|
||||
* @groups({"read", "docgen:read"})
|
||||
*/
|
||||
private ?Location $location = null;
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var Person
|
||||
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
|
||||
*/
|
||||
private ?Person $person = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private ?Collection $persons = null;
|
||||
|
||||
/**
|
||||
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_")
|
||||
*/
|
||||
private PrivateCommentEmbeddable $privateComment;
|
||||
private $person;
|
||||
|
||||
/**
|
||||
* @var ActivityReason
|
||||
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
private Collection $reasons;
|
||||
private $reasons;
|
||||
|
||||
/**
|
||||
* @var Scope
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
private ?Scope $scope = null;
|
||||
private $scope;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", options={"default": ""})
|
||||
* @Groups({"docgen:read"})
|
||||
* @var ActivityType
|
||||
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
|
||||
*/
|
||||
private string $sentReceived = '';
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction")
|
||||
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction")
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private Collection $socialActions;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialIssue")
|
||||
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue")
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private Collection $socialIssues;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private ?Collection $thirdParties = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="time", nullable=true)
|
||||
*/
|
||||
private ?DateTime $travelTime = null;
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @var User
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
private User $user;
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User")
|
||||
* @Groups({"read", "docgen:read"})
|
||||
* Activity constructor.
|
||||
*/
|
||||
private ?Collection $users = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->reasons = new ArrayCollection();
|
||||
$this->comment = new CommentEmbeddable();
|
||||
$this->privateComment = new PrivateCommentEmbeddable();
|
||||
$this->persons = new ArrayCollection();
|
||||
$this->thirdParties = new ArrayCollection();
|
||||
$this->documents = new ArrayCollection();
|
||||
$this->users = new ArrayCollection();
|
||||
$this->socialIssues = new ArrayCollection();
|
||||
$this->socialActions = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function addDocument(StoredObject $document): self
|
||||
/**
|
||||
* Add a reason.
|
||||
*
|
||||
* @return Activity
|
||||
*/
|
||||
public function addReason(ActivityReason $reason)
|
||||
{
|
||||
$this->documents[] = $document;
|
||||
$this->reasons[] = $reason;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a person to the person list.
|
||||
* Get attendee.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function addPerson(?Person $person): self
|
||||
{
|
||||
if (null !== $person) {
|
||||
if (!$this->persons->contains($person)) {
|
||||
$this->persons[] = $person;
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addReason(ActivityReason $reason): self
|
||||
{
|
||||
$this->reasons->add($reason);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addSocialAction(SocialAction $socialAction): self
|
||||
{
|
||||
if (!$this->socialActions->contains($socialAction)) {
|
||||
$this->socialActions[] = $socialAction;
|
||||
$this->ensureSocialActionConsistency();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a social issue.
|
||||
*
|
||||
* Note: the social issue consistency (the fact that only yougest social issues
|
||||
* are kept) is processed by an entity listener:
|
||||
*
|
||||
* @see{\Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodSocialIssueConsistencyEntityListener}
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addSocialIssue(SocialIssue $socialIssue): self
|
||||
{
|
||||
if (!$this->socialIssues->contains($socialIssue)) {
|
||||
$this->socialIssues[] = $socialIssue;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addThirdParty(?ThirdParty $thirdParty): self
|
||||
{
|
||||
if (null !== $thirdParty) {
|
||||
if (!$this->thirdParties->contains($thirdParty)) {
|
||||
$this->thirdParties[] = $thirdParty;
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addUser(?User $user): self
|
||||
{
|
||||
if (null !== $user) {
|
||||
if (!$this->users->contains($user)) {
|
||||
$this->users[] = $user;
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAccompanyingPeriod(): ?AccompanyingPeriod
|
||||
{
|
||||
return $this->accompanyingPeriod;
|
||||
}
|
||||
|
||||
public function getActivityType(): ActivityType
|
||||
{
|
||||
return $this->activityType;
|
||||
}
|
||||
|
||||
public function getAttendee(): ?ActivityPresence
|
||||
public function getAttendee()
|
||||
{
|
||||
return $this->attendee;
|
||||
}
|
||||
@@ -305,388 +133,202 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
||||
/**
|
||||
* get the center
|
||||
* center is extracted from person.
|
||||
*
|
||||
* @return Center
|
||||
*/
|
||||
public function getCenters(): iterable
|
||||
public function getCenter()
|
||||
{
|
||||
if ($this->person instanceof Person) {
|
||||
return [$this->person->getCenter()];
|
||||
}
|
||||
|
||||
if ($this->getAccompanyingPeriod() instanceof AccompanyingPeriod) {
|
||||
return $this->getAccompanyingPeriod()->getCenters() ?? [];
|
||||
}
|
||||
|
||||
return [];
|
||||
return $this->person->getCenter();
|
||||
}
|
||||
|
||||
public function getComment(): CommentEmbeddable
|
||||
/**
|
||||
* @return \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable
|
||||
*/
|
||||
public function getComment()
|
||||
{
|
||||
return $this->comment;
|
||||
}
|
||||
|
||||
public function getDate(): DateTime
|
||||
/**
|
||||
* Get date.
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getDate()
|
||||
{
|
||||
return $this->date;
|
||||
}
|
||||
|
||||
public function getDocuments(): Collection
|
||||
{
|
||||
return $this->documents;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Groups({"docgen:read"})
|
||||
* Get durationTime.
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
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()
|
||||
{
|
||||
return $this->durationTime;
|
||||
}
|
||||
|
||||
public function getEmergency(): bool
|
||||
{
|
||||
return $this->emergency;
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
/**
|
||||
* Get id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getLocation(): ?Location
|
||||
{
|
||||
return $this->location;
|
||||
}
|
||||
|
||||
public function getPerson(): ?Person
|
||||
/**
|
||||
* Get person.
|
||||
*
|
||||
* @return Person
|
||||
*/
|
||||
public function getPerson()
|
||||
{
|
||||
return $this->person;
|
||||
}
|
||||
|
||||
public function getPersons(): Collection
|
||||
{
|
||||
return $this->persons;
|
||||
}
|
||||
|
||||
public function getPersonsAssociated(): array
|
||||
{
|
||||
if (null !== $this->accompanyingPeriod) {
|
||||
$personsAssociated = [];
|
||||
|
||||
foreach ($this->accompanyingPeriod->getOpenParticipations() as $participation) {
|
||||
if ($this->persons->contains($participation->getPerson())) {
|
||||
$personsAssociated[] = $participation->getPerson();
|
||||
}
|
||||
}
|
||||
|
||||
return $personsAssociated;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getPersonsNotAssociated(): array
|
||||
{
|
||||
if (null !== $this->accompanyingPeriod) {
|
||||
$personsNotAssociated = [];
|
||||
|
||||
// TODO better semantic with: return $this->persons->filter(...);
|
||||
foreach ($this->persons as $person) {
|
||||
if ($this->accompanyingPeriod->getOpenParticipationContainsPerson($person) === null) {
|
||||
$personsNotAssociated[] = $person;
|
||||
}
|
||||
}
|
||||
|
||||
return $personsNotAssociated;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getPrivateComment(): PrivateCommentEmbeddable
|
||||
{
|
||||
return $this->privateComment;
|
||||
}
|
||||
|
||||
public function getReasons(): Collection
|
||||
/**
|
||||
* Get reasons.
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getReasons()
|
||||
{
|
||||
return $this->reasons;
|
||||
}
|
||||
|
||||
public function getScope(): ?Scope
|
||||
/**
|
||||
* Get scope.
|
||||
*
|
||||
* @return Scope
|
||||
*/
|
||||
public function getScope()
|
||||
{
|
||||
return $this->scope;
|
||||
}
|
||||
|
||||
public function getScopes(): iterable
|
||||
/**
|
||||
* Get type.
|
||||
*
|
||||
* @return ActivityType
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
if (null !== $this->getAccompanyingPeriod()) {
|
||||
return $this->getAccompanyingPeriod()->getScopes();
|
||||
}
|
||||
|
||||
if (null !== $this->getPerson()) {
|
||||
return [$this->scope];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getSentReceived(): string
|
||||
{
|
||||
return $this->sentReceived;
|
||||
}
|
||||
|
||||
public function getSocialActions(): Collection
|
||||
{
|
||||
return $this->socialActions;
|
||||
}
|
||||
|
||||
public function getSocialIssues(): Collection
|
||||
{
|
||||
return $this->socialIssues;
|
||||
}
|
||||
|
||||
public function getThirdParties(): Collection
|
||||
{
|
||||
return $this->thirdParties;
|
||||
}
|
||||
|
||||
public function getTravelTime(): ?DateTime
|
||||
{
|
||||
return $this->travelTime;
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Groups({"docgen:read"})
|
||||
* Get user.
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function getTravelTimeMinute(): int
|
||||
{
|
||||
if (null === $this->travelTime) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (int) round(($this->travelTime->getTimestamp() + $this->travelTime->getOffset()) / 60.0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public function getType(): ActivityType
|
||||
{
|
||||
return $this->activityType;
|
||||
}
|
||||
|
||||
public function getUser(): User
|
||||
public function getUser()
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function getUsers(): Collection
|
||||
{
|
||||
return $this->users;
|
||||
}
|
||||
|
||||
public function isEmergency(): bool
|
||||
{
|
||||
return $this->getEmergency();
|
||||
}
|
||||
|
||||
public function removeDocument(StoredObject $document): void
|
||||
{
|
||||
$this->documents->removeElement($document);
|
||||
}
|
||||
|
||||
public function removePerson(Person $person): void
|
||||
{
|
||||
$this->persons->removeElement($person);
|
||||
}
|
||||
|
||||
public function removeReason(ActivityReason $reason): void
|
||||
public function removeReason(ActivityReason $reason)
|
||||
{
|
||||
$this->reasons->removeElement($reason);
|
||||
}
|
||||
|
||||
public function removeSocialAction(SocialAction $socialAction): self
|
||||
{
|
||||
$this->socialActions->removeElement($socialAction);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeSocialIssue(SocialIssue $socialIssue): self
|
||||
{
|
||||
$this->socialIssues->removeElement($socialIssue);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeThirdParty(ThirdParty $thirdParty): void
|
||||
{
|
||||
$this->thirdParties->removeElement($thirdParty);
|
||||
}
|
||||
|
||||
public function removeUser(User $user): void
|
||||
{
|
||||
$this->users->removeElement($user);
|
||||
}
|
||||
|
||||
public function setAccompanyingPeriod(?AccompanyingPeriod $accompanyingPeriod): self
|
||||
{
|
||||
$this->accompanyingPeriod = $accompanyingPeriod;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setActivityType(ActivityType $activityType): self
|
||||
{
|
||||
$this->activityType = $activityType;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setAttendee(ActivityPresence $attendee): self
|
||||
/**
|
||||
* Set attendee.
|
||||
*
|
||||
* @param bool $attendee
|
||||
*
|
||||
* @return Activity
|
||||
*/
|
||||
public function setAttendee($attendee)
|
||||
{
|
||||
$this->attendee = $attendee;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setComment(CommentEmbeddable $comment): self
|
||||
/**
|
||||
* @param \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable $comment
|
||||
*/
|
||||
public function setComment($comment)
|
||||
{
|
||||
$this->comment = $comment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDate(DateTime $date): self
|
||||
/**
|
||||
* Set date.
|
||||
*
|
||||
* @param DateTime $date
|
||||
*
|
||||
* @return Activity
|
||||
*/
|
||||
public function setDate($date)
|
||||
{
|
||||
$this->date = $date;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDocuments(Collection $documents): self
|
||||
{
|
||||
$this->documents = $documents;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDurationTime(?DateTime $durationTime): self
|
||||
/**
|
||||
* Set durationTime.
|
||||
*
|
||||
* @param DateTime $durationTime
|
||||
*
|
||||
* @return Activity
|
||||
*/
|
||||
public function setDurationTime($durationTime)
|
||||
{
|
||||
$this->durationTime = $durationTime;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setEmergency(bool $emergency): self
|
||||
{
|
||||
$this->emergency = $emergency;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setLocation(?Location $location): Activity
|
||||
{
|
||||
$this->location = $location;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setPerson(?Person $person): self
|
||||
/**
|
||||
* Set person.
|
||||
*
|
||||
* @return Activity
|
||||
*/
|
||||
public function setPerson(Person $person)
|
||||
{
|
||||
$this->person = $person;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setPersons(?Collection $persons): self
|
||||
{
|
||||
$this->persons = $persons;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setPrivateComment(PrivateCommentEmbeddable $privateComment): self
|
||||
{
|
||||
$this->privateComment = $privateComment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setReasons(?ArrayCollection $reasons): self
|
||||
{
|
||||
$this->reasons = $reasons;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setScope(Scope $scope): self
|
||||
/**
|
||||
* Set scope.
|
||||
*
|
||||
* @return Activity
|
||||
*/
|
||||
public function setScope(Scope $scope)
|
||||
{
|
||||
$this->scope = $scope;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setSentReceived(?string $sentReceived): self
|
||||
/**
|
||||
* Set type.
|
||||
*
|
||||
* @return Activity
|
||||
*/
|
||||
public function setType(ActivityType $type)
|
||||
{
|
||||
$this->sentReceived = (string) $sentReceived;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setThirdParties(?Collection $thirdParties): self
|
||||
{
|
||||
$this->thirdParties = $thirdParties;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setTravelTime(DateTime $travelTime): self
|
||||
{
|
||||
$this->travelTime = $travelTime;
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Set user.
|
||||
*
|
||||
* @return Activity
|
||||
*/
|
||||
public function setType(ActivityType $activityType): self
|
||||
{
|
||||
$this->activityType = $activityType;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setUser(UserInterface $user): self
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setUsers(?Collection $users): self
|
||||
{
|
||||
$this->users = $users;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function ensureSocialActionConsistency(): void
|
||||
{
|
||||
$ancestors = SocialAction::findAncestorSocialActions($this->getSocialActions());
|
||||
|
||||
foreach ($ancestors as $ancestor) {
|
||||
$this->removeSocialAction($ancestor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,91 +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\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
|
||||
/**
|
||||
* Class ActivityPresence.
|
||||
*
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="activitytpresence")
|
||||
* @ORM\HasLifecycleCallbacks
|
||||
*/
|
||||
class ActivityPresence
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
private bool $active = true;
|
||||
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @Serializer\Groups({"docgen:read"})
|
||||
*/
|
||||
private ?int $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json")
|
||||
* @Serializer\Groups({"docgen:read"})
|
||||
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
|
||||
*/
|
||||
private array $name = [];
|
||||
|
||||
/**
|
||||
* Get active
|
||||
* return true if the category type is active.
|
||||
*/
|
||||
public function getActive(): bool
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
public function getId(): int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getName(): array
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is active
|
||||
* return true if the category type is active.
|
||||
*/
|
||||
public function isActive(): bool
|
||||
{
|
||||
return $this->getActive();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set active
|
||||
* set to true if the category type is active.
|
||||
*/
|
||||
public function setActive(bool $active): self
|
||||
{
|
||||
$this->active = $active;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setName(array $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
@@ -14,8 +16,6 @@ namespace Chill\ActivityBundle\Entity;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Class ActivityReason.
|
||||
*
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="activityreason")
|
||||
* @ORM\HasLifecycleCallbacks
|
||||
@@ -47,7 +47,7 @@ class ActivityReason
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @ORM\Column(type="json")
|
||||
* @ORM\Column(type="json_array")
|
||||
*/
|
||||
private $name;
|
||||
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
@@ -15,8 +17,6 @@ use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Class ActivityReasonCategory.
|
||||
*
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="activityreasoncategory")
|
||||
* @ORM\HasLifecycleCallbacks
|
||||
@@ -40,7 +40,7 @@ class ActivityReasonCategory
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @ORM\Column(type="json")
|
||||
* @ORM\Column(type="json_array")
|
||||
*/
|
||||
private $name;
|
||||
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
@@ -12,825 +14,119 @@ declare(strict_types=1);
|
||||
namespace Chill\ActivityBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use InvalidArgumentException;
|
||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
/**
|
||||
* Class ActivityType.
|
||||
*
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="activitytype")
|
||||
* @ORM\HasLifecycleCallbacks
|
||||
*/
|
||||
class ActivityType
|
||||
{
|
||||
public const FIELD_INVISIBLE = 0;
|
||||
|
||||
public const FIELD_OPTIONAL = 1;
|
||||
|
||||
public const FIELD_REQUIRED = 2;
|
||||
|
||||
/**
|
||||
* @deprecated not in use
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $accompanyingPeriodLabel = '';
|
||||
|
||||
/**
|
||||
* @deprecated not in use
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||
*/
|
||||
private int $accompanyingPeriodVisible = self::FIELD_INVISIBLE;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
private bool $active = true;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $attendeeLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||
*/
|
||||
private int $attendeeVisible = self::FIELD_OPTIONAL;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityTypeCategory")
|
||||
*/
|
||||
private ?ActivityTypeCategory $category = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $commentLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||
*/
|
||||
private int $commentVisible = self::FIELD_OPTIONAL;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $dateLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 2})
|
||||
*/
|
||||
private int $dateVisible = self::FIELD_REQUIRED;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $documentsLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||
*/
|
||||
private int $documentsVisible = self::FIELD_OPTIONAL;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $durationTimeLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||
*/
|
||||
private int $durationTimeVisible = self::FIELD_OPTIONAL;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $emergencyLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||
*/
|
||||
private int $emergencyVisible = self::FIELD_INVISIBLE;
|
||||
private $active = true;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
private ?int $id;
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
* @var array
|
||||
* @ORM\Column(type="json_array")
|
||||
*/
|
||||
private string $locationLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||
*/
|
||||
private int $locationVisible = self::FIELD_INVISIBLE;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json")
|
||||
* @Groups({"read", "docgen:read"})
|
||||
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
|
||||
*/
|
||||
private array $name = [];
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="float", options={"default": "0.0"})
|
||||
*/
|
||||
private float $ordering = 0.0;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $personLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $personsLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
private int $personsVisible = self::FIELD_OPTIONAL;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 2})
|
||||
*/
|
||||
private int $personVisible = self::FIELD_REQUIRED;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $privateCommentLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||
*/
|
||||
private int $privateCommentVisible = self::FIELD_OPTIONAL;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $reasonsLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||
*/
|
||||
private int $reasonsVisible = self::FIELD_OPTIONAL;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $sentReceivedLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||
*/
|
||||
private int $sentReceivedVisible = self::FIELD_OPTIONAL;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $socialActionsLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||
*/
|
||||
private int $socialActionsVisible = self::FIELD_INVISIBLE;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @deprecated not in use
|
||||
*/
|
||||
private string $socialDataLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||
*
|
||||
* @deprecated not in use
|
||||
*/
|
||||
private int $socialDataVisible = self::FIELD_INVISIBLE;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $socialIssuesLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||
*/
|
||||
private int $socialIssuesVisible = self::FIELD_INVISIBLE;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $thirdPartiesLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
private int $thirdPartiesVisible = self::FIELD_INVISIBLE;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $travelTimeLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||
*/
|
||||
private int $travelTimeVisible = self::FIELD_OPTIONAL;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $userLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $usersLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
private int $usersVisible = self::FIELD_OPTIONAL;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 2})
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* Get active
|
||||
* return true if the type is active.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getActive(): bool
|
||||
public function getActive()
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
public function getAttendeeLabel(): string
|
||||
{
|
||||
return $this->attendeeLabel;
|
||||
}
|
||||
|
||||
public function getAttendeeVisible(): int
|
||||
{
|
||||
return $this->attendeeVisible;
|
||||
}
|
||||
|
||||
public function getCategory(): ?ActivityTypeCategory
|
||||
{
|
||||
return $this->category;
|
||||
}
|
||||
|
||||
public function getCommentLabel(): string
|
||||
{
|
||||
return $this->commentLabel;
|
||||
}
|
||||
|
||||
public function getCommentVisible(): int
|
||||
{
|
||||
return $this->commentVisible;
|
||||
}
|
||||
|
||||
public function getDateLabel(): string
|
||||
{
|
||||
return $this->dateLabel;
|
||||
}
|
||||
|
||||
public function getDateVisible(): int
|
||||
{
|
||||
return $this->dateVisible;
|
||||
}
|
||||
|
||||
public function getDocumentsLabel(): string
|
||||
{
|
||||
return $this->documentsLabel;
|
||||
}
|
||||
|
||||
public function getDocumentsVisible(): int
|
||||
{
|
||||
return $this->documentsVisible;
|
||||
}
|
||||
|
||||
public function getDurationTimeLabel(): string
|
||||
{
|
||||
return $this->durationTimeLabel;
|
||||
}
|
||||
|
||||
public function getDurationTimeVisible(): int
|
||||
{
|
||||
return $this->durationTimeVisible;
|
||||
}
|
||||
|
||||
public function getEmergencyLabel(): string
|
||||
{
|
||||
return $this->emergencyLabel;
|
||||
}
|
||||
|
||||
public function getEmergencyVisible(): int
|
||||
{
|
||||
return $this->emergencyVisible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId(): int
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getLabel(string $field): ?string
|
||||
{
|
||||
$property = $field . 'Label';
|
||||
|
||||
if (!property_exists($this, $property)) {
|
||||
throw new InvalidArgumentException('Field "' . $field . '" not found');
|
||||
}
|
||||
|
||||
return $this->{$property};
|
||||
}
|
||||
|
||||
public function getLocationLabel(): ?string
|
||||
{
|
||||
return $this->locationLabel;
|
||||
}
|
||||
|
||||
public function getLocationVisible(): ?int
|
||||
{
|
||||
return $this->locationVisible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name.
|
||||
*
|
||||
* @param mixed|null $locale
|
||||
*
|
||||
* @return array | string
|
||||
*/
|
||||
public function getName(): array
|
||||
public function getName($locale = null)
|
||||
{
|
||||
if ($locale) {
|
||||
if (isset($this->name[$locale])) {
|
||||
return $this->name[$locale];
|
||||
}
|
||||
|
||||
foreach ($this->name as $name) {
|
||||
if (!empty($name)) {
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getOrdering(): float
|
||||
{
|
||||
return $this->ordering;
|
||||
}
|
||||
|
||||
public function getPersonLabel(): string
|
||||
{
|
||||
return $this->personLabel;
|
||||
}
|
||||
|
||||
public function getPersonsLabel(): string
|
||||
{
|
||||
return $this->personsLabel;
|
||||
}
|
||||
|
||||
public function getPersonsVisible(): int
|
||||
{
|
||||
return $this->personsVisible;
|
||||
}
|
||||
|
||||
public function getPersonVisible(): int
|
||||
{
|
||||
return $this->personVisible;
|
||||
}
|
||||
|
||||
public function getPrivateCommentLabel(): string
|
||||
{
|
||||
return $this->privateCommentLabel;
|
||||
}
|
||||
|
||||
public function getPrivateCommentVisible(): int
|
||||
{
|
||||
return $this->privateCommentVisible;
|
||||
}
|
||||
|
||||
public function getReasonsLabel(): string
|
||||
{
|
||||
return $this->reasonsLabel;
|
||||
}
|
||||
|
||||
public function getReasonsVisible(): int
|
||||
{
|
||||
return $this->reasonsVisible;
|
||||
}
|
||||
|
||||
public function getSentReceivedLabel(): string
|
||||
{
|
||||
return $this->sentReceivedLabel;
|
||||
}
|
||||
|
||||
public function getSentReceivedVisible(): int
|
||||
{
|
||||
return $this->sentReceivedVisible;
|
||||
}
|
||||
|
||||
public function getSocialActionsLabel(): ?string
|
||||
{
|
||||
return $this->socialActionsLabel;
|
||||
}
|
||||
|
||||
public function getSocialActionsVisible(): ?int
|
||||
{
|
||||
return $this->socialActionsVisible;
|
||||
}
|
||||
|
||||
public function getSocialIssuesLabel(): ?string
|
||||
{
|
||||
return $this->socialIssuesLabel;
|
||||
}
|
||||
|
||||
public function getSocialIssuesVisible(): ?int
|
||||
{
|
||||
return $this->socialIssuesVisible;
|
||||
}
|
||||
|
||||
public function getThirdPartiesLabel(): string
|
||||
{
|
||||
return $this->thirdPartiesLabel;
|
||||
}
|
||||
|
||||
public function getThirdPartiesVisible(): int
|
||||
{
|
||||
return $this->thirdPartiesVisible;
|
||||
}
|
||||
|
||||
public function getTravelTimeLabel(): string
|
||||
{
|
||||
return $this->travelTimeLabel;
|
||||
}
|
||||
|
||||
public function getTravelTimeVisible(): int
|
||||
{
|
||||
return $this->travelTimeVisible;
|
||||
}
|
||||
|
||||
public function getUserLabel(): string
|
||||
{
|
||||
return $this->userLabel;
|
||||
}
|
||||
|
||||
public function getUsersLabel(): string
|
||||
{
|
||||
return $this->usersLabel;
|
||||
}
|
||||
|
||||
public function getUsersVisible(): int
|
||||
{
|
||||
return $this->usersVisible;
|
||||
}
|
||||
|
||||
public function getUserVisible(): int
|
||||
{
|
||||
return $this->userVisible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is active
|
||||
* return true if the type is active.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isActive(): bool
|
||||
public function isActive()
|
||||
{
|
||||
return $this->getActive();
|
||||
}
|
||||
|
||||
public function isRequired(string $field): bool
|
||||
{
|
||||
$property = $field . 'Visible';
|
||||
|
||||
if (!property_exists($this, $property)) {
|
||||
throw new InvalidArgumentException('Field "' . $field . '" not found');
|
||||
}
|
||||
|
||||
return self::FIELD_REQUIRED === $this->{$property};
|
||||
}
|
||||
|
||||
public function isVisible(string $field): bool
|
||||
{
|
||||
$property = $field . 'Visible';
|
||||
|
||||
if (!property_exists($this, $property)) {
|
||||
throw new InvalidArgumentException('Field "' . $field . '" not found');
|
||||
}
|
||||
|
||||
return self::FIELD_INVISIBLE !== $this->{$property};
|
||||
}
|
||||
|
||||
/**
|
||||
* Set active
|
||||
* set to true if the type is active.
|
||||
*
|
||||
* @param bool $active
|
||||
*
|
||||
* @return ActivityType
|
||||
*/
|
||||
public function setActive(bool $active): self
|
||||
public function setActive($active)
|
||||
{
|
||||
$this->active = $active;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setAttendeeLabel(string $attendeeLabel): self
|
||||
{
|
||||
$this->attendeeLabel = $attendeeLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setAttendeeVisible(int $attendeeVisible): self
|
||||
{
|
||||
$this->attendeeVisible = $attendeeVisible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setCategory(?ActivityTypeCategory $category): self
|
||||
{
|
||||
$this->category = $category;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setCommentLabel(string $commentLabel): self
|
||||
{
|
||||
$this->commentLabel = $commentLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setCommentVisible(int $commentVisible): self
|
||||
{
|
||||
$this->commentVisible = $commentVisible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDateLabel(string $dateLabel): self
|
||||
{
|
||||
$this->dateLabel = $dateLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDateVisible(int $dateVisible): self
|
||||
{
|
||||
$this->dateVisible = $dateVisible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDocumentsLabel(string $documentsLabel): self
|
||||
{
|
||||
$this->documentsLabel = $documentsLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDocumentsVisible(int $documentsVisible): self
|
||||
{
|
||||
$this->documentsVisible = $documentsVisible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDurationTimeLabel(string $durationTimeLabel): self
|
||||
{
|
||||
$this->durationTimeLabel = $durationTimeLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDurationTimeVisible(int $durationTimeVisible): self
|
||||
{
|
||||
$this->durationTimeVisible = $durationTimeVisible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setEmergencyLabel(string $emergencyLabel): self
|
||||
{
|
||||
$this->emergencyLabel = $emergencyLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setEmergencyVisible(int $emergencyVisible): self
|
||||
{
|
||||
$this->emergencyVisible = $emergencyVisible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setLocationLabel(string $locationLabel): self
|
||||
{
|
||||
$this->locationLabel = $locationLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setLocationVisible(int $locationVisible): self
|
||||
{
|
||||
$this->locationVisible = $locationVisible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name.
|
||||
*
|
||||
* @param array $name
|
||||
*
|
||||
* @return ActivityType
|
||||
*/
|
||||
public function setName(array $name): self
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setOrdering(float $ordering): self
|
||||
{
|
||||
$this->ordering = $ordering;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setPersonLabel(string $personLabel): self
|
||||
{
|
||||
$this->personLabel = $personLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setPersonsLabel(string $personsLabel): self
|
||||
{
|
||||
$this->personsLabel = $personsLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setPersonsVisible(int $personsVisible): self
|
||||
{
|
||||
$this->personsVisible = $personsVisible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setPersonVisible(int $personVisible): self
|
||||
{
|
||||
$this->personVisible = $personVisible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setPrivateCommentLabel(string $privateCommentLabel): self
|
||||
{
|
||||
$this->privateCommentLabel = $privateCommentLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setPrivateCommentVisible(int $privateCommentVisible): self
|
||||
{
|
||||
$this->privateCommentVisible = $privateCommentVisible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setReasonsLabel(string $reasonsLabel): self
|
||||
{
|
||||
$this->reasonsLabel = $reasonsLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setReasonsVisible(int $reasonsVisible): self
|
||||
{
|
||||
$this->reasonsVisible = $reasonsVisible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setSentReceivedLabel(string $sentReceivedLabel): self
|
||||
{
|
||||
$this->sentReceivedLabel = $sentReceivedLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setSentReceivedVisible(int $sentReceivedVisible): self
|
||||
{
|
||||
$this->sentReceivedVisible = $sentReceivedVisible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setSocialActionsLabel(string $socialActionsLabel): self
|
||||
{
|
||||
$this->socialActionsLabel = $socialActionsLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setSocialActionsVisible(int $socialActionsVisible): self
|
||||
{
|
||||
$this->socialActionsVisible = $socialActionsVisible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setSocialIssuesLabel(string $socialIssuesLabel): self
|
||||
{
|
||||
$this->socialIssuesLabel = $socialIssuesLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setSocialIssuesVisible(int $socialIssuesVisible): self
|
||||
{
|
||||
$this->socialIssuesVisible = $socialIssuesVisible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setThirdPartiesLabel(string $thirdPartiesLabel): self
|
||||
{
|
||||
$this->thirdPartiesLabel = $thirdPartiesLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setThirdPartiesVisible(int $thirdPartiesVisible): self
|
||||
{
|
||||
$this->thirdPartiesVisible = $thirdPartiesVisible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setTravelTimeLabel(string $TravelTimeLabel): self
|
||||
{
|
||||
$this->travelTimeLabel = $TravelTimeLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setTravelTimeVisible(int $TravelTimeVisible): self
|
||||
{
|
||||
$this->travelTimeVisible = $TravelTimeVisible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setUserLabel(string $userLabel): self
|
||||
{
|
||||
$this->userLabel = $userLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setUsersLabel(string $usersLabel): self
|
||||
{
|
||||
$this->usersLabel = $usersLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setUsersVisible(int $usersVisible): self
|
||||
{
|
||||
$this->usersVisible = $usersVisible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setUserVisible(int $userVisible): self
|
||||
{
|
||||
$this->userVisible = $userVisible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@@ -1,108 +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\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="activitytypecategory")
|
||||
* @ORM\HasLifecycleCallbacks
|
||||
*/
|
||||
class ActivityTypeCategory
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
private bool $active = true;
|
||||
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json")
|
||||
*/
|
||||
private array $name = [];
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="float", options={"default": "0.0"})
|
||||
*/
|
||||
private float $ordering = 0.0;
|
||||
|
||||
/**
|
||||
* Get active
|
||||
* return true if the category type is active.
|
||||
*/
|
||||
public function getActive(): bool
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name.
|
||||
*/
|
||||
public function getName(): array
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getOrdering(): float
|
||||
{
|
||||
return $this->ordering;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is active
|
||||
* return true if the category type is active.
|
||||
*/
|
||||
public function isActive(): bool
|
||||
{
|
||||
return $this->getActive();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set active
|
||||
* set to true if the category type is active.
|
||||
*/
|
||||
public function setActive(bool $active): self
|
||||
{
|
||||
$this->active = $active;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name.
|
||||
*/
|
||||
public function setName(array $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setOrdering(float $ordering): self
|
||||
{
|
||||
$this->ordering = $ordering;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
@@ -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\ActivityBundle\EntityListener;
|
||||
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use function in_array;
|
||||
|
||||
class ActivityEntityListener
|
||||
{
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
private AccompanyingPeriodWorkRepository $workRepository;
|
||||
|
||||
public function __construct(EntityManagerInterface $em, AccompanyingPeriodWorkRepository $workRepository)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->workRepository = $workRepository;
|
||||
}
|
||||
|
||||
public function persistActionToCourse(Activity $activity)
|
||||
{
|
||||
if ($activity->getAccompanyingPeriod() instanceof AccompanyingPeriod) {
|
||||
$period = $activity->getAccompanyingPeriod();
|
||||
|
||||
$accompanyingCourseWorks = $this->workRepository->findByAccompanyingPeriod($period);
|
||||
$periodActions = [];
|
||||
$now = new DateTimeImmutable();
|
||||
|
||||
foreach ($accompanyingCourseWorks as $key => $work) {
|
||||
// take only the actions which are still opened
|
||||
if ($work->getEndDate() === null || $work->getEndDate() > ($activity->getDate() ?? $now)) {
|
||||
$periodActions[$key] = spl_object_hash($work->getSocialAction());
|
||||
}
|
||||
}
|
||||
|
||||
$associatedPersons = $activity->getPersonsAssociated();
|
||||
$associatedThirdparties = $activity->getThirdParties();
|
||||
|
||||
foreach ($activity->getSocialActions() as $action) {
|
||||
if (in_array(spl_object_hash($action), $periodActions, true)) {
|
||||
continue;
|
||||
}
|
||||
$newAction = new AccompanyingPeriodWork();
|
||||
$newAction->setSocialAction($action);
|
||||
$period->addWork($newAction);
|
||||
|
||||
$date = DateTimeImmutable::createFromMutable($activity->getDate());
|
||||
$newAction->setStartDate($date);
|
||||
|
||||
foreach ($associatedPersons as $person) {
|
||||
$newAction->addPerson($person);
|
||||
}
|
||||
|
||||
$this->em->persist($newAction);
|
||||
$this->em->flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,83 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Aggregator\ACPAggregators;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository;
|
||||
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
|
||||
use Closure;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class BySocialActionAggregator implements AggregatorInterface
|
||||
{
|
||||
private SocialActionRender $actionRender;
|
||||
|
||||
private SocialActionRepository $actionRepository;
|
||||
|
||||
public function __construct(
|
||||
SocialActionRender $actionRender,
|
||||
SocialActionRepository $actionRepository
|
||||
) {
|
||||
$this->actionRender = $actionRender;
|
||||
$this->actionRepository = $actionRepository;
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
return function($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'Social action';
|
||||
}
|
||||
|
||||
$sa = $this->actionRepository->find($value);
|
||||
|
||||
return $this->actionRender->renderString($sa, []);
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['socialaction_aggregator'];
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Group activity by linked socialaction';
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if(!in_array('socialaction', $qb->getAllAliases())) {
|
||||
$qb->join('activity.socialActions', 'socialaction');
|
||||
}
|
||||
|
||||
$qb->addSelect('socialaction.id AS socialaction_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('socialaction_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('socialaction_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
}
|
@@ -1,84 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Aggregator\ACPAggregators;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
|
||||
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
|
||||
use Closure;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class BySocialIssueAggregator implements AggregatorInterface
|
||||
{
|
||||
private SocialIssueRepository $issueRepository;
|
||||
|
||||
private SocialIssueRender $issueRender;
|
||||
|
||||
public function __construct(
|
||||
SocialIssueRepository $issueRepository,
|
||||
SocialIssueRender $issueRender
|
||||
) {
|
||||
$this->issueRepository = $issueRepository;
|
||||
$this->issueRender = $issueRender;
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
return function ($value): string {
|
||||
|
||||
if ($value === '_header') {
|
||||
return 'Social issues';
|
||||
}
|
||||
|
||||
$i = $this->issueRepository->find($value);
|
||||
|
||||
return $this->issueRender->renderString($i, []);
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['socialissue_aggregator'];
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Group activity by linked socialissue';
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('socialissue', $qb->getAllAliases())) {
|
||||
$qb->join('activity.socialIssues', 'socialissue');
|
||||
}
|
||||
|
||||
$qb->addSelect('socialissue.id AS socialissue_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('socialissue_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('socialissue_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
}
|
@@ -1,83 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Aggregator\ACPAggregators;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\ThirdPartyBundle\Repository\ThirdPartyRepository;
|
||||
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
|
||||
use Closure;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ByThirdpartyAggregator implements AggregatorInterface
|
||||
{
|
||||
private ThirdPartyRepository $thirdPartyRepository;
|
||||
|
||||
private ThirdPartyRender $thirdPartyRender;
|
||||
|
||||
public function __construct(
|
||||
ThirdPartyRepository $thirdPartyRepository,
|
||||
ThirdPartyRender $thirdPartyRender
|
||||
) {
|
||||
$this->thirdPartyRepository = $thirdPartyRepository;
|
||||
$this->thirdPartyRender = $thirdPartyRender;
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
return function ($value): string {
|
||||
if ($value === '_header') {
|
||||
return 'Accepted thirdparty';
|
||||
}
|
||||
|
||||
$tp = $this->thirdPartyRepository->find($value);
|
||||
|
||||
return $this->thirdPartyRender->renderString($tp, []);
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['thirdparty_aggregator'];
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Group activity by linked thirdparties';
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('thirdparty', $qb->getAllAliases())) {
|
||||
$qb->join('activity.thirdParties', 'thirdparty');
|
||||
}
|
||||
|
||||
$qb->addSelect('thirdparty.id AS thirdparty_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('thirdparty_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('thirdparty_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
}
|
@@ -1,83 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Aggregator\ACPAggregators;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Repository\UserRepository;
|
||||
use Chill\MainBundle\Templating\Entity\UserRender;
|
||||
use Closure;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ByUserAggregator implements AggregatorInterface
|
||||
{
|
||||
private UserRepository $userRepository;
|
||||
|
||||
private UserRender $userRender;
|
||||
|
||||
public function __construct(
|
||||
UserRepository $userRepository,
|
||||
UserRender $userRender
|
||||
) {
|
||||
$this->userRepository = $userRepository;
|
||||
$this->userRender = $userRender;
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
return function ($value): string {
|
||||
if ($value === '_header') {
|
||||
return 'Accepted users';
|
||||
}
|
||||
|
||||
$u = $this->userRepository->find($value);
|
||||
|
||||
return $this->userRender->renderString($u, []);
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['users_aggregator'];
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Group activity by linked users';
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('user', $qb->getAllAliases())) {
|
||||
$qb->join('activity.users', 'user');
|
||||
}
|
||||
|
||||
$qb->addSelect('user.id AS users_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('users_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('users_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
}
|
@@ -1,129 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Aggregator\ACPAggregators;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Closure;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class DateAggregator implements AggregatorInterface
|
||||
{
|
||||
private const CHOICES = [
|
||||
'by month' => 'month',
|
||||
'by week' => 'week',
|
||||
'by year' => 'year',
|
||||
];
|
||||
|
||||
private CONST DEFAULT_CHOICE = 'year';
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
return function ($value) use ($data): string {
|
||||
if ($value === '_header') {
|
||||
return 'by '. $data['frequency'];
|
||||
}
|
||||
switch ($data['frequency']) {
|
||||
case 'month':
|
||||
$month = \DateTime::createFromFormat('!m', $value);
|
||||
return sprintf(
|
||||
"%02d (%s)",
|
||||
$value,
|
||||
$month->format('M')
|
||||
);
|
||||
|
||||
case 'week':
|
||||
//return $this->translator->trans('for week') .' '. $value ;
|
||||
|
||||
case 'year':
|
||||
//return $this->translator->trans('in year') .' '. $value ;
|
||||
|
||||
default:
|
||||
return $value;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['date_aggregator'];
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('frequency', ChoiceType::class, [
|
||||
'choices' => self::CHOICES,
|
||||
'multiple' => false,
|
||||
'expanded' => true,
|
||||
'empty_data' => self::DEFAULT_CHOICE,
|
||||
'data' => self::DEFAULT_CHOICE,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Group activity by date';
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$order = null;
|
||||
|
||||
switch ($data['frequency']) {
|
||||
case 'month':
|
||||
$fmt = 'MM'; break;
|
||||
|
||||
case 'week':
|
||||
$fmt = 'IW'; break;
|
||||
|
||||
case 'year':
|
||||
$fmt = 'YYYY'; $order = 'DESC'; break;
|
||||
|
||||
default:
|
||||
throw new RuntimeException(sprintf("The frequency data '%s' is invalid.", $data['frequency']));
|
||||
}
|
||||
|
||||
$qb->addSelect(sprintf("TO_CHAR(activity.date, '%s') AS date_aggregator", $fmt));
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('date_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('date_aggregator');
|
||||
}
|
||||
|
||||
$orderBy = $qb->getDQLPart('orderBy');
|
||||
|
||||
if (!empty($orderBy)) {
|
||||
$qb->addOrderBy('date_aggregator', $order);
|
||||
} else {
|
||||
$qb->orderBy('date_aggregator', $order);
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
}
|
@@ -1,86 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Aggregator\ACPAggregators;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Repository\LocationTypeRepository;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Closure;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class LocationTypeAggregator implements AggregatorInterface
|
||||
{
|
||||
private LocationTypeRepository $locationTypeRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
LocationTypeRepository $locationTypeRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->locationTypeRepository = $locationTypeRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
return function ($value): string {
|
||||
if ($value === '_header') {
|
||||
return 'Accepted locationtype';
|
||||
}
|
||||
|
||||
$lt = $this->locationTypeRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
$lt->getTitle()
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['locationtype_aggregator'];
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Group activity by locationtype';
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('location', $qb->getAllAliases())) {
|
||||
$qb->join('activity.location', 'location');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(location.locationType) AS locationtype_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('locationtype_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('locationtype_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
}
|
@@ -1,86 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Aggregator\ACPAggregators;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Repository\ScopeRepository;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Closure;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class UserScopeAggregator implements AggregatorInterface
|
||||
{
|
||||
private ScopeRepository $scopeRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
ScopeRepository $scopeRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->scopeRepository = $scopeRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
return function ($value): string {
|
||||
if ($value === '_header') {
|
||||
return 'Scope';
|
||||
}
|
||||
|
||||
$s = $this->scopeRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
$s->getName()
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['userscope_aggregator'];
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Group activity by userscope';
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('user', $qb->getAllAliases())) {
|
||||
$qb->join('activity.user', 'user');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(user.mainScope) AS userscope_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('userscope_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('userscope_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
}
|
@@ -1,24 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Aggregator\PersonAggregators;
|
||||
namespace Chill\ActivityBundle\Export\Aggregator;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\ActivityBundle\Repository\ActivityReasonCategoryRepository;
|
||||
use Chill\ActivityBundle\Repository\ActivityReasonRepository;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query\Expr\Join;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use RuntimeException;
|
||||
@@ -30,22 +29,33 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use function array_key_exists;
|
||||
use function count;
|
||||
|
||||
class ActivityReasonAggregator implements AggregatorInterface, ExportElementValidatedInterface
|
||||
class ActivityReasonAggregator implements
|
||||
AggregatorInterface,
|
||||
ExportElementValidatedInterface
|
||||
{
|
||||
protected ActivityReasonCategoryRepository $activityReasonCategoryRepository;
|
||||
/**
|
||||
* @var EntityRepository
|
||||
*/
|
||||
protected $categoryRepository;
|
||||
|
||||
protected ActivityReasonRepository $activityReasonRepository;
|
||||
/**
|
||||
* @var EntityRepository
|
||||
*/
|
||||
protected $reasonRepository;
|
||||
|
||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
||||
/**
|
||||
* @var TranslatableStringHelper
|
||||
*/
|
||||
protected $stringHelper;
|
||||
|
||||
public function __construct(
|
||||
ActivityReasonCategoryRepository $activityReasonCategoryRepository,
|
||||
ActivityReasonRepository $activityReasonRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
EntityRepository $categoryRepository,
|
||||
EntityRepository $reasonRepository,
|
||||
TranslatableStringHelper $stringHelper
|
||||
) {
|
||||
$this->activityReasonCategoryRepository = $activityReasonCategoryRepository;
|
||||
$this->activityReasonRepository = $activityReasonRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->categoryRepository = $categoryRepository;
|
||||
$this->reasonRepository = $reasonRepository;
|
||||
$this->stringHelper = $stringHelper;
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
@@ -63,7 +73,7 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
||||
$elem = 'category.id';
|
||||
$alias = 'activity_categories_id';
|
||||
} else {
|
||||
throw new RuntimeException('The data provided are not recognized.');
|
||||
throw new RuntimeException('the data provided are not recognized');
|
||||
}
|
||||
|
||||
$qb->addSelect($elem . ' as ' . $alias);
|
||||
@@ -80,8 +90,7 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
||||
) {
|
||||
$qb->add(
|
||||
'join',
|
||||
[
|
||||
'activity' => new Join(Join::INNER_JOIN, 'activity.reasons', 'reasons'),
|
||||
['activity' => new Join(Join::INNER_JOIN, 'activity.reasons', 'reasons'),
|
||||
],
|
||||
true
|
||||
);
|
||||
@@ -105,26 +114,22 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
public function applyOn()
|
||||
{
|
||||
return Declarations::ACTIVITY_PERSON;
|
||||
return 'activity';
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add(
|
||||
'level',
|
||||
ChoiceType::class,
|
||||
[
|
||||
'choices' => [
|
||||
'By reason' => 'reasons',
|
||||
'By category of reason' => 'categories',
|
||||
],
|
||||
'multiple' => false,
|
||||
'expanded' => true,
|
||||
'label' => "Reason's level",
|
||||
]
|
||||
);
|
||||
$builder->add('level', ChoiceType::class, [
|
||||
'choices' => [
|
||||
'By reason' => 'reasons',
|
||||
'By category of reason' => 'categories',
|
||||
],
|
||||
'multiple' => false,
|
||||
'expanded' => true,
|
||||
'label' => 'Reason\'s level',
|
||||
]);
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
@@ -132,38 +137,46 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
||||
// for performance reason, we load data from db only once
|
||||
switch ($data['level']) {
|
||||
case 'reasons':
|
||||
$this->activityReasonRepository->findBy(['id' => $values]);
|
||||
$this->reasonRepository->findBy(['id' => $values]);
|
||||
|
||||
break;
|
||||
|
||||
case 'categories':
|
||||
$this->activityReasonCategoryRepository->findBy(['id' => $values]);
|
||||
$this->categoryRepository->findBy(['id' => $values]);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new RuntimeException(sprintf("The level data '%s' is invalid.", $data['level']));
|
||||
throw new RuntimeException(sprintf(
|
||||
"the level data '%s' is invalid",
|
||||
$data['level']
|
||||
));
|
||||
}
|
||||
|
||||
return function ($value) use ($data) {
|
||||
if ('_header' === $value) {
|
||||
return 'reasons' === $data['level'] ? 'Group by reasons' : 'Group by categories of reason';
|
||||
return 'reasons' === $data['level'] ?
|
||||
'Group by reasons'
|
||||
:
|
||||
'Group by categories of reason';
|
||||
}
|
||||
|
||||
switch ($data['level']) {
|
||||
case 'reasons':
|
||||
$r = $this->activityReasonRepository->find($value);
|
||||
/** @var \Chill\ActivityBundle\Entity\ActivityReason $r */
|
||||
$r = $this->reasonRepository->find($value);
|
||||
|
||||
return sprintf(
|
||||
'%s > %s',
|
||||
$this->translatableStringHelper->localize($r->getCategory()->getName()),
|
||||
$this->translatableStringHelper->localize($r->getName())
|
||||
);
|
||||
return $this->stringHelper->localize($r->getCategory()->getName())
|
||||
. ' > '
|
||||
. $this->stringHelper->localize($r->getName());
|
||||
|
||||
break;
|
||||
case 'categories':
|
||||
$c = $this->activityReasonCategoryRepository->find($value);
|
||||
$c = $this->categoryRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize($c->getName());
|
||||
return $this->stringHelper->localize($c->getName());
|
||||
|
||||
break;
|
||||
// no need for a default : the default was already set above
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -179,7 +192,7 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
||||
return ['activity_categories_id'];
|
||||
}
|
||||
|
||||
throw new RuntimeException('The data provided are not recognised.');
|
||||
throw new RuntimeException('the data provided are not recognised');
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
@@ -190,8 +203,7 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
||||
public function validateForm($data, ExecutionContextInterface $context)
|
||||
{
|
||||
if (null === $data['level']) {
|
||||
$context
|
||||
->buildViolation("The reasons's level should not be empty.")
|
||||
$context->buildViolation("The reasons's level should not be empty")
|
||||
->addViolation();
|
||||
}
|
||||
}
|
@@ -1,22 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Aggregator;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\ActivityBundle\Repository\ActivityTypeRepository;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Closure;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query\Expr\Join;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
@@ -26,16 +26,22 @@ class ActivityTypeAggregator implements AggregatorInterface
|
||||
{
|
||||
public const KEY = 'activity_type_aggregator';
|
||||
|
||||
protected ActivityTypeRepository $activityTypeRepository;
|
||||
/**
|
||||
* @var TranslatableStringHelper
|
||||
*/
|
||||
protected $stringHelper;
|
||||
|
||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
||||
/**
|
||||
* @var EntityRepository
|
||||
*/
|
||||
protected $typeRepository;
|
||||
|
||||
public function __construct(
|
||||
ActivityTypeRepository $activityTypeRepository,
|
||||
TranslatableStringHelperInterface $translatableStringHelper
|
||||
EntityRepository $typeRepository,
|
||||
TranslatableStringHelper $stringHelper
|
||||
) {
|
||||
$this->activityTypeRepository = $activityTypeRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->typeRepository = $typeRepository;
|
||||
$this->stringHelper = $stringHelper;
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
@@ -45,24 +51,16 @@ class ActivityTypeAggregator implements AggregatorInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('type', $qb->getAllAliases())) {
|
||||
$qb->join('activity.activityType', 'type');
|
||||
}
|
||||
// add select element
|
||||
$qb->addSelect(sprintf('IDENTITY(activity.type) AS %s', self::KEY));
|
||||
|
||||
$qb->addSelect(sprintf('IDENTITY(activity.activityType) AS %s', self::KEY));
|
||||
|
||||
$groupby = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy(self::KEY);
|
||||
} else {
|
||||
$qb->groupBy(self::KEY);
|
||||
}
|
||||
// add the "group by" part
|
||||
$groupBy = $qb->addGroupBy(self::KEY);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
public function applyOn()
|
||||
{
|
||||
return Declarations::ACTIVITY;
|
||||
return 'activity';
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
@@ -70,23 +68,24 @@ class ActivityTypeAggregator implements AggregatorInterface
|
||||
// no form required for this aggregator
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): Closure
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
// for performance reason, we load data from db only once
|
||||
$this->activityTypeRepository->findBy(['id' => $values]);
|
||||
$this->typeRepository->findBy(['id' => $values]);
|
||||
|
||||
return function ($value): string {
|
||||
return function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'Activity type';
|
||||
}
|
||||
|
||||
$t = $this->activityTypeRepository->find($value);
|
||||
/** @var \Chill\ActivityBundle\Entity\ActivityType $r */
|
||||
$t = $this->typeRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize($t->getName());
|
||||
return $this->stringHelper->localize($t->getName());
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
public function getQueryKeys($data)
|
||||
{
|
||||
return [self::KEY];
|
||||
}
|
||||
|
@@ -1,22 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Aggregator;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Repository\UserRepository;
|
||||
use Chill\MainBundle\Templating\Entity\UserRender;
|
||||
use Closure;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
@@ -25,16 +26,14 @@ class ActivityUserAggregator implements AggregatorInterface
|
||||
{
|
||||
public const KEY = 'activity_user_id';
|
||||
|
||||
private UserRepository $userRepository;
|
||||
/**
|
||||
* @var EntityManagerInterface
|
||||
*/
|
||||
protected $em;
|
||||
|
||||
private UserRender $userRender;
|
||||
|
||||
public function __construct(
|
||||
UserRepository $userRepository,
|
||||
UserRender $userRender
|
||||
) {
|
||||
$this->userRepository = $userRepository;
|
||||
$this->userRender = $userRender;
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
@@ -53,7 +52,7 @@ class ActivityUserAggregator implements AggregatorInterface
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY;
|
||||
return 'activity';
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
@@ -64,16 +63,18 @@ class ActivityUserAggregator implements AggregatorInterface
|
||||
public function getLabels($key, $values, $data): Closure
|
||||
{
|
||||
// preload users at once
|
||||
$this->userRepository->findBy(['id' => $values]);
|
||||
$this->em->getRepository(User::class)
|
||||
->findBy(['id' => $values]);
|
||||
|
||||
return function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'Activity user';
|
||||
switch ($value) {
|
||||
case '_header':
|
||||
return 'activity user';
|
||||
|
||||
default:
|
||||
return $this->em->getRepository(User::class)->find($value)
|
||||
->getUsername();
|
||||
}
|
||||
|
||||
$u = $this->userRepository->find($value);
|
||||
|
||||
return $this->userRender->renderString($u, []);
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -1,24 +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\Export;
|
||||
|
||||
/**
|
||||
* This class declare constants used for the export framework.
|
||||
*/
|
||||
abstract class Declarations
|
||||
{
|
||||
public const ACTIVITY = 'activity';
|
||||
|
||||
public const ACTIVITY_ACP = "activity_linked_to_acp";
|
||||
|
||||
public const ACTIVITY_PERSON = "activity_linked_to_person";
|
||||
}
|
110
src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php
Normal file
110
src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<?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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Export;
|
||||
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\MainBundle\Export\ExportInterface;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query;
|
||||
use LogicException;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
class CountActivity implements ExportInterface
|
||||
{
|
||||
/**
|
||||
* @var EntityManagerInterface
|
||||
*/
|
||||
protected $entityManager;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->entityManager = $em;
|
||||
}
|
||||
|
||||
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder)
|
||||
{
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes()
|
||||
{
|
||||
return [\Chill\MainBundle\Export\FormatterInterface::TYPE_TABULAR];
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return 'Count activities by various parameters.';
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
if ('export_count_activity' !== $key) {
|
||||
throw new LogicException("the key {$key} is not used by this export");
|
||||
}
|
||||
|
||||
return static function ($value) {
|
||||
return '_header' === $value ?
|
||||
'Number of activities'
|
||||
:
|
||||
$value;
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data)
|
||||
{
|
||||
return ['export_count_activity'];
|
||||
}
|
||||
|
||||
public function getResult($qb, $data)
|
||||
{
|
||||
return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return 'Count activities';
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return 'activity';
|
||||
}
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
$qb = $this->entityManager->createQueryBuilder();
|
||||
$centers = array_map(static function ($el) {
|
||||
return $el['center'];
|
||||
}, $acl);
|
||||
|
||||
$qb->select('COUNT(activity.id) as export_count_activity')
|
||||
->from('ChillActivityBundle:Activity', 'activity')
|
||||
->join('activity.person', 'person');
|
||||
|
||||
$qb->where($qb->expr()->in('person.center', ':centers'))
|
||||
->setParameter('centers', $centers);
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
public function requiredRole()
|
||||
{
|
||||
return new Role(ActivityStatsVoter::STATS);
|
||||
}
|
||||
|
||||
public function supportsModifiers()
|
||||
{
|
||||
return ['person', 'activity'];
|
||||
}
|
||||
}
|
@@ -1,103 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Export\LinkedToACP;
|
||||
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\MainBundle\Export\ExportInterface;
|
||||
use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Closure;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
class AvgActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
protected EntityRepository $repository;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->repository = $em->getRepository(Activity::class);
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
// TODO: Implement buildForm() method.
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Average activity linked to an accompanying period duration';
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
return [FormatterInterface::TYPE_TABULAR];
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Average activities linked to an accompanying period duration by various parameters.';
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
if ('export_avg_activity_duration' !== $key) {
|
||||
throw new LogicException("the key {$key} is not used by this export");
|
||||
}
|
||||
|
||||
return static fn ($value) => '_header' === $value ? 'Average activities linked to an accompanying period duration' : $value;
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['export_avg_activity_duration'];
|
||||
}
|
||||
|
||||
public function getResult($qb, $data)
|
||||
{
|
||||
return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||
}
|
||||
|
||||
public function getType(): string
|
||||
{
|
||||
return Declarations::ACTIVITY;
|
||||
}
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
$qb = $this->repository->createQueryBuilder('activity')
|
||||
->join('activity.accompanyingPeriod', 'acp')
|
||||
;
|
||||
|
||||
$qb->select('AVG(activity.durationTime) as export_avg_activity_duration');
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
public function requiredRole(): Role
|
||||
{
|
||||
return new Role(ActivityStatsVoter::STATS);
|
||||
}
|
||||
|
||||
public function supportsModifiers(): array
|
||||
{
|
||||
return [
|
||||
Declarations::ACTIVITY,
|
||||
Declarations::ACTIVITY_ACP,
|
||||
//PersonDeclarations::ACP_TYPE,
|
||||
];
|
||||
}
|
||||
|
||||
public function getGroup(): string
|
||||
{
|
||||
return 'Exports of activities linked to an accompanying period';
|
||||
}
|
||||
|
||||
}
|
@@ -1,103 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Export\LinkedToACP;
|
||||
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\MainBundle\Export\ExportInterface;
|
||||
use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Closure;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
protected EntityRepository $repository;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->repository = $em->getRepository(Activity::class);
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
// TODO: Implement buildForm() method.
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Average activity linked to an accompanying period visit duration';
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
return [FormatterInterface::TYPE_TABULAR];
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Average activities linked to an accompanying period visit duration by various parameters.';
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
if ('export_avg_activity_visit_duration' !== $key) {
|
||||
throw new LogicException("the key {$key} is not used by this export");
|
||||
}
|
||||
|
||||
return static fn ($value) => '_header' === $value ? 'Average activities linked to an accompanying period visit duration' : $value;
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['export_avg_activity_visit_duration'];
|
||||
}
|
||||
|
||||
public function getResult($qb, $data)
|
||||
{
|
||||
return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||
}
|
||||
|
||||
public function getType(): string
|
||||
{
|
||||
return Declarations::ACTIVITY;
|
||||
}
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
$qb = $this->repository->createQueryBuilder('activity')
|
||||
->join('activity.accompanyingPeriod', 'acp')
|
||||
;
|
||||
|
||||
$qb->select('AVG(activity.travelTime) as export_avg_activity_visit_duration');
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
public function requiredRole(): Role
|
||||
{
|
||||
return new Role(ActivityStatsVoter::STATS);
|
||||
}
|
||||
|
||||
public function supportsModifiers(): array
|
||||
{
|
||||
return [
|
||||
Declarations::ACTIVITY,
|
||||
Declarations::ACTIVITY_ACP,
|
||||
//PersonDeclarations::ACP_TYPE,
|
||||
];
|
||||
}
|
||||
|
||||
public function getGroup(): string
|
||||
{
|
||||
return 'Exports of activities linked to an accompanying period';
|
||||
}
|
||||
|
||||
}
|
@@ -1,110 +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\Export\Export\LinkedToACP;
|
||||
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\MainBundle\Export\ExportInterface;
|
||||
use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query;
|
||||
use LogicException;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
class CountActivity implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
protected EntityRepository $repository;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->repository = $em->getRepository(Activity::class);
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
return [FormatterInterface::TYPE_TABULAR];
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Count activities linked to an accompanying period by various parameters.';
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
if ('export_count_activity' !== $key) {
|
||||
throw new LogicException("the key {$key} is not used by this export");
|
||||
}
|
||||
|
||||
return static fn ($value) => '_header' === $value ? 'Number of activities linked to an accompanying period' : $value;
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['export_count_activity'];
|
||||
}
|
||||
|
||||
public function getResult($qb, $data)
|
||||
{
|
||||
return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Count activities linked to an accompanying period';
|
||||
}
|
||||
|
||||
public function getType(): string
|
||||
{
|
||||
return Declarations::ACTIVITY;
|
||||
}
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
$qb = $this->repository->createQueryBuilder('activity')
|
||||
->join('activity.accompanyingPeriod', 'acp')
|
||||
;
|
||||
|
||||
$qb->select('COUNT(activity.id) as export_count_activity');
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
public function requiredRole(): Role
|
||||
{
|
||||
return new Role(ActivityStatsVoter::STATS);
|
||||
}
|
||||
|
||||
public function supportsModifiers(): array
|
||||
{
|
||||
return [
|
||||
Declarations::ACTIVITY,
|
||||
Declarations::ACTIVITY_ACP,
|
||||
//PersonDeclarations::ACP_TYPE,
|
||||
];
|
||||
}
|
||||
|
||||
public function getGroup(): string
|
||||
{
|
||||
return 'Exports of activities linked to an accompanying period';
|
||||
}
|
||||
}
|
@@ -1,103 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Export\LinkedToACP;
|
||||
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\MainBundle\Export\ExportInterface;
|
||||
use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Closure;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
class SumActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
protected EntityRepository $repository;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->repository = $em->getRepository(Activity::class);
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
// TODO: Implement buildForm() method.
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Sum activity linked to an accompanying period duration';
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
return [FormatterInterface::TYPE_TABULAR];
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Sum activities linked to an accompanying period duration by various parameters.';
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
if ('export_sum_activity_duration' !== $key) {
|
||||
throw new LogicException("the key {$key} is not used by this export");
|
||||
}
|
||||
|
||||
return static fn ($value) => '_header' === $value ? 'Sum activities linked to an accompanying period duration' : $value;
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['export_sum_activity_duration'];
|
||||
}
|
||||
|
||||
public function getResult($qb, $data)
|
||||
{
|
||||
return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||
}
|
||||
|
||||
public function getType(): string
|
||||
{
|
||||
return Declarations::ACTIVITY;
|
||||
}
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
$qb = $this->repository->createQueryBuilder('activity')
|
||||
->join('activity.accompanyingPeriod', 'acp')
|
||||
;
|
||||
|
||||
$qb->select('SUM(activity.durationTime) as export_sum_activity_duration');
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
public function requiredRole(): Role
|
||||
{
|
||||
return new Role(ActivityStatsVoter::STATS);
|
||||
}
|
||||
|
||||
public function supportsModifiers(): array
|
||||
{
|
||||
return [
|
||||
Declarations::ACTIVITY,
|
||||
Declarations::ACTIVITY_ACP,
|
||||
//PersonDeclarations::ACP_TYPE,
|
||||
];
|
||||
}
|
||||
|
||||
public function getGroup(): string
|
||||
{
|
||||
return 'Exports of activities linked to an accompanying period';
|
||||
}
|
||||
|
||||
}
|
@@ -1,102 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Export\LinkedToACP;
|
||||
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\MainBundle\Export\ExportInterface;
|
||||
use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Closure;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
class SumActivityVisitDuration implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
protected EntityRepository $repository;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->repository = $em->getRepository(Activity::class);
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
// TODO: Implement buildForm() method.
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Sum activity linked to an accompanying period visit duration';
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
return [FormatterInterface::TYPE_TABULAR];
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Sum activities linked to an accompanying period visit duration by various parameters.';
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
if ('export_sum_activity_visit_duration' !== $key) {
|
||||
throw new LogicException("the key {$key} is not used by this export");
|
||||
}
|
||||
|
||||
return static fn ($value) => '_header' === $value ? 'Sum activities linked to an accompanying period visit duration' : $value;
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['export_sum_activity_visit_duration'];
|
||||
}
|
||||
|
||||
public function getResult($qb, $data)
|
||||
{
|
||||
return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||
}
|
||||
|
||||
public function getType(): string
|
||||
{
|
||||
return Declarations::ACTIVITY;
|
||||
}
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
$qb = $this->repository->createQueryBuilder('activity')
|
||||
->join('activity.accompanyingPeriod', 'acp')
|
||||
;
|
||||
|
||||
$qb->select('SUM(activity.travelTime) as export_sum_activity_visit_duration');
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
public function requiredRole(): Role
|
||||
{
|
||||
return new Role(ActivityStatsVoter::STATS);
|
||||
}
|
||||
|
||||
public function supportsModifiers(): array
|
||||
{
|
||||
return [
|
||||
Declarations::ACTIVITY,
|
||||
Declarations::ACTIVITY_ACP,
|
||||
//PersonDeclarations::ACP_TYPE,
|
||||
];
|
||||
}
|
||||
|
||||
public function getGroup(): string
|
||||
{
|
||||
return 'Exports of activities linked to an accompanying period';
|
||||
}
|
||||
}
|
@@ -1,115 +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\Export\Export\LinkedToPerson;
|
||||
|
||||
use Chill\ActivityBundle\Repository\ActivityRepository;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\MainBundle\Export\ExportInterface;
|
||||
use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
||||
use Doctrine\ORM\Query;
|
||||
use LogicException;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
class CountActivity implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
protected ActivityRepository $activityRepository;
|
||||
|
||||
public function __construct(
|
||||
ActivityRepository $activityRepository
|
||||
) {
|
||||
$this->activityRepository = $activityRepository;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes()
|
||||
{
|
||||
return [FormatterInterface::TYPE_TABULAR];
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return 'Count activities linked to a person by various parameters.';
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
if ('export_count_activity' !== $key) {
|
||||
throw new LogicException("the key {$key} is not used by this export");
|
||||
}
|
||||
|
||||
return static fn ($value) => '_header' === $value ? 'Number of activities linked to a person' : $value;
|
||||
}
|
||||
|
||||
public function getQueryKeys($data)
|
||||
{
|
||||
return ['export_count_activity'];
|
||||
}
|
||||
|
||||
public function getResult($qb, $data)
|
||||
{
|
||||
return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return 'Count activities linked to a person';
|
||||
}
|
||||
|
||||
public function getType(): string
|
||||
{
|
||||
return Declarations::ACTIVITY;
|
||||
}
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||
|
||||
$qb = $this->activityRepository->createQueryBuilder('activity')
|
||||
->join('activity.person', 'person')
|
||||
;
|
||||
|
||||
$qb->select('COUNT(activity.id) as export_count_activity');
|
||||
|
||||
$qb
|
||||
->where($qb->expr()->in('person.center', ':centers'))
|
||||
->setParameter('centers', $centers)
|
||||
;
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
public function requiredRole()
|
||||
{
|
||||
return new Role(ActivityStatsVoter::STATS);
|
||||
}
|
||||
|
||||
public function supportsModifiers()
|
||||
{
|
||||
return [
|
||||
Declarations::ACTIVITY,
|
||||
Declarations::ACTIVITY_PERSON,
|
||||
//PersonDeclarations::PERSON_TYPE,
|
||||
];
|
||||
}
|
||||
|
||||
public function getGroup(): string
|
||||
{
|
||||
return 'Exports of activities linked to a person';
|
||||
}
|
||||
}
|
@@ -1,45 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Export\LinkedToPerson;
|
||||
namespace Chill\ActivityBundle\Export\Export;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||
use Chill\ActivityBundle\Repository\ActivityRepository;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Chill\MainBundle\Export\ListInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use DateTime;
|
||||
use Doctrine\DBAL\Exception\InvalidArgumentException;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Symfony\Component\Validator\Constraints\Callback;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
||||
|
||||
use function array_key_exists;
|
||||
use function count;
|
||||
use function in_array;
|
||||
|
||||
class ListActivity implements ListInterface, GroupedExportInterface
|
||||
/**
|
||||
* Create a list for all activities.
|
||||
*/
|
||||
class ListActivity implements ListInterface
|
||||
{
|
||||
protected EntityManagerInterface $entityManager;
|
||||
/**
|
||||
* @var EntityManagerInterface
|
||||
*/
|
||||
protected $entityManager;
|
||||
|
||||
protected array $fields = [
|
||||
protected $fields = [
|
||||
'id',
|
||||
'date',
|
||||
'durationTime',
|
||||
@@ -53,24 +56,29 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
'person_id',
|
||||
];
|
||||
|
||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
||||
/**
|
||||
* @var TranslatableStringHelper
|
||||
*/
|
||||
protected $translatableStringHelper;
|
||||
|
||||
protected TranslatorInterface $translator;
|
||||
|
||||
private ActivityRepository $activityRepository;
|
||||
/**
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
TranslatorInterface $translator,
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
ActivityRepository $activityRepository
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->entityManager = $em;
|
||||
$this->translator = $translator;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->activityRepository = $activityRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('fields', ChoiceType::class, [
|
||||
@@ -90,6 +98,11 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getAllowedFormattersTypes()
|
||||
{
|
||||
return [FormatterInterface::TYPE_LIST];
|
||||
@@ -97,7 +110,7 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return 'List activities linked to a person description';
|
||||
return 'List activities';
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
@@ -113,7 +126,6 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
|
||||
return $date->format('d-m-Y');
|
||||
};
|
||||
|
||||
case 'attendee':
|
||||
return static function ($value) {
|
||||
if ('_header' === $value) {
|
||||
@@ -122,16 +134,18 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
|
||||
return $value ? 1 : 0;
|
||||
};
|
||||
|
||||
case 'list_reasons':
|
||||
$activityRepository = $this->activityRepository;
|
||||
/** @var EntityRepository $activityReasonsRepository */
|
||||
$activityRepository = $this->entityManager
|
||||
->getRepository('ChillActivityBundle:Activity');
|
||||
|
||||
return function ($value) use ($activityRepository): string {
|
||||
return function ($value) use ($activityRepository) {
|
||||
if ('_header' === $value) {
|
||||
return 'activity reasons';
|
||||
}
|
||||
|
||||
$activity = $activityRepository->find($value);
|
||||
$activity = $activityRepository
|
||||
->find($value);
|
||||
|
||||
return implode(', ', array_map(function (ActivityReason $r) {
|
||||
return '"' .
|
||||
@@ -141,23 +155,23 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
. '"';
|
||||
}, $activity->getReasons()->toArray()));
|
||||
};
|
||||
|
||||
case 'circle_name':
|
||||
return function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'circle';
|
||||
}
|
||||
|
||||
return $this->translatableStringHelper->localize(json_decode($value, true));
|
||||
return $this->translatableStringHelper
|
||||
->localize(json_decode($value, true));
|
||||
};
|
||||
|
||||
case 'type_name':
|
||||
return function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'activity type';
|
||||
}
|
||||
|
||||
return $this->translatableStringHelper->localize(json_decode($value, true));
|
||||
return $this->translatableStringHelper
|
||||
->localize(json_decode($value, true));
|
||||
};
|
||||
|
||||
default:
|
||||
@@ -183,12 +197,12 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return 'List activity linked to a person';
|
||||
return 'List activities';
|
||||
}
|
||||
|
||||
public function getType(): string
|
||||
public function getType()
|
||||
{
|
||||
return Declarations::ACTIVITY;
|
||||
return 'activity';
|
||||
}
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
@@ -199,7 +213,8 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
|
||||
// throw an error if any fields are present
|
||||
if (!array_key_exists('fields', $data)) {
|
||||
throw new InvalidArgumentException('Any fields have been checked.');
|
||||
throw new \Doctrine\DBAL\Exception\InvalidArgumentException('any fields '
|
||||
. 'have been checked');
|
||||
}
|
||||
|
||||
$qb = $this->entityManager->createQueryBuilder();
|
||||
@@ -218,40 +233,33 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
$qb->addSelect('activity.id AS id');
|
||||
|
||||
break;
|
||||
|
||||
case 'person_firstname':
|
||||
$qb->addSelect('person.firstName AS person_firstname');
|
||||
|
||||
break;
|
||||
|
||||
case 'person_lastname':
|
||||
$qb->addSelect('person.lastName AS person_lastname');
|
||||
|
||||
break;
|
||||
|
||||
case 'person_id':
|
||||
$qb->addSelect('person.id AS person_id');
|
||||
|
||||
break;
|
||||
|
||||
case 'user_username':
|
||||
$qb->join('activity.user', 'user');
|
||||
$qb->addSelect('user.username AS user_username');
|
||||
|
||||
break;
|
||||
|
||||
case 'circle_name':
|
||||
$qb->join('activity.scope', 'circle');
|
||||
$qb->addSelect('circle.name AS circle_name');
|
||||
|
||||
break;
|
||||
|
||||
case 'type_name':
|
||||
$qb->join('activity.type', 'type');
|
||||
$qb->addSelect('type.name AS type_name');
|
||||
|
||||
break;
|
||||
|
||||
case 'list_reasons':
|
||||
// this is a trick... The reasons is filled with the
|
||||
// activity id which will be used to load reasons
|
||||
@@ -277,15 +285,6 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
|
||||
public function supportsModifiers()
|
||||
{
|
||||
return [
|
||||
Declarations::ACTIVITY,
|
||||
Declarations::ACTIVITY_PERSON,
|
||||
//PersonDeclarations::PERSON_TYPE,
|
||||
];
|
||||
}
|
||||
|
||||
public function getGroup(): string
|
||||
{
|
||||
return 'Exports of activities linked to a person';
|
||||
return ['activity', 'person'];
|
||||
}
|
||||
}
|
@@ -1,27 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Export\LinkedToPerson;
|
||||
namespace Chill\ActivityBundle\Export\Export;
|
||||
|
||||
use Chill\ActivityBundle\Repository\ActivityRepository;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Export\ExportInterface;
|
||||
use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query;
|
||||
use LogicException;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
/**
|
||||
@@ -29,53 +25,68 @@ use Symfony\Component\Security\Core\Role\Role;
|
||||
*
|
||||
* The desired stat must be given in constructor.
|
||||
*/
|
||||
class StatActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
class StatActivityDuration implements ExportInterface
|
||||
{
|
||||
public const SUM = 'sum';
|
||||
|
||||
/**
|
||||
* The action for this report.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected string $action;
|
||||
|
||||
private ActivityRepository $activityRepository;
|
||||
protected $action;
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface
|
||||
*/
|
||||
protected $entityManager;
|
||||
|
||||
/**
|
||||
* constructor.
|
||||
*
|
||||
* @param string $action the stat to perform
|
||||
*/
|
||||
public function __construct(
|
||||
ActivityRepository $activityRepository,
|
||||
string $action = 'sum'
|
||||
EntityManagerInterface $em,
|
||||
$action = 'sum'
|
||||
) {
|
||||
$this->entityManager = $em;
|
||||
$this->action = $action;
|
||||
$this->activityRepository = $activityRepository;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder)
|
||||
{
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes()
|
||||
{
|
||||
return [FormatterInterface::TYPE_TABULAR];
|
||||
return [\Chill\MainBundle\Export\FormatterInterface::TYPE_TABULAR];
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
if (self::SUM === $this->action) {
|
||||
return 'Sum activities linked to a person duration by various parameters.';
|
||||
return 'Sum activities duration by various parameters.';
|
||||
}
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
if ('export_stat_activity' !== $key) {
|
||||
throw new LogicException(sprintf('The key %s is not used by this export', $key));
|
||||
throw new LogicException("the key {$key} is not used by this export");
|
||||
}
|
||||
|
||||
$header = self::SUM === $this->action ? 'Sum activities linked to a person duration' : false;
|
||||
switch ($this->action) {
|
||||
case self::SUM:
|
||||
$header = 'Sum of activities duration';
|
||||
}
|
||||
|
||||
return static fn (string $value) => '_header' === $value ? $header : $value;
|
||||
return static function ($value) use ($header) {
|
||||
return '_header' === $value ?
|
||||
$header
|
||||
:
|
||||
$value;
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data)
|
||||
@@ -91,35 +102,34 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
public function getTitle()
|
||||
{
|
||||
if (self::SUM === $this->action) {
|
||||
return 'Sum activity linked to a person duration';
|
||||
return 'Sum activity duration';
|
||||
}
|
||||
}
|
||||
|
||||
public function getType(): string
|
||||
public function getType()
|
||||
{
|
||||
return Declarations::ACTIVITY;
|
||||
return 'activity';
|
||||
}
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
$centers = array_map(
|
||||
static fn (array $el): Center => $el['center'],
|
||||
$acl
|
||||
);
|
||||
|
||||
$qb = $this->activityRepository->createQueryBuilder('activity');
|
||||
|
||||
$select = null;
|
||||
$centers = array_map(static function ($el) {
|
||||
return $el['center'];
|
||||
}, $acl);
|
||||
$qb = $this->entityManager->createQueryBuilder();
|
||||
|
||||
if (self::SUM === $this->action) {
|
||||
$select = 'SUM(activity.durationTime) AS export_stat_activity';
|
||||
}
|
||||
|
||||
return $qb->select($select)
|
||||
$qb->select($select)
|
||||
->from('ChillActivityBundle:Activity', 'activity')
|
||||
->join('activity.person', 'person')
|
||||
->join('person.center', 'center')
|
||||
->where($qb->expr()->in('center', ':centers'))
|
||||
->setParameter(':centers', $centers);
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
public function requiredRole()
|
||||
@@ -129,15 +139,6 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
|
||||
public function supportsModifiers()
|
||||
{
|
||||
return [
|
||||
Declarations::ACTIVITY,
|
||||
Declarations::ACTIVITY_PERSON,
|
||||
//PersonDeclarations::PERSON_TYPE,
|
||||
];
|
||||
}
|
||||
|
||||
public function getGroup(): string
|
||||
{
|
||||
return 'Exports of activities linked to a person';
|
||||
return ['person', 'activity'];
|
||||
}
|
||||
}
|
@@ -1,85 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
||||
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class BySocialActionFilter implements FilterInterface
|
||||
{
|
||||
private SocialActionRender $actionRender;
|
||||
|
||||
public function __construct(SocialActionRender $actionRender)
|
||||
{
|
||||
$this->actionRender = $actionRender;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('accepted_socialactions', EntityType::class, [
|
||||
'class' => SocialAction::class,
|
||||
'choice_label' => function (SocialAction $sa) {
|
||||
return $this->actionRender->renderString($sa, []);
|
||||
},
|
||||
'multiple' => true,
|
||||
'expanded' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Filter activity by linked socialaction';
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
$actions = [];
|
||||
|
||||
foreach ($data['accepted_socialactions'] as $sa) {
|
||||
$actions[] = $this->actionRender->renderString($sa, []);
|
||||
}
|
||||
|
||||
return ['Filtered activity by linked socialaction: only %actions%', [
|
||||
'%actions%' => implode(", ou ", $actions)
|
||||
]];
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
if (!in_array('socialaction', $qb->getAllAliases())) {
|
||||
$qb->join('activity.socialActions', 'socialaction');
|
||||
}
|
||||
|
||||
$clause = $qb->expr()->in('socialaction.id', ':socialactions');
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('socialactions', $data['accepted_socialactions']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
}
|
@@ -1,85 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
||||
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class BySocialIssueFilter implements FilterInterface
|
||||
{
|
||||
private SocialIssueRender $issueRender;
|
||||
|
||||
public function __construct(SocialIssueRender $issueRender)
|
||||
{
|
||||
$this->issueRender = $issueRender;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('accepted_socialissues', EntityType::class, [
|
||||
'class' => SocialIssue::class,
|
||||
'choice_label' => function(SocialIssue $si) {
|
||||
return $this->issueRender->renderString($si, []);
|
||||
},
|
||||
'multiple' => true,
|
||||
'expanded' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Filter activity by linked socialissue';
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
$issues = [];
|
||||
|
||||
foreach ($data['accepted_socialissues'] as $si) {
|
||||
$issues[] = $this->issueRender->renderString($si, []);
|
||||
}
|
||||
|
||||
return ['Filtered activity by linked socialissue: only %issues%', [
|
||||
'%issues%' => implode(", ou ", $issues)
|
||||
]];
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
if (!in_array('socialissue', $qb->getAllAliases())) {
|
||||
$qb->join('activity.socialIssues', 'socialissue');
|
||||
}
|
||||
|
||||
$clause = $qb->expr()->in('socialissue.id', ':socialissues');
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('socialissues', $data['accepted_socialissues']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
}
|
@@ -1,84 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
||||
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Templating\Entity\UserRender;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ByUserFilter implements FilterInterface
|
||||
{
|
||||
private UserRender $userRender;
|
||||
|
||||
public function __construct(UserRender $userRender)
|
||||
{
|
||||
$this->userRender = $userRender;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('accepted_users', EntityType::class, [
|
||||
'class' => User::class,
|
||||
'choice_label' => function (User $u) {
|
||||
return $this->userRender->renderString($u, []);
|
||||
},
|
||||
'multiple' => true,
|
||||
'expanded' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Filter activity by linked users';
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
$users = [];
|
||||
|
||||
foreach ($data['accepted_users'] as $u) {
|
||||
$users[] = $this->userRender->renderString($u, []);
|
||||
}
|
||||
|
||||
return ['Filtered activity by linked users: only %users%', [
|
||||
'%users%' => implode(", ou ", $users)
|
||||
]];
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
if (!in_array('user', $qb->getAllAliases())) {
|
||||
$qb->join('activity.users', 'user');
|
||||
}
|
||||
|
||||
$clause = $qb->expr()->in('user.id', ':users');
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('users', $data['accepted_users']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
}
|
@@ -1,86 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
||||
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class EmergencyFilter implements FilterInterface
|
||||
{
|
||||
private const CHOICES = [
|
||||
'activity is emergency' => true,
|
||||
'activity is not emergency' => false,
|
||||
];
|
||||
|
||||
private CONST DEFAULT_CHOICE = false;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('accepted_emergency', ChoiceType::class, [
|
||||
'choices' => self::CHOICES,
|
||||
'multiple' => false,
|
||||
'expanded' => true,
|
||||
'empty_data' => self::DEFAULT_CHOICE,
|
||||
'data' => self::DEFAULT_CHOICE,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Filter activity by emergency';
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
foreach (self::CHOICES as $k => $v) {
|
||||
if ($v === $data['accepted_emergency']) {
|
||||
$choice = $k;
|
||||
}
|
||||
}
|
||||
|
||||
return ['Filtered activity by emergency: only %emergency%', [
|
||||
'%emergency%' => $this->translator->trans($choice)
|
||||
]];
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
$clause = $qb->expr()->eq('activity.emergency', ':emergency');
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('emergency', $data['accepted_emergency']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
}
|
@@ -1,85 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
||||
|
||||
use Chill\MainBundle\Entity\LocationType;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class LocationTypeFilter implements FilterInterface
|
||||
{
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('accepted_locationtype', EntityType::class, [
|
||||
'class' => LocationType::class,
|
||||
'choice_label' => function(LocationType $type) {
|
||||
return $this->translatableStringHelper->localize($type->getTitle());
|
||||
},
|
||||
'multiple' => true,
|
||||
'expanded' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Filter activity by locationtype';
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
$types = [];
|
||||
|
||||
foreach ($data['accepted_locationtype'] as $type) {
|
||||
$types[] = $this->translatableStringHelper->localize(
|
||||
$type->getTitle()
|
||||
);
|
||||
}
|
||||
|
||||
return ['Filtered activity by locationtype: only %types%', [
|
||||
'%types%' => implode(", ou ", $types)
|
||||
]];
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('location', $qb->getAllAliases())) {
|
||||
$qb->join('activity.location', 'location');
|
||||
}
|
||||
|
||||
$where = $qb->getDQLPart('where');
|
||||
$clause = $qb->expr()->in('location.locationType', ':locationtype');
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('locationtype', $data['accepted_locationtype']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
}
|
@@ -1,82 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
||||
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class SentReceivedFilter implements FilterInterface
|
||||
{
|
||||
private const CHOICES = [
|
||||
'is sent' => Activity::SENTRECEIVED_SENT,
|
||||
'is received' => Activity::SENTRECEIVED_RECEIVED,
|
||||
];
|
||||
|
||||
private CONST DEFAULT_CHOICE = Activity::SENTRECEIVED_SENT;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('accepted_sentreceived', ChoiceType::class, [
|
||||
'choices' => self::CHOICES,
|
||||
'multiple' => false,
|
||||
'expanded' => true,
|
||||
'empty_data' => self::DEFAULT_CHOICE,
|
||||
'data' => self::DEFAULT_CHOICE,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Filter activity by sentreceived';
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
$sentreceived = array_flip(self::CHOICES)[$data['accepted_sentreceived']];
|
||||
|
||||
return ['Filtered activity by sentreceived: only %sentreceived%', [
|
||||
'%sentreceived%' => $this->translator->trans($sentreceived)
|
||||
]];
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
$clause = $qb->expr()->eq('activity.sentReceived', ':sentreceived');
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('sentreceived', $data['accepted_sentreceived']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
}
|
@@ -1,82 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
||||
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Templating\Entity\UserRender;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class UserFilter implements FilterInterface
|
||||
{
|
||||
private UserRender $userRender;
|
||||
|
||||
public function __construct(UserRender $userRender)
|
||||
{
|
||||
$this->userRender = $userRender;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('accepted_users', EntityType::class, [
|
||||
'class' => User::class,
|
||||
'choice_label' => function (User $u) {
|
||||
return $this->userRender->renderString($u, []);
|
||||
},
|
||||
'multiple' => true,
|
||||
'expanded' => true,
|
||||
'label' => 'Creators'
|
||||
]);
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Filter activity by user';
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
$users = [];
|
||||
|
||||
foreach ($data['accepted_users'] as $u) {
|
||||
$users[] = $this->userRender->renderString($u, []);
|
||||
}
|
||||
|
||||
return ['Filtered activity by user: only %users%', [
|
||||
'%users%' => implode(", ou ", $users)
|
||||
]];
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
$clause = $qb->expr()->in('activity.user', ':users');
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('users', $data['accepted_users']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
}
|
@@ -1,89 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
||||
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class UserScopeFilter implements FilterInterface
|
||||
{
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('accepted_userscope', EntityType::class, [
|
||||
'class' => Scope::class,
|
||||
'choice_label' => function (Scope $s) {
|
||||
return $this->translatableStringHelper->localize(
|
||||
$s->getName()
|
||||
);
|
||||
},
|
||||
'multiple' => true,
|
||||
'expanded' => true
|
||||
]);
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Filter activity by userscope';
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
$scopes = [];
|
||||
|
||||
foreach ($data['accepted_userscope'] as $s) {
|
||||
$scopes[] = $this->translatableStringHelper->localize(
|
||||
$s->getName()
|
||||
);
|
||||
}
|
||||
|
||||
return ['Filtered activity by userscope: only %scopes%', [
|
||||
'%scopes%' => implode(", ou ", $scopes)
|
||||
]];
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('user', $qb->getAllAliases())) {
|
||||
$qb->join('activity.user', 'user');
|
||||
}
|
||||
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
$clause = $qb->expr()->in('user.mainScope', ':userscope');
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('userscope', $data['accepted_userscope']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
}
|
@@ -1,32 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
use Chill\MainBundle\Form\Type\Export\FilterType;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\Query\Expr;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||
use Symfony\Component\Form\FormError;
|
||||
use Symfony\Component\Form\FormEvent;
|
||||
use Symfony\Component\Form\FormEvents;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
class ActivityDateFilter implements FilterInterface
|
||||
{
|
||||
protected TranslatorInterface $translator;
|
||||
/**
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
{
|
||||
@@ -38,7 +40,7 @@ class ActivityDateFilter implements FilterInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
public function alterQuery(\Doctrine\ORM\QueryBuilder $qb, $data)
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
$clause = $qb->expr()->between(
|
||||
@@ -58,23 +60,28 @@ class ActivityDateFilter implements FilterInterface
|
||||
$qb->setParameter('date_to', $data['date_to']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
public function applyOn()
|
||||
{
|
||||
return Declarations::ACTIVITY;
|
||||
return 'activity';
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder)
|
||||
{
|
||||
$builder
|
||||
->add('date_from', ChillDateType::class, [
|
||||
'label' => 'Activities after this date',
|
||||
'data' => new DateTime(),
|
||||
])
|
||||
->add('date_to', ChillDateType::class, [
|
||||
'label' => 'Activities before this date',
|
||||
'data' => new DateTime(),
|
||||
])
|
||||
;
|
||||
$builder->add('date_from', DateType::class, [
|
||||
'label' => 'Activities after this date',
|
||||
'data' => new DateTime(),
|
||||
'attr' => ['class' => 'datepicker'],
|
||||
'widget' => 'single_text',
|
||||
'format' => 'dd-MM-yyyy',
|
||||
]);
|
||||
|
||||
$builder->add('date_to', DateType::class, [
|
||||
'label' => 'Activities before this date',
|
||||
'data' => new DateTime(),
|
||||
'attr' => ['class' => 'datepicker'],
|
||||
'widget' => 'single_text',
|
||||
'format' => 'dd-MM-yyyy',
|
||||
]);
|
||||
|
||||
$builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
|
||||
/** @var \Symfony\Component\Form\FormInterface $filterForm */
|
||||
@@ -124,8 +131,7 @@ class ActivityDateFilter implements FilterInterface
|
||||
[
|
||||
'%date_from%' => $data['date_from']->format('d-m-Y'),
|
||||
'%date_to%' => $data['date_to']->format('d-m-Y'),
|
||||
],
|
||||
];
|
||||
], ];
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
|
@@ -1,24 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter\PersonFilters;
|
||||
namespace Chill\ActivityBundle\Export\Filter;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\ActivityBundle\Repository\ActivityReasonRepository;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query\Expr;
|
||||
use Doctrine\ORM\Query\Expr\Join;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
@@ -30,18 +30,28 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use function array_key_exists;
|
||||
use function count;
|
||||
|
||||
class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInterface
|
||||
class ActivityReasonFilter implements
|
||||
ExportElementValidatedInterface,
|
||||
FilterInterface
|
||||
{
|
||||
protected ActivityReasonRepository $activityReasonRepository;
|
||||
/**
|
||||
* The repository for activity reasons.
|
||||
*
|
||||
* @var EntityRepository
|
||||
*/
|
||||
protected $reasonRepository;
|
||||
|
||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
||||
/**
|
||||
* @var TranslatableStringHelper
|
||||
*/
|
||||
protected $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
TranslatableStringHelper $helper,
|
||||
ActivityReasonRepository $activityReasonRepository
|
||||
EntityRepository $reasonRepository
|
||||
) {
|
||||
$this->translatableStringHelper = $helper;
|
||||
$this->activityReasonRepository = $activityReasonRepository;
|
||||
$this->reasonRepository = $reasonRepository;
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
@@ -80,17 +90,24 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt
|
||||
$qb->setParameter('selected_activity_reasons', $data['reasons']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
public function applyOn()
|
||||
{
|
||||
return Declarations::ACTIVITY_PERSON;
|
||||
return 'activity';
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
//create a local copy of translatableStringHelper
|
||||
$helper = $this->translatableStringHelper;
|
||||
|
||||
$builder->add('reasons', EntityType::class, [
|
||||
'class' => ActivityReason::class,
|
||||
'choice_label' => fn (ActivityReason $reason) => $this->translatableStringHelper->localize($reason->getName()),
|
||||
'group_by' => fn (ActivityReason $reason) => $this->translatableStringHelper->localize($reason->getCategory()->getName()),
|
||||
'class' => 'ChillActivityBundle:ActivityReason',
|
||||
'choice_label' => static function (ActivityReason $reason) use ($helper) {
|
||||
return $helper->localize($reason->getName());
|
||||
},
|
||||
'group_by' => static function (ActivityReason $reason) use ($helper) {
|
||||
return $helper->localize($reason->getCategory()->getName());
|
||||
},
|
||||
'multiple' => true,
|
||||
'expanded' => false,
|
||||
]);
|
||||
@@ -100,16 +117,14 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt
|
||||
{
|
||||
// collect all the reasons'name used in this filter in one array
|
||||
$reasonsNames = array_map(
|
||||
fn (ActivityReason $r): string => '"' . $this->translatableStringHelper->localize($r->getName()) . '"',
|
||||
$this->activityReasonRepository->findBy(['id' => $data['reasons']->toArray()])
|
||||
function (ActivityReason $r) {
|
||||
return '"' . $this->translatableStringHelper->localize($r->getName()) . '"';
|
||||
},
|
||||
$this->reasonRepository->findBy(['id' => $data['reasons']->toArray()])
|
||||
);
|
||||
|
||||
return [
|
||||
'Filtered by reasons: only %list%',
|
||||
[
|
||||
'%list%' => implode(', ', $reasonsNames),
|
||||
],
|
||||
];
|
||||
return ['Filtered by reasons: only %list%',
|
||||
['%list%' => implode(', ', $reasonsNames)], ];
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
@@ -120,8 +135,7 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt
|
||||
public function validateForm($data, ExecutionContextInterface $context)
|
||||
{
|
||||
if (null === $data['reasons'] || count($data['reasons']) === 0) {
|
||||
$context
|
||||
->buildViolation('At least one reason must be chosen')
|
||||
$context->buildViolation('At least one reason must be choosen')
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
@@ -131,8 +145,10 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt
|
||||
*
|
||||
* @param Join[] $joins
|
||||
* @param mixed $alias
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function checkJoinAlreadyDefined(array $joins, $alias): bool
|
||||
private function checkJoinAlreadyDefined(array $joins, $alias)
|
||||
{
|
||||
foreach ($joins as $join) {
|
||||
if ($join->getAlias() === $alias) {
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
@@ -12,12 +14,11 @@ declare(strict_types=1);
|
||||
namespace Chill\ActivityBundle\Export\Filter;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityType;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\ActivityBundle\Repository\ActivityTypeRepository;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query\Expr;
|
||||
use Doctrine\ORM\Query\Expr\Join;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
@@ -28,18 +29,28 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
use function count;
|
||||
|
||||
class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInterface
|
||||
class ActivityTypeFilter implements
|
||||
ExportElementValidatedInterface,
|
||||
FilterInterface
|
||||
{
|
||||
protected ActivityTypeRepository $activityTypeRepository;
|
||||
/**
|
||||
* @var TranslatableStringHelper
|
||||
*/
|
||||
protected $translatableStringHelper;
|
||||
|
||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
||||
/**
|
||||
* The repository for activity reasons.
|
||||
*
|
||||
* @var EntityRepository
|
||||
*/
|
||||
protected $typeRepository;
|
||||
|
||||
public function __construct(
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
ActivityTypeRepository $activityTypeRepository
|
||||
TranslatableStringHelper $helper,
|
||||
EntityRepository $typeRepository
|
||||
) {
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->activityTypeRepository = $activityTypeRepository;
|
||||
$this->translatableStringHelper = $helper;
|
||||
$this->typeRepository = $typeRepository;
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
@@ -50,7 +61,7 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
$clause = $qb->expr()->in('activity.activityType', ':selected_activity_types');
|
||||
$clause = $qb->expr()->in('activity.type', ':selected_activity_types');
|
||||
|
||||
if ($where instanceof Expr\Andx) {
|
||||
$where->add($clause);
|
||||
@@ -62,17 +73,21 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter
|
||||
$qb->setParameter('selected_activity_types', $data['types']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
public function applyOn()
|
||||
{
|
||||
return Declarations::ACTIVITY;
|
||||
return 'activity';
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
//create a local copy of translatableStringHelper
|
||||
$helper = $this->translatableStringHelper;
|
||||
|
||||
$builder->add('types', EntityType::class, [
|
||||
'class' => ActivityType::class,
|
||||
'choice_label' => fn (ActivityType $type) => $this->translatableStringHelper->localize($type->getName()),
|
||||
'group_by' => fn (ActivityType $type) => $this->translatableStringHelper->localize($type->getCategory()->getName()),
|
||||
'choice_label' => static function (ActivityType $type) use ($helper) {
|
||||
return $helper->localize($type->getName());
|
||||
},
|
||||
'multiple' => true,
|
||||
'expanded' => false,
|
||||
]);
|
||||
@@ -82,13 +97,14 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter
|
||||
{
|
||||
// collect all the reasons'name used in this filter in one array
|
||||
$reasonsNames = array_map(
|
||||
fn (ActivityType $t): string => $this->translatableStringHelper->localize($t->getName()),
|
||||
$this->activityTypeRepository->findBy(['id' => $data['types']->toArray()])
|
||||
function (ActivityType $t) {
|
||||
return '"' . $this->translatableStringHelper->localize($t->getName()) . '"';
|
||||
},
|
||||
$this->typeRepository->findBy(['id' => $data['types']->toArray()])
|
||||
);
|
||||
|
||||
return ['Filtered by activity type: only %list%', [
|
||||
'%list%' => implode(', ou ', $reasonsNames),
|
||||
]];
|
||||
return ['Filtered by activity type: only %list%',
|
||||
['%list%' => implode(', ', $reasonsNames)], ];
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
@@ -99,8 +115,7 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter
|
||||
public function validateForm($data, ExecutionContextInterface $context)
|
||||
{
|
||||
if (null === $data['types'] || count($data['types']) === 0) {
|
||||
$context
|
||||
->buildViolation('At least one type must be chosen')
|
||||
$context->buildViolation('At least one type must be choosen')
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
@@ -1,50 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter\PersonFilters;
|
||||
namespace Chill\ActivityBundle\Export\Filter;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||
use Chill\ActivityBundle\Repository\ActivityReasonRepository;
|
||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Form\Type\Export\FilterType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query\Expr;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormError;
|
||||
use Symfony\Component\Form\FormEvent;
|
||||
use Symfony\Component\Form\FormEvents;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
use function count;
|
||||
|
||||
class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInterface, FilterInterface
|
||||
class PersonHavingActivityBetweenDateFilter implements
|
||||
ExportElementValidatedInterface,
|
||||
FilterInterface
|
||||
{
|
||||
protected ActivityReasonRepository $activityReasonRepository;
|
||||
/**
|
||||
* @var EntityRepository
|
||||
*/
|
||||
protected $activityReasonRepository;
|
||||
|
||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
||||
/**
|
||||
* @var TranslatableStringHelper
|
||||
*/
|
||||
protected $translatableStringHelper;
|
||||
|
||||
protected TranslatorInterface $translator;
|
||||
/**
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
public function __construct(
|
||||
TranslatableStringHelper $translatableStringHelper,
|
||||
ActivityReasonRepository $activityReasonRepository,
|
||||
EntityRepository $activityReasonRepository,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
@@ -57,23 +66,23 @@ class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInt
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
public function alterQuery(\Doctrine\ORM\QueryBuilder $qb, $data)
|
||||
{
|
||||
// create a query for activity
|
||||
$sqb = $qb->getEntityManager()->createQueryBuilder();
|
||||
$sqb->select('person_person_having_activity.id')
|
||||
->from('ChillActivityBundle:Activity', 'activity_person_having_activity')
|
||||
->join('activity_person_having_activity.person', 'person_person_having_activity');
|
||||
|
||||
// add clause between date
|
||||
$sqb->where('activity_person_having_activity.date BETWEEN '
|
||||
. ':person_having_activity_between_date_from'
|
||||
. ' AND '
|
||||
. ':person_having_activity_between_date_to');
|
||||
|
||||
. ':person_having_activity_between_date_from'
|
||||
. ' AND '
|
||||
. ':person_having_activity_between_date_to');
|
||||
// add clause activity reason
|
||||
$sqb->join('activity_person_having_activity.reasons', 'reasons_person_having_activity');
|
||||
|
||||
$sqb->join(
|
||||
'activity_person_having_activity.reasons',
|
||||
'reasons_person_having_activity'
|
||||
);
|
||||
$sqb->andWhere(
|
||||
$sqb->expr()->in(
|
||||
'reasons_person_having_activity',
|
||||
@@ -102,12 +111,12 @@ class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInt
|
||||
$qb->setParameter('person_having_activity_reasons', $data['reasons']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
public function applyOn()
|
||||
{
|
||||
return Declarations::PERSON_IMPLIED_IN;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('date_from', DateType::class, [
|
||||
'label' => 'Implied in an activity after this date',
|
||||
@@ -126,9 +135,15 @@ class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInt
|
||||
]);
|
||||
|
||||
$builder->add('reasons', EntityType::class, [
|
||||
'class' => ActivityReason::class,
|
||||
'choice_label' => fn (ActivityReason $reason): ?string => $this->translatableStringHelper->localize($reason->getName()),
|
||||
'group_by' => fn (ActivityReason $reason): ?string => $this->translatableStringHelper->localize($reason->getCategory()->getName()),
|
||||
'class' => 'ChillActivityBundle:ActivityReason',
|
||||
'choice_label' => function (ActivityReason $reason) {
|
||||
return $this->translatableStringHelper
|
||||
->localize($reason->getName());
|
||||
},
|
||||
'group_by' => function (ActivityReason $reason) {
|
||||
return $this->translatableStringHelper
|
||||
->localize($reason->getCategory()->getName());
|
||||
},
|
||||
'data' => $this->activityReasonRepository->findAll(),
|
||||
'multiple' => true,
|
||||
'expanded' => false,
|
||||
@@ -136,7 +151,7 @@ class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInt
|
||||
]);
|
||||
|
||||
$builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
|
||||
/** @var FormInterface $filterForm */
|
||||
/** @var \Symfony\Component\Form\FormInterface $filterForm */
|
||||
$filterForm = $event->getForm()->getParent();
|
||||
$enabled = $filterForm->get(FilterType::ENABLED_FIELD)->getData();
|
||||
|
||||
@@ -184,15 +199,14 @@ class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInt
|
||||
[
|
||||
'%date_from%' => $data['date_from']->format('d-m-Y'),
|
||||
'%date_to%' => $data['date_to']->format('d-m-Y'),
|
||||
'%reasons_name%' => implode(
|
||||
', ',
|
||||
array_map(
|
||||
fn (ActivityReason $r): string => '"' . $this->translatableStringHelper->localize($r->getName()) . '"',
|
||||
$data['reasons']
|
||||
)
|
||||
),
|
||||
],
|
||||
];
|
||||
'%reasons_name%' => implode(', ', array_map(
|
||||
function (ActivityReason $r) {
|
||||
return '"' . $this->translatableStringHelper->
|
||||
localize($r->getName()) . '"';
|
||||
},
|
||||
$data['reasons']
|
||||
)),
|
||||
], ];
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
@@ -203,7 +217,7 @@ class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInt
|
||||
public function validateForm($data, ExecutionContextInterface $context)
|
||||
{
|
||||
if (null === $data['reasons'] || count($data['reasons']) === 0) {
|
||||
$context->buildViolation('At least one reason must be chosen')
|
||||
$context->buildViolation('At least one reason must be choosen')
|
||||
->addViolation();
|
||||
}
|
||||
}
|
@@ -1,42 +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\Form;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityPresence;
|
||||
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class ActivityPresenceType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('name', TranslatableStringFormType::class)
|
||||
->add('active', ChoiceType::class, [
|
||||
'choices' => [
|
||||
'Yes' => true,
|
||||
'No' => false,
|
||||
],
|
||||
'expanded' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => ActivityPresence::class,
|
||||
]);
|
||||
}
|
||||
}
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* 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.
|
||||
*
|
||||
* @see https://www.champs-libres.coop/
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user