diff --git a/CHANGELOG.md b/CHANGELOG.md
index 593fcf262..148b993f6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,12 +11,32 @@ and this project adheres to
## Unreleased
+* [search]: listing of parcours display changed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/410)
+* [user]: page with accompanying periods to which is user is referent (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/408)
+
+## Test releases
+
+### test release 2021-01-28
+
+* [person] improve filiations vis graph: disable physics, use chill colors for persons-households-course, increase label of relations, remove labels on household arrows and other improvements (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/286, https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/362)
+* [activity] Order activity by date and by id (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/364)
+* [main] increase length of 4 Address fields (change to TEXT, no size limits) (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/277)
+* [main] Add confidential option for address, in edit and view (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/165)
+* [person] name suggestions within create person form when person is created departing from a search input (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/377)
+* [person] Add residential address entity, form and list for each person
+* [aside_activity]: dynamicUserPickerType used (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/399)
+* dispatching list
+
+
+### test release 2021-01-26
+
* [parcours] comments truncated if too long + link added (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/406)
* [person]: possibility to add person resources (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/382)
* [person ressources]: module added
* [person] age added to renderstring + renderbox/ vue component created to display person text (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/389)
+* [parcours] bugfix if deathdate is not defined (eg. for a thirdparty) parcours is still displayed. Gave error before.
+
-## Test releases
### test release 2022-01-24
diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php
index 2947fda38..3e32edfce 100644
--- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php
+++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php
@@ -256,7 +256,7 @@ final class ActivityController extends AbstractController
if ($person instanceof Person) {
$this->denyAccessUnlessGranted(ActivityVoter::SEE, $person);
$activities = $this->activityACLAwareRepository
- ->findByPerson($person, ActivityVoter::SEE, 0, null);
+ ->findByPerson($person, ActivityVoter::SEE, 0, null, ['date' => 'DESC', 'id' => 'DESC']);
$event = new PrivacyEvent($person, [
'element_class' => Activity::class,
@@ -269,7 +269,7 @@ final class ActivityController extends AbstractController
$this->denyAccessUnlessGranted(ActivityVoter::SEE, $accompanyingPeriod);
$activities = $this->activityACLAwareRepository
- ->findByAccompanyingPeriod($accompanyingPeriod, ActivityVoter::SEE);
+ ->findByAccompanyingPeriod($accompanyingPeriod, ActivityVoter::SEE, 0, null, ['date' => 'DESC', 'id' => 'DESC']);
$view = 'ChillActivityBundle:Activity:listAccompanyingCourse.html.twig';
}
diff --git a/src/Bundle/ChillActivityBundle/Tests/Security/Authorization/ActivityVoterTest.php b/src/Bundle/ChillActivityBundle/Tests/Security/Authorization/ActivityVoterTest.php
index b3d8472c6..3ca5aab45 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Security/Authorization/ActivityVoterTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Security/Authorization/ActivityVoterTest.php
@@ -29,9 +29,13 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
final class ActivityVoterTest extends KernelTestCase
{
use PrepareActivityTrait;
+
use PrepareCenterTrait;
+
use PreparePersonTrait;
+
use PrepareScopeTrait;
+
use PrepareUserTrait;
/**
diff --git a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php
index eee8c7dc8..e5244009e 100644
--- a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php
+++ b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php
@@ -32,6 +32,8 @@ final class AsideActivityController extends CRUDController
{
$asideActivity = new AsideActivity();
+ $asideActivity->setAgent($this->getUser());
+
$duration = $request->query->get('duration', '300');
$duration = DateTime::createFromFormat('U', $duration);
$asideActivity->setDuration($duration);
diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php
index 683adf8da..6ade55d07 100644
--- a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php
+++ b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php
@@ -14,7 +14,6 @@ namespace Chill\AsideActivityBundle\Form;
use Chill\AsideActivityBundle\Entity\AsideActivity;
use Chill\AsideActivityBundle\Entity\AsideActivityCategory;
use Chill\AsideActivityBundle\Templating\Entity\CategoryRender;
-use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\ChillTextareaType;
use Chill\MainBundle\Form\Type\PickUserDynamicType;
@@ -69,22 +68,6 @@ final class AsideActivityFormType extends AbstractType
];
$builder
- // ->add(
- // 'agent',
- // EntityType::class,
- // [
- // 'label' => 'For agent',
- // 'required' => true,
- // 'class' => User::class,
- // 'data' => $this->storage->getToken()->getUser(),
- // 'query_builder' => static function (EntityRepository $er) {
- // return $er->createQueryBuilder('u')->where('u.enabled = true');
- // },
- // 'attr' => ['class' => 'select2 '],
- // 'placeholder' => 'Choose the agent for whom this activity is created',
- // 'choice_label' => 'username',
- // ]
- // )
->add('agent', PickUserDynamicType::class, [
'label' => 'For agent',
'required' => true,
diff --git a/src/Bundle/ChillMainBundle/Entity/Address.php b/src/Bundle/ChillMainBundle/Entity/Address.php
index 070d40468..0e6cd549b 100644
--- a/src/Bundle/ChillMainBundle/Entity/Address.php
+++ b/src/Bundle/ChillMainBundle/Entity/Address.php
@@ -42,10 +42,16 @@ class Address
*/
private $buildingName;
+ /**
+ * @ORM\Column(type="boolean")
+ * @Groups({"write"})
+ */
+ private bool $confidential = false;
+
/**
* @var string|null
*
- * @ORM\Column(type="string", length=16, nullable=true)
+ * @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"write"})
*/
private $corridor;
@@ -78,7 +84,7 @@ class Address
/**
* @var string|null
*
- * @ORM\Column(type="string", length=16, nullable=true)
+ * @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"write"})
*/
private $flat;
@@ -86,7 +92,7 @@ class Address
/**
* @var string|null
*
- * @ORM\Column(type="string", length=16, nullable=true)
+ * @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"write"})
*/
private $floor;
@@ -143,7 +149,7 @@ class Address
/**
* @var string|null
*
- * @ORM\Column(type="string", length=16, nullable=true)
+ * @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"write"})
*/
private $steps;
@@ -192,6 +198,7 @@ class Address
return (new Address())
->setAddressReference($original->getAddressReference())
->setBuildingName($original->getBuildingName())
+ ->setConfidential($original->getConfidential())
->setCorridor($original->getCorridor())
->setCustoms($original->getCustoms())
->setDistribution($original->getDistribution())
@@ -229,6 +236,11 @@ class Address
return $this->buildingName;
}
+ public function getConfidential(): bool
+ {
+ return $this->confidential;
+ }
+
public function getCorridor(): ?string
{
return $this->corridor;
@@ -369,6 +381,13 @@ class Address
return $this;
}
+ public function setConfidential(bool $confidential): self
+ {
+ $this->confidential = $confidential;
+
+ return $this;
+ }
+
public function setCorridor(?string $corridor): self
{
$this->corridor = $corridor;
diff --git a/src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php b/src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php
index 51b8978a0..61ebce10b 100644
--- a/src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php
+++ b/src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php
@@ -20,10 +20,9 @@ use Doctrine\ORM\Mapping as ORM;
class CommentEmbeddable
{
/**
- * @var string
* @ORM\Column(type="text", nullable=true)
*/
- private $comment;
+ private ?string $comment = null;
/**
* @var DateTime
@@ -39,10 +38,7 @@ class CommentEmbeddable
*/
private $userId;
- /**
- * @return string
- */
- public function getComment()
+ public function getComment(): ?string
{
return $this->comment;
}
@@ -68,9 +64,6 @@ class CommentEmbeddable
return empty($this->getComment());
}
- /**
- * @param string $comment
- */
public function setComment(?string $comment)
{
$this->comment = $comment;
diff --git a/src/Bundle/ChillMainBundle/Entity/ResidentialAddress.php b/src/Bundle/ChillMainBundle/Entity/ResidentialAddress.php
new file mode 100644
index 000000000..7763ea9d5
--- /dev/null
+++ b/src/Bundle/ChillMainBundle/Entity/ResidentialAddress.php
@@ -0,0 +1,166 @@
+comment = new CommentEmbeddable();
+ }
+
+ public function getAddress(): ?Address
+ {
+ return $this->address;
+ }
+
+ public function getComment(): CommentEmbeddable
+ {
+ return $this->comment;
+ }
+
+ public function getEndDate(): ?DateTimeImmutable
+ {
+ return $this->endDate;
+ }
+
+ public function getHostPerson(): ?Person
+ {
+ return $this->hostPerson;
+ }
+
+ public function getHostThirdParty(): ?ThirdParty
+ {
+ return $this->hostThirdParty;
+ }
+
+ public function getId(): ?int
+ {
+ return $this->id;
+ }
+
+ public function getPerson(): ?Person
+ {
+ return $this->person;
+ }
+
+ public function getStartDate(): ?DateTimeImmutable
+ {
+ return $this->startDate;
+ }
+
+ public function setAddress(?Address $address): self
+ {
+ $this->address = $address;
+
+ return $this;
+ }
+
+ public function setComment(CommentEmbeddable $comment): self
+ {
+ $this->comment = $comment;
+
+ return $this;
+ }
+
+ public function setEndDate(?DateTimeImmutable $endDate): self
+ {
+ $this->endDate = $endDate;
+
+ return $this;
+ }
+
+ public function setHostPerson(?Person $hostPerson): self
+ {
+ $this->hostPerson = $hostPerson;
+
+ return $this;
+ }
+
+ public function setHostThirdParty(?ThirdParty $hostThirdParty): self
+ {
+ $this->hostThirdParty = $hostThirdParty;
+
+ return $this;
+ }
+
+ public function setPerson(?Person $person): self
+ {
+ $this->person = $person;
+
+ return $this;
+ }
+
+ public function setStartDate(DateTimeImmutable $startDate): self
+ {
+ $this->startDate = $startDate;
+
+ return $this;
+ }
+}
diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php
index b56435f5d..0d7142e9f 100644
--- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php
+++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php
@@ -37,6 +37,7 @@ use function count;
class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
{
use TrackCreationTrait;
+
use TrackUpdateTrait;
/**
diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowComment.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowComment.php
index b041a5aa3..9f4e7f096 100644
--- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowComment.php
+++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowComment.php
@@ -24,6 +24,7 @@ use Doctrine\ORM\Mapping as ORM;
class EntityWorkflowComment implements TrackCreationInterface, TrackUpdateInterface
{
use TrackCreationTrait;
+
use TrackUpdateTrait;
/**
diff --git a/src/Bundle/ChillMainBundle/Form/Type/ResidentialAddressType.php b/src/Bundle/ChillMainBundle/Form/Type/ResidentialAddressType.php
new file mode 100644
index 000000000..0ebe47fef
--- /dev/null
+++ b/src/Bundle/ChillMainBundle/Form/Type/ResidentialAddressType.php
@@ -0,0 +1,73 @@
+add('startDate', DateType::class, [
+ 'required' => true,
+ 'input' => 'datetime_immutable',
+ 'widget' => 'single_text',
+ ])
+ ->add('endDate', DateType::class, [
+ 'required' => false,
+ 'input' => 'datetime_immutable',
+ 'widget' => 'single_text',
+ ])
+ ->add('comment', CommentType::class, [
+ 'required' => false,
+ ]);
+
+ if ('person' === $options['kind']) {
+ $builder
+ ->add('hostPerson', PickPersonDynamicType::class, [
+ 'label' => 'Person',
+ ]);
+ }
+
+ if ('thirdparty' === $options['kind']) {
+ $builder
+ ->add('hostThirdParty', PickThirdpartyDynamicType::class, [
+ 'label' => 'Third party',
+ ]);
+ }
+
+ if ('address' === $options['kind']) {
+ $builder
+ ->add('address', PickAddressType::class, [
+ 'required' => false,
+ 'label' => 'Address',
+ 'use_valid_from' => false,
+ 'use_valid_to' => false,
+ ]);
+ }
+ }
+
+ public function configureOptions(OptionsResolver $resolver)
+ {
+ $resolver->setDefaults([
+ 'data_class' => ResidentialAddress::class,
+ 'kind' => null,
+ ]);
+ }
+}
diff --git a/src/Bundle/ChillMainBundle/Repository/ResidentialAddressRepository.php b/src/Bundle/ChillMainBundle/Repository/ResidentialAddressRepository.php
new file mode 100644
index 000000000..05cdfdf6c
--- /dev/null
+++ b/src/Bundle/ChillMainBundle/Repository/ResidentialAddressRepository.php
@@ -0,0 +1,59 @@
+createQueryBuilder('r')
+ ->andWhere('r.exampleField = :val')
+ ->setParameter('val', $value)
+ ->orderBy('r.id', 'ASC')
+ ->setMaxResults(10)
+ ->getQuery()
+ ->getResult()
+ ;
+ }
+ */
+
+ /*
+ public function findOneBySomeField($value): ?ResidentialAddress
+ {
+ return $this->createQueryBuilder('r')
+ ->andWhere('r.exampleField = :val')
+ ->setParameter('val', $value)
+ ->getQuery()
+ ->getOneOrNullResult()
+ ;
+ }
+ */
+}
diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/blur/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/blur/index.js
index 6e3b75f2b..1d66d25e6 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/module/blur/index.js
+++ b/src/Bundle/ChillMainBundle/Resources/public/module/blur/index.js
@@ -1,21 +1,19 @@
require('./blur.scss');
-var toggleBlur = function(e){
-
- var btn = e.target;
-
- btn.previousElementSibling.classList.toggle("blur");
- btn.classList.toggle("fa-eye");
- btn.classList.toggle("fa-eye-slash");
-
-}
-
-var infos = document.getElementsByClassName("confidential");
-for(var i=0; i < infos.length; i++){
- infos[i].insertAdjacentHTML('beforeend', '');
-}
-
-var toggles = document.getElementsByClassName("toggle");
-for(var i=0; i < toggles.length; i++){
- toggles[i].addEventListener("click", toggleBlur);
-}
\ No newline at end of file
+document.querySelectorAll('.confidential').forEach(function (el) {
+ let i = document.createElement('i');
+ const classes = ['fa', 'fa-eye', 'toggle'];
+ i.classList.add(...classes);
+ el.appendChild(i);
+ const toggleBlur = function(e) {
+ for (let child of el.children) {
+ if (!child.classList.contains('toggle')) {
+ child.classList.toggle('blur');
+ }
+ }
+ i.classList.toggle('fa-eye');
+ i.classList.toggle('fa-eye-slash');
+ }
+ i.addEventListener('click', toggleBlur);
+ toggleBlur();
+});
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 1fd6b34f7..4cc917502 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js
+++ b/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js
@@ -19,6 +19,12 @@ function loadDynamicPicker(element) {
input = element.querySelector('[data-input-uniqid="'+ el.dataset.uniqid +'"]'),
picked = (isMultiple) ? (JSON.parse(input.value)) : ((input.value === '[]') ? (null) : ([JSON.parse(input.value)]));
+ if (!isMultiple) {
+ if (input.value === '[]'){
+ input.value = null;
+ }
+ }
+
const app = createApp({
template: '