From be8901a5c44949c8813efe5746d5eaa290188203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 16 Sep 2024 15:52:48 +0200 Subject: [PATCH 001/103] Fix referrer scope date comparison in aggregator Correct the date comparison logic to use openingDate instead of closingDate when evaluating user history end dates. This ensures accurate grouping by referrer in the accompanying course aggregators. Added a changelog entry for Issue #309. --- .changes/unreleased/Fixed-20240916-155150.yaml | 6 ++++++ .../ReferrerScopeAggregator.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Fixed-20240916-155150.yaml diff --git a/.changes/unreleased/Fixed-20240916-155150.yaml b/.changes/unreleased/Fixed-20240916-155150.yaml new file mode 100644 index 000000000..52382db20 --- /dev/null +++ b/.changes/unreleased/Fixed-20240916-155150.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: | + Correctly compute the grouping by referrer aggregator +time: 2024-09-16T15:51:50.268336979+02:00 +custom: + Issue: "309" diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php index c183cff70..3525538fd 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php @@ -56,7 +56,7 @@ readonly class ReferrerScopeAggregator implements AggregatorInterface, DataTrans $qb->expr()->gte('COALESCE(acp.closingDate, CURRENT_TIMESTAMP())', "{$p}_userHistory.startDate"), $qb->expr()->orX( $qb->expr()->isNull("{$p}_userHistory.endDate"), - $qb->expr()->lt('COALESCE(acp.closingDate, CURRENT_TIMESTAMP())', "{$p}_userHistory.endDate") + $qb->expr()->lt('COALESCE(acp.openingDate, CURRENT_TIMESTAMP())', "{$p}_userHistory.endDate") ) ), $qb->expr()->andX( From 8e30873001791effff4e49b2379f560fc45e2397 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 25 Sep 2024 16:02:40 +0200 Subject: [PATCH 002/103] Create gender admin entity and add configuration to use it entity, migration, controller, repository, templates, form added --- .../Controller/GenderController.php | 17 ++++ .../ChillMainExtension.php | 25 +++++ src/Bundle/ChillMainBundle/Entity/Gender.php | 93 +++++++++++++++++++ .../ChillMainBundle/Form/GenderType.php | 44 +++++++++ .../Repository/GenderRepository.php | 7 ++ .../Resources/views/Gender/edit.html.twig | 11 +++ .../Resources/views/Gender/index.html.twig | 53 +++++++++++ .../Resources/views/Gender/new.html.twig | 11 +++ .../migrations/Version20240925133053.php | 28 ++++++ .../Menu/AdminPersonMenuBuilder.php | 8 +- 10 files changed, 295 insertions(+), 2 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Controller/GenderController.php create mode 100644 src/Bundle/ChillMainBundle/Entity/Gender.php create mode 100644 src/Bundle/ChillMainBundle/Form/GenderType.php create mode 100644 src/Bundle/ChillMainBundle/Repository/GenderRepository.php create mode 100644 src/Bundle/ChillMainBundle/Resources/views/Gender/edit.html.twig create mode 100644 src/Bundle/ChillMainBundle/Resources/views/Gender/index.html.twig create mode 100644 src/Bundle/ChillMainBundle/Resources/views/Gender/new.html.twig create mode 100644 src/Bundle/ChillMainBundle/migrations/Version20240925133053.php diff --git a/src/Bundle/ChillMainBundle/Controller/GenderController.php b/src/Bundle/ChillMainBundle/Controller/GenderController.php new file mode 100644 index 000000000..8a949294f --- /dev/null +++ b/src/Bundle/ChillMainBundle/Controller/GenderController.php @@ -0,0 +1,17 @@ +addOrderBy('e.order', 'ASC'); + + return parent::orderQuery($action, $query, $request, $paginator); + } +} diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index 9d788c64e..b406f56f1 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -17,6 +17,7 @@ use Chill\MainBundle\Controller\CivilityApiController; use Chill\MainBundle\Controller\CivilityController; use Chill\MainBundle\Controller\CountryApiController; use Chill\MainBundle\Controller\CountryController; +use Chill\MainBundle\Controller\GenderController; use Chill\MainBundle\Controller\GeographicalUnitApiController; use Chill\MainBundle\Controller\LanguageController; use Chill\MainBundle\Controller\LocationController; @@ -52,6 +53,7 @@ use Chill\MainBundle\Doctrine\Type\PointType; use Chill\MainBundle\Entity\Center; use Chill\MainBundle\Entity\Civility; use Chill\MainBundle\Entity\Country; +use Chill\MainBundle\Entity\Gender; use Chill\MainBundle\Entity\GeographicalUnitLayer; use Chill\MainBundle\Entity\Language; use Chill\MainBundle\Entity\Location; @@ -63,6 +65,7 @@ use Chill\MainBundle\Entity\UserJob; use Chill\MainBundle\Form\CenterType; use Chill\MainBundle\Form\CivilityType; use Chill\MainBundle\Form\CountryType; +use Chill\MainBundle\Form\GenderType; use Chill\MainBundle\Form\LanguageType; use Chill\MainBundle\Form\LocationFormType; use Chill\MainBundle\Form\LocationTypeType; @@ -485,6 +488,28 @@ class ChillMainExtension extends Extension implements ], ], ], + [ + 'class' => Gender::class, + 'name' => 'main_gender', + 'base_path' => '/admin/main/gender', + 'base_role' => 'ROLE_ADMIN', + 'form_class' => GenderType::class, + 'controller' => GenderController::class, + 'actions' => [ + 'index' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillMain/Gender/index.html.twig', + ], + 'new' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillMain/Gender/new.html.twig', + ], + 'edit' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillMain/Gender/edit.html.twig', + ], + ], + ], [ 'class' => Language::class, 'name' => 'main_language', diff --git a/src/Bundle/ChillMainBundle/Entity/Gender.php b/src/Bundle/ChillMainBundle/Entity/Gender.php new file mode 100644 index 000000000..8bc94e473 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Entity/Gender.php @@ -0,0 +1,93 @@ + '0.0'])] + private float $order = 0; + + public function getId(): int + { + return $this->id; + } + + public function getLabel(): array + { + return $this->label; + } + + public function setLabel(array $label): void + { + $this->label = $label; + } + + public function isActive(): bool + { + return $this->active; + } + + public function setActive(bool $active): void + { + $this->active = $active; + } + + public function isGrammatical(): bool + { + return $this->isGrammatical; + } + + public function setIsGrammatical(bool $isGrammatical): void + { + $this->isGrammatical = $isGrammatical; + } + + public function getIcon(): string + { + return $this->icon; + } + + public function setIcon(string $icon): void + { + $this->icon = $icon; + } + + public function getOrder(): float + { + return $this->order; + } + + public function setOrder(float $order): void + { + $this->order = $order; + } +} diff --git a/src/Bundle/ChillMainBundle/Form/GenderType.php b/src/Bundle/ChillMainBundle/Form/GenderType.php new file mode 100644 index 000000000..2f188ba58 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Form/GenderType.php @@ -0,0 +1,44 @@ +add('label', TranslatableStringFormType::class, [ + 'required' => true, + ]) + ->add('icon', TextType::class) + ->add('isGrammatical', ChoiceType::class, [ + 'choices' => [ + 'Grammatical' => true, + 'Not grammatical' => false, + ], + ]) + ->add('active', ChoiceType::class, [ + 'choices' => [ + 'Active' => true, + 'Inactive' => false, + ], + ]) + ->add('order', IntegerType::class); + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Gender::class, + ]); + } +} diff --git a/src/Bundle/ChillMainBundle/Repository/GenderRepository.php b/src/Bundle/ChillMainBundle/Repository/GenderRepository.php new file mode 100644 index 000000000..357e301b5 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Repository/GenderRepository.php @@ -0,0 +1,7 @@ +id + {{ 'gender.label'|trans }} + {{ 'gender.icon'|trans }} + {{ 'gender.isGrammatical'|trans }} + {{ 'gender.active'|trans }} + {{ 'gender.ordering'|trans }} + + {% endblock %} + {% block table_entities_tbody %} + {% for entity in entities %} + + {{ entity.id }} + {{ entity.label|localize_translatable_string }} +{# todo: decide which icon source to use#} + + + {%- if entity.isGrammatical -%} + + {%- else -%} + + {%- endif -%} + + + {%- if entity.active -%} + + {%- else -%} + + {%- endif -%} + + {{ entity.order }} + + + + + {% endfor %} + {% endblock %} + + {% block actions_before %} +
  • + {{'Back to the admin'|trans}} +
  • + {% endblock %} + {% endembed %} +{% endblock %} diff --git a/src/Bundle/ChillMainBundle/Resources/views/Gender/new.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Gender/new.html.twig new file mode 100644 index 000000000..7c204dddd --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/views/Gender/new.html.twig @@ -0,0 +1,11 @@ +{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} + +{% block title %} + {% include('@ChillMain/CRUD/_new_title.html.twig') %} +{% endblock %} + +{% block admin_content %} + {% embed '@ChillMain/CRUD/_new_content.html.twig' %} + {% block content_form_actions_save_and_show %}{% endblock %} + {% endembed %} +{% endblock admin_content %} diff --git a/src/Bundle/ChillMainBundle/migrations/Version20240925133053.php b/src/Bundle/ChillMainBundle/migrations/Version20240925133053.php new file mode 100644 index 000000000..4767ff3bd --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20240925133053.php @@ -0,0 +1,28 @@ +addSql('CREATE SEQUENCE chill_main_gender_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE TABLE chill_main_gender (id INT NOT NULL, label JSON NOT NULL, active BOOLEAN NOT NULL, isGrammatical BOOLEAN NOT NULL, icon VARCHAR(255) NOT NULL, ordering DOUBLE PRECISION DEFAULT \'0.0\', PRIMARY KEY(id))'); + } + + public function down(Schema $schema): void + { + $this->addSql('DROP SEQUENCE chill_main_gender_id_seq CASCADE'); + $this->addSql('DROP TABLE chill_main_gender'); + } +} diff --git a/src/Bundle/ChillPersonBundle/Menu/AdminPersonMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/AdminPersonMenuBuilder.php index ee2dad9dc..c3d369f00 100644 --- a/src/Bundle/ChillPersonBundle/Menu/AdminPersonMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/AdminPersonMenuBuilder.php @@ -45,13 +45,17 @@ class AdminPersonMenuBuilder implements LocalMenuBuilderInterface 'route' => 'chill_crud_main_civility_index', ])->setExtras(['order' => 2010]); + $menu->addChild('Gender', [ + 'route' => 'chill_crud_main_gender_index', + ])->setExtras(['order' => 2020]); + $menu->addChild('Marital status', [ 'route' => 'chill_crud_person_marital-status_index', - ])->setExtras(['order' => 2020]); + ])->setExtras(['order' => 2030]); $menu->addChild('person_admin.person_resource_kind', [ 'route' => 'chill_crud_person_resource-kind_index', - ])->setExtras(['order' => 2030]); + ])->setExtras(['order' => 2040]); } public static function getMenuIds(): array From 94875d83b31453072a0cdc396af849df0d6cc83c Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 26 Sep 2024 12:20:36 +0200 Subject: [PATCH 003/103] Create genderEnum, add genderTranslation property to Gender entity and new gender property to Person entity Also migrations were created to handle the changes in the database. --- src/Bundle/ChillMainBundle/Entity/Gender.php | 14 ++--- .../ChillMainBundle/Entity/GenderEnum.php | 11 ++++ .../migrations/Version20240926093955.php | 62 +++++++++++++++++++ .../ChillPersonBundle/Entity/Person.php | 25 ++++---- .../migrations/Version20240926100337.php | 41 ++++++++++++ 5 files changed, 135 insertions(+), 18 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Entity/GenderEnum.php create mode 100644 src/Bundle/ChillMainBundle/migrations/Version20240926093955.php create mode 100644 src/Bundle/ChillPersonBundle/migrations/Version20240926100337.php diff --git a/src/Bundle/ChillMainBundle/Entity/Gender.php b/src/Bundle/ChillMainBundle/Entity/Gender.php index 8bc94e473..a14f433c8 100644 --- a/src/Bundle/ChillMainBundle/Entity/Gender.php +++ b/src/Bundle/ChillMainBundle/Entity/Gender.php @@ -25,9 +25,9 @@ class Gender #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $active = true; - #[Serializer\Groups(['read'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] - private bool $isGrammatical = true; + #[Assert\NotNull(message: 'You must choose a gender translation')] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, enumType: GenderEnum::class)] + private GenderEnum $genderTranslation; #[Serializer\Groups(['read'])] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)] @@ -61,14 +61,14 @@ class Gender $this->active = $active; } - public function isGrammatical(): bool + public function getGenderTranslation(): GenderEnum { - return $this->isGrammatical; + return $this->genderTranslation; } - public function setIsGrammatical(bool $isGrammatical): void + public function setGenderTranslation(GenderEnum $genderTranslation): void { - $this->isGrammatical = $isGrammatical; + $this->$genderTranslation = $genderTranslation; } public function getIcon(): string diff --git a/src/Bundle/ChillMainBundle/Entity/GenderEnum.php b/src/Bundle/ChillMainBundle/Entity/GenderEnum.php new file mode 100644 index 000000000..d171ea343 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Entity/GenderEnum.php @@ -0,0 +1,11 @@ +addSql('CREATE SEQUENCE chill_main_gender_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE TABLE chill_main_gender (id INT NOT NULL, label JSON NOT NULL, active BOOLEAN NOT NULL, genderTranslation VARCHAR(255) NOT NULL, icon VARCHAR(255) NOT NULL, ordering DOUBLE PRECISION DEFAULT \'0.0\', PRIMARY KEY(id))'); + + // Insert the four gender records into the chill_main_gender table + $this->addSql(" + INSERT INTO chill_main_gender (id, label, active, genderTranslation, icon, ordering) + VALUES + (nextval('chill_main_gender_id_seq'), + '{\"fr\": \"homme\", \"nl\": \"man\"}', + true, + 'man', + '', + 1.0 + ), + (nextval('chill_main_gender_id_seq'), + '{\"fr\": \"femme\", \"nl\": \"vrouw\"}', + true, + 'woman', + '', + 1.1 + ), + (nextval('chill_main_gender_id_seq'), + '{\"fr\": \"neutre\", \"nl\": \"neutraal\"}', + true, + 'neutral', + '', + 1.1 + ), + (nextval('chill_main_gender_id_seq'), + '{\"fr\": \"inconnu\", \"nl\": \"ongekend\"}', + true, + 'unknown', + '', + 1.2 + ) + "); + } + + public function down(Schema $schema): void + { + $this->addSql('DROP SEQUENCE chill_main_gender_id_seq CASCADE'); + $this->addSql('DROP TABLE chill_main_gender'); + } +} diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index 0b4b54681..c8ba84797 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -21,6 +21,7 @@ use Chill\MainBundle\Entity\Center; use Chill\MainBundle\Entity\Civility; use Chill\MainBundle\Entity\Country; use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; +use Chill\MainBundle\Entity\Gender; use Chill\MainBundle\Entity\HasCenterInterface; use Chill\MainBundle\Entity\Language; use Chill\MainBundle\Entity\User; @@ -59,19 +60,11 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; #[HouseholdMembershipSequential(groups: ['household_memberships'])] class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateInterface, \Stringable { - final public const BOTH_GENDER = 'both'; - // have days in commun final public const ERROR_ADDIND_PERIOD_AFTER_AN_OPEN_PERIOD = 2; // where there exist final public const ERROR_PERIODS_ARE_COLLAPSING = 1; // when two different periods - final public const FEMALE_GENDER = 'woman'; - - final public const MALE_GENDER = 'man'; - - final public const NO_INFORMATION = 'unknown'; - /** * Accept receiving email. */ @@ -242,11 +235,11 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI private ?string $fullnameCanonical = ''; /** - * The person's gender. + * NEW column : The person's gender. */ #[Assert\NotNull(message: 'The gender must be set')] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 9, nullable: true)] - private ?string $gender = null; + #[ORM\ManyToOne(targetEntity: Gender::class)] + private ?Gender $gender = null; /** * Comment on gender. @@ -1657,6 +1650,16 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI return $this; } + public function getGenderKind(): ?Gender + { + return $this->genderKind; + } + + public function setGenderKind(?Gender $genderKind): void + { + $this->genderKind = $genderKind; + } + private function getCurrentCenterHistory(): ?PersonCenterHistory { if (0 === $this->centerHistory->count()) { diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20240926100337.php b/src/Bundle/ChillPersonBundle/migrations/Version20240926100337.php new file mode 100644 index 000000000..021533efd --- /dev/null +++ b/src/Bundle/ChillPersonBundle/migrations/Version20240926100337.php @@ -0,0 +1,41 @@ +addSql('ALTER TABLE chill_person_person ADD gender_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_person_person ADD CONSTRAINT FK_BF210A14708A0E0 FOREIGN KEY (gender_id) REFERENCES chill_main_gender (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('CREATE INDEX IDX_BF210A14708A0E0 ON chill_person_person (gender_id)'); + + // transfer gender values to point to corresponding gender entity within new column + $this->addSql(" + UPDATE chill_person_person AS p + SET gender_id = g.id + FROM chill_main_gender AS g + WHERE g.genderTranslation = p.gender AND p.gender IN ('man', 'woman', 'unknown') + OR (g.genderTranslation = 'neutral' AND p.gender = 'both') + "); + + // delete old gender column + $this->addSql('ALTER TABLE chill_person_person DROP gender'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_person_person ADD gender VARCHAR(9) DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_person_person DROP gender_id'); + } +} From e831cb1656fb0c006d402c8a4cf0af669f8d531a Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 26 Sep 2024 13:24:30 +0200 Subject: [PATCH 004/103] Change PickGenderType form field to use in Person creation form --- .../ChillMainBundle/Form/GenderType.php | 11 ++-- .../Resources/views/Gender/index.html.twig | 11 +--- .../migrations/Version20240925133053.php | 28 ---------- .../ChillPersonBundle/Entity/Person.php | 14 +---- .../Form/CreationPersonType.php | 4 +- .../ChillPersonBundle/Form/PersonType.php | 4 +- .../Form/Type/GenderType.php | 44 --------------- .../Form/Type/PickGenderType.php | 53 +++++++++++++++++++ .../Resources/views/Entity/person.html.twig | 2 +- .../translations/messages+intl-icu.fr.yaml | 2 +- 10 files changed, 69 insertions(+), 104 deletions(-) delete mode 100644 src/Bundle/ChillMainBundle/migrations/Version20240925133053.php delete mode 100644 src/Bundle/ChillPersonBundle/Form/Type/GenderType.php create mode 100644 src/Bundle/ChillPersonBundle/Form/Type/PickGenderType.php diff --git a/src/Bundle/ChillMainBundle/Form/GenderType.php b/src/Bundle/ChillMainBundle/Form/GenderType.php index 2f188ba58..d6a95e803 100644 --- a/src/Bundle/ChillMainBundle/Form/GenderType.php +++ b/src/Bundle/ChillMainBundle/Form/GenderType.php @@ -3,6 +3,7 @@ namespace Chill\MainBundle\Form; use Chill\MainBundle\Entity\Gender; +use Chill\MainBundle\Entity\GenderEnum; use Chill\MainBundle\Form\Type\TranslatableStringFormType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; @@ -20,11 +21,11 @@ class GenderType extends AbstractType 'required' => true, ]) ->add('icon', TextType::class) - ->add('isGrammatical', ChoiceType::class, [ - 'choices' => [ - 'Grammatical' => true, - 'Not grammatical' => false, - ], + ->add('genderTranslation', ChoiceType::class, [ + 'choices' => GenderEnum::cases(), + 'choice_label' => fn(GenderEnum $enum) => ucfirst(strtolower($enum->name)), + 'choice_value' => fn(?GenderEnum $enum) => $enum ? $enum->value : null, + 'data_class' => null, ]) ->add('active', ChoiceType::class, [ 'choices' => [ diff --git a/src/Bundle/ChillMainBundle/Resources/views/Gender/index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Gender/index.html.twig index 82994aaa4..a46fbee56 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Gender/index.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Gender/index.html.twig @@ -6,7 +6,7 @@ id {{ 'gender.label'|trans }} {{ 'gender.icon'|trans }} - {{ 'gender.isGrammatical'|trans }} + {{ 'gender.genderTranslation'|trans }} {{ 'gender.active'|trans }} {{ 'gender.ordering'|trans }} @@ -16,15 +16,8 @@ {{ entity.id }} {{ entity.label|localize_translatable_string }} -{# todo: decide which icon source to use#} - - {%- if entity.isGrammatical -%} - - {%- else -%} - - {%- endif -%} - + {{ entity.genderTranslation.value }} {%- if entity.active -%} diff --git a/src/Bundle/ChillMainBundle/migrations/Version20240925133053.php b/src/Bundle/ChillMainBundle/migrations/Version20240925133053.php deleted file mode 100644 index 4767ff3bd..000000000 --- a/src/Bundle/ChillMainBundle/migrations/Version20240925133053.php +++ /dev/null @@ -1,28 +0,0 @@ -addSql('CREATE SEQUENCE chill_main_gender_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE TABLE chill_main_gender (id INT NOT NULL, label JSON NOT NULL, active BOOLEAN NOT NULL, isGrammatical BOOLEAN NOT NULL, icon VARCHAR(255) NOT NULL, ordering DOUBLE PRECISION DEFAULT \'0.0\', PRIMARY KEY(id))'); - } - - public function down(Schema $schema): void - { - $this->addSql('DROP SEQUENCE chill_main_gender_id_seq CASCADE'); - $this->addSql('DROP TABLE chill_main_gender'); - } -} diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index c8ba84797..aa59948df 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -996,7 +996,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI return $this->fullnameCanonical; } - public function getGender(): ?string + public function getGender(): ?Gender { return $this->gender; } @@ -1525,7 +1525,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI return $this; } - public function setGender(?string $gender): self + public function setGender(?Gender $gender): self { $this->gender = $gender; @@ -1650,16 +1650,6 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI return $this; } - public function getGenderKind(): ?Gender - { - return $this->genderKind; - } - - public function setGenderKind(?Gender $genderKind): void - { - $this->genderKind = $genderKind; - } - private function getCurrentCenterHistory(): ?PersonCenterHistory { if (0 === $this->centerHistory->count()) { diff --git a/src/Bundle/ChillPersonBundle/Form/CreationPersonType.php b/src/Bundle/ChillPersonBundle/Form/CreationPersonType.php index 9bfb75e31..bb40c6c35 100644 --- a/src/Bundle/ChillPersonBundle/Form/CreationPersonType.php +++ b/src/Bundle/ChillPersonBundle/Form/CreationPersonType.php @@ -20,8 +20,8 @@ use Chill\MainBundle\Form\Type\PickCenterType; use Chill\MainBundle\Form\Type\PickCivilityType; use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper; use Chill\PersonBundle\Entity\Person; -use Chill\PersonBundle\Form\Type\GenderType; use Chill\PersonBundle\Form\Type\PersonAltNameType; +use Chill\PersonBundle\Form\Type\PickGenderType; use Chill\PersonBundle\Security\Authorization\PersonVoter; use libphonenumber\PhoneNumberType; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; @@ -60,7 +60,7 @@ final class CreationPersonType extends AbstractType 'label' => 'Civility', 'placeholder' => 'choose civility', ]) - ->add('gender', GenderType::class, [ + ->add('gender', PickGenderType::class, [ 'required' => true, 'placeholder' => null, ]) ->add('birthdate', ChillDateType::class, [ diff --git a/src/Bundle/ChillPersonBundle/Form/PersonType.php b/src/Bundle/ChillPersonBundle/Form/PersonType.php index 21717a25b..0f4fbd8e4 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonType.php @@ -24,9 +24,9 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\PersonPhone; -use Chill\PersonBundle\Form\Type\GenderType; use Chill\PersonBundle\Form\Type\PersonAltNameType; use Chill\PersonBundle\Form\Type\PersonPhoneType; +use Chill\PersonBundle\Form\Type\PickGenderType; use Chill\PersonBundle\Form\Type\Select2MaritalStatusType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\CallbackTransformer; @@ -80,7 +80,7 @@ class PersonType extends AbstractType 'input' => 'datetime_immutable', 'widget' => 'single_text', ]) - ->add('gender', GenderType::class, [ + ->add('gender', PickGenderType::class, [ 'required' => true, ]) ->add('genderComment', CommentType::class, [ diff --git a/src/Bundle/ChillPersonBundle/Form/Type/GenderType.php b/src/Bundle/ChillPersonBundle/Form/Type/GenderType.php deleted file mode 100644 index 2989b3ec4..000000000 --- a/src/Bundle/ChillPersonBundle/Form/Type/GenderType.php +++ /dev/null @@ -1,44 +0,0 @@ - Person::MALE_GENDER, - Person::FEMALE_GENDER => Person::FEMALE_GENDER, - Person::BOTH_GENDER => Person::BOTH_GENDER, - ]; - - $resolver->setDefaults([ - 'choices' => $a, - 'expanded' => true, - 'multiple' => false, - 'placeholder' => null, - ]); - } - - public function getParent() - { - return ChoiceType::class; - } -} diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PickGenderType.php b/src/Bundle/ChillPersonBundle/Form/Type/PickGenderType.php new file mode 100644 index 000000000..4d4552caf --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Form/Type/PickGenderType.php @@ -0,0 +1,53 @@ +setDefault('label', 'Gender') + ->setDefault( + 'choice_label', + fn (Gender $gender): string => $this->translatableStringHelper->localize($gender->getLabel()) + ) + ->setDefault( + 'query_builder', + static fn (EntityRepository $er): QueryBuilder => $er->createQueryBuilder('g') + ->where('g.active = true') + ->orderBy('g.order'), + ) + ->setDefault('placeholder', 'choose gender') + ->setDefault('class', Gender::class); + } + + public function getParent() + { + return EntityType::class; + } +} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig index 5c606e737..bd3ff0ff1 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig @@ -106,7 +106,7 @@ {%- endif -%} {%- elseif person.birthdate is not null -%} {%- if options['addAge'] -%} diff --git a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml index 9b2edf573..c65e8ccdd 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml +++ b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml @@ -2,7 +2,7 @@ Born the date: >- {gender, select, man {Né le {birthdate}} woman {Née le {birthdate}} - other {Né·e le {birthdate}} + neutral {Né·e le {birthdate}} } Requestor: >- From de914f4f17969e9725864c715310261f95213069 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 26 Sep 2024 15:45:44 +0200 Subject: [PATCH 005/103] wip: use GenderIconEnum to allow user to select bootstrap icon --- src/Bundle/ChillMainBundle/Entity/Gender.php | 8 ++++---- src/Bundle/ChillMainBundle/Entity/GenderIconEnum.php | 12 ++++++++++++ src/Bundle/ChillMainBundle/Form/GenderType.php | 9 ++++++++- .../Resources/public/module/bootstrap/index.js | 3 ++- .../Resources/views/Entity/person.html.twig | 6 +----- .../translations/messages+intl-icu.fr.yaml | 5 +++-- 6 files changed, 30 insertions(+), 13 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Entity/GenderIconEnum.php diff --git a/src/Bundle/ChillMainBundle/Entity/Gender.php b/src/Bundle/ChillMainBundle/Entity/Gender.php index a14f433c8..bd8b26b68 100644 --- a/src/Bundle/ChillMainBundle/Entity/Gender.php +++ b/src/Bundle/ChillMainBundle/Entity/Gender.php @@ -30,8 +30,8 @@ class Gender private GenderEnum $genderTranslation; #[Serializer\Groups(['read'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)] - private string $icon = ''; + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, enumType: GenderIconEnum::class)] + private GenderIconEnum $icon; #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, name: 'ordering', nullable: true, options: ['default' => '0.0'])] private float $order = 0; @@ -71,12 +71,12 @@ class Gender $this->$genderTranslation = $genderTranslation; } - public function getIcon(): string + public function getIcon(): GenderIconEnum { return $this->icon; } - public function setIcon(string $icon): void + public function setIcon(GenderIconEnum $icon): void { $this->icon = $icon; } diff --git a/src/Bundle/ChillMainBundle/Entity/GenderIconEnum.php b/src/Bundle/ChillMainBundle/Entity/GenderIconEnum.php new file mode 100644 index 000000000..da8c2221e --- /dev/null +++ b/src/Bundle/ChillMainBundle/Entity/GenderIconEnum.php @@ -0,0 +1,12 @@ +add('label', TranslatableStringFormType::class, [ 'required' => true, ]) - ->add('icon', TextType::class) + ->add('icon', ChoiceType::class, [ + 'choices' => GenderIconEnum::cases(), + 'expanded' => true, + 'multiple' => false, + 'mapped' => true, + 'label' => 'Select Gender Icon', + ]) ->add('genderTranslation', ChoiceType::class, [ 'choices' => GenderEnum::cases(), 'choice_label' => fn(GenderEnum $enum) => ucfirst(strtolower($enum->name)), diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/index.js index a9d34e01d..91d66416a 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/index.js @@ -10,6 +10,7 @@ import Modal from 'bootstrap/js/dist/modal'; import Collapse from 'bootstrap/js/src/collapse'; import Carousel from 'bootstrap/js/src/carousel'; import Popover from 'bootstrap/js/src/popover'; +import 'bootstrap-icons/font/bootstrap-icons.css'; // // Carousel: ACHeaderSlider is a small slider used in banner of AccompanyingCourse Section @@ -59,4 +60,4 @@ const popoverList = triggerList.map(function (el) { return new Popover(el, { html: true, }); -}); \ No newline at end of file +}); diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig index bd3ff0ff1..7c3c02abe 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig @@ -85,12 +85,8 @@ {%- endif -%} {%- if options['addInfo'] -%} - {% set gender = (person.gender == 'woman') ? 'fa-venus' : - (person.gender == 'man') ? 'fa-mars' : (person.gender == 'both') ? 'fa-neuter' : 'fa-genderless' %} - {% set genderTitle = (person.gender == 'woman') ? 'woman' : - (person.gender == 'man') ? 'man' : (person.gender == 'both') ? 'both' : 'Not given'|trans %}

    - + {%- if person.deathdate is not null -%} {%- if person.birthdate is not null -%} diff --git a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml index c65e8ccdd..eaeaf137d 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml +++ b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml @@ -3,13 +3,14 @@ Born the date: >- man {Né le {birthdate}} woman {Née le {birthdate}} neutral {Né·e le {birthdate}} + other {Né·e le {birthdate}} } Requestor: >- {gender, select, man {Demandeur} woman {Demandeuse} - other {Demandeur·euse} + neutral {Demandeur·euse} } person: @@ -17,7 +18,7 @@ person: {gender, select, man {et lui-même} woman {et elle-même} - other {et lui·elle-même} + neutral {et lui·elle-même} } from_the: depuis le From 376ce5991705e3b7918371224a110c23fbccc8aa Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Oct 2024 10:35:38 +0200 Subject: [PATCH 006/103] Fix typing errors in customfieldbundle --- .../CustomFields/CustomFieldLongChoice.php | 4 ++-- .../ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php index 54d63b978..3a0adbdcc 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php @@ -42,8 +42,8 @@ class CustomFieldLongChoice extends AbstractCustomField $translatableStringHelper = $this->translatableStringHelper; $builder->add($customField->getSlug(), Select2ChoiceType::class, [ 'choices' => $entries, - 'choice_label' => static fn (Option $option) => $translatableStringHelper->localize($option->getText()), - 'choice_value' => static fn (Option $key): ?int => null === $key ? null : $key->getId(), + 'choice_label' => static fn (?Option $option) => $translatableStringHelper->localize($option->getText()), + 'choice_value' => static fn (?Option $key): ?int => $key?->getId(), 'multiple' => false, 'expanded' => false, 'required' => $customField->isRequired(), diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php index 55f09597c..21aa746aa 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php @@ -46,11 +46,8 @@ class CustomFieldsGroup #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; - /** - * @var array - */ #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] - private $name; + private array|string $name; #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private array $options = []; From f7f8319749c5f7afbc81878109ef76d12e1fa131 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Oct 2024 10:38:22 +0200 Subject: [PATCH 007/103] Update bundles version to v3.1.1 --- .../unreleased/Fixed-20240916-151843.yaml | 6 - .../unreleased/Fixed-20240916-155150.yaml | 6 - .changes/v3.1.1.md | 6 + CHANGELOG.md | 205 +++++++++--------- 4 files changed, 111 insertions(+), 112 deletions(-) delete mode 100644 .changes/unreleased/Fixed-20240916-151843.yaml delete mode 100644 .changes/unreleased/Fixed-20240916-155150.yaml create mode 100644 .changes/v3.1.1.md diff --git a/.changes/unreleased/Fixed-20240916-151843.yaml b/.changes/unreleased/Fixed-20240916-151843.yaml deleted file mode 100644 index ba89d3a70..000000000 --- a/.changes/unreleased/Fixed-20240916-151843.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixed -body: Show only the current referrer in the page "show" for an accompanying period - workf -time: 2024-09-16T15:18:43.017401122+02:00 -custom: - Issue: "308" diff --git a/.changes/unreleased/Fixed-20240916-155150.yaml b/.changes/unreleased/Fixed-20240916-155150.yaml deleted file mode 100644 index 52382db20..000000000 --- a/.changes/unreleased/Fixed-20240916-155150.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixed -body: | - Correctly compute the grouping by referrer aggregator -time: 2024-09-16T15:51:50.268336979+02:00 -custom: - Issue: "309" diff --git a/.changes/v3.1.1.md b/.changes/v3.1.1.md new file mode 100644 index 000000000..06bf33077 --- /dev/null +++ b/.changes/v3.1.1.md @@ -0,0 +1,6 @@ +## v3.1.1 - 2024-10-01 +### Fixed +* ([#308](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/308)) Show only the current referrer in the page "show" for an accompanying period workf +* ([#309](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/309)) Correctly compute the grouping by referrer aggregator + +* Fixed typing of custom field long choice and custom field group diff --git a/CHANGELOG.md b/CHANGELOG.md index 5272cd5a9..d05b19e6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,22 +6,35 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). +## v3.1.1 - 2024-10-01 +### Fixed +* ([#308](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/308)) Show only the current referrer in the page "show" for an accompanying period workf +* ([#309](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/309)) Correctly compute the grouping by referrer aggregator + +* Fixed typing of custom field long choice and custom field group + ## v3.1.0 - 2024-08-30 ### Feature -* Add export aggregator to aggregate activities by household + filter persons that are not part of an accompanyingperiod during a certain timeframe. +* Add export aggregator to aggregate activities by household + filter persons that are not part of an accompanyingperiod during a certain timeframe. ## v3.0.0 - 2024-08-26 ### Fixed -* Fix delete action for accompanying periods in draft state -* Fix connection to azure when making an calendar event in chill -* CollectionType js fixes for remove button and adding multiple entries +* Fix delete action for accompanying periods in draft state +* Fix connection to azure when making an calendar event in chill +* CollectionType js fixes for remove button and adding multiple entries ## v2.24.0 - 2024-09-11 ### Feature -* ([#306](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/306)) When a document is converted or downloaded in the browser, this document is removed from the browser memory after 45s. Future click on the button re-download the document. +* ([#306](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/306)) When a document is converted or downloaded in the browser, this document is removed from the browser memory after 45s. Future click on the button re-download the document. -## v2.23.0 - 2024-07-19 & 2024-07-23 +## v2.23.0 - 2024-07-23 & 2024-07-19 ### Feature +* ([#221](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/221)) [DX] move async-upload-bundle features into chill-bundles +* Add job bundle (module emploi) +* Upgrade import of address list to the last version of compiled addresses of belgian-best-address + +* Upgrade CKEditor and refactor configuration with use of typescript + * ([#123](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/123)) Add a button to duplicate calendar ranges from a week to another one * [admin] filter users by active / inactive in the admin user's list * ([#273](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/273)) Add the possibility to mark all notifications as read @@ -31,6 +44,8 @@ and is generated by [Changie](https://github.com/miniscruff/changie). * Do not update the "createdAt" column when importing postal code which does not change * Display filename on file upload within the UI interface ### Fixed +* Fix resolving of centers for an household, which will fix in turn the access control +* Resolved type hinting error in activity list export * ([#271](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/271)) Take into account the acp closing date in the acp works date filter ### Traduction française des principaux changements @@ -43,25 +58,15 @@ and is generated by [Changie](https://github.com/miniscruff/changie). - Agrandit l'icône du type de fichier dans l'interface de dépôt de fichier; - correction: tient compte de la date de fermeture du parcours dans les filtres sur les actions d'accompagnement. -* ([#221](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/221)) [DX] move async-upload-bundle features into chill-bundles -* Add job bundle (module emploi) -* Upgrade import of address list to the last version of compiled addresses of belgian-best-address - -* Upgrade CKEditor and refactor configuration with use of typescript - -### Fixed -* Fix resolving of centers for an household, which will fix in turn the access control -* Resolved type hinting error in activity list export - ## v2.22.2 - 2024-07-03 ### Fixed -* Remove scope required for event participation stats +* Remove scope required for event participation stats ## v2.22.1 - 2024-07-01 ### Fixed -* Remove debug word +* Remove debug word ### DX -* Add a command for reading official address DB from Luxembourg and update chill addresses +* Add a command for reading official address DB from Luxembourg and update chill addresses ## v2.22.0 - 2024-06-25 ### Feature @@ -104,7 +109,7 @@ and is generated by [Changie](https://github.com/miniscruff/changie). ## v2.20.1 - 2024-06-05 ### Fixed -* Do not allow StoredObjectCreated for edit and convert buttons +* Do not allow StoredObjectCreated for edit and convert buttons ## v2.20.0 - 2024-06-05 ### Fixed @@ -151,96 +156,96 @@ and is generated by [Changie](https://github.com/miniscruff/changie). ## v2.18.2 - 2024-04-12 ### Fixed -* ([#250](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/250)) Postal codes import : fix the source URL and the keys to handle each record +* ([#250](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/250)) Postal codes import : fix the source URL and the keys to handle each record ## v2.18.1 - 2024-03-26 ### Fixed -* Fix layout issue in document generation for admin (minor) +* Fix layout issue in document generation for admin (minor) ## v2.18.0 - 2024-03-26 ### Feature -* ([#268](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/268)) Improve admin UX to configure document templates for document generation +* ([#268](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/268)) Improve admin UX to configure document templates for document generation ### Fixed -* ([#267](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/267)) Fix the join between job and user in the user list (admin): show only the current user job +* ([#267](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/267)) Fix the join between job and user in the user list (admin): show only the current user job ## v2.17.0 - 2024-03-19 ### Feature -* ([#237](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/237)) New export filter for social actions with an evaluation created between two dates -* ([#258](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/258)) In the list of accompangying period, add the list of person's centers and the duration of the course -* ([#238](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/238)) Allow to customize list person with new fields +* ([#237](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/237)) New export filter for social actions with an evaluation created between two dates +* ([#258](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/258)) In the list of accompangying period, add the list of person's centers and the duration of the course +* ([#238](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/238)) Allow to customize list person with new fields * ([#159](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/159)) Admin can publish news on the homepage ### Fixed -* ([#264](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/264)) Fix languages: load the languages in all availables languages configured for Chill -* ([#259](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/259)) Keep a consistent behaviour between the filtering of activities within the document generation (model "accompanying period with activities"), and the same filter in the list of activities for an accompanying period +* ([#264](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/264)) Fix languages: load the languages in all availables languages configured for Chill +* ([#259](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/259)) Keep a consistent behaviour between the filtering of activities within the document generation (model "accompanying period with activities"), and the same filter in the list of activities for an accompanying period ## v2.16.3 - 2024-02-26 ### Fixed -* ([#236](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/236)) Fix translation of user job -> 'service' must be 'métier' +* ([#236](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/236)) Fix translation of user job -> 'service' must be 'métier' ### UX -* ([#232](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/232)) Order user jobs and services alphabetically in export filters +* ([#232](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/232)) Order user jobs and services alphabetically in export filters ## v2.16.2 - 2024-02-21 ### Fixed -* Check for null values in closing motive of parcours d'accompagnement for correct rendering of template +* Check for null values in closing motive of parcours d'accompagnement for correct rendering of template ## v2.16.1 - 2024-02-09 ### Fixed -* Force bootstrap version to avoid error in builds with newer version +* Force bootstrap version to avoid error in builds with newer version ## v2.16.0 - 2024-02-08 ### Feature -* ([#231](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/231)) Create new filter for persons having a participation in an accompanying period during a certain time span -* ([#241](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/241)) [Export][List of accompanyign period] Add two columns: the list of persons participating to the period, and their ids -* ([#244](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/244)) Add capability to generate export about change of steps of accompanying period, and generate exports for this -* ([#253](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/253)) Export: group accompanying period by person participating -* ([#243](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/243)) Export: add filter for courses not linked to a reference address -* ([#229](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/229)) Allow to group activities linked with accompanying period by reason -* ([#115](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/115)) Prevent social work to be saved when another user edited conccurently the social work -* Modernize the event bundle, with some new fields and multiple improvements +* ([#231](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/231)) Create new filter for persons having a participation in an accompanying period during a certain time span +* ([#241](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/241)) [Export][List of accompanyign period] Add two columns: the list of persons participating to the period, and their ids +* ([#244](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/244)) Add capability to generate export about change of steps of accompanying period, and generate exports for this +* ([#253](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/253)) Export: group accompanying period by person participating +* ([#243](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/243)) Export: add filter for courses not linked to a reference address +* ([#229](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/229)) Allow to group activities linked with accompanying period by reason +* ([#115](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/115)) Prevent social work to be saved when another user edited conccurently the social work +* Modernize the event bundle, with some new fields and multiple improvements ### Fixed -* ([#220](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/220)) Fix error in logs about wrong typing of eventArgs in onEditNotificationComment method -* ([#256](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/256)) Fix the conditions upon which social actions should be optional or required in relation to social issues within the activity creation form +* ([#220](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/220)) Fix error in logs about wrong typing of eventArgs in onEditNotificationComment method +* ([#256](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/256)) Fix the conditions upon which social actions should be optional or required in relation to social issues within the activity creation form ### UX -* ([#260](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/260)) Order list of centers alphabetically in dropdown 'user' section admin. +* ([#260](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/260)) Order list of centers alphabetically in dropdown 'user' section admin. ## v2.15.2 - 2024-01-11 ### Fixed -* Fix the id_seq used when creating a new accompanying period participation during fusion of two person files +* Fix the id_seq used when creating a new accompanying period participation during fusion of two person files ### DX -* Set placeholder to False for expanded EntityType form fields where required is set to False. +* Set placeholder to False for expanded EntityType form fields where required is set to False. ## v2.15.1 - 2023-12-20 ### Fixed -* Fix the household export query to exclude accompanying periods that are in draft state. +* Fix the household export query to exclude accompanying periods that are in draft state. ### DX -* ([#167](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/167)) Fixed readthedocs compilation by updating readthedocs config file and requirements for Sphinx +* ([#167](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/167)) Fixed readthedocs compilation by updating readthedocs config file and requirements for Sphinx ## v2.15.0 - 2023-12-11 ### Feature -* ([#191](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/191)) Add export "number of household associate with an exchange" -* ([#235](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/235)) Export: add dates on the filter "filter course by activity type" +* ([#191](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/191)) Add export "number of household associate with an exchange" +* ([#235](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/235)) Export: add dates on the filter "filter course by activity type" ### Fixed -* ([#214](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/214)) Fix error when posting an empty comment on an accompanying period. -* ([#233](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/233)) Fix "filter evaluation by evaluation type" (and add select2 to the list of evaluation types to pick) +* ([#214](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/214)) Fix error when posting an empty comment on an accompanying period. +* ([#233](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/233)) Fix "filter evaluation by evaluation type" (and add select2 to the list of evaluation types to pick) * ([#234](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/234)) Fix "filter aside activity by date" - -* ([#228](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/228)) Fix export of activity for people created before the introduction of the createdAt column on person (during v1) -* ([#246](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/246)) Do not show activities, evaluations and social work when associated to a confidential accompanying period, except for the users which are allowed to see them + +* ([#228](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/228)) Fix export of activity for people created before the introduction of the createdAt column on person (during v1) +* ([#246](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/246)) Do not show activities, evaluations and social work when associated to a confidential accompanying period, except for the users which are allowed to see them ## v2.14.1 - 2023-11-29 ### Fixed -* Export: fix list person with custom fields -* ([#100](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/100)) Add a paginator to budget elements (resource and charge types) in the admin -* Fix error in ListEvaluation when "handling agents" are alone +* Export: fix list person with custom fields +* ([#100](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/100)) Add a paginator to budget elements (resource and charge types) in the admin +* Fix error in ListEvaluation when "handling agents" are alone ## v2.14.0 - 2023-11-24 ### Feature -* ([#161](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/161)) Export: in filter "Filter accompanying period work (social action) by type, goal and result", order the items alphabetically or with the defined order +* ([#161](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/161)) Export: in filter "Filter accompanying period work (social action) by type, goal and result", order the items alphabetically or with the defined order ### Fixed -* ([#141](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/141)) Export: on filter "action by type goals, and results", restore the fields when editing a saved export -* ([#219](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/219)) Export: fix the list of accompanying period work, when the "calc date" is null -* ([#222](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/222)) Fix rendering of custom fields -* Fix various errors in custom fields administration +* ([#141](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/141)) Export: on filter "action by type goals, and results", restore the fields when editing a saved export +* ([#219](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/219)) Export: fix the list of accompanying period work, when the "calc date" is null +* ([#222](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/222)) Fix rendering of custom fields +* Fix various errors in custom fields administration ## v2.13.0 - 2023-11-21 ### Feature @@ -254,7 +259,7 @@ and is generated by [Changie](https://github.com/miniscruff/changie). ## v2.12.1 - 2023-11-16 ### Fixed -* ([#208](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/208)) Export: fix loading of form for "filter action by type, goal and result" +* ([#208](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/208)) Export: fix loading of form for "filter action by type, goal and result" ## v2.12.0 - 2023-11-15 ### Feature @@ -285,36 +290,36 @@ and is generated by [Changie](https://github.com/miniscruff/changie). ## v2.11.0 - 2023-11-07 ### Feature -* ([#194](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/194)) Export: add a filter "filter activity by creator job" +* ([#194](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/194)) Export: add a filter "filter activity by creator job" ### Fixed -* ([#185](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/185)) Export: fix "group accompanying period by geographical unit": take into account the accompanying periods when the period is not located within an unit -* Fix "group activity by creator job" aggregator +* ([#185](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/185)) Export: fix "group accompanying period by geographical unit": take into account the accompanying periods when the period is not located within an unit +* Fix "group activity by creator job" aggregator ## v2.10.6 - 2023-11-07 ### Fixed -* ([#182](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/182)) Fix merging of double person files. Adjustement relationship sql statement -* ([#185](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/185)) Export: fix aggregator by geographical unit on person: avoid inconsistencies +* ([#182](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/182)) Fix merging of double person files. Adjustement relationship sql statement +* ([#185](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/185)) Export: fix aggregator by geographical unit on person: avoid inconsistencies ## v2.10.5 - 2023-11-05 ### Fixed -* ([#183](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/183)) Fix "problem during download" on some filters, which used a wrong data type -* ([#184](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/184)) Fix filter "activity by date" +* ([#183](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/183)) Fix "problem during download" on some filters, which used a wrong data type +* ([#184](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/184)) Fix filter "activity by date" ## v2.10.4 - 2023-10-26 ### Fixed -* Fix null value constraint errors when merging relationships in doubles +* Fix null value constraint errors when merging relationships in doubles ## v2.10.3 - 2023-10-26 ### Fixed -* ([#175](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/175)) Replace old method of getting translator with injection of translatorInterface +* ([#175](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/175)) Replace old method of getting translator with injection of translatorInterface ## v2.10.2 - 2023-10-26 ### Fixed -* ([#175](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/175)) Use injection of translator instead of ->get(). +* ([#175](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/175)) Use injection of translator instead of ->get(). ## v2.10.1 - 2023-10-24 ### Fixed -* Fix export controller when generating an export without any data in session +* Fix export controller when generating an export without any data in session ## v2.10.0 - 2023-10-24 ### Feature @@ -339,11 +344,11 @@ and is generated by [Changie](https://github.com/miniscruff/changie). ## v2.9.2 - 2023-10-17 ### Fixed -* Fix possible null values in string's entities +* Fix possible null values in string's entities ## 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 +* 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 @@ -391,57 +396,57 @@ But if you do not need this any more, you must ensure that the configuration key ## v2.7.0 - 2023-09-27 ### Feature -* ([#155](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/155)) The regulation list load accompanying periods by exact postal code (address associated with postal code), and not by the content of the postal code (postal code with same code's string) +* ([#155](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/155)) The regulation list load accompanying periods by exact postal code (address associated with postal code), and not by the content of the postal code (postal code with same code's string) ### Fixed -* ([#142](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/142)) Fix the label of filter ActivityTypeFilter to a more obvious one -* ([#140](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/140)) [export] Fix association of filter "filter location by type" which did not appears on "list of activities" +* ([#142](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/142)) Fix the label of filter ActivityTypeFilter to a more obvious one +* ([#140](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/140)) [export] Fix association of filter "filter location by type" which did not appears on "list of activities" ## v2.6.3 - 2023-09-19 ### Fixed -* Remove id property from document -mappedsuperclass +* Remove id property from document +mappedsuperclass ## v2.6.2 - 2023-09-18 ### Fixed -* Fix doctrine mapping of AbstractTaskPlaceEvent and SingleTaskPlaceEvent: id property moved. +* Fix doctrine mapping of AbstractTaskPlaceEvent and SingleTaskPlaceEvent: id property moved. ## v2.6.1 - 2023-09-14 ### Fixed -* Filter out active centers in exports, which uses a different PickCenterType. +* Filter out active centers in exports, which uses a different PickCenterType. ## v2.6.0 - 2023-09-14 ### Feature -* ([#133](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/133)) Add locations in Aside Activity. By default, suggest user location, otherwise a select with all locations. -* ([#133](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/133)) Adapt Aside Activity exports: display location, filter by location, group by location -* Use the CRUD controller for center entity + add the isActive property to be able to mask instances of Center that are no longer in use. +* ([#133](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/133)) Add locations in Aside Activity. By default, suggest user location, otherwise a select with all locations. +* ([#133](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/133)) Adapt Aside Activity exports: display location, filter by location, group by location +* Use the CRUD controller for center entity + add the isActive property to be able to mask instances of Center that are no longer in use. ### Fixed -* ([#107](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/107)) reinstate the fusion of duplicate persons -* Missing translation in Work Actions exports -* Reimplement the mission type filter on tasks, only for instances that have a config parameter indicating true for this. -* ([#135](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/135)) Corrects a typing error in 2 filters, which caused an +* ([#107](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/107)) reinstate the fusion of duplicate persons +* Missing translation in Work Actions exports +* Reimplement the mission type filter on tasks, only for instances that have a config parameter indicating true for this. +* ([#135](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/135)) Corrects a typing error in 2 filters, which caused an error when trying to reedit a saved export - -* ([#136](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/136)) [household] when moving a person to a sharing position to a not-sharing position on the same household on the same date, remove the previous household membership on the same household. This fix duplicate member. + +* ([#136](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/136)) [household] when moving a person to a sharing position to a not-sharing position on the same household on the same date, remove the previous household membership on the same household. This fix duplicate member. * Add missing translation for comment field placeholder in repositionning household editor. - -* Do not send an email to creator twice when adding a comment to a notification -* ([#107](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/107)) Fix gestion doublon functionality to work with chill bundles v2 + +* Do not send an email to creator twice when adding a comment to a notification +* ([#107](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/107)) Fix gestion doublon functionality to work with chill bundles v2 ### UX * Uniformize badge-person in household banner (background, size) - + ## v2.5.3 - 2023-07-20 ### Fixed -* ([#132](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/132)) Rendez-vous documents created would appear in all documents lists of all persons with an accompanying period. Or statements are now added to the where clause to filter out documents that come from unrelated accompanying period/ or person rendez-vous. +* ([#132](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/132)) Rendez-vous documents created would appear in all documents lists of all persons with an accompanying period. Or statements are now added to the where clause to filter out documents that come from unrelated accompanying period/ or person rendez-vous. ## v2.5.2 - 2023-07-15 ### Fixed -* [Collate Address] when updating address point, do not use the point's address reference if the similarity is below the requirement for associating the address reference and the address (it uses the postcode's center instead) +* [Collate Address] when updating address point, do not use the point's address reference if the similarity is below the requirement for associating the address reference and the address (it uses the postcode's center instead) ## v2.5.1 - 2023-07-14 ### Fixed -* [collate addresses] block collating addresses to another address reference where the address reference is already the best match +* [collate addresses] block collating addresses to another address reference where the address reference is already the best match ## v2.5.0 - 2023-07-14 ### Feature From 43dd94dad6847b0293f176f6564682b9bb4f7b58 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Oct 2024 11:36:00 +0200 Subject: [PATCH 008/103] Use renderInterface to render gender icons in twig --- .../Resources/views/Gender/index.html.twig | 2 +- .../Entity/ChillGenderIconRender.php | 37 +++++++++++++++++++ .../config/services/templating.yaml | 2 + .../Resources/views/Entity/person.html.twig | 3 +- 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Templating/Entity/ChillGenderIconRender.php diff --git a/src/Bundle/ChillMainBundle/Resources/views/Gender/index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Gender/index.html.twig index a46fbee56..b93d8ba90 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Gender/index.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Gender/index.html.twig @@ -16,7 +16,7 @@ {{ entity.id }} {{ entity.label|localize_translatable_string }} - + {{ entity.icon|chill_entity_render_box }} {{ entity.genderTranslation.value }} {%- if entity.active -%} diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/ChillGenderIconRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/ChillGenderIconRender.php new file mode 100644 index 000000000..7494908cb --- /dev/null +++ b/src/Bundle/ChillMainBundle/Templating/Entity/ChillGenderIconRender.php @@ -0,0 +1,37 @@ + + */ +final readonly class ChillGenderIconRender implements ChillEntityRenderInterface +{ + public function renderBox($icon, array $options): string + { + return + ''; + } + + public function renderString($icon, array $options): string + { + return $icon->value; + } + + public function supports($icon, array $options): bool + { + return $icon instanceof GenderIconEnum; + } +} diff --git a/src/Bundle/ChillMainBundle/config/services/templating.yaml b/src/Bundle/ChillMainBundle/config/services/templating.yaml index 0baa91b69..dc21b07f5 100644 --- a/src/Bundle/ChillMainBundle/config/services/templating.yaml +++ b/src/Bundle/ChillMainBundle/config/services/templating.yaml @@ -49,6 +49,8 @@ services: Chill\MainBundle\Templating\Entity\NewsItemRender: ~ + Chill\MainBundle\Templating\Entity\ChillGenderIconRender: ~ + Chill\MainBundle\Templating\Entity\UserRender: ~ Chill\MainBundle\Templating\Listing\: diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig index 7c3c02abe..776d87132 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig @@ -86,7 +86,8 @@ {%- if options['addInfo'] -%}

    - + {{ person.gender.icon|chill_entity_render_box }} +{# #} {%- if person.deathdate is not null -%} {%- if person.birthdate is not null -%} From d61c090cee9672561913f269ddbf7cdffa0b7fef Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Oct 2024 11:38:20 +0200 Subject: [PATCH 009/103] Remove 'unknown' gender enum --- src/Bundle/ChillMainBundle/Entity/GenderEnum.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Entity/GenderEnum.php b/src/Bundle/ChillMainBundle/Entity/GenderEnum.php index d171ea343..e8af76293 100644 --- a/src/Bundle/ChillMainBundle/Entity/GenderEnum.php +++ b/src/Bundle/ChillMainBundle/Entity/GenderEnum.php @@ -7,5 +7,4 @@ enum GenderEnum : string case MALE = 'man'; case FEMALE = 'woman'; case NEUTRAL = 'neutral'; - case UNKNOWN = 'unknown'; } From e6bfcddae243e2c4c66453e3523fca61c9dad7be Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Oct 2024 11:38:43 +0200 Subject: [PATCH 010/103] Use EnumType in form instead of ChoiceType for field genderTranslation --- .../ChillMainBundle/Form/GenderType.php | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Form/GenderType.php b/src/Bundle/ChillMainBundle/Form/GenderType.php index cf49d24aa..76d2a4345 100644 --- a/src/Bundle/ChillMainBundle/Form/GenderType.php +++ b/src/Bundle/ChillMainBundle/Form/GenderType.php @@ -8,6 +8,7 @@ use Chill\MainBundle\Entity\GenderIconEnum; use Chill\MainBundle\Form\Type\TranslatableStringFormType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\EnumType; use Symfony\Component\Form\Extension\Core\Type\IntegerType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; @@ -21,18 +22,25 @@ class GenderType extends AbstractType ->add('label', TranslatableStringFormType::class, [ 'required' => true, ]) +/* ->add('icon', EnumType::class, [ + 'class' => GenderIconEnum::class, + 'label_html' => true, + 'expanded' => false, + 'mapped' => true, + ])*/ ->add('icon', ChoiceType::class, [ 'choices' => GenderIconEnum::cases(), 'expanded' => true, 'multiple' => false, 'mapped' => true, - 'label' => 'Select Gender Icon', + 'choice_label' => fn(GenderIconEnum $enum) => '', + 'choice_value' => fn(?GenderIconEnum $enum) => $enum ? $enum->value : null, + 'label' => 'gender.admin.Select Gender Icon', + 'label_html' => true, ]) - ->add('genderTranslation', ChoiceType::class, [ - 'choices' => GenderEnum::cases(), - 'choice_label' => fn(GenderEnum $enum) => ucfirst(strtolower($enum->name)), - 'choice_value' => fn(?GenderEnum $enum) => $enum ? $enum->value : null, - 'data_class' => null, + ->add('genderTranslation', EnumType::class, [ + 'class' => GenderEnum::class, + 'label' => 'gender.admin.Select Gender Translation', ]) ->add('active', ChoiceType::class, [ 'choices' => [ From 236e8117d42a1ff9e8b9cff12a9f4054a20b853c Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Oct 2024 11:39:10 +0200 Subject: [PATCH 011/103] Fix display of icon field in gender admin form --- .../Resources/views/Gender/edit.html.twig | 70 +++++++++++++++++- .../Resources/views/Gender/new.html.twig | 74 ++++++++++++++++++- 2 files changed, 138 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/views/Gender/edit.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Gender/edit.html.twig index 4d55c480c..39f01e519 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Gender/edit.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Gender/edit.html.twig @@ -4,8 +4,72 @@ {% include('@ChillMain/CRUD/_edit_title.html.twig') %} {% endblock %} +{% form_theme form _self %} + +{% block _gender_icon_widget %} + {% for child in form %} +

    + + + +
    + {% endfor %} +{% endblock %} + {% block admin_content %} - {% embed '@ChillMain/CRUD/_edit_content.html.twig' %} - {% block content_form_actions_save_and_show %}{% endblock %} - {% endembed %} + {% set formId = crudMainFormId|default('crud_main_form') %} + + {% block crud_content_header %} +

    {{ ('crud.'~crud_name~'.title_edit')|trans }}

    + {% endblock crud_content_header %} + + {% block crud_content_form %} + {{ form_start(form, { 'attr' : { 'id': formId } }) }} + + {{ form_row(form.label) }} + {{ form_row(form.genderTranslation) }} + {{ form_row(form.icon) }} + {{ form_row(form.active) }} + {{ form_row(form.order) }} + + {{ form_end(form) }} + {% block crud_content_after_form %}{% endblock %} + + {% block crud_content_form_actions %} +
      + {% block content_form_actions_back %} +
    • + {# #} + {# {{ 'Cancel'|trans }}#} + {# #} +
    • + {% endblock %} + {% block content_form_actions_before %}{% endblock %} + {% block content_form_actions_delete %} + {% if chill_crud_action_exists(crud_name, 'delete') %} + {% if is_granted(chill_crud_config('role', crud_name, 'delete'), entity) %} +
    • + +
    • + {% endif %} + {% endif %} + {% endblock content_form_actions_delete %} + {% block content_form_actions_save_and_close %} +
    • + +
    • + {% endblock %} + {% block content_form_actions_after %}{% endblock %} +
    + {% endblock %} + + {% endblock %} {% endblock admin_content %} diff --git a/src/Bundle/ChillMainBundle/Resources/views/Gender/new.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Gender/new.html.twig index 7c204dddd..a07ebfa9d 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Gender/new.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Gender/new.html.twig @@ -4,8 +4,76 @@ {% include('@ChillMain/CRUD/_new_title.html.twig') %} {% endblock %} +{% form_theme form _self %} + +{% block _gender_icon_widget %} + {% for child in form %} +
    + + + +
    + {% endfor %} +{% endblock %} + {% block admin_content %} - {% embed '@ChillMain/CRUD/_new_content.html.twig' %} - {% block content_form_actions_save_and_show %}{% endblock %} - {% endembed %} + {% set formId = crudMainFormId|default('crud_main_form') %} + + {% block crud_content_header %} +

    {{ ('crud.' ~ crud_name ~ '.title_new')|trans({'%crud_name%' : crud_name }) }}

    + {% endblock crud_content_header %} + + {% block crud_content_form %} + {{ form_start(form, { 'attr' : { 'id': formId } }) }} + {{ form_row(form.label) }} + {{ form_row(form.genderTranslation) }} + {{ form_row(form.icon) }} + {{ form_row(form.active) }} + {{ form_row(form.order) }} + {{ form_end(form) }} + + {% block crud_content_after_form %}{% endblock %} + + {% block crud_content_form_actions %} +
      + {% block content_form_actions_back %} +
    • + + {{ 'Cancel'|trans }} + +
    • + {% endblock %} + {% block content_form_actions_save_and_close %} +
    • + +
    • + {% endblock %} + {% block content_form_actions_save_and_show %} +
    • + +
    • + {% endblock %} + {% block content_form_actions_save_and_new %} +
    • + +
    • + {% endblock %} +
    + {% endblock %} + + {{ form_end(form) }} + {% endblock %} + {% endblock admin_content %} From 406eba80d2d0f57c64fc27109cf3095a1d5cf477 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Oct 2024 11:41:19 +0200 Subject: [PATCH 012/103] Create gender API and adjust serialization of gender property --- .../Controller/GenderApiController.php | 15 +++++++++++++++ .../DependencyInjection/ChillMainExtension.php | 16 ++++++++++++++++ src/Bundle/ChillMainBundle/Entity/Gender.php | 2 +- .../Resources/public/vuejs/_api/OnTheFly.js | 7 +++++++ .../Normalizer/PersonJsonNormalizer.php | 7 +++++-- 5 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Controller/GenderApiController.php diff --git a/src/Bundle/ChillMainBundle/Controller/GenderApiController.php b/src/Bundle/ChillMainBundle/Controller/GenderApiController.php new file mode 100644 index 000000000..567756ba7 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Controller/GenderApiController.php @@ -0,0 +1,15 @@ +addOrderBy('e.order', 'ASC'); + } +} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index b406f56f1..ca293cdd3 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -17,6 +17,7 @@ use Chill\MainBundle\Controller\CivilityApiController; use Chill\MainBundle\Controller\CivilityController; use Chill\MainBundle\Controller\CountryApiController; use Chill\MainBundle\Controller\CountryController; +use Chill\MainBundle\Controller\GenderApiController; use Chill\MainBundle\Controller\GenderController; use Chill\MainBundle\Controller\GeographicalUnitApiController; use Chill\MainBundle\Controller\LanguageController; @@ -813,6 +814,21 @@ class ChillMainExtension extends Extension implements ], ], ], + [ + 'class' => Gender::class, + 'name' => 'gender', + 'base_path' => '/api/1.0/main/gender', + 'base_role' => 'ROLE_USER', + 'controller' => GenderApiController::class, + 'actions' => [ + '_index' => [ + 'methods' => [ + Request::METHOD_GET => true, + Request::METHOD_HEAD => true, + ], + ], + ], + ], [ 'class' => GeographicalUnitLayer::class, 'controller' => GeographicalUnitApiController::class, diff --git a/src/Bundle/ChillMainBundle/Entity/Gender.php b/src/Bundle/ChillMainBundle/Entity/Gender.php index bd8b26b68..2c4667e46 100644 --- a/src/Bundle/ChillMainBundle/Entity/Gender.php +++ b/src/Bundle/ChillMainBundle/Entity/Gender.php @@ -6,7 +6,7 @@ use Chill\MainBundle\Repository\GenderRepository; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation as Serializer; - +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['chill_main_gender' => Gender::class])] #[ORM\Entity(repositoryClass: GenderRepository::class)] #[ORM\Table(name: 'chill_main_gender')] class Gender diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/OnTheFly.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/OnTheFly.js index c9c77991f..3c58b67e9 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/OnTheFly.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/OnTheFly.js @@ -24,6 +24,12 @@ const getCivilities = () => throw Error('Error with request resource response'); }); +const getGenders = () => + fetch('/api/1.0/main/gender.json').then(response => { + if (response.ok) { return response.json(); } + throw Error('Error with request resource response'); + }); + const getCentersForPersonCreation = () => makeFetch('GET', '/api/1.0/person/creation/authorized-centers', null); /* @@ -67,6 +73,7 @@ export { getPerson, getPersonAltNames, getCivilities, + getGenders, postPerson, patchPerson }; diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php index d39a69d73..88c38cfbb 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php @@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Serializer\Normalizer; use Chill\MainBundle\Entity\Center; use Chill\MainBundle\Entity\Civility; +use Chill\MainBundle\Entity\Gender; use Chill\MainBundle\Phonenumber\PhoneNumberHelperInterface; use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface; use Chill\MainBundle\Templating\Entity\ChillEntityRenderExtension; @@ -112,7 +113,9 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar break; case 'gender': - $person->setGender($data[$item]); + $gender = $this->denormalizer->denormalize($data[$item], Gender::class, $format, []); + + $person->setGender($gender); break; @@ -199,7 +202,7 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar 'phonenumber' => $this->normalizer->normalize($person->getPhonenumber(), $format, $context), 'mobilenumber' => $this->normalizer->normalize($person->getMobilenumber(), $format, $context), 'email' => $person->getEmail(), - 'gender' => $person->getGender(), + 'gender' => $this->normalizer->normalize($person->getGender(), $format, $context), 'civility' => $this->normalizer->normalize($person->getCivility(), $format, $context), ]; From 726cdb385fddd9a3f33353859f4ec8a9d1d4e320 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Oct 2024 12:15:31 +0200 Subject: [PATCH 013/103] Implement gender icon renderbox for vue components --- .../vuejs/_components/Entity/GenderIconRenderBox.vue | 11 +++++++++++ .../vuejs/_components/Entity/PersonRenderBox.vue | 6 ++++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/GenderIconRenderBox.vue diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/GenderIconRenderBox.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/GenderIconRenderBox.vue new file mode 100644 index 000000000..2aeb123c7 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/GenderIconRenderBox.vue @@ -0,0 +1,11 @@ + + + diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue index 100dc9caf..732efd689 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue @@ -37,8 +37,8 @@

    - - + + @@ -180,6 +180,7 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue index 100dc9caf..732efd689 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue @@ -37,8 +37,8 @@

    - - + + @@ -180,6 +180,7 @@