diff --git a/CHANGELOG.md b/CHANGELOG.md index e43212b4c..077cc0242 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,16 +15,24 @@ and this project adheres to * [admin] add admin section for languages and countries (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/596) * [activity] activity admin: translations + remove label field for comment on admin activity type (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/587) * [main] admin user_job: improvements (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/588) +* [address] can add extra address info even if noAddress (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/576) + + +## Test releases + +### 2022-05-06 + +* [person] add civility when creating a person (with the on-the-fly component or in the php form) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/557) +* [person] add address when creating a person (with the on-the-fly component or in the php form) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/557) +* [person] add household creation API point (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/557) + +### 2021-04-29 * [person] prevent circular references in PersonDocGenNormalizer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/527) * [person] add maritalStatusComment to PersonDocGenNormalizer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/582) * Load relationships without gender in french fixtures * Add command to remove old draft accompanying periods - - -## Test releases - ### 2021-04-28 * [address] fix bug when editing address: update location and addressreferenceId + better update of the map in edition (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/593) diff --git a/src/Bundle/ChillDocStoreBundle/Security/Authorization/AccompanyingCourseDocumentVoter.php b/src/Bundle/ChillDocStoreBundle/Security/Authorization/AccompanyingCourseDocumentVoter.php index 88e701fcf..35fde9b28 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Authorization/AccompanyingCourseDocumentVoter.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Authorization/AccompanyingCourseDocumentVoter.php @@ -85,8 +85,6 @@ class AccompanyingCourseDocumentVoter extends AbstractChillVoter implements Prov protected function voteOnAttribute($attribute, $subject, TokenInterface $token) { - $this->logger->debug(sprintf('Voting from %s class', self::class)); - if (!$token->getUser() instanceof User) { return false; } diff --git a/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php b/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php index 1a7d8956a..1ac7a87fe 100644 --- a/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php +++ b/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php @@ -76,7 +76,8 @@ final class AddressReferenceAPIController extends ApiController protected function customizeQuery(string $action, Request $request, $qb): void { if ($request->query->has('postal_code')) { - $qb->where('e.postcode = :postal_code') + $qb->where($qb->expr()->isNull('e.deletedAt')) + ->andWhere('e.postcode = :postal_code') ->setParameter('postal_code', $request->query->get('postal_code')); } } diff --git a/src/Bundle/ChillMainBundle/Entity/AddressReference.php b/src/Bundle/ChillMainBundle/Entity/AddressReference.php index a9d421fcb..fc4339fe0 100644 --- a/src/Bundle/ChillMainBundle/Entity/AddressReference.php +++ b/src/Bundle/ChillMainBundle/Entity/AddressReference.php @@ -12,13 +12,14 @@ declare(strict_types=1); namespace Chill\MainBundle\Entity; use Chill\MainBundle\Doctrine\Model\Point; +use DateTimeImmutable; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; /** * @ORM\Entity * @ORM\Table(name="chill_main_address_reference", indexes={ - * @ORM\Index(name="address_refid", columns={"refId"}, options={"where": "refid != ''"}) + * @ORM\Index(name="address_refid", columns={"refId"}) * }) * @ORM\HasLifecycleCallbacks */ @@ -33,6 +34,18 @@ class AddressReference */ private string $addressCanonical = ''; + /** + * @ORM\Column(type="datetime_immutable", nullable=true) + * @groups({"read"}) + */ + private ?DateTimeImmutable $createdAt = null; + + /** + * @ORM\Column(type="datetime_immutable", nullable=true) + * @groups({"read"}) + */ + private ?DateTimeImmutable $deletedAt = null; + /** * @ORM\Id * @ORM\GeneratedValue @@ -89,6 +102,22 @@ class AddressReference */ private $streetNumber; + /** + * @ORM\Column(type="datetime_immutable", nullable=true) + * @groups({"read"}) + */ + private ?DateTimeImmutable $updatedAt = null; + + public function getCreatedAt(): ?DateTimeImmutable + { + return $this->createdAt; + } + + public function getDeletedAt(): ?DateTimeImmutable + { + return $this->deletedAt; + } + public function getId(): ?int { return $this->id; @@ -134,6 +163,25 @@ class AddressReference return $this->streetNumber; } + public function getUpdatedAt(): ?DateTimeImmutable + { + return $this->updatedAt; + } + + public function setCreatedAt(?DateTimeImmutable $createdAt): self + { + $this->createdAt = $createdAt; + + return $this; + } + + public function setDeletedAt(?DateTimeImmutable $deletedAt): self + { + $this->deletedAt = $deletedAt; + + return $this; + } + public function setMunicipalityCode(?string $municipalityCode): self { $this->municipalityCode = $municipalityCode; @@ -189,4 +237,11 @@ class AddressReference return $this; } + + public function setUpdatedAt(?DateTimeImmutable $updatedAt): self + { + $this->updatedAt = $updatedAt; + + return $this; + } } diff --git a/src/Bundle/ChillMainBundle/Entity/PostalCode.php b/src/Bundle/ChillMainBundle/Entity/PostalCode.php index 484a9e322..4b79f58e8 100644 --- a/src/Bundle/ChillMainBundle/Entity/PostalCode.php +++ b/src/Bundle/ChillMainBundle/Entity/PostalCode.php @@ -21,10 +21,11 @@ use Symfony\Component\Serializer\Annotation\Groups; * @ORM\Entity * @ORM\Table( * name="chill_main_postal_code", - * indexes={@ORM\Index( - * name="search_name_code", - * columns={"code", "label"} - * )}) + * indexes={ + * @ORM\Index(name="search_name_code", columns={"code", "label"}), + * @ORM\Index(name="search_by_reference_code", columns={"code", "refpostalcodeid"}) + * }) + * * @ORM\HasLifecycleCallbacks */ class PostalCode diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index 76fd7196d..ad4888d58 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -45,7 +45,7 @@ class User implements AdvancedUserInterface * * @ORM\Column(type="json", nullable=true) */ - private array $attributes; + private array $attributes = []; /** * @ORM\ManyToOne(targetEntity=Location::class) diff --git a/src/Bundle/ChillMainBundle/Repository/AddressReferenceRepository.php b/src/Bundle/ChillMainBundle/Repository/AddressReferenceRepository.php index 9cbad91c9..8a0755902 100644 --- a/src/Bundle/ChillMainBundle/Repository/AddressReferenceRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/AddressReferenceRepository.php @@ -130,12 +130,13 @@ final class AddressReferenceRepository implements ObjectRepository $query ->setFromClause('chill_main_address_reference cma') - ->andWhereClause('postcode_id = ?', [$postalCode->getId()]); + ->andWhereClause('postcode_id = ?', [$postalCode->getId()]) + ->andWhereClause('deletedAt IS NULL', []); $pertinenceClause = ['STRICT_WORD_SIMILARITY(addresscanonical, UNACCENT(?))']; $pertinenceArgs = [$pattern]; - $orWhere = ['addresscanonical %>> UNACCENT(?)']; - $orWhereArgs = [$pattern]; + $andWhere = []; + $andWhereArgs = []; foreach (explode(' ', $pattern) as $part) { $part = trim($part); @@ -144,8 +145,8 @@ final class AddressReferenceRepository implements ObjectRepository continue; } - $orWhere[] = "addresscanonical LIKE '%' || UNACCENT(LOWER(?)) || '%'"; - $orWhereArgs[] = $part; + $andWhere[] = "(addresscanonical LIKE '%' || UNACCENT(LOWER(?)) || '%')"; + $andWhereArgs[] = $part; $pertinenceClause[] = "(EXISTS (SELECT 1 FROM unnest(string_to_array(addresscanonical, ' ')) AS t WHERE starts_with(t, UNACCENT(LOWER(?)))))::int"; $pertinenceClause[] = @@ -154,7 +155,7 @@ final class AddressReferenceRepository implements ObjectRepository } $query ->setSelectPertinence(implode(' + ', $pertinenceClause), $pertinenceArgs) - ->andWhereClause(implode(' OR ', $orWhere), $orWhereArgs); + ->andWhereClause(implode(' AND ', $andWhere), $andWhereArgs); return $query; } diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js index f184bf100..511d2126e 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js @@ -51,9 +51,7 @@ function loadDynamicPicker(element) { }, methods: { addNewEntity(entity) { - console.log('addNewEntity', entity); if (this.multiple) { - console.log('adding multiple'); if (!this.picked.some(el => { return el.type === entity.type && el.id === entity.id; })) { @@ -71,7 +69,6 @@ function loadDynamicPicker(element) { } }, removeEntity(entity) { - console.log('removeEntity', entity); this.picked = this.picked.filter(e => !(e.type === entity.type && e.id === entity.id)); input.value = JSON.stringify(this.picked); }, @@ -86,7 +83,6 @@ function loadDynamicPicker(element) { document.addEventListener('show-hide-show', function(e) { - console.log('creation event caught') loadDynamicPicker(e.detail.container) }) @@ -94,17 +90,14 @@ document.addEventListener('show-hide-hide', function(e) { console.log('hiding event caught') e.detail.container.querySelectorAll('[data-module="pick-dynamic"]').forEach((el) => { let uniqId = el.dataset.uniqid; - console.log(uniqId); if (appsOnPage.has(uniqId)) { appsOnPage.get(uniqId).unmount(); - console.log('App has been unmounted') appsOnPage.delete(uniqId); } }) }) document.addEventListener('DOMContentLoaded', function(e) { - console.log('loaded event', e) loadDynamicPicker(document) }) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue index 93a64ad19..a26478126 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue @@ -1,7 +1,7 @@