diff --git a/.changes/v2.9.1.md b/.changes/v2.9.1.md new file mode 100644 index 000000000..2e0ddc3ab --- /dev/null +++ b/.changes/v2.9.1.md @@ -0,0 +1,3 @@ +## v2.9.1 - 2023-10-17 +### Fixed +* Fix the handling of activity form when editing or creating an activity in an accompanying period with multiple centers diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ade82289..ac742bf77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). +## v2.9.1 - 2023-10-17 +### Fixed +* Fix the handling of activity form when editing or creating an activity in an accompanying period with multiple centers + ## v2.9.0 - 2023-10-17 ### Feature * ([#147](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/147)) Add history to scopes and to jobs in administrator section. When user job or main scope of user is changed, automaticaly add a new row in history. diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php index 8ea117c4a..03a21a5b7 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php @@ -87,8 +87,7 @@ class ActivityType extends AbstractType /** @var \Chill\ActivityBundle\Entity\ActivityType $activityType */ $activityType = $options['activityType']; - // TODO revoir la gestion des center au niveau du form des activité. - if ($options['center'] instanceof Center && null !== $options['data']->getPerson()) { + if (null !== $options['data']->getPerson()) { $builder->add('scope', ScopePickerType::class, [ 'center' => $options['center'], 'role' => ActivityVoter::CREATE === (string) $options['role'] ? ActivityVoter::CREATE_PERSON : (string) $options['role'], @@ -192,7 +191,7 @@ class ActivityType extends AbstractType ]); } - if ($activityType->isVisible('user') && $options['center'] instanceof Center) { + if ($activityType->isVisible('user')) { $builder->add('user', PickUserDynamicType::class, [ 'label' => $activityType->getLabel('user'), 'required' => $activityType->isRequired('user'), @@ -402,7 +401,7 @@ class ActivityType extends AbstractType $resolver ->setRequired(['center', 'role', 'activityType', 'accompanyingPeriod']) - ->setAllowedTypes('center', ['null', Center::class]) + ->setAllowedTypes('center', ['null', Center::class, 'array']) ->setAllowedTypes('role', ['string']) ->setAllowedTypes('activityType', \Chill\ActivityBundle\Entity\ActivityType::class) ->setAllowedTypes('accompanyingPeriod', [\Chill\PersonBundle\Entity\AccompanyingPeriod::class, 'null']);