Compare commits

...

4 Commits

Author SHA1 Message Date
34801dcd5f master merged into branch 2022-07-18 15:04:31 +02:00
cc2bee8188 php cs style fixes, stan ok! 2022-07-18 14:56:44 +02:00
fb0135a0af update changelog 2022-07-18 12:01:07 +02:00
88961e3e7e allow the deletion of a relationship 2022-07-18 12:00:09 +02:00
2 changed files with 5 additions and 3 deletions

View File

@@ -16,6 +16,7 @@ and this project adheres to
* [person-thirdparty]: fix quick-add of names that consist of multiple parts (eg. De Vlieger) within onthefly modal person/thirdparty
* [search]: Order of birthdate fields changed in advanced search to avoid confusion.
* [workflow]: Constraint added to workflow (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/675)
* [filiation]: Allow the deletion of a relationship in filiations (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/608)
* [household]: Reposition and cut button for enfant hors menage have been deleted (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/620)
## Test releases

View File

@@ -39,6 +39,7 @@ class RelationshipNoDuplicateValidator extends ConstraintValidator
$fromPerson = $value->getFromPerson();
$toPerson = $value->getToPerson();
$relationType = $value->getRelation();
$relationships = $this->relationshipRepository->findBy([
'fromPerson' => [$fromPerson, $toPerson],
@@ -46,11 +47,11 @@ class RelationshipNoDuplicateValidator extends ConstraintValidator
]);
foreach ($relationships as $r) {
if (
$r->getFromPerson() === $fromPerson
if ($r->getRelation()->getId() !== $relationType->getId()
&& ($r->getFromPerson() === $fromPerson
|| $r->getFromPerson() === $toPerson
|| $r->getToPerson() === $fromPerson
|| $r->getToPerson() === $toPerson
|| $r->getToPerson() === $toPerson)
) {
$this->context->buildViolation($constraint->message)
->addViolation();