mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-10-31 01:08:26 +00:00 
			
		
		
		
	Compare commits
	
		
			11 Commits
		
	
	
		
			v3.5.1
			...
			fix_saved_
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 2ca9de2f60 | |||
| 184bb095d8 | |||
| 78c8e94765 | |||
| c8d1a91953 | |||
| 3e8e2b0fa8 | |||
|  | 2c9c700ca7 | ||
|  | 110db30748 | ||
|  | 1f96f76f87 | ||
|  | 65902ea231 | ||
|  | 88c0b1570d | ||
| 4933d2251c | 
							
								
								
									
										3
									
								
								.changes/v3.5.2.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								.changes/v3.5.2.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| ## v3.5.2 - 2024-12-19 | ||||
| ### Fixed | ||||
| * ([#345](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/345)) Export: activity filtering of users that were associated to an activity between certain dates. Results contained activities that were not within the specified date range"  | ||||
							
								
								
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -51,3 +51,8 @@ phpstan.neon | ||||
| npm-debug.log | ||||
| yarn-error.log | ||||
| ###< symfony/webpack-encore-bundle ### | ||||
|  | ||||
| ###> friendsofphp/php-cs-fixer ### | ||||
| /.php-cs-fixer.php | ||||
| /.php-cs-fixer.cache | ||||
| ###< friendsofphp/php-cs-fixer ### | ||||
|   | ||||
| @@ -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). | ||||
|  | ||||
|  | ||||
| ## v3.5.2 - 2024-12-19 | ||||
| ### Fixed | ||||
| * ([#345](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/345)) Export: activity filtering of users that were associated to an activity between certain dates. Results contained activities that were not within the specified date range"  | ||||
|  | ||||
| ## v3.5.1 - 2024-12-16 | ||||
| ### Fixed | ||||
| * Filiation: fix the display of the gender label in the graph  | ||||
|   | ||||
| @@ -16,6 +16,7 @@ | ||||
|         "champs-libres/wopi-bundle": "dev-master@dev", | ||||
|         "champs-libres/wopi-lib": "dev-master@dev", | ||||
|         "doctrine/doctrine-bundle": "^2.1", | ||||
|         "doctrine/data-fixtures": "^1.8", | ||||
|         "doctrine/doctrine-migrations-bundle": "^3.0", | ||||
|         "doctrine/orm": "^2.13.0", | ||||
|         "erusev/parsedown": "^1.7", | ||||
| @@ -85,6 +86,7 @@ | ||||
|     "require-dev": { | ||||
|         "doctrine/doctrine-fixtures-bundle": "^3.3", | ||||
|         "fakerphp/faker": "^1.13", | ||||
|         "friendsofphp/php-cs-fixer": "3.65.0", | ||||
|         "jangregor/phpstan-prophecy": "^1.0", | ||||
|         "nelmio/alice": "^3.8", | ||||
|         "nikic/php-parser": "^4.15", | ||||
|   | ||||
| @@ -55,6 +55,8 @@ final readonly class PersonHavingActivityBetweenDateFilter implements ExportElem | ||||
|             .' AND ' | ||||
|             .'(person_person_having_activity.id = person.id OR person MEMBER OF activity_person_having_activity.persons)'); | ||||
|  | ||||
|         $sqb->andWhere('activity_person_having_activity.id = activity.id'); | ||||
|  | ||||
|         if (isset($data['reasons']) && [] !== $data['reasons']) { | ||||
|             // add clause activity reason | ||||
|             $sqb->join('activity_person_having_activity.reasons', 'reasons_person_having_activity'); | ||||
|   | ||||
| @@ -298,7 +298,7 @@ class CustomFieldsGroupController extends AbstractController | ||||
|             ->setCustomFieldsGroup($customFieldsGroup); | ||||
|  | ||||
|         $builder = $this->get('form.factory') | ||||
|             ->createNamedBuilder(null, FormType::class, $customfield, [ | ||||
|             ->createNamedBuilder('', FormType::class, $customfield, [ | ||||
|                 'method' => 'GET', | ||||
|                 'action' => $this->generateUrl('customfield_new'), | ||||
|                 'csrf_protection' => false, | ||||
|   | ||||
| @@ -53,7 +53,6 @@ final readonly class PdfSignedMessageHandler implements MessageHandlerInterface | ||||
|  | ||||
|         $this->entityManager->wrapInTransaction(function () use ($storedObject, $message, $signature) { | ||||
|             $this->storedObjectManager->write($storedObject, $message->content); | ||||
|  | ||||
|             $this->signatureStepStateChanger->markSignatureAsSigned($signature, $message->signatureZoneIndex); | ||||
|         }); | ||||
|  | ||||
|   | ||||
| @@ -25,6 +25,8 @@ use Chill\MainBundle\Workflow\WorkflowTransitionContextDTO; | ||||
| use Chill\PersonBundle\Entity\Person; | ||||
| use Doctrine\ORM\EntityManagerInterface; | ||||
| use PHPUnit\Framework\TestCase; | ||||
| use Prophecy\Argument; | ||||
| use Prophecy\PhpUnit\ProphecyTrait; | ||||
| use Psr\Log\NullLogger; | ||||
|  | ||||
| /** | ||||
| @@ -34,6 +36,8 @@ use Psr\Log\NullLogger; | ||||
|  */ | ||||
| class PdfSignedMessageHandlerTest extends TestCase | ||||
| { | ||||
|     use ProphecyTrait; | ||||
|  | ||||
|     public function testThatObjectIsWrittenInStoredObjectManagerHappyScenario(): void | ||||
|     { | ||||
|         // a dummy stored object | ||||
| @@ -91,10 +95,19 @@ class PdfSignedMessageHandlerTest extends TestCase | ||||
|  | ||||
|     private function buildEntityManager(bool $willFlush): EntityManagerInterface | ||||
|     { | ||||
|         $em = $this->createMock(EntityManagerInterface::class); | ||||
|         $em->expects($willFlush ? $this->once() : $this->never())->method('flush'); | ||||
|         $em->expects($willFlush ? $this->once() : $this->never())->method('clear'); | ||||
|         $em = $this->prophesize(EntityManagerInterface::class); | ||||
|         $clear = $em->clear(); | ||||
|         $wrap = $em->wrapInTransaction(Argument::type('callable'))->will(function ($args) { | ||||
|             $callable = $args[0]; | ||||
|  | ||||
|         return $em; | ||||
|             return call_user_func($callable); | ||||
|         }); | ||||
|  | ||||
|         if ($willFlush) { | ||||
|             $clear->shouldBeCalled(); | ||||
|             $wrap->shouldBeCalled(); | ||||
|         } | ||||
|  | ||||
|         return $em->reveal(); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -28,8 +28,8 @@ class EntityToJsonTransformer implements DataTransformerInterface | ||||
|  | ||||
|     public function reverseTransform($value) | ||||
|     { | ||||
|         if (false === $this->multiple && '' === $value) { | ||||
|             return null; | ||||
|         if ($this->multiple && '' === $value) { | ||||
|             return []; | ||||
|         } | ||||
|  | ||||
|         if ($this->multiple && [] === $value) { | ||||
|   | ||||
| @@ -0,0 +1,26 @@ | ||||
| <?php | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| /* | ||||
|  * 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. | ||||
|  */ | ||||
|  | ||||
| namespace Chill\PersonBundle\Controller; | ||||
|  | ||||
| use Chill\MainBundle\CRUD\Controller\CRUDController; | ||||
| use Chill\MainBundle\Pagination\PaginatorInterface; | ||||
| use Symfony\Component\HttpFoundation\Request; | ||||
|  | ||||
| class EmploymentStatusController extends CRUDController | ||||
| { | ||||
|     protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator) | ||||
|     { | ||||
|         $query->addOrderBy('e.order', 'ASC'); | ||||
|  | ||||
|         return parent::orderQuery($action, $query, $request, $paginator); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,45 @@ | ||||
| <?php | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| /* | ||||
|  * 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. | ||||
|  */ | ||||
|  | ||||
| namespace Chill\PersonBundle\DataFixtures\ORM; | ||||
|  | ||||
| use Chill\PersonBundle\Entity\EmploymentStatus; | ||||
| use Doctrine\Bundle\FixturesBundle\Fixture; | ||||
| use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface; | ||||
| use Doctrine\Persistence\ObjectManager; | ||||
|  | ||||
| class LoadEmploymentStatus extends Fixture implements FixtureGroupInterface | ||||
| { | ||||
|     public static function getGroups(): array | ||||
|     { | ||||
|         return ['employment_status']; | ||||
|     } | ||||
|  | ||||
|     public function load(ObjectManager $manager): void | ||||
|     { | ||||
|         $status = [ | ||||
|             ['name' => ['fr' => 'Salarié·e']], | ||||
|             ['name' => ['fr' => 'Indépendant·e']], | ||||
|             ['name' => ['fr' => 'Chômeur·euse']], | ||||
|             ['name' => ['fr' => 'Bénéficiaire du CPAS']], | ||||
|             ['name' => ['fr' => 'Pensionsé·e']], | ||||
|         ]; | ||||
|  | ||||
|         foreach ($status as $val) { | ||||
|             $employmentStatus = (new EmploymentStatus()) | ||||
|                 ->setName($val['name']) | ||||
|                 ->setActive(true); | ||||
|             $manager->persist($employmentStatus); | ||||
|         } | ||||
|  | ||||
|         $manager->flush(); | ||||
|     } | ||||
| } | ||||
| @@ -15,10 +15,13 @@ use Chill\MainBundle\DependencyInjection\MissingBundleException; | ||||
| use Chill\MainBundle\Security\Authorization\ChillExportVoter; | ||||
| use Chill\PersonBundle\Controller\AccompanyingPeriodCommentApiController; | ||||
| use Chill\PersonBundle\Controller\AccompanyingPeriodResourceApiController; | ||||
| use Chill\PersonBundle\Controller\EmploymentStatusController; | ||||
| use Chill\PersonBundle\Controller\HouseholdCompositionTypeApiController; | ||||
| use Chill\PersonBundle\Controller\RelationApiController; | ||||
| use Chill\PersonBundle\Doctrine\DQL\AddressPart; | ||||
| use Chill\PersonBundle\Entity\AccompanyingPeriod; | ||||
| use Chill\PersonBundle\Entity\EmploymentStatus; | ||||
| use Chill\PersonBundle\Form\EmploymentStatusType; | ||||
| use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodCommentVoter; | ||||
| use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodResourceVoter; | ||||
| use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; | ||||
| @@ -192,6 +195,28 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac | ||||
|                         ], | ||||
|                     ], | ||||
|                 ], | ||||
|                 [ | ||||
|                     'class' => EmploymentStatus::class, | ||||
|                     'name' => 'employment_status', | ||||
|                     'base_path' => '/admin/employment', | ||||
|                     'base_role' => 'ROLE_ADMIN', | ||||
|                     'form_class' => EmploymentStatusType::class, | ||||
|                     'controller' => EmploymentStatusController::class, | ||||
|                     'actions' => [ | ||||
|                         'index' => [ | ||||
|                             'role' => 'ROLE_ADMIN', | ||||
|                             'template' => '@ChillPerson/EmploymentStatus/index.html.twig', | ||||
|                         ], | ||||
|                         'new' => [ | ||||
|                             'role' => 'ROLE_ADMIN', | ||||
|                             'template' => '@ChillPerson/EmploymentStatus/new.html.twig', | ||||
|                         ], | ||||
|                         'edit' => [ | ||||
|                             'role' => 'ROLE_ADMIN', | ||||
|                             'template' => '@ChillPerson/EmploymentStatus/edit.html.twig', | ||||
|                         ], | ||||
|                     ], | ||||
|                 ], | ||||
|                 [ | ||||
|                     'class' => \Chill\PersonBundle\Entity\MaritalStatus::class, | ||||
|                     'name' => 'person_marital-status', | ||||
|   | ||||
| @@ -85,6 +85,7 @@ class Configuration implements ConfigurationInterface | ||||
|             ->append($this->addFieldNode('number_of_children')) | ||||
|             ->append($this->addFieldNode('acceptEmail')) | ||||
|             ->append($this->addFieldNode('deathdate')) | ||||
|             ->append($this->addFieldNode('employment_status', 'hidden')) | ||||
|             ->arrayNode('alt_names') | ||||
|             ->defaultValue([]) | ||||
|             ->arrayPrototype() | ||||
| @@ -141,7 +142,7 @@ class Configuration implements ConfigurationInterface | ||||
|         return $treeBuilder; | ||||
|     } | ||||
|  | ||||
|     private function addFieldNode($key) | ||||
|     private function addFieldNode(string $key, string $defaultVisibility = 'visible') | ||||
|     { | ||||
|         $tree = new TreeBuilder($key, 'enum'); | ||||
|         $node = $tree->getRootNode(); | ||||
| @@ -153,7 +154,7 @@ class Configuration implements ConfigurationInterface | ||||
|  | ||||
|         $node | ||||
|             ->values(['hidden', 'visible']) | ||||
|             ->defaultValue('visible') | ||||
|             ->defaultValue($defaultVisibility) | ||||
|             ->info($info) | ||||
|             ->end(); | ||||
|  | ||||
|   | ||||
							
								
								
									
										80
									
								
								src/Bundle/ChillPersonBundle/Entity/EmploymentStatus.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										80
									
								
								src/Bundle/ChillPersonBundle/Entity/EmploymentStatus.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,80 @@ | ||||
| <?php | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| /* | ||||
|  * 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. | ||||
|  */ | ||||
|  | ||||
| namespace Chill\PersonBundle\Entity; | ||||
|  | ||||
| use Doctrine\ORM\Mapping as ORM; | ||||
| use Symfony\Component\Serializer\Annotation as Serializer; | ||||
|  | ||||
| #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['chill_person_employment_status' => EmploymentStatus::class])] | ||||
| #[ORM\Entity] | ||||
| #[ORM\Table(name: 'chill_person_employment_status')] | ||||
| class EmploymentStatus | ||||
| { | ||||
|     #[Serializer\Groups(['read', 'docgen:read'])] | ||||
|     #[ORM\Id] | ||||
|     #[ORM\GeneratedValue] | ||||
|     #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] | ||||
|     private ?int $id = null; | ||||
|  | ||||
|     #[Serializer\Groups(['read', 'docgen:read'])] | ||||
|     #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] | ||||
|     #[Serializer\Context(['is-translatable' => true], groups: ['docgen:read'])] | ||||
|     private array $name = []; | ||||
|  | ||||
|     #[Serializer\Groups(['read'])] | ||||
|     #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] | ||||
|     private bool $active = true; | ||||
|  | ||||
|     #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, name: 'ordering', nullable: true, options: ['default' => '0.0'])] | ||||
|     private float $order = 0; | ||||
|  | ||||
|     public function getId(): ?int | ||||
|     { | ||||
|         return $this->id; | ||||
|     } | ||||
|  | ||||
|     public function getActive(): ?bool | ||||
|     { | ||||
|         return $this->active; | ||||
|     } | ||||
|  | ||||
|     public function getName(): ?array | ||||
|     { | ||||
|         return $this->name; | ||||
|     } | ||||
|  | ||||
|     public function getOrder(): ?float | ||||
|     { | ||||
|         return $this->order; | ||||
|     } | ||||
|  | ||||
|     public function setActive(bool $active): self | ||||
|     { | ||||
|         $this->active = $active; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setName(array $name): self | ||||
|     { | ||||
|         $this->name = $name; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setOrder(float $order): self | ||||
|     { | ||||
|         $this->order = $order; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
| } | ||||
| @@ -311,6 +311,13 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI | ||||
|     #[PhonenumberConstraint(type: 'mobile')] | ||||
|     private ?PhoneNumber $mobilenumber = null; | ||||
|  | ||||
|     /** | ||||
|      * The person's professional status. | ||||
|      */ | ||||
|     #[ORM\ManyToOne(targetEntity: EmploymentStatus::class)] | ||||
|     #[ORM\JoinColumn(nullable: true)] | ||||
|     private ?EmploymentStatus $employmentStatus = null; | ||||
|  | ||||
|     /** | ||||
|      * The person's nationality. | ||||
|      */ | ||||
| @@ -1033,6 +1040,11 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI | ||||
|         return $this->fullnameCanonical; | ||||
|     } | ||||
|  | ||||
|     public function getEmploymentStatus(): ?EmploymentStatus | ||||
|     { | ||||
|         return $this->employmentStatus; | ||||
|     } | ||||
|  | ||||
|     public function getGender(): ?Gender | ||||
|     { | ||||
|         return $this->gender; | ||||
| @@ -1551,6 +1563,13 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setEmploymentStatus(?EmploymentStatus $employmentStatus): self | ||||
|     { | ||||
|         $this->employmentStatus = $employmentStatus; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setGenderComment(CommentEmbeddable $genderComment): self | ||||
|     { | ||||
|         $this->genderComment = $genderComment; | ||||
|   | ||||
							
								
								
									
										44
									
								
								src/Bundle/ChillPersonBundle/Form/EmploymentStatusType.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								src/Bundle/ChillPersonBundle/Form/EmploymentStatusType.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,44 @@ | ||||
| <?php | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| /* | ||||
|  * 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. | ||||
|  */ | ||||
|  | ||||
| namespace Chill\PersonBundle\Form; | ||||
|  | ||||
| use Chill\MainBundle\Form\Type\TranslatableStringFormType; | ||||
| use Chill\PersonBundle\Entity\EmploymentStatus; | ||||
| use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | ||||
| use Symfony\Component\Form\Extension\Core\Type\NumberType; | ||||
| use Symfony\Component\Form\FormBuilderInterface; | ||||
| use Symfony\Component\OptionsResolver\OptionsResolver; | ||||
|  | ||||
| class EmploymentStatusType extends \Symfony\Component\Form\AbstractType | ||||
| { | ||||
|     public function buildForm(FormBuilderInterface $builder, array $options): void | ||||
|     { | ||||
|         $builder | ||||
|             ->add('name', TranslatableStringFormType::class, [ | ||||
|                 'required' => true, | ||||
|             ]) | ||||
|             ->add('active', ChoiceType::class, [ | ||||
|                 'choices' => [ | ||||
|                     'Active' => true, | ||||
|                     'Inactive' => false, | ||||
|                 ], | ||||
|             ]) | ||||
|             ->add('order', NumberType::class); | ||||
|     } | ||||
|  | ||||
|     public function configureOptions(OptionsResolver $resolver): void | ||||
|     { | ||||
|         $resolver->setDefaults([ | ||||
|             'data_class' => EmploymentStatus::class, | ||||
|         ]); | ||||
|     } | ||||
| } | ||||
| @@ -26,6 +26,7 @@ use Chill\PersonBundle\Entity\Person; | ||||
| use Chill\PersonBundle\Entity\PersonPhone; | ||||
| use Chill\PersonBundle\Form\Type\PersonAltNameType; | ||||
| use Chill\PersonBundle\Form\Type\PersonPhoneType; | ||||
| use Chill\PersonBundle\Form\Type\PickEmploymentStatusType; | ||||
| use Chill\PersonBundle\Form\Type\PickGenderType; | ||||
| use Chill\PersonBundle\Form\Type\Select2MaritalStatusType; | ||||
| use Symfony\Component\Form\AbstractType; | ||||
| @@ -102,6 +103,11 @@ class PersonType extends AbstractType | ||||
|                 ->add('memo', ChillTextareaType::class, ['required' => false]); | ||||
|         } | ||||
|  | ||||
|         if ('visible' === $this->config['employment_status']) { | ||||
|             $builder | ||||
|                 ->add('employmentStatus', PickEmploymentStatusType::class, ['required' => false]); | ||||
|         } | ||||
|  | ||||
|         if ('visible' === $this->config['place_of_birth']) { | ||||
|             $builder->add('placeOfBirth', TextType::class, [ | ||||
|                 'required' => false, | ||||
|   | ||||
| @@ -0,0 +1,50 @@ | ||||
| <?php | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| /* | ||||
|  * 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. | ||||
|  */ | ||||
|  | ||||
| namespace Chill\PersonBundle\Form\Type; | ||||
|  | ||||
| use Doctrine\ORM\EntityRepository; | ||||
| use Doctrine\ORM\QueryBuilder; | ||||
| use Symfony\Bridge\Doctrine\Form\Type\EntityType; | ||||
| use Symfony\Component\Form\AbstractType; | ||||
| use Symfony\Component\OptionsResolver\OptionsResolver; | ||||
| use Chill\MainBundle\Templating\TranslatableStringHelperInterface; | ||||
| use Chill\PersonBundle\Entity\EmploymentStatus; | ||||
|  | ||||
| class PickEmploymentStatusType extends AbstractType | ||||
| { | ||||
|     public function __construct( | ||||
|         private readonly TranslatableStringHelperInterface $translatableStringHelper, | ||||
|     ) {} | ||||
|  | ||||
|     public function configureOptions(OptionsResolver $resolver) | ||||
|     { | ||||
|         $resolver | ||||
|             ->setDefault('label', 'Employment status') | ||||
|             ->setDefault( | ||||
|                 'choice_label', | ||||
|                 fn (EmploymentStatus $employmentStatus): string => $this->translatableStringHelper->localize($employmentStatus->getName()) | ||||
|             ) | ||||
|             ->setDefault( | ||||
|                 'query_builder', | ||||
|                 static fn (EntityRepository $er): QueryBuilder => $er->createQueryBuilder('c') | ||||
|                     ->where('c.active = true') | ||||
|                     ->orderBy('c.order'), | ||||
|             ) | ||||
|             ->setDefault('placeholder', $this->translatableStringHelper->localize(['Select an option…'])) | ||||
|             ->setDefault('class', EmploymentStatus::class); | ||||
|     } | ||||
|  | ||||
|     public function getParent() | ||||
|     { | ||||
|         return EntityType::class; | ||||
|     } | ||||
| } | ||||
| @@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Menu; | ||||
|  | ||||
| use Chill\MainBundle\Routing\LocalMenuBuilderInterface; | ||||
| use Knp\Menu\MenuItem; | ||||
| use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; | ||||
| use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; | ||||
|  | ||||
| class AdminPersonMenuBuilder implements LocalMenuBuilderInterface | ||||
| @@ -22,9 +23,14 @@ class AdminPersonMenuBuilder implements LocalMenuBuilderInterface | ||||
|      */ | ||||
|     protected $authorizationChecker; | ||||
|  | ||||
|     public function __construct(AuthorizationCheckerInterface $authorizationChecker) | ||||
|     { | ||||
|     private array $fields_visibility; | ||||
|  | ||||
|     public function __construct( | ||||
|         AuthorizationCheckerInterface $authorizationChecker, | ||||
|         ParameterBagInterface $parameterBag, | ||||
|     ) { | ||||
|         $this->authorizationChecker = $authorizationChecker; | ||||
|         $this->fields_visibility = $parameterBag->get('chill_person.person_fields'); | ||||
|     } | ||||
|  | ||||
|     public function buildMenu($menuId, MenuItem $menu, array $parameters) | ||||
| @@ -53,6 +59,12 @@ class AdminPersonMenuBuilder implements LocalMenuBuilderInterface | ||||
|             'route' => 'chill_crud_person_marital-status_index', | ||||
|         ])->setExtras(['order' => 2030]); | ||||
|  | ||||
|         if ('visible' == $this->fields_visibility['employment_status']) { | ||||
|             $menu->addChild('Employment status', [ | ||||
|                 'route' => 'chill_crud_employment_status_index', | ||||
|             ])->setExtras(['order' => 2035]); | ||||
|         } | ||||
|  | ||||
|         $menu->addChild('person_admin.person_resource_kind', [ | ||||
|             'route' => 'chill_crud_person_resource-kind_index', | ||||
|         ])->setExtras(['order' => 2040]); | ||||
|   | ||||
| @@ -0,0 +1,11 @@ | ||||
| {% extends '@ChillMain/CRUD/Admin/index.html.twig' %} | ||||
|  | ||||
| {% block title %} | ||||
|     {% include('@ChillMain/CRUD/_edit_title.html.twig') %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block admin_content %} | ||||
|     {% embed '@ChillMain/CRUD/_edit_content.html.twig' %} | ||||
|         {% block content_form_actions_save_and_show %}{% endblock %} | ||||
|     {% endembed %} | ||||
| {% endblock admin_content %} | ||||
| @@ -0,0 +1,42 @@ | ||||
| {% extends '@ChillMain/CRUD/Admin/index.html.twig' %} | ||||
|  | ||||
| {% block admin_content %} | ||||
|     {% embed '@ChillMain/CRUD/_index.html.twig' %} | ||||
|         {% block table_entities_thead_tr %} | ||||
|             <th>id</th> | ||||
|             <th>{{ 'name'|trans }}</th> | ||||
|             <th>{{ 'active'|trans }}</th> | ||||
|             <th>{{ 'ordering'|trans }}</th> | ||||
|             <th></th> | ||||
|         {% endblock %} | ||||
|         {% block table_entities_tbody %} | ||||
|             {% for entity in entities %} | ||||
|                 <tr> | ||||
|                     <td>{{ entity.id }}</td> | ||||
|                     <td>{{ entity.name|localize_translatable_string }}</td> | ||||
|                     <td style="text-align:center;"> | ||||
| 						{%- if entity.active -%} | ||||
| 							<i class="fa fa-check-square-o"></i> | ||||
| 						{%- else -%} | ||||
| 							<i class="fa fa-square-o"></i> | ||||
| 						{%- endif -%} | ||||
| 					</td> | ||||
|                     <td>{{ entity.order }}</td> | ||||
|                     <td> | ||||
|                         <ul class="record_actions"> | ||||
|                             <li> | ||||
|                                 <a href="{{ chill_path_add_return_path('chill_crud_employment_status_edit', { 'id': entity.id}) }}" class="btn btn-sm btn-edit btn-mini"></a> | ||||
|                             </li> | ||||
|                         </ul> | ||||
|                     </td> | ||||
|                 </tr> | ||||
|             {% endfor %} | ||||
|         {% endblock %} | ||||
|  | ||||
|         {% block actions_before %} | ||||
|             <li class='cancel'> | ||||
|                 <a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a> | ||||
|             </li> | ||||
|         {% endblock %} | ||||
|     {% endembed %} | ||||
| {% endblock %} | ||||
| @@ -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 %} | ||||
| @@ -107,6 +107,9 @@ | ||||
|         {%- if form.spokenLanguages is defined -%} | ||||
|         {{ form_row(form.spokenLanguages, {'label' : 'Spoken languages'}) }} | ||||
|         {%- endif -%} | ||||
|         {%- if form.employmentStatus is defined -%} | ||||
|         {{ form_row(form.employmentStatus, {'label' : 'Employment status'}) }} | ||||
|         {%- endif -%} | ||||
|     </fieldset> | ||||
|     {%- endif -%} | ||||
|  | ||||
|   | ||||
| @@ -170,6 +170,18 @@ This view should receive those arguments: | ||||
|                     </dd> | ||||
|                 </dl> | ||||
|                 {%- endif -%} | ||||
|                 <dl> | ||||
|                     {% if chill_person.fields.employment_status == 'visible' %} | ||||
|                     <dt>{{ 'Employment status'|trans }} :</dt> | ||||
|                     <dd> | ||||
|                     {% if person.employmentStatus is not empty %} | ||||
|                         {{ person.employmentStatus.name|localize_translatable_string }} | ||||
|                     {% else %} | ||||
|                         <span class="chill-no-data-statement">{{ 'No data given'|trans }}</span> | ||||
|                     {% endif %} | ||||
|                     </dd> | ||||
|                     {% endif %} | ||||
|                 </dl> | ||||
|                 {%- if chill_person.fields.number_of_children == 'visible' -%} | ||||
|                 <dl> | ||||
|                     <dt>{{'Number of children'|trans}} :</dt> | ||||
| @@ -195,8 +207,8 @@ This view should receive those arguments: | ||||
|                             <span class="chill-no-data-statement">{{ 'No data given'|trans }}</span> | ||||
|                         {% endif %} | ||||
|                     </dd> | ||||
|  | ||||
|                     <dt>{{ 'Comment on the marital status'|trans }} :</dt> | ||||
|  | ||||
|                     <dd> | ||||
|                         {% if person.maritalStatusComment.comment is not empty %} | ||||
|                             <blockquote class="chill-user-quote"> | ||||
|   | ||||
| @@ -0,0 +1,43 @@ | ||||
| <?php | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| /* | ||||
|  * 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. | ||||
|  */ | ||||
|  | ||||
| namespace Chill\Migrations\Person; | ||||
|  | ||||
| use Doctrine\DBAL\Schema\Schema; | ||||
| use Doctrine\Migrations\AbstractMigration; | ||||
|  | ||||
| /** | ||||
|  * Auto-generated Migration: Please modify to your needs! | ||||
|  */ | ||||
| final class Version20241121080214 extends AbstractMigration | ||||
| { | ||||
|     public function getDescription(): string | ||||
|     { | ||||
|         return 'Add employment status'; | ||||
|     } | ||||
|  | ||||
|     public function up(Schema $schema): void | ||||
|     { | ||||
|         $this->addSql('CREATE SEQUENCE chill_person_employment_status_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | ||||
|         $this->addSql('CREATE TABLE chill_person_employment_status (id INT NOT NULL, name JSON NOT NULL, active BOOLEAN NOT NULL, ordering DOUBLE PRECISION DEFAULT \'0.0\', PRIMARY KEY(id))'); | ||||
|         $this->addSql('ALTER TABLE chill_person_person ADD employmentstatus_id INT DEFAULT NULL'); | ||||
|         $this->addSql('ALTER TABLE chill_person_person ADD CONSTRAINT FK_BF210A14BAE6AEE2 FOREIGN KEY (employmentstatus_id) REFERENCES chill_person_employment_status (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | ||||
|         $this->addSql('CREATE INDEX BF210A14BAE6AEE2 ON chill_person_person (employmentstatus_id)'); | ||||
|     } | ||||
|  | ||||
|     public function down(Schema $schema): void | ||||
|     { | ||||
|         $this->addSql('DROP SEQUENCE chill_person_employment_status_id_seq CASCADE'); | ||||
|         $this->addSql('ALTER TABLE chill_person_person DROP CONSTRAINT FK_BF210A14BAE6AEE2'); | ||||
|         $this->addSql('ALTER TABLE chill_person_person DROP employmentstatus_id'); | ||||
|         $this->addSql('DROP TABLE chill_person_employment_status'); | ||||
|     } | ||||
| } | ||||
| @@ -1,4 +1,5 @@ | ||||
| Edit: Modifier | ||||
| Select an option…: Choisissez une option… | ||||
| 'First name': Prénom | ||||
| firstname: prénom | ||||
| firstName: prénom | ||||
| @@ -98,7 +99,7 @@ memo: Commentaire | ||||
| numberOfChildren: Nombre d'enfants | ||||
| contactInfo: Commentaire des contacts | ||||
| spokenLanguages: Langues parlées | ||||
|  | ||||
| Employment status: Situation professionelle | ||||
|  | ||||
|  | ||||
| # dédoublonnage | ||||
| @@ -653,6 +654,12 @@ crud: | ||||
|             add_new: Ajouter un nouveau | ||||
|         title_new: Nouveau motif de clotûre | ||||
|         title_edit: Modifier le motif de clotûre | ||||
|     employment_status: | ||||
|         index: | ||||
|             title: Situations professionelles | ||||
|             add_new: Ajouter une nouvelle | ||||
|         title_new: Ajouter une situation professionelle | ||||
|         title_edit: Modifier cette situation professionelle | ||||
|     origin: | ||||
|         index: | ||||
|             title: Liste des origines de parcours | ||||
|   | ||||
							
								
								
									
										12
									
								
								symfony.lock
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								symfony.lock
									
									
									
									
									
								
							| @@ -53,6 +53,18 @@ | ||||
|             "migrations/.gitignore" | ||||
|         ] | ||||
|     }, | ||||
|     "friendsofphp/php-cs-fixer": { | ||||
|         "version": "3.65", | ||||
|         "recipe": { | ||||
|             "repo": "github.com/symfony/recipes", | ||||
|             "branch": "main", | ||||
|             "version": "3.0", | ||||
|             "ref": "be2103eb4a20942e28a6dd87736669b757132435" | ||||
|         }, | ||||
|         "files": [ | ||||
|             ".php-cs-fixer.dist.php" | ||||
|         ] | ||||
|     }, | ||||
|     "knplabs/knp-menu-bundle": { | ||||
|         "version": "v3.4.2" | ||||
|     }, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user