diff --git a/CHANGELOG.md b/CHANGELOG.md index 07c166301..71b72e2b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,15 @@ and this project adheres to ## Unreleased +* [household] change translations (champs-libres/departement-de-la-vendee/accent-suivi-developpement#109) +* [household] add address i18n in household component (champs-libres/departement-de-la-vendee/accent-suivi-developpement#158) +* [household] add on the fly i18n in household component +* [household] redirect to the household page when a household is created from a person (champs-libres/departement-de-la-vendee/accent-suivi-developpement#175) +* [household] household member editor: display alert if some members have already an household (champs-libres/departement-de-la-vendee/accent-suivi-developpement#172) +* [household] household member editor: do not add in new members if the member is included in the members of household (champs-libres/departement-de-la-vendee/accent-suivi-developpement#123) +* [household] household member editor: remove markNoAddress button (champs-libres/departement-de-la-vendee/accent-suivi-developpement#109) +* [person]: ordering fields in add person (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/61) +* [person]: Add email and alt names in add person (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/61) * AddAddress: optimize loading: wait for the user finish typing; * UserPicker: fix bug with deprecated role * docgen: add base context + tests @@ -25,6 +34,7 @@ and this project adheres to * Household: show date validFrom and validTo when moving * address reference: add index for refid * [accompanyingCourse_work] fix styles conflicts + fix bug with remove goal (remove goals one at a time) +* [accompanyingCourse] improve masonry on resume page, add origin ## Test releases diff --git a/composer.json b/composer.json index 9d7a30800..1cecf0852 100644 --- a/composer.json +++ b/composer.json @@ -1,22 +1,22 @@ { "name": "chill-project/chill-bundles", - "type": "library", "description": "Most used bundles for chill-project", + "license": "AGPL-3.0-only", + "type": "library", "keywords": [ "chill", "social worker" ], - "license": "AGPL-3.0-only", "require": { "php": "^7.4", "champs-libres/async-uploader-bundle": "dev-sf4#d57134aee8e504a83c902ff0cf9f8d36ac418290", "champs-libres/wopi-bundle": "dev-master#59b468503b9413f8d588ef9e626e7675560db3d8", + "champs-libres/wopi-lib": "dev-master#0e1da19bb6de820080b8651867a7e475be590060", "doctrine/doctrine-bundle": "^2.1", "doctrine/doctrine-migrations-bundle": "^3.0", "doctrine/orm": "^2.7", "erusev/parsedown": "^1.7", "graylog2/gelf-php": "^1.5", - "knplabs/knp-menu": "^3.1", "knplabs/knp-menu-bundle": "^3.0", "knplabs/knp-time-bundle": "^1.12", "league/csv": "^9.7.1", @@ -31,6 +31,7 @@ "symfony/css-selector": "^4.4", "symfony/expression-language": "^4.4", "symfony/form": "^4.4", + "symfony/framework-bundle": "^4.4", "symfony/intl": "^4.4", "symfony/mailer": "^5.4", "symfony/mime": "^4.4", @@ -67,8 +68,7 @@ "symfony/phpunit-bridge": "^4.4", "symfony/stopwatch": "^4.4", "symfony/var-dumper": "^4.4", - "symfony/web-profiler-bundle": "^4.4", - "vimeo/psalm": "^4.15" + "symfony/web-profiler-bundle": "^4.4" }, "config": { "bin-dir": "bin", @@ -107,8 +107,19 @@ "Chill\\DocGeneratorBundle\\Tests\\": "src/Bundle/ChillDocGeneratorBundle/tests" } }, - "minimum-stability": "dev", - "prefer-stable": true, + "config": { + "allow-plugins": { + "composer/package-versions-deprecated": true, + "phpstan/extension-installer": true, + "ergebnis/composer-normalize": true, + "phpro/grumphp": true, + "ocramius/package-versions": true + }, + "bin-dir": "bin", + "optimize-autoloader": true, + "sort-packages": true, + "vendor-dir": "tests/app/vendor" + }, "scripts": { "auto-scripts": { "cache:clear": "symfony-cmd", diff --git a/phpstan-deprecations.neon b/phpstan-deprecations.neon index 24deda05f..bc372e96b 100644 --- a/phpstan-deprecations.neon +++ b/phpstan-deprecations.neon @@ -859,11 +859,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php - - - message: "#^Call to deprecated method setTimeout\\(\\) of class Redis\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverLocker.php - - message: """ diff --git a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonCategoryControllerTest.php b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonCategoryControllerTest.php index a6277608f..0d64d0b65 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonCategoryControllerTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonCategoryControllerTest.php @@ -66,7 +66,7 @@ final class ActivityReasonCategoryControllerTest extends WebTestCase $crawler = $client->followRedirect(); // Check the entity has been delete on the list - $this->assertNotRegExp('/Foo/', $client->getResponse()->getContent()); + $this->assertDoesNotMatchRegularExpression('/Foo/', $client->getResponse()->getContent()); } */ diff --git a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonControllerTest.php b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonControllerTest.php index a2ae8c13f..481098eb0 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonControllerTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonControllerTest.php @@ -66,7 +66,7 @@ final class ActivityReasonControllerTest extends WebTestCase $crawler = $client->followRedirect(); // Check the entity has been delete on the list - $this->assertNotRegExp('/Foo/', $client->getResponse()->getContent()); + $this->assertDoesNotMatchRegularExpression('/Foo/', $client->getResponse()->getContent()); } */ diff --git a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityTypeControllerTest.php b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityTypeControllerTest.php index a07f03770..7ccf26cf1 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityTypeControllerTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityTypeControllerTest.php @@ -66,7 +66,7 @@ final class ActivityTypeControllerTest extends WebTestCase $crawler = $client->followRedirect(); // Check the entity has been delete on the list - $this->assertNotRegExp('/Foo/', $client->getResponse()->getContent()); + $this->assertDoesNotMatchRegularExpression('/Foo/', $client->getResponse()->getContent()); } */ diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/Config/ConfigCustomizablesEntitiesTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/Config/ConfigCustomizablesEntitiesTest.php index 6a2809071..cb8136806 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Tests/Config/ConfigCustomizablesEntitiesTest.php +++ b/src/Bundle/ChillCustomFieldsBundle/Tests/Config/ConfigCustomizablesEntitiesTest.php @@ -33,11 +33,11 @@ final class ConfigCustomizablesEntitiesTest extends KernelTestCase $customizableEntities = self::$kernel->getContainer() ->getParameter('chill_custom_fields.customizables_entities'); - $this->assertInternalType('array', $customizableEntities); + $this->assertIsArray($customizableEntities); $this->assertCount(2, $customizableEntities); foreach ($customizableEntities as $key => $config) { - $this->assertInternalType('array', $config); + $this->assertIsArray($config); $this->assertArrayHasKey('name', $config); $this->assertArrayHasKey('class', $config); } @@ -56,7 +56,7 @@ final class ConfigCustomizablesEntitiesTest extends KernelTestCase $customizableEntities = self::$kernel->getContainer() ->getParameter('chill_custom_fields.customizables_entities'); - $this->assertInternalType('array', $customizableEntities); + $this->assertIsArray($customizableEntities); $this->assertCount(1, $customizableEntities); } } diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/Controller/CustomFieldControllerTest_TODO.php b/src/Bundle/ChillCustomFieldsBundle/Tests/Controller/CustomFieldControllerTest_TODO.php index 32513a837..b5e8ab438 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Tests/Controller/CustomFieldControllerTest_TODO.php +++ b/src/Bundle/ChillCustomFieldsBundle/Tests/Controller/CustomFieldControllerTest_TODO.php @@ -61,7 +61,7 @@ final class CustomFieldControllerTest_TODO extends WebTestCase $crawler = $client->followRedirect(); // Check the entity has been delete on the list - $this->assertNotRegExp('/Foo/', $client->getResponse()->getContent()); + $this->assertDoesNotMatchRegularExpression('/Foo/', $client->getResponse()->getContent()); } */ diff --git a/src/Bundle/ChillEventBundle/Tests/Controller/EventControllerTest.php b/src/Bundle/ChillEventBundle/Tests/Controller/EventControllerTest.php index 8966a45a1..21c5c89d9 100644 --- a/src/Bundle/ChillEventBundle/Tests/Controller/EventControllerTest.php +++ b/src/Bundle/ChillEventBundle/Tests/Controller/EventControllerTest.php @@ -66,7 +66,7 @@ final class EventControllerTest extends WebTestCase $crawler = $client->followRedirect(); // Check the entity has been delete on the list - $this->assertNotRegExp('/Foo/', $client->getResponse()->getContent()); + $this->assertDoesNotMatchRegularExpression('/Foo/', $client->getResponse()->getContent()); } */ diff --git a/src/Bundle/ChillEventBundle/Tests/Controller/EventTypeControllerTest.php b/src/Bundle/ChillEventBundle/Tests/Controller/EventTypeControllerTest.php index 4b69b9849..e2a8170d4 100644 --- a/src/Bundle/ChillEventBundle/Tests/Controller/EventTypeControllerTest.php +++ b/src/Bundle/ChillEventBundle/Tests/Controller/EventTypeControllerTest.php @@ -66,7 +66,7 @@ final class EventTypeControllerTest extends WebTestCase $crawler = $client->followRedirect(); // Check the entity has been delete on the list - $this->assertNotRegExp('/Foo/', $client->getResponse()->getContent()); + $this->assertDoesNotMatchRegularExpression('/Foo/', $client->getResponse()->getContent()); } */ diff --git a/src/Bundle/ChillEventBundle/Tests/Controller/RoleControllerTest.php b/src/Bundle/ChillEventBundle/Tests/Controller/RoleControllerTest.php index d24b10a40..d720f7e7a 100644 --- a/src/Bundle/ChillEventBundle/Tests/Controller/RoleControllerTest.php +++ b/src/Bundle/ChillEventBundle/Tests/Controller/RoleControllerTest.php @@ -66,7 +66,7 @@ final class RoleControllerTest extends WebTestCase $crawler = $client->followRedirect(); // Check the entity has been delete on the list - $this->assertNotRegExp('/Foo/', $client->getResponse()->getContent()); + $this->assertDoesNotMatchRegularExpression('/Foo/', $client->getResponse()->getContent()); } */ diff --git a/src/Bundle/ChillEventBundle/Tests/Controller/StatusControllerTest.php b/src/Bundle/ChillEventBundle/Tests/Controller/StatusControllerTest.php index d07909032..28bbab8e3 100644 --- a/src/Bundle/ChillEventBundle/Tests/Controller/StatusControllerTest.php +++ b/src/Bundle/ChillEventBundle/Tests/Controller/StatusControllerTest.php @@ -66,7 +66,7 @@ final class StatusControllerTest extends WebTestCase $crawler = $client->followRedirect(); // Check the entity has been delete on the list - $this->assertNotRegExp('/Foo/', $client->getResponse()->getContent()); + $this->assertDoesNotMatchRegularExpression('/Foo/', $client->getResponse()->getContent()); } */ diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php index 9563ed4bf..1a91d4629 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php @@ -140,8 +140,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase { $filter = $this->getAggregator(); - $this->assertInternalType( - 'string', + $this->assertIsString( $filter->applyOn(), 'test that the internal type of "applyOn" is a string' ); @@ -160,8 +159,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase { $queryKeys = $this->getAggregator()->getQueryKeys($data); - $this->assertInternalType( - 'array', + $this->assertIsArray( $queryKeys, 'test that the query keys returned are an array' ); @@ -252,7 +250,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase { $title = $this->getAggregator()->getTitle(); - $this->assertInternalType('string', $title); + $this->assertIsString($title); $this->assertNotEmpty( $title, 'test that the title is not empty' diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php index 7a888eb01..18a3f6c66 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php @@ -151,8 +151,7 @@ abstract class AbstractExportTest extends WebTestCase { $export = $this->getExport(); - $this->assertInternalType( - 'string', + $this->assertIsString( $export->getDescription(), 'Assert that the `getDescription` method return a string' ); @@ -214,8 +213,7 @@ abstract class AbstractExportTest extends WebTestCase $results = $this->getExport()->getResult($query, $data); - $this->assertInternalType( - 'array', + $this->assertIsArray( $results, 'assert that the returned result is an array' ); @@ -271,8 +269,7 @@ abstract class AbstractExportTest extends WebTestCase { $export = $this->getExport(); - $this->assertInternalType( - 'string', + $this->assertIsString( $export->getType(), 'Assert that the `getType` method return a string' ); diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php index d0f4eaa97..4355687e1 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php @@ -126,7 +126,7 @@ abstract class AbstractFilterTest extends KernelTestCase { $filter = $this->getFilter(); - $this->assertInternalType('string', $filter->applyOn()); + $this->assertIsString($filter->applyOn()); } /** @@ -149,8 +149,7 @@ abstract class AbstractFilterTest extends KernelTestCase 'test that the description is not empty' ); } elseif (is_array($description)) { - $this->assertInternalType( - 'string', + $this->assertIsString( $description[0], 'test that the first element in the description array is a string' ); @@ -191,7 +190,7 @@ abstract class AbstractFilterTest extends KernelTestCase { $title = $this->getFilter()->getTitle(); - $this->assertInternalType('string', $title); + $this->assertIsString($title); $this->assertNotEmpty( $title, 'test that the title is not empty' diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/CenterControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/CenterControllerTest.php index 981bb3094..b5bb012a2 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/CenterControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/CenterControllerTest.php @@ -72,6 +72,6 @@ final class CenterControllerTest extends WebTestCase $crawler = $client->request('GET', '/fr/admin/center/'); // Check the entity has been delete on the list - $this->assertRegExp('/Foo/', $client->getResponse()->getContent()); + $this->assertMatchesRegularExpression('/Foo/', $client->getResponse()->getContent()); } } diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/LoginControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/LoginControllerTest.php index bed40b372..a7c53a75d 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/LoginControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/LoginControllerTest.php @@ -40,7 +40,7 @@ final class LoginControllerTest extends WebTestCase $this->assertTrue($client->getResponse()->isRedirect()); //the response is not a login page, but on a new page - $this->assertNotRegExp('/\/login$/', $client->getResponse() + $this->assertDoesNotMatchRegularExpression('/\/login$/', $client->getResponse() ->headers ->get('location')); @@ -48,7 +48,7 @@ final class LoginControllerTest extends WebTestCase $client->followRedirects(true); $crawler = $client->request('GET', '/'); - $this->assertRegExp('/center a_social/', $client->getResponse() + $this->assertMatchesRegularExpression('/center a_social/', $client->getResponse() ->getContent()); $logoutLinkFilter = $crawler->filter('a:contains("Se déconnecter")'); @@ -63,7 +63,7 @@ final class LoginControllerTest extends WebTestCase $client->followRedirect(); //redirect to login page //check we are back on login page - $this->assertRegExp('/\/login$/', $client->getResponse() + $this->assertMatchesRegularExpression('/\/login$/', $client->getResponse() ->headers ->get('location')); } diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/PermissionsGroupControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/PermissionsGroupControllerTest.php index f27eaa7a7..b7cb73cbf 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/PermissionsGroupControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/PermissionsGroupControllerTest.php @@ -66,7 +66,7 @@ final class PermissionsGroupControllerTest extends WebTestCase $crawler = $client->followRedirect(); // Check the entity has been delete on the list - $this->assertNotRegExp('/Foo/', $client->getResponse()->getContent()); + $this->assertDoesNotMatchRegularExpression('/Foo/', $client->getResponse()->getContent()); } */ diff --git a/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php index cc10e43cb..7208c3ee9 100644 --- a/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php @@ -48,7 +48,7 @@ final class TokenManagerTest extends KernelTestCase $tokens = $tokenManager->generate($user, $expiration); - $this->assertInternalType('array', $tokens); + $this->assertIsArray($tokens); $this->assertArrayHasKey('h', $tokens); $this->assertArrayHasKey('t', $tokens); $this->assertNotEmpty($tokens['h']); diff --git a/src/Bundle/ChillMainBundle/Tests/Services/MenuComposerTest.php b/src/Bundle/ChillMainBundle/Tests/Services/MenuComposerTest.php index b7df8018e..8ed185aa9 100644 --- a/src/Bundle/ChillMainBundle/Tests/Services/MenuComposerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Services/MenuComposerTest.php @@ -48,6 +48,6 @@ final class MenuComposerTest extends KernelTestCase $routes = $this->menuComposer->getRoutesFor('dummy0'); - $this->assertInternalType('array', $routes); + $this->assertIsArray($routes); } } diff --git a/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php b/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php index ae291067b..7226e96c9 100644 --- a/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php +++ b/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php @@ -11,8 +11,6 @@ declare(strict_types=1); namespace Chill\PersonBundle\Config; -use function count; - /** * Give help to interact with the config for alt names. */ @@ -69,6 +67,6 @@ class ConfigPersonAltNamesHelper */ public function hasAltNames(): bool { - return count($this->config) > 0; + return [] !== $this->config; } } diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php index 28966c4e5..5be598426 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php @@ -14,23 +14,52 @@ namespace Chill\PersonBundle\Controller; use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\Entity\Address; use Chill\MainBundle\Security\Authorization\AuthorizationHelper; +use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper; +use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Security\Authorization\PersonVoter; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; - -use function array_filter; -use function array_values; +use function in_array; class PersonApiController extends ApiController { private AuthorizationHelper $authorizationHelper; - public function __construct(AuthorizationHelper $authorizationHelper) - { + private ConfigPersonAltNamesHelper $configPersonAltNameHelper; + + public function __construct( + AuthorizationHelper $authorizationHelper, + ConfigPersonAltNamesHelper $configPersonAltNameHelper + ) { $this->authorizationHelper = $authorizationHelper; + $this->configPersonAltNameHelper = $configPersonAltNameHelper; + } + + /** + * @Route("/api/1.0/person/config/alt_names.{_format}", + * name="chill_person_config_alt_names", + * requirements={ + * "_format": "json" + * } + * ) + */ + public function configAltNames(Request $request, string $_format): Response + { + $configAltNamesChoices = $this->configPersonAltNameHelper->getChoices(); + + return $this->json( + array_map( + static fn (array $data, string $key): array => ['key' => $key, 'labels' => $data], + $configAltNamesChoices, + array_keys($configAltNamesChoices) + ), + Response::HTTP_OK, + [], + ['groups' => ['read']] + ); } public function personAddressApi($id, Request $request, string $_format): Response @@ -51,22 +80,51 @@ class PersonApiController extends ApiController { $this->denyAccessUnlessGranted(PersonVoter::SEE, $person); - $addresses = []; + $seenAddressIds = []; + // collect addresses from location in courses - foreach ($person->getAccompanyingPeriodParticipations() as $participation) { - if (null !== $participation->getAccompanyingPeriod()->getAddressLocation()) { - $a = $participation->getAccompanyingPeriod()->getAddressLocation(); - $addresses[$a->getId()] = $a; - } - } + $addresses = $person + ->getAccompanyingPeriodParticipations() + ->filter( + static function (AccompanyingPeriodParticipation $accompanyingPeriodParticipation): bool { + return null !== $accompanyingPeriodParticipation->getAccompanyingPeriod()->getAddressLocation(); + } + ) + ->map( + static function (AccompanyingPeriodParticipation $accompanyingPeriodParticipation): ?Address { + return $accompanyingPeriodParticipation->getAccompanyingPeriod()->getAddressLocation(); + } + ) + ->filter( + // We remove potential null addresses. + static fn (?Address $address): bool => null !== $address + ) + ->filter( + static function (Address $address) use (&$seenAddressIds): bool { + $id = $address->getId(); + + if (in_array($id, $seenAddressIds, true)) { + return false; + } + + $seenAddressIds[] = $id; + + return true; + } + ); // remove the actual address $actual = $person->getCurrentHouseholdAddress(); if (null !== $actual) { - $addresses = array_filter($addresses, static fn ($a) => $a !== $actual); + $addresses = $addresses->filter(static fn (Address $address): bool => $address !== $actual); } - return $this->json(array_values($addresses), Response::HTTP_OK, [], ['groups' => ['read']]); + return $this->json( + $addresses->getValues(), + Response::HTTP_OK, + [], + ['groups' => ['read']] + ); } } diff --git a/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php b/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php index d233082c4..4fe1e5fca 100644 --- a/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php +++ b/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Entity; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Serializer\Annotation\Groups; /** * PersonAltName. @@ -34,6 +35,7 @@ class PersonAltName * @var string * * @ORM\Column(name="key", type="string", length=255) + * @Groups({"write"}) */ private $key; @@ -41,6 +43,7 @@ class PersonAltName * @var string * * @ORM\Column(name="label", type="text") + * @Groups({"write"}) */ private $label; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss index f39f64eb2..db5df905a 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss @@ -254,3 +254,24 @@ abbr.referrer { // still used ? border: 1px solid black; padding: 10px; } + +/// Masonry blocs on AccompanyingCourse resume page +div#dashboards { + div.mbloc { + & > div:not(.warnings) { + border: 1px solid $chill-light-gray; + background-color: $chill-llight-gray; + border-radius: 0.35rem; + padding: 1rem; + } + & > div.warnings .alert { + margin-bottom: 0; + } + blockquote.chill-user-quote { + margin: -1.2em; + p { + margin: 0; + } + } + } +} diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/api.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/api.js index 7a91ec912..b42e57fe6 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/api.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/api.js @@ -33,7 +33,7 @@ const fetchHouseholdSuggestionByAccompanyingPeriod = (personId) => { throw Error ({m: 'Error while fetching household suggestion', status: response.status}); }).then(data => Promise.resolve(data.results)) - .catch(e => console.err(e)); + .catch(e => console.error(e)); ; }; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue index b291bc06d..09359c6dd 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue @@ -9,7 +9,7 @@
{{ $t('household_members_editor.concerned.persons_will_be_moved') }} :
-
+
{{ $t('household_members_editor.concerned.persons_with_household') }}
+