diff --git a/.editorconfig b/.editorconfig
index fe115d4c0..d51908caf 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -18,3 +18,10 @@ max_line_length = 80
[COMMIT_EDITMSG]
max_line_length = 0
+<<<<<<< Updated upstream
+=======
+
+[*.{js, vue, ts}]
+indent_size = 2
+indent_style = space
+>>>>>>> Stashed changes
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b9fa2851a..fa4fcd96d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,13 @@ and this project adheres to
* [person] add closing motive to closed acc course (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/603)
+* [person] household filiation: fetch person info when unfolding person (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/586)
+* [admin] repair edit of social action in the admin (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/601)
+* [admin]: add select2 to Goal form type entity fields (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/702)
+* [main] allow hide permissions group list menu (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/577)
+* [main] allow hide change user password menu (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/577)
+* [main] filter user jobs by active jobs (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/577)
+* [main] add civility to User (entity, migration and form type) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/577)
* [admin] refactorisation of the admin section: reorganisation of the menu, translations, form types, new entities (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/592)
* [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)
@@ -33,6 +40,7 @@ and this project adheres to
* [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
+* [parcours]: If users assings him/herself as referrer and job is not null. Update parcours job (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/578)
### 2021-04-28
diff --git a/phpstan-deprecations.neon b/phpstan-deprecations.neon
index 2de8b8bc8..42981a551 100644
--- a/phpstan-deprecations.neon
+++ b/phpstan-deprecations.neon
@@ -471,11 +471,6 @@ parameters:
count: 1
path: src/Bundle/ChillMainBundle/Form/Type/UserPickerType.php
- -
- message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
- count: 1
- path: src/Bundle/ChillMainBundle/Form/UserType.php
-
-
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
count: 2
diff --git a/src/Bundle/ChillActivityBundle/Entity/Activity.php b/src/Bundle/ChillActivityBundle/Entity/Activity.php
index 0c0632722..db0d5c7d1 100644
--- a/src/Bundle/ChillActivityBundle/Entity/Activity.php
+++ b/src/Bundle/ChillActivityBundle/Entity/Activity.php
@@ -15,6 +15,7 @@ use Chill\ActivityBundle\Validator\Constraints as ActivityValidator;
use Chill\DocStoreBundle\Entity\StoredObject;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
+use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable;
use Chill\MainBundle\Entity\HasCenterInterface;
use Chill\MainBundle\Entity\HasScopeInterface;
use Chill\MainBundle\Entity\Location;
@@ -134,6 +135,12 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
*/
private ?Collection $persons = null;
+ /**
+ * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_")
+ * @Groups({"docgen:read"})
+ */
+ private PrivateCommentEmbeddable $privateComment;
+
/**
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
* @Groups({"docgen:read"})
@@ -193,6 +200,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
{
$this->reasons = new ArrayCollection();
$this->comment = new CommentEmbeddable();
+ $this->privateComment = new PrivateCommentEmbeddable();
$this->persons = new ArrayCollection();
$this->thirdParties = new ArrayCollection();
$this->documents = new ArrayCollection();
@@ -400,6 +408,11 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
return [];
}
+ public function getPrivateComment(): PrivateCommentEmbeddable
+ {
+ return $this->privateComment;
+ }
+
public function getReasons(): Collection
{
return $this->reasons;
@@ -586,6 +599,13 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
return $this;
}
+ public function setPrivateComment(PrivateCommentEmbeddable $privateComment): self
+ {
+ $this->privateComment = $privateComment;
+
+ return $this;
+ }
+
public function setReasons(?ArrayCollection $reasons): self
{
$this->reasons = $reasons;
diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php
index bdf75ed05..845b31ca2 100644
--- a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php
+++ b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php
@@ -167,6 +167,16 @@ class ActivityType
*/
private int $personVisible = self::FIELD_REQUIRED;
+ /**
+ * @ORM\Column(type="string", nullable=false, options={"default": ""})
+ */
+ private string $privateCommentLabel = '';
+
+ /**
+ * @ORM\Column(type="smallint", nullable=false, options={"default": 1})
+ */
+ private int $privateCommentVisible = self::FIELD_OPTIONAL;
+
/**
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
@@ -416,6 +426,16 @@ class ActivityType
return $this->personVisible;
}
+ public function getPrivateCommentLabel(): string
+ {
+ return $this->privateCommentLabel;
+ }
+
+ public function getPrivateCommentVisible(): int
+ {
+ return $this->privateCommentVisible;
+ }
+
public function getReasonsLabel(): string
{
return $this->reasonsLabel;
@@ -688,6 +708,20 @@ class ActivityType
return $this;
}
+ public function setPrivateCommentLabel(string $privateCommentLabel): self
+ {
+ $this->privateCommentLabel = $privateCommentLabel;
+
+ return $this;
+ }
+
+ public function setPrivateCommentVisible(int $privateCommentVisible): self
+ {
+ $this->privateCommentVisible = $privateCommentVisible;
+
+ return $this;
+ }
+
public function setReasonsLabel(string $reasonsLabel): self
{
$this->reasonsLabel = $reasonsLabel;
diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php
index 6e75bde25..4c767cd54 100644
--- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php
+++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php
@@ -20,6 +20,7 @@ use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Form\Type\ChillCollectionType;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\CommentType;
+use Chill\MainBundle\Form\Type\PrivateCommentType;
use Chill\MainBundle\Form\Type\ScopePickerType;
use Chill\MainBundle\Form\Type\UserPickerType;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
@@ -251,6 +252,13 @@ class ActivityType extends AbstractType
]);
}
+ if ($activityType->isVisible('privateComment')) {
+ $builder->add('privateComment', PrivateCommentType::class, [
+ 'label' => '' === $activityType->getLabel('privateComment') ? 'private comment' : $activityType->getPrivateCommentLabel(),
+ 'required' => false,
+ ]);
+ }
+
if ($activityType->isVisible('persons')) {
$builder->add('persons', HiddenType::class);
$builder->get('persons')
diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php b/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php
index 17d2bb914..4cdcb31f2 100644
--- a/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php
+++ b/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php
@@ -57,7 +57,7 @@ class ActivityTypeType extends AbstractType
$fields = [
'persons', 'user', 'date', 'location', 'persons',
'thirdParties', 'durationTime', 'travelTime', 'attendee',
- 'reasons', 'sentReceived', 'documents',
+ 'reasons', 'comment', 'privateComment', 'sentReceived', 'documents',
'emergency', 'socialIssues', 'socialActions', 'users',
];
diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig
index 218dc37b0..8d9ee878c 100644
--- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig
+++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig
@@ -83,6 +83,10 @@
{{ form_row(edit_form.comment) }}
{% endif %}
+{%- if edit_form.privateComment is defined -%}
+ {{ form_row(edit_form.privateComment) }}
+{% endif %}
+
{%- if edit_form.attendee is defined -%}
{{ form_row(edit_form.attendee) }}
{% endif %}
diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig
index 8e078702c..6f6e1fe53 100644
--- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig
+++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig
@@ -81,10 +81,13 @@
{% endif %}
{%- if form.comment is defined -%}
- {# TODO .. public and private #}
{{ form_row(form.comment) }}
{% endif %}
+{%- if form.privateComment is defined -%}
+ {{ form_row(form.privateComment) }}
+{% endif %}
+
{%- if form.attendee is defined -%}
{{ form_row(form.attendee) }}
{% endif %}
diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig
index ce4c22304..8b47f4de2 100644
--- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig
+++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig
@@ -1,4 +1,5 @@
{%- set t = entity.type -%}
+{% set userId = app.user.id %}
{%- import "@ChillDocStore/Macro/macro.html.twig" as m -%}
{{ "Activity"|trans }}
@@ -146,6 +147,21 @@
{% endif %}
+ {% if t.privateCommentVisible and is_granted('CHILL_ACTIVITY_SEE_DETAILS', entity) and entity.privateComment.hasCommentForUser(app.user) %}
+ {% if t.privateCommentLabel is not empty %}
+
{{ t.privateCommentLabel }}
+ {% else %}
+
{{ 'Private comment'|trans }}
+ {% endif %}
+
+
+
+ {{ entity.privateComment.comments[userId] }}
+
+
+
+ {% endif %}
+
{% if t.documentsVisible and is_granted('CHILL_ACTIVITY_SEE_DETAILS', entity) %}
{{ 'Documents'|trans }}
diff --git a/src/Bundle/ChillActivityBundle/migrations/Version20220425133027.php b/src/Bundle/ChillActivityBundle/migrations/Version20220425133027.php
new file mode 100644
index 000000000..4a829f18c
--- /dev/null
+++ b/src/Bundle/ChillActivityBundle/migrations/Version20220425133027.php
@@ -0,0 +1,35 @@
+addSql('ALTER TABLE activitytype DROP privateCommentLabel');
+ $this->addSql('ALTER TABLE activitytype DROP privateCommentVisible');
+ }
+
+ public function getDescription(): string
+ {
+ return 'add private comment option to activity types';
+ }
+
+ public function up(Schema $schema): void
+ {
+ $this->addSql('ALTER TABLE activitytype ADD privateCommentLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
+ $this->addSql('ALTER TABLE activitytype ADD privateCommentVisible SMALLINT DEFAULT 1 NOT NULL');
+ }
+}
diff --git a/src/Bundle/ChillActivityBundle/migrations/Version20220527124438.php b/src/Bundle/ChillActivityBundle/migrations/Version20220527124438.php
new file mode 100644
index 000000000..2661edf4b
--- /dev/null
+++ b/src/Bundle/ChillActivityBundle/migrations/Version20220527124438.php
@@ -0,0 +1,33 @@
+addSql('ALTER TABLE chill_person_accompanying_period_work DROP privateComment_comments');
+ }
+
+ public function getDescription(): string
+ {
+ return 'add private comment to activity';
+ }
+
+ public function up(Schema $schema): void
+ {
+ $this->addSql('ALTER TABLE activity ADD privateComment_comments JSON DEFAULT \'{}\'');
+ }
+}
diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml
index 3ca4def7c..abfa0ea89 100644
--- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml
+++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml
@@ -44,6 +44,7 @@ Received: Recevoir
by: 'Par '
location: Lieu
Reasons: Sujets
+Private comment: Commentaire privé
#forms
@@ -175,6 +176,8 @@ Reasons visible: Visibilité du champ Sujet
Reasons label: Libellé du champ Sujet
Comment visible: Visibilité du champ Commentaire
Comment label: Libellé du champ Commentaire
+Private comment visible: Visibilité du champ Commentaire Privé
+Private comment label: Libellé du champ Commentaire Privé
Emergency visible: Visibilité du champ Urgent
Emergency label: Libellé du champ Urgent
Accompanying period visible: Visibilité du champ Période d'accompagnement
diff --git a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php
index 11104cc6a..c40bddb44 100644
--- a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php
+++ b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php
@@ -14,6 +14,7 @@ namespace Chill\CalendarBundle\Entity;
use Chill\ActivityBundle\Entity\Activity;
use Chill\CalendarBundle\Repository\CalendarRepository;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
+use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable;
use Chill\MainBundle\Entity\Location;
use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
@@ -115,6 +116,12 @@ class Calendar
*/
private Collection $persons;
+ /**
+ * @ORM\Embedded(class=PrivateCommentEmbeddable::class, columnPrefix="privateComment_")
+ * @Serializer\Groups({"calendar:read"})
+ */
+ private PrivateCommentEmbeddable $privateComment;
+
/**
* @ORM\ManyToMany(
* targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty",
@@ -151,6 +158,7 @@ class Calendar
public function __construct()
{
$this->comment = new CommentEmbeddable();
+ $this->privateComment = new PrivateCommentEmbeddable();
$this->persons = new ArrayCollection();
$this->professionals = new ArrayCollection();
$this->invites = new ArrayCollection();
@@ -278,6 +286,11 @@ class Calendar
return [];
}
+ public function getPrivateComment(): PrivateCommentEmbeddable
+ {
+ return $this->privateComment;
+ }
+
/**
* @return Collection|ThirdParty[]
*/
@@ -407,6 +420,13 @@ class Calendar
return $this;
}
+ public function setPrivateComment(PrivateCommentEmbeddable $privateComment): self
+ {
+ $this->privateComment = $privateComment;
+
+ return $this;
+ }
+
public function setSendSMS(?bool $sendSMS): self
{
$this->sendSMS = $sendSMS;
diff --git a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php
index 05dc362b4..b1dccb5fd 100644
--- a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php
+++ b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php
@@ -18,6 +18,7 @@ use Chill\CalendarBundle\Entity\Invite;
use Chill\MainBundle\Entity\Location;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Form\Type\CommentType;
+use Chill\MainBundle\Form\Type\PrivateCommentType;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\PersonBundle\Entity\Person;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
@@ -51,6 +52,10 @@ class CalendarType extends AbstractType
->add('comment', CommentType::class, [
'required' => false,
])
+ ->add('privateComment', PrivateCommentType::class, [
+ 'required' => false,
+ 'label' => 'private comment',
+ ])
// ->add('cancelReason', EntityType::class, [
// 'required' => false,
// 'class' => CancelReason::class,
diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/edit.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/edit.html.twig
index d67202920..b96d12c06 100644
--- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/edit.html.twig
+++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/edit.html.twig
@@ -47,6 +47,10 @@
{{ form_row(form.comment) }}
{% endif %}
+{%- if form.privateComment is defined -%}
+ {{ form_row(form.privateComment) }}
+{% endif %}
+
{%- if form.sendSMS is defined -%}
{{ form_row(form.sendSMS) }}
{% endif %}
diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/new.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/new.html.twig
index 255c2641b..41adb52cc 100644
--- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/new.html.twig
+++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/new.html.twig
@@ -43,6 +43,10 @@
{{ form_row(form.comment) }}
{% endif %}
+{%- if form.privateComment is defined -%}
+ {{ form_row(form.privateComment) }}
+{% endif %}
+
{%- if form.sendSMS is defined -%}
{{ form_row(form.sendSMS) }}
{% endif %}
@@ -50,22 +54,22 @@