From b36fd57e4fd32c19a256f733f0c1fcf489db0aab Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 25 Apr 2022 15:46:55 +0200 Subject: [PATCH 01/47] Add private comment options to activity type (visibility + label) --- .../Controller/ActivityController.php | 2 -- .../Entity/ActivityType.php | 34 +++++++++++++++++++ .../ChillActivityBundle/Form/ActivityType.php | 10 +++--- .../Form/ActivityTypeType.php | 2 +- .../Resources/views/Activity/show.html.twig | 8 +++-- .../migrations/Version20220425133027.php | 33 ++++++++++++++++++ .../translations/messages.fr.yml | 2 ++ 7 files changed, 82 insertions(+), 9 deletions(-) create mode 100644 src/Bundle/ChillActivityBundle/migrations/Version20220425133027.php diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 4702e18e7..2840e3f27 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -431,8 +431,6 @@ final class ActivityController extends AbstractController 'accompanyingPeriod' => $accompanyingPeriod, ]); - dump($form); - if ($form->has('documents')) { $form->add('gendocTemplateId', HiddenType::class, [ 'mapped' => false, diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php index bdf75ed05..deb28184c 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php @@ -76,6 +76,16 @@ class ActivityType */ private int $commentVisible = self::FIELD_OPTIONAL; + /** + * @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": ""}) */ @@ -314,6 +324,16 @@ class ActivityType return $this->commentVisible; } + public function getPrivateCommentLabel(): string + { + return $this->privateCommentLabel; + } + + public function getPrivateCommentVisible(): int + { + return $this->privateCommentVisible; + } + public function getDateLabel(): string { return $this->dateLabel; @@ -573,6 +593,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 setDateLabel(string $dateLabel): self { $this->dateLabel = $dateLabel; diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php index 7ff07ba3f..0fa2fdf76 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php @@ -252,10 +252,12 @@ class ActivityType extends AbstractType ]); } - $builder->add('privateComment', PrivateCommentType::class, [ - 'label' => 'activity.private comment', - 'required' => false - ]); + if($activityType->isVisible('privateComment')) { + $builder->add('privateComment', PrivateCommentType::class, [ + 'label' => empty($activityType->getLabel('privateComment')) ? 'activity.private comment' : $activityType->getPrivateCommentLabel(), + 'required' => false + ]); + } if ($activityType->isVisible('persons')) { $builder->add('persons', HiddenType::class); diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php b/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php index 28947d72b..75e79fd5b 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', 'comment', 'sentReceived', 'documents', + 'reasons', 'comment', 'privateComment', 'sentReceived', 'documents', 'emergency', 'socialIssues', 'socialActions', 'users', ]; diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig index 53817c1c4..512557491 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig @@ -146,8 +146,12 @@ {% endif %} - {% if is_granted('CHILL_ACTIVITY_SEE_DETAILS', entity) and entity.privateComment.userId is same as(app.user.id) %} -
{{ 'activity.private comment'|trans }}
+ {% if t.privateCommentVisible and is_granted('CHILL_ACTIVITY_SEE_DETAILS', entity) and entity.privateComment.userId is same as(app.user.id) %} + {% if t.privateCommentLabel is not empty %} +
{{ t.privateCommentLabel }}
+ {% else %} +
{{ 'activity.private comment'|trans }}
+ {% endif %}
{%- if entity.privateComment.empty -%} {{ 'No comment associated'|trans }} diff --git a/src/Bundle/ChillActivityBundle/migrations/Version20220425133027.php b/src/Bundle/ChillActivityBundle/migrations/Version20220425133027.php new file mode 100644 index 000000000..c29f2d66e --- /dev/null +++ b/src/Bundle/ChillActivityBundle/migrations/Version20220425133027.php @@ -0,0 +1,33 @@ +addSql('ALTER TABLE activitytype ADD privateCommentLabel VARCHAR(255) DEFAULT \'\' NOT NULL'); + $this->addSql('ALTER TABLE activitytype ADD privateCommentVisible SMALLINT DEFAULT 1 NOT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE activitytype DROP privateCommentLabel'); + $this->addSql('ALTER TABLE activitytype DROP privateCommentVisible'); + } +} diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 912f3368f..00639f46b 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -169,6 +169,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 From 79fa03032345aecfef21a307f4257d48191864ed Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 25 Apr 2022 15:47:13 +0200 Subject: [PATCH 02/47] add private comment input field to edit form --- .../Resources/views/Activity/edit.html.twig | 4 ++++ 1 file changed, 4 insertions(+) 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 %} From 171cc79a4a95f9a2af927e4c72a7c5dfd081fa76 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 25 Apr 2022 15:47:51 +0200 Subject: [PATCH 03/47] Add private comment to rendez-vous --- .../ChillCalendarBundle/Entity/Calendar.php | 19 +++++++++++ .../ChillCalendarBundle/Form/CalendarType.php | 5 +++ .../Resources/views/Calendar/edit.html.twig | 4 +++ .../Resources/views/Calendar/new.html.twig | 4 +++ .../migrations/Version20220425131140.php | 34 +++++++++++++++++++ .../translations/messages.fr.yml | 3 +- 6 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillCalendarBundle/migrations/Version20220425131140.php diff --git a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php index 11104cc6a..bf425bd2d 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php @@ -70,6 +70,12 @@ class Calendar */ private CommentEmbeddable $comment; + /** + * @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="prcomment_") + * @Serializer\Groups({"calendar:read"}) + */ + private CommentEmbeddable $privateComment; + /** * @ORM\Column(type="datetimetz_immutable") * @Serializer\Groups({"calendar:read"}) @@ -151,6 +157,7 @@ class Calendar public function __construct() { $this->comment = new CommentEmbeddable(); + $this->privateComment = new CommentEmbeddable(); $this->persons = new ArrayCollection(); $this->professionals = new ArrayCollection(); $this->invites = new ArrayCollection(); @@ -208,6 +215,11 @@ class Calendar return $this->comment; } + public function getPrivateComment(): CommentEmbeddable + { + return $this->privateComment; + } + public function getEndDate(): ?DateTimeImmutable { return $this->endDate; @@ -386,6 +398,13 @@ class Calendar return $this; } + public function setPrivateComment(CommentEmbeddable $privateComment): self + { + $this->privateComment = $privateComment; + + return $this; + } + public function setEndDate(DateTimeImmutable $endDate): self { $this->endDate = $endDate; diff --git a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php index 05dc362b4..7269b2a66 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..7841f5b46 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 %} diff --git a/src/Bundle/ChillCalendarBundle/migrations/Version20220425131140.php b/src/Bundle/ChillCalendarBundle/migrations/Version20220425131140.php new file mode 100644 index 000000000..5910ca236 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/migrations/Version20220425131140.php @@ -0,0 +1,34 @@ +addSql('ALTER TABLE chill_calendar.calendar ADD prcomment_comment TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_calendar.calendar ADD prcomment_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_calendar.calendar ADD prcomment_userId INT DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE chill_calendar.calendar DROP prcomment_comment'); + $this->addSql('ALTER TABLE chill_calendar.calendar DROP prcomment_date'); + $this->addSql('ALTER TABLE chill_calendar.calendar DROP prcomment_userId'); + } +} diff --git a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml index 56ac8543c..1dbb00bb8 100644 --- a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml @@ -25,4 +25,5 @@ Add a new calendar: Ajouter un nouveau rendez-vous The calendar item has been successfully removed.: Le rendez-vous a été supprimé From the day: Du to the day: au -Transform to activity: Transformer en échange \ No newline at end of file +Transform to activity: Transformer en échange +private comment: Commentaire privé \ No newline at end of file From 064286aa2fb5bd3509ac9d524806c34788c14c05 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 26 Apr 2022 09:52:00 +0200 Subject: [PATCH 04/47] private comment for action. still needs (de)normalization --- .../AccompanyingPeriodWork.php | 20 +++++++++++ .../vuejs/AccompanyingCourseWorkEdit/App.vue | 9 +++++ .../migrations/Version20220425135900.php | 35 +++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/migrations/Version20220425135900.php diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php index 055507162..91d85883a 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php @@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\MainBundle\Doctrine\Model\TrackCreationInterface; use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface; +use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; use Chill\MainBundle\Entity\User; use Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodLinkedWithSocialIssuesEntityInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; @@ -134,6 +135,12 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues */ private string $note = ''; + /** + * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="prcomment_") + * @Serializer\Groups({"read", "accompanying_period_work:edit", "docgen:read"}) + */ + private CommentEmbeddable $privateComment; + /** * @ORM\ManyToMany(targetEntity=Person::class) * @ORM\JoinTable(name="chill_person_accompanying_period_work_person") @@ -202,6 +209,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues public function __construct() { $this->goals = new ArrayCollection(); + $this->privateComment = new CommentEmbeddable(); $this->results = new ArrayCollection(); $this->thirdParties = new ArrayCollection(); $this->persons = new ArrayCollection(); @@ -323,6 +331,11 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues return $this->note; } + public function getPrivateComment(): CommentEmbeddable + { + return $this->privateComment; + } + public function getPersons(): Collection { return $this->persons; @@ -505,6 +518,13 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues return $this; } + public function setPrivateComment(CommentEmbeddable $privateComment): self + { + $this->privateComment = $privateComment; + + return $this; + } + public function setSocialAction(?SocialAction $socialAction): self { $this->socialAction = $socialAction; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue index bcfa53e45..19d253f41 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue @@ -33,6 +33,15 @@ > +
+ + +
+

{{ $t('goals_title') }}

diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20220425135900.php b/src/Bundle/ChillPersonBundle/migrations/Version20220425135900.php new file mode 100644 index 000000000..8598ee432 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/migrations/Version20220425135900.php @@ -0,0 +1,35 @@ +addSql('ALTER TABLE chill_person_accompanying_period_work ADD prcomment_comment TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_person_accompanying_period_work ADD prcomment_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_person_accompanying_period_work ADD prcomment_userId INT DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE chill_person_accompanying_period_work DROP prcomment_comment'); + $this->addSql('ALTER TABLE chill_person_accompanying_period_work DROP prcomment_date'); + $this->addSql('ALTER TABLE chill_person_accompanying_period_work DROP prcomment_userId'); + } +} From 64b5de2c03b983ac0220c18abea2026794b22fae Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 26 Apr 2022 20:19:40 +0200 Subject: [PATCH 05/47] migrations deleted --- .../migrations/Version20220425100208.php | 301 ------------------ .../migrations/Version20220425131140.php | 34 -- .../migrations/Version20220425135900.php | 35 -- 3 files changed, 370 deletions(-) delete mode 100644 src/Bundle/ChillActivityBundle/migrations/Version20220425100208.php delete mode 100644 src/Bundle/ChillCalendarBundle/migrations/Version20220425131140.php delete mode 100644 src/Bundle/ChillPersonBundle/migrations/Version20220425135900.php diff --git a/src/Bundle/ChillActivityBundle/migrations/Version20220425100208.php b/src/Bundle/ChillActivityBundle/migrations/Version20220425100208.php deleted file mode 100644 index 3b8826ffb..000000000 --- a/src/Bundle/ChillActivityBundle/migrations/Version20220425100208.php +++ /dev/null @@ -1,301 +0,0 @@ -addSql('DROP SEQUENCE chill_person_accompanying_period_work_eval_doc_id_seq CASCADE'); - // $this->addSql('DROP TABLE chill_main_address_legacy'); - $this->addSql('ALTER TABLE activity ADD prcomment_comment TEXT DEFAULT NULL'); - $this->addSql('ALTER TABLE activity ADD prcomment_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL'); - $this->addSql('ALTER TABLE activity ADD prcomment_userId INT DEFAULT NULL'); - // $this->addSql('ALTER INDEX idx_ac74095a550b0c53 RENAME TO IDX_AC74095AD7FA8EF0'); - // $this->addSql('ALTER INDEX idx_55026b0cc54c8c93 RENAME TO IDX_AC74095AC54C8C93'); - // $this->addSql('ALTER INDEX idx_55026b0c217bbb47 RENAME TO IDX_AC74095A217BBB47'); - // $this->addSql('ALTER INDEX idx_55026b0c682b5931 RENAME TO IDX_AC74095A682B5931'); - // $this->addSql('ALTER INDEX idx_55026b0ca76ed395 RENAME TO IDX_AC74095AA76ED395'); - // $this->addSql('ALTER TABLE activityreason ALTER name SET NOT NULL'); - // $this->addSql('ALTER INDEX idx_654a2fcd12469de2 RENAME TO IDX_AF82522312469DE2'); - // $this->addSql('ALTER TABLE activityreasoncategory ALTER name SET NOT NULL'); - // $this->addSql('DROP INDEX internal_center_geom_idx'); - // $this->addSql('DROP INDEX chill_custom_main_address_filtering_idx'); - // $this->addSql('ALTER TABLE chill_main_address DROP customs'); - // $this->addSql('ALTER TABLE chill_main_address ALTER isnoaddress DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_main_address ALTER floor TYPE VARCHAR(255)'); - // $this->addSql('ALTER TABLE chill_main_address ALTER floor DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_main_address ALTER corridor TYPE VARCHAR(255)'); - // $this->addSql('ALTER TABLE chill_main_address ALTER corridor DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_main_address ALTER steps TYPE VARCHAR(255)'); - // $this->addSql('ALTER TABLE chill_main_address ALTER steps DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_main_address ALTER flat TYPE VARCHAR(255)'); - // $this->addSql('ALTER TABLE chill_main_address ALTER flat DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_main_address ALTER point TYPE geometry(POINT,4326)'); - // $this->addSql('ALTER TABLE chill_main_address ALTER point DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_main_address ALTER confidential DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_main_address ALTER confidential SET NOT NULL'); - // $this->addSql('DROP INDEX chill_internal_address_reference_canonicalized'); - // $this->addSql('DROP INDEX address_refid'); - // $this->addSql('ALTER TABLE chill_main_address_reference ALTER point TYPE geometry(POINT,4326)'); - // $this->addSql('ALTER TABLE chill_main_address_reference ALTER point DROP DEFAULT'); - // $this->addSql('CREATE INDEX address_refid ON chill_main_address_reference (refId) WHERE refid != \'\''); - // $this->addSql('ALTER TABLE chill_main_location ALTER active DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_main_location_type ALTER active DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_main_location_type ALTER editablebyusers DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_main_location_type ALTER editablebyusers SET NOT NULL'); - // $this->addSql('ALTER TABLE chill_main_notification ALTER addressesemails DROP DEFAULT'); - // $this->addSql('ALTER INDEX idx_154a075fef1a9d84 RENAME TO IDX_589D51B4EF1A9D84'); - // $this->addSql('ALTER INDEX idx_154a075fa76ed395 RENAME TO IDX_589D51B4A76ED395'); - // $this->addSql('DROP INDEX chill_internal_postal_code_canonicalized'); - // $this->addSql('ALTER TABLE chill_main_postal_code ALTER center TYPE geometry(POINT,4326)'); - // $this->addSql('ALTER TABLE chill_main_postal_code ALTER center DROP DEFAULT'); - // $this->addSql('CREATE INDEX search_name_code ON chill_main_postal_code (code, label)'); - // $this->addSql('ALTER INDEX idx_a9f001fa7e6af9d4 RENAME TO IDX_D63001607E6AF9D4'); - // $this->addSql('ALTER INDEX idx_a9f001faa76ed395 RENAME TO IDX_D6300160A76ED395'); - // $this->addSql('ALTER INDEX idx_64a4a621504cb38d RENAME TO IDX_E260A868504CB38D'); - // $this->addSql('ALTER TABLE chill_person_accompanying_period_closingmotive ALTER ordering DROP DEFAULT'); - // $this->addSql('ALTER INDEX idx_92351ece727aca70 RENAME TO IDX_72D110E8727ACA70'); - // $this->addSql('DROP INDEX participations_no_overlap'); - // $this->addSql('ALTER TABLE chill_person_accompanying_period_participation ALTER startdate DROP DEFAULT'); - // $this->addSql('DROP INDEX thirdparty_unique'); - // $this->addSql('DROP INDEX person_unique'); - // $this->addSql('CREATE UNIQUE INDEX thirdparty_unique ON chill_person_accompanying_period_resource (thirdparty_id, accompanyingperiod_id)'); - // $this->addSql('CREATE UNIQUE INDEX person_unique ON chill_person_accompanying_period_resource (person_id, accompanyingperiod_id)'); - // $this->addSql('ALTER TABLE chill_person_household DROP CONSTRAINT fk_household_comment_embeddable_user'); - // $this->addSql('DROP INDEX IDX_BE50A270116F5FA9'); - // $this->addSql('ALTER TABLE chill_person_household_composition ALTER createdat TYPE TIMESTAMP(0) WITHOUT TIME ZONE'); - // $this->addSql('ALTER TABLE chill_person_household_composition ALTER createdat DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_person_household_composition ALTER updatedat TYPE TIMESTAMP(0) WITHOUT TIME ZONE'); - // $this->addSql('ALTER TABLE chill_person_household_composition ALTER updatedat DROP DEFAULT'); - // $this->addSql('COMMENT ON COLUMN chill_person_household_composition.createdAt IS \'(DC2Type:datetime_immutable)\''); - // $this->addSql('COMMENT ON COLUMN chill_person_household_composition.updatedAt IS \'(DC2Type:datetime_immutable)\''); - // $this->addSql('DROP INDEX household_members_not_overlaps'); - // $this->addSql('DROP INDEX chill_custom_person_household_members_sharing_idx'); - // $this->addSql('ALTER TABLE chill_person_household_members ALTER startdate TYPE DATE'); - // $this->addSql('ALTER TABLE chill_person_household_members ALTER startdate DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_person_household_members ALTER enddate TYPE DATE'); - // $this->addSql('ALTER TABLE chill_person_household_members ALTER enddate DROP DEFAULT'); - // $this->addSql('COMMENT ON COLUMN chill_person_household_members.startDate IS \'(DC2Type:date_immutable)\''); - // $this->addSql('COMMENT ON COLUMN chill_person_household_members.endDate IS \'(DC2Type:date_immutable)\''); - // $this->addSql('ALTER TABLE chill_person_marital_status ALTER id TYPE VARCHAR(7)'); - // $this->addSql('DROP INDEX phonenumber_trgm_idx'); - // $this->addSql('DROP INDEX mobilenumber_trgm_idx'); - // $this->addSql('DROP INDEX chill_custom_fullnamecanonical_only_trgm_idx_gin'); - // $this->addSql('DROP INDEX fullnamecanonical_trgm_idx'); - // $this->addSql('ALTER TABLE chill_person_person DROP cfdata_old'); - // $this->addSql('ALTER TABLE chill_person_person ALTER maritalstatus_id TYPE VARCHAR(7)'); - // $this->addSql('ALTER TABLE chill_person_person ALTER phonenumber TYPE VARCHAR(35)'); - // $this->addSql('ALTER TABLE chill_person_person ALTER phonenumber DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_person_person ALTER cfdata SET NOT NULL'); - // $this->addSql('ALTER TABLE chill_person_person ALTER mobilenumber TYPE VARCHAR(35)'); - // $this->addSql('ALTER TABLE chill_person_person ALTER mobilenumber DROP DEFAULT'); - // $this->addSql('COMMENT ON COLUMN chill_person_person.phonenumber IS \'(DC2Type:phone_number)\''); - // $this->addSql('COMMENT ON COLUMN chill_person_person.mobilenumber IS \'(DC2Type:phone_number)\''); - // $this->addSql('ALTER INDEX idx_person_center RENAME TO IDX_BF210A145932F377'); - // $this->addSql('ALTER INDEX idx_3370d4403818da5 RENAME TO IDX_BF210A143818DA5'); - // $this->addSql('ALTER INDEX idx_bf210a145521be40 RENAME TO IDX_BF210A14D7D03CE3'); - // $this->addSql('ALTER INDEX idx_3370d4401c9da55 RENAME TO IDX_BF210A141C9DA55'); - // $this->addSql('ALTER TABLE persons_spoken_languages DROP CONSTRAINT FK_7201106F217BBB47'); - // $this->addSql('ALTER TABLE persons_spoken_languages DROP CONSTRAINT FK_7201106F82F1BAF4'); - // $this->addSql('ALTER TABLE persons_spoken_languages ADD CONSTRAINT FK_7201106F217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - // $this->addSql('ALTER TABLE persons_spoken_languages ADD CONSTRAINT FK_7201106F82F1BAF4 FOREIGN KEY (language_id) REFERENCES language (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - // $this->addSql('ALTER TABLE chill_person_phone ALTER phonenumber TYPE VARCHAR(35)'); - // $this->addSql('ALTER TABLE chill_person_phone ALTER phonenumber DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_person_phone ALTER phonenumber SET NOT NULL'); - // $this->addSql('COMMENT ON COLUMN chill_person_phone.phonenumber IS \'(DC2Type:phone_number)\''); - // $this->addSql('ALTER TABLE chill_person_relations ALTER isactive DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_person_relations ALTER isactive DROP NOT NULL'); - // $this->addSql('ALTER INDEX idx_9bc1fd50f5b7af75 RENAME TO IDX_B9CEBEACF5B7AF75'); - // $this->addSql('ALTER INDEX idx_9bc1fd50dca38092 RENAME TO IDX_B9CEBEACDCA38092'); - // $this->addSql('ALTER INDEX idx_9bc1fd508dfc48dc RENAME TO IDX_B9CEBEAC8DFC48DC'); - // $this->addSql('ALTER INDEX idx_9bc1fd50217bbb47 RENAME TO IDX_B9CEBEAC217BBB47'); - // $this->addSql('ALTER TABLE chill_person_resource ALTER createdby_id DROP NOT NULL'); - // $this->addSql('ALTER TABLE chill_person_resource ALTER createdat TYPE TIMESTAMP(0) WITHOUT TIME ZONE'); - // $this->addSql('ALTER TABLE chill_person_resource ALTER createdat DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_person_resource ALTER createdat DROP NOT NULL'); - // $this->addSql('ALTER TABLE chill_person_resource ALTER updatedat TYPE TIMESTAMP(0) WITHOUT TIME ZONE'); - // $this->addSql('ALTER TABLE chill_person_resource ALTER updatedat DROP DEFAULT'); - // $this->addSql('COMMENT ON COLUMN chill_person_resource.createdAt IS \'(DC2Type:datetime_immutable)\''); - // $this->addSql('COMMENT ON COLUMN chill_person_resource.updatedAt IS \'(DC2Type:datetime_immutable)\''); - // $this->addSql('ALTER TABLE custom_field_long_choice_options ALTER internal_key DROP DEFAULT'); - // $this->addSql('ALTER TABLE customfield ALTER required DROP DEFAULT'); - // $this->addSql('ALTER TABLE customfield ALTER required SET NOT NULL'); - // $this->addSql('ALTER INDEX idx_40fb5d6dfec418b RENAME TO IDX_7A6FDBEFEC418B'); - // $this->addSql('ALTER INDEX idx_286dc95df53b66 RENAME TO IDX_7A48DF7F5DF53B66'); - // $this->addSql('ALTER TABLE customfieldsgroup ALTER options DROP DEFAULT'); - // $this->addSql('ALTER TABLE customfieldsgroup ALTER options SET NOT NULL'); - // $this->addSql('ALTER TABLE chill_vendee.geographical_unit_association ADD CONSTRAINT FK_981D5C95D58FA2A4 FOREIGN KEY (geographicalUnit_id) REFERENCES chill_vendee.geographical_unit (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - // $this->addSql('ALTER TABLE chill_vendee.geographical_unit_association ADD CONSTRAINT FK_981D5C95A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - // $this->addSql('ALTER INDEX idx_a14d8f3d447bbb3b RENAME TO IDX_A14D8F3D96DF1F10'); - // $this->addSql('ALTER TABLE permission_groups ALTER flags DROP DEFAULT'); - // $this->addSql('DROP INDEX "primary"'); - // $this->addSql('ALTER TABLE chill_vendee.security_profile_jobs ADD PRIMARY KEY (profile_id, job_id)'); - // $this->addSql('ALTER TABLE chill_vendee.security_profile_action ALTER profile_id DROP NOT NULL'); - // $this->addSql('ALTER TABLE chill_vendee.security_profile_action ALTER action SET NOT NULL'); - // $this->addSql('DROP INDEX chill_custom_canonicalized_trgm_idx_gist'); - // $this->addSql('ALTER TABLE chill_3party.third_party ALTER firstname SET NOT NULL'); - // $this->addSql('DROP INDEX uniq_93f763ae217bbb47'); - // $this->addSql('ALTER TABLE chill_vendee.vendee_person ALTER situationprofessionellestartdate TYPE DATE'); - // $this->addSql('ALTER TABLE chill_vendee.vendee_person ALTER situationprofessionellestartdate DROP DEFAULT'); - // $this->addSql('COMMENT ON COLUMN chill_vendee.vendee_person.situationProfessionelleStartDate IS \'(DC2Type:date_immutable)\''); - // $this->addSql('ALTER TABLE chill_vendee.vendeeperson_entourage ADD CONSTRAINT FK_4D319FFEF57537C3 FOREIGN KEY (vendeeperson_id) REFERENCES chill_vendee.vendee_person (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - // $this->addSql('ALTER INDEX chill_vendee.idx_1a4b602deef79338 RENAME TO IDX_DD0A4C00EEF79338'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - // $this->addSql('CREATE SCHEMA public'); - // $this->addSql('CREATE SEQUENCE chill_person_accompanying_period_work_eval_doc_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - // $this->addSql('CREATE TABLE chill_main_address_legacy (id INT DEFAULT NULL, postcode_id INT DEFAULT NULL, street VARCHAR(255) DEFAULT NULL, streetnumber VARCHAR(255) DEFAULT NULL, validfrom DATE DEFAULT NULL, isnoaddress BOOLEAN DEFAULT NULL, customs JSONB DEFAULT NULL, floor VARCHAR(16) DEFAULT NULL, corridor VARCHAR(16) DEFAULT NULL, steps VARCHAR(16) DEFAULT NULL, buildingname VARCHAR(255) DEFAULT NULL, flat VARCHAR(16) DEFAULT NULL, distribution VARCHAR(255) DEFAULT NULL, extra VARCHAR(255) DEFAULT NULL, validto DATE DEFAULT NULL, point VARCHAR(255) DEFAULT NULL, linkedtothirdparty_id INT DEFAULT NULL)'); - // $this->addSql('ALTER INDEX idx_7a48df7f5df53b66 RENAME TO idx_286dc95df53b66'); - // $this->addSql('ALTER TABLE persons_spoken_languages DROP CONSTRAINT fk_7201106f217bbb47'); - // $this->addSql('ALTER TABLE persons_spoken_languages DROP CONSTRAINT fk_7201106f82f1baf4'); - // $this->addSql('ALTER TABLE persons_spoken_languages ADD CONSTRAINT fk_7201106f217bbb47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - // $this->addSql('ALTER TABLE persons_spoken_languages ADD CONSTRAINT fk_7201106f82f1baf4 FOREIGN KEY (language_id) REFERENCES language (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - // $this->addSql('ALTER TABLE customfieldsgroup ALTER options SET DEFAULT \'{}\''); - // $this->addSql('ALTER TABLE customfieldsgroup ALTER options DROP NOT NULL'); - // $this->addSql('ALTER TABLE activityreasoncategory ALTER name DROP NOT NULL'); - // $this->addSql('ALTER TABLE activityreason ALTER name DROP NOT NULL'); - // $this->addSql('ALTER INDEX idx_af82522312469de2 RENAME TO idx_654a2fcd12469de2'); - // $this->addSql('ALTER INDEX idx_a14d8f3d96df1f10 RENAME TO idx_a14d8f3d447bbb3b'); - // $this->addSql('ALTER TABLE customfield ALTER required SET DEFAULT \'false\''); - // $this->addSql('ALTER TABLE customfield ALTER required DROP NOT NULL'); - // $this->addSql('ALTER INDEX idx_7a6fdbefec418b RENAME TO idx_40fb5d6dfec418b'); - // $this->addSql('ALTER TABLE custom_field_long_choice_options ALTER internal_key SET DEFAULT \'\''); - // $this->addSql('ALTER TABLE chill_person_marital_status ALTER id TYPE VARCHAR(10)'); - // $this->addSql('ALTER TABLE permission_groups ALTER flags SET DEFAULT \'[]\''); - // $this->addSql('ALTER TABLE chill_person_phone ALTER phonenumber TYPE TEXT'); - // $this->addSql('ALTER TABLE chill_person_phone ALTER phonenumber DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_person_phone ALTER phonenumber DROP NOT NULL'); - // $this->addSql('COMMENT ON COLUMN chill_person_phone.phonenumber IS NULL'); - // $this->addSql('ALTER TABLE chill_person_accompanying_period_closingmotive ALTER ordering SET DEFAULT \'0\''); - // $this->addSql('ALTER INDEX idx_72d110e8727aca70 RENAME TO idx_92351ece727aca70'); - // $this->addSql('ALTER TABLE chill_person_accompanying_period_participation ALTER startDate SET DEFAULT \'1970-01-01\''); - // $this->addSql('CREATE INDEX participations_no_overlap ON chill_person_accompanying_period_participation (person_id, accompanyingperiod_id)'); - // $this->addSql('ALTER TABLE chill_person_household ADD CONSTRAINT fk_household_comment_embeddable_user FOREIGN KEY (comment_members_userid) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - // $this->addSql('CREATE INDEX IDX_BE50A270116F5FA9 ON chill_person_household (comment_members_userid)'); - // $this->addSql('ALTER TABLE chill_vendee.vendeeperson_entourage DROP CONSTRAINT FK_4D319FFEF57537C3'); - // $this->addSql('ALTER TABLE chill_vendee.security_profile_action ALTER profile_id SET NOT NULL'); - // $this->addSql('ALTER TABLE chill_vendee.security_profile_action ALTER action DROP NOT NULL'); - // $this->addSql('DROP INDEX security_profile_jobs_pkey'); - // $this->addSql('ALTER TABLE chill_vendee.security_profile_jobs ADD PRIMARY KEY (job_id, profile_id)'); - $this->addSql('ALTER TABLE activity DROP prcomment_comment'); - $this->addSql('ALTER TABLE activity DROP prcomment_date'); - $this->addSql('ALTER TABLE activity DROP prcomment_userId'); - // $this->addSql('ALTER INDEX idx_ac74095ac54c8c93 RENAME TO idx_55026b0cc54c8c93'); - // $this->addSql('ALTER INDEX idx_ac74095a217bbb47 RENAME TO idx_55026b0c217bbb47'); - // $this->addSql('ALTER INDEX idx_ac74095a682b5931 RENAME TO idx_55026b0c682b5931'); - // $this->addSql('ALTER INDEX idx_ac74095aa76ed395 RENAME TO idx_55026b0ca76ed395'); - // $this->addSql('ALTER INDEX idx_ac74095ad7fa8ef0 RENAME TO IDX_AC74095A550B0C53'); - // $this->addSql('ALTER TABLE chill_vendee.geographical_unit_association DROP CONSTRAINT FK_981D5C95D58FA2A4'); - // $this->addSql('ALTER TABLE chill_vendee.geographical_unit_association DROP CONSTRAINT FK_981D5C95A76ED395'); - // $this->addSql('ALTER TABLE chill_person_relations ALTER isActive SET DEFAULT \'true\''); - // $this->addSql('ALTER TABLE chill_person_relations ALTER isActive SET NOT NULL'); - // $this->addSql('ALTER TABLE chill_person_person ADD cfdata_old TEXT DEFAULT NULL'); - // $this->addSql('ALTER TABLE chill_person_person ALTER cFData DROP NOT NULL'); - // $this->addSql('ALTER TABLE chill_person_person ALTER mobilenumber TYPE TEXT'); - // $this->addSql('ALTER TABLE chill_person_person ALTER mobilenumber DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_person_person ALTER phonenumber TYPE TEXT'); - // $this->addSql('ALTER TABLE chill_person_person ALTER phonenumber DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_person_person ALTER maritalStatus_id TYPE VARCHAR(10)'); - // $this->addSql('COMMENT ON COLUMN chill_person_person.cfdata_old IS \'(DC2Type:array)\''); - // $this->addSql('COMMENT ON COLUMN chill_person_person.mobilenumber IS NULL'); - // $this->addSql('COMMENT ON COLUMN chill_person_person.phonenumber IS NULL'); - // $this->addSql('CREATE INDEX phonenumber_trgm_idx ON chill_person_person (phonenumber)'); - // $this->addSql('CREATE INDEX mobilenumber_trgm_idx ON chill_person_person (mobilenumber)'); - // $this->addSql('CREATE INDEX chill_custom_fullnamecanonical_only_trgm_idx_gin ON chill_person_person (fullnamecanonical)'); - // $this->addSql('CREATE INDEX fullnamecanonical_trgm_idx ON chill_person_person (center_id, fullnamecanonical)'); - // $this->addSql('ALTER INDEX idx_bf210a141c9da55 RENAME TO idx_3370d4401c9da55'); - // $this->addSql('ALTER INDEX idx_bf210a145932f377 RENAME TO idx_person_center'); - // $this->addSql('ALTER INDEX idx_bf210a143818da5 RENAME TO idx_3370d4403818da5'); - // $this->addSql('ALTER INDEX idx_bf210a14d7d03ce3 RENAME TO IDX_BF210A145521BE40'); - // $this->addSql('DROP INDEX address_refid'); - // $this->addSql('ALTER TABLE chill_main_address_reference ALTER point TYPE VARCHAR(255)'); - // $this->addSql('ALTER TABLE chill_main_address_reference ALTER point DROP DEFAULT'); - // $this->addSql('CREATE INDEX chill_internal_address_reference_canonicalized ON chill_main_address_reference (postcode_id, addresscanonical)'); - // $this->addSql('CREATE INDEX address_refid ON chill_main_address_reference (refid) WHERE ((refid)::text <> \'\'::text)'); - // $this->addSql('DROP INDEX search_name_code'); - // $this->addSql('ALTER TABLE chill_main_postal_code ALTER center TYPE VARCHAR(255)'); - // $this->addSql('ALTER TABLE chill_main_postal_code ALTER center DROP DEFAULT'); - // $this->addSql('CREATE INDEX chill_internal_postal_code_canonicalized ON chill_main_postal_code (canonical) WHERE (origin = 0)'); - // $this->addSql('ALTER TABLE chill_person_household_members ALTER endDate TYPE DATE'); - // $this->addSql('ALTER TABLE chill_person_household_members ALTER endDate DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_person_household_members ALTER startDate TYPE DATE'); - // $this->addSql('ALTER TABLE chill_person_household_members ALTER startDate DROP DEFAULT'); - // $this->addSql('COMMENT ON COLUMN chill_person_household_members.enddate IS NULL'); - // $this->addSql('COMMENT ON COLUMN chill_person_household_members.startdate IS NULL'); - // $this->addSql('CREATE INDEX household_members_not_overlaps ON chill_person_household_members (person_id) WHERE (sharedhousehold IS TRUE)'); - // $this->addSql('CREATE INDEX chill_custom_person_household_members_sharing_idx ON chill_person_household_members (person_id, startdate, enddate, household_id) WHERE (sharedhousehold IS TRUE)'); - // $this->addSql('ALTER INDEX idx_589d51b4a76ed395 RENAME TO idx_154a075fa76ed395'); - // $this->addSql('ALTER INDEX idx_589d51b4ef1a9d84 RENAME TO idx_154a075fef1a9d84'); - // $this->addSql('DROP INDEX person_unique'); - // $this->addSql('DROP INDEX thirdparty_unique'); - // $this->addSql('CREATE UNIQUE INDEX person_unique ON chill_person_accompanying_period_resource (person_id, accompanyingperiod_id) WHERE (person_id IS NOT NULL)'); - // $this->addSql('CREATE UNIQUE INDEX thirdparty_unique ON chill_person_accompanying_period_resource (thirdparty_id, accompanyingperiod_id) WHERE (thirdparty_id IS NOT NULL)'); - // $this->addSql('ALTER TABLE chill_main_location_type ALTER active SET DEFAULT \'true\''); - // $this->addSql('ALTER TABLE chill_main_location_type ALTER editableByUsers SET DEFAULT \'true\''); - // $this->addSql('ALTER TABLE chill_main_location_type ALTER editableByUsers DROP NOT NULL'); - // $this->addSql('ALTER INDEX idx_d6300160a76ed395 RENAME TO idx_a9f001faa76ed395'); - // $this->addSql('ALTER INDEX idx_d63001607e6af9d4 RENAME TO idx_a9f001fa7e6af9d4'); - // $this->addSql('ALTER INDEX idx_e260a868504cb38d RENAME TO idx_64a4a621504cb38d'); - // $this->addSql('ALTER TABLE chill_person_resource ALTER createdAt TYPE TIMESTAMP(0) WITHOUT TIME ZONE'); - // $this->addSql('ALTER TABLE chill_person_resource ALTER createdAt DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_person_resource ALTER createdAt SET NOT NULL'); - // $this->addSql('ALTER TABLE chill_person_resource ALTER updatedAt TYPE TIMESTAMP(0) WITHOUT TIME ZONE'); - // $this->addSql('ALTER TABLE chill_person_resource ALTER updatedAt DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_person_resource ALTER createdBy_id SET NOT NULL'); - // $this->addSql('COMMENT ON COLUMN chill_person_resource.createdat IS NULL'); - // $this->addSql('COMMENT ON COLUMN chill_person_resource.updatedat IS NULL'); - // $this->addSql('ALTER TABLE chill_person_household_composition ALTER createdAt TYPE DATE'); - // $this->addSql('ALTER TABLE chill_person_household_composition ALTER createdAt DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_person_household_composition ALTER updatedAt TYPE DATE'); - // $this->addSql('ALTER TABLE chill_person_household_composition ALTER updatedAt DROP DEFAULT'); - // $this->addSql('COMMENT ON COLUMN chill_person_household_composition.createdat IS \'(DC2Type:date_immutable)\''); - // $this->addSql('COMMENT ON COLUMN chill_person_household_composition.updatedat IS \'(DC2Type:date_immutable)\''); - // $this->addSql('ALTER INDEX chill_vendee.idx_dd0a4c00eef79338 RENAME TO idx_1a4b602deef79338'); - // $this->addSql('CREATE INDEX internal_center_geom_idx ON chill_vendee.center_polygon (geom)'); - // $this->addSql('ALTER TABLE chill_vendee.vendee_person ALTER situationProfessionelleStartDate TYPE DATE'); - // $this->addSql('ALTER TABLE chill_vendee.vendee_person ALTER situationProfessionelleStartDate DROP DEFAULT'); - // $this->addSql('COMMENT ON COLUMN chill_vendee.vendee_person.situationprofessionellestartdate IS NULL'); - // $this->addSql('CREATE UNIQUE INDEX uniq_93f763ae217bbb47 ON chill_vendee.vendee_person (person_id)'); - // $this->addSql('ALTER INDEX idx_b9cebeac217bbb47 RENAME TO idx_9bc1fd50217bbb47'); - // $this->addSql('ALTER INDEX idx_b9cebeacf5b7af75 RENAME TO idx_9bc1fd50f5b7af75'); - // $this->addSql('ALTER INDEX idx_b9cebeacdca38092 RENAME TO idx_9bc1fd50dca38092'); - // $this->addSql('ALTER INDEX idx_b9cebeac8dfc48dc RENAME TO idx_9bc1fd508dfc48dc'); - // $this->addSql('ALTER TABLE chill_main_location ALTER active SET DEFAULT \'true\''); - // $this->addSql('ALTER TABLE chill_3party.third_party ALTER firstname DROP NOT NULL'); - // $this->addSql('CREATE INDEX chill_custom_canonicalized_trgm_idx_gist ON chill_3party.third_party (canonicalized) WHERE (active IS TRUE)'); - // $this->addSql('ALTER TABLE chill_main_notification ALTER addressesEmails SET DEFAULT \'[]\''); - // $this->addSql('ALTER TABLE chill_main_address ADD customs JSONB DEFAULT \'[]\''); - // $this->addSql('ALTER TABLE chill_main_address ALTER confidential SET DEFAULT \'false\''); - // $this->addSql('ALTER TABLE chill_main_address ALTER confidential DROP NOT NULL'); - // $this->addSql('ALTER TABLE chill_main_address ALTER corridor TYPE TEXT'); - // $this->addSql('ALTER TABLE chill_main_address ALTER corridor DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_main_address ALTER flat TYPE TEXT'); - // $this->addSql('ALTER TABLE chill_main_address ALTER flat DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_main_address ALTER floor TYPE TEXT'); - // $this->addSql('ALTER TABLE chill_main_address ALTER floor DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_main_address ALTER isNoAddress SET DEFAULT \'false\''); - // $this->addSql('ALTER TABLE chill_main_address ALTER point TYPE VARCHAR(255)'); - // $this->addSql('ALTER TABLE chill_main_address ALTER point DROP DEFAULT'); - // $this->addSql('ALTER TABLE chill_main_address ALTER steps TYPE TEXT'); - // $this->addSql('ALTER TABLE chill_main_address ALTER steps DROP DEFAULT'); - // $this->addSql('CREATE INDEX chill_custom_main_address_filtering_idx ON chill_main_address (id, validfrom, validto)'); - } -} diff --git a/src/Bundle/ChillCalendarBundle/migrations/Version20220425131140.php b/src/Bundle/ChillCalendarBundle/migrations/Version20220425131140.php deleted file mode 100644 index 5910ca236..000000000 --- a/src/Bundle/ChillCalendarBundle/migrations/Version20220425131140.php +++ /dev/null @@ -1,34 +0,0 @@ -addSql('ALTER TABLE chill_calendar.calendar ADD prcomment_comment TEXT DEFAULT NULL'); - $this->addSql('ALTER TABLE chill_calendar.calendar ADD prcomment_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL'); - $this->addSql('ALTER TABLE chill_calendar.calendar ADD prcomment_userId INT DEFAULT NULL'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE chill_calendar.calendar DROP prcomment_comment'); - $this->addSql('ALTER TABLE chill_calendar.calendar DROP prcomment_date'); - $this->addSql('ALTER TABLE chill_calendar.calendar DROP prcomment_userId'); - } -} diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20220425135900.php b/src/Bundle/ChillPersonBundle/migrations/Version20220425135900.php deleted file mode 100644 index 8598ee432..000000000 --- a/src/Bundle/ChillPersonBundle/migrations/Version20220425135900.php +++ /dev/null @@ -1,35 +0,0 @@ -addSql('ALTER TABLE chill_person_accompanying_period_work ADD prcomment_comment TEXT DEFAULT NULL'); - $this->addSql('ALTER TABLE chill_person_accompanying_period_work ADD prcomment_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL'); - $this->addSql('ALTER TABLE chill_person_accompanying_period_work ADD prcomment_userId INT DEFAULT NULL'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE chill_person_accompanying_period_work DROP prcomment_comment'); - $this->addSql('ALTER TABLE chill_person_accompanying_period_work DROP prcomment_date'); - $this->addSql('ALTER TABLE chill_person_accompanying_period_work DROP prcomment_userId'); - } -} From 37a198b8605ec73b7f66d44016cabc9589304447 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 26 Apr 2022 20:21:33 +0200 Subject: [PATCH 06/47] PrivateCommentEmbeddable created and added to entities + datamapper --- .../ChillActivityBundle/Entity/Activity.php | 11 ++-- .../ChillCalendarBundle/Entity/Calendar.php | 11 ++-- .../Embeddable/PrivateCommentEmbeddable.php | 44 +++++++++++++++ .../DataMapper/PrivateCommentDataMapper.php | 54 +++++++++++++++++++ .../Form/Type/PrivateCommentType.php | 29 +++++----- .../ChillMainBundle/config/services/form.yaml | 4 ++ .../migrations/Version20220426133048.php | 35 ++++++++++++ .../AccompanyingPeriodWork.php | 11 ++-- 8 files changed, 167 insertions(+), 32 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Entity/Embeddable/PrivateCommentEmbeddable.php create mode 100644 src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php create mode 100644 src/Bundle/ChillMainBundle/migrations/Version20220426133048.php diff --git a/src/Bundle/ChillActivityBundle/Entity/Activity.php b/src/Bundle/ChillActivityBundle/Entity/Activity.php index f7e429476..b5a58c900 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; @@ -86,10 +87,10 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac private CommentEmbeddable $comment; /** - * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="prcomment_") + * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_") * @Groups({"docgen:read"}) */ - private CommentEmbeddable $privateComment; + private PrivateCommentEmbeddable $privateComment; /** * @ORM\Column(type="datetime") @@ -197,7 +198,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac { $this->reasons = new ArrayCollection(); $this->comment = new CommentEmbeddable(); - $this->privateComment = new CommentEmbeddable(); + $this->privateComment = new PrivateCommentEmbeddable(); $this->persons = new ArrayCollection(); $this->thirdParties = new ArrayCollection(); $this->documents = new ArrayCollection(); @@ -307,7 +308,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac return $this->comment; } - public function getPrivateComment(): CommentEmbeddable + public function getPrivateComment(): PrivateCommentEmbeddable { return $this->privateComment; } @@ -536,7 +537,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac return $this; } - public function setPrivateComment(CommentEmbeddable $privateComment): self + public function setPrivateComment(PrivateCommentEmbeddable $privateComment): self { $this->privateComment = $privateComment; diff --git a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php index bf425bd2d..4783e70b6 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; @@ -71,10 +72,10 @@ class Calendar private CommentEmbeddable $comment; /** - * @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="prcomment_") + * @ORM\Embedded(class=PrivateCommentEmbeddable::class, columnPrefix="privateComment_") * @Serializer\Groups({"calendar:read"}) */ - private CommentEmbeddable $privateComment; + private PrivateCommentEmbeddable $privateComment; /** * @ORM\Column(type="datetimetz_immutable") @@ -157,7 +158,7 @@ class Calendar public function __construct() { $this->comment = new CommentEmbeddable(); - $this->privateComment = new CommentEmbeddable(); + $this->privateComment = new PrivateCommentEmbeddable(); $this->persons = new ArrayCollection(); $this->professionals = new ArrayCollection(); $this->invites = new ArrayCollection(); @@ -215,7 +216,7 @@ class Calendar return $this->comment; } - public function getPrivateComment(): CommentEmbeddable + public function getPrivateComment(): PrivateCommentEmbeddable { return $this->privateComment; } @@ -398,7 +399,7 @@ class Calendar return $this; } - public function setPrivateComment(CommentEmbeddable $privateComment): self + public function setPrivateComment(PrivateCommentEmbeddable $privateComment): self { $this->privateComment = $privateComment; diff --git a/src/Bundle/ChillMainBundle/Entity/Embeddable/PrivateCommentEmbeddable.php b/src/Bundle/ChillMainBundle/Entity/Embeddable/PrivateCommentEmbeddable.php new file mode 100644 index 000000000..70374749c --- /dev/null +++ b/src/Bundle/ChillMainBundle/Entity/Embeddable/PrivateCommentEmbeddable.php @@ -0,0 +1,44 @@ +comments; + } + + + public function getCommentForUser(User $user): string + { + return $this->comments[$user->getId()] ?? ''; + } + + public function setCommentForUser(User $user, string $content): self + { + $this->comments[$user->getId()] = $content; + + return $this; + } +} diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php new file mode 100644 index 000000000..5d4cd08cd --- /dev/null +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php @@ -0,0 +1,54 @@ +security = $security; + } + + public function mapDataToForms($viewData, $forms) + { + if (null === $viewData) { + return null; + } + + if (!$viewData instanceof PrivateCommentEmbeddable) { + throw new UnexpectedTypeException($viewData, PrivateCommentEmbeddable::class); + } + + $forms = iterator_to_array($forms); + + $forms['comments']->setData($viewData->getCommentForUser($this->security->getUser())); + + + } + + public function mapFormsToData($forms, &$viewData) + { + $forms = iterator_to_array($forms); + + $viewData->setCommentForUser($this->security->getUser(), $forms['comments']->getData()); + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php b/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php index 77e1a1902..174326d86 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php @@ -12,8 +12,13 @@ declare(strict_types=1); namespace Chill\MainBundle\Form\Type; use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; +use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable; +use Chill\MainBundle\Form\DataMapper\PrivateCommentDataMapper; use DateTime; + use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\CollectionType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; @@ -27,29 +32,19 @@ class PrivateCommentType extends AbstractType { protected UserInterface $user; - public function __construct(TokenStorageInterface $tokenStorage) + protected PrivateCommentDataMapper $dataMapper; + + public function __construct(TokenStorageInterface $tokenStorage, PrivateCommentDataMapper $dataMapper) { $this->user = $tokenStorage->getToken()->getUser(); + $this->dataMapper = $dataMapper; } public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('comment', ChillTextareaType::class, [ - 'disable_editor' => $options['disable_editor'], - 'label' => $options['label'], - ]); - - $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) { - $data = $event->getForm()->getData(); - $privateComment = $event->getData() ?? ['privateComment' => '']; - - if (null !== $data && $data->getComment() !== $privateComment['comment']) { - $data->setDate(new DateTime()); - $data->setUserId($this->user->getId()); - $event->getForm()->setData($data); - } - }); + ->add('comments', ChillTextareaType::class) + ->setDataMapper($this->dataMapper); } public function buildView(FormView $view, FormInterface $form, array $options) @@ -68,7 +63,7 @@ class PrivateCommentType extends AbstractType ->setDefined('disable_editor') ->setAllowedTypes('disable_editor', 'bool') ->setDefaults([ - 'data_class' => CommentEmbeddable::class, + 'data_class' => PrivateCommentEmbeddable::class, 'disable_editor' => false, ]); } diff --git a/src/Bundle/ChillMainBundle/config/services/form.yaml b/src/Bundle/ChillMainBundle/config/services/form.yaml index f2dc7803a..407a1b6af 100644 --- a/src/Bundle/ChillMainBundle/config/services/form.yaml +++ b/src/Bundle/ChillMainBundle/config/services/form.yaml @@ -143,3 +143,7 @@ services: Chill\MainBundle\Form\Type\LocationFormType: ~ Chill\MainBundle\Form\WorkflowStepType: ~ + + Chill\MainBundle\Form\DataMapper\PrivateCommentDataMapper: + autowire: true + autoconfigure: true diff --git a/src/Bundle/ChillMainBundle/migrations/Version20220426133048.php b/src/Bundle/ChillMainBundle/migrations/Version20220426133048.php new file mode 100644 index 000000000..2f1fbab1a --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20220426133048.php @@ -0,0 +1,35 @@ +addSql('ALTER TABLE activity ADD privateComment_comments JSON DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_calendar.calendar ADD privateComment_comments JSON DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_person_accompanying_period_work ADD privateComment_comments JSON DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE chill_person_accompanying_period_work DROP privateComment_comments'); + $this->addSql('ALTER TABLE activity DROP privateComment_comments'); + $this->addSql('ALTER TABLE chill_calendar.calendar DROP privateComment_comments'); + } +} diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php index 91d85883a..fd1156e01 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php @@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\MainBundle\Doctrine\Model\TrackCreationInterface; use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface; use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; +use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable; use Chill\MainBundle\Entity\User; use Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodLinkedWithSocialIssuesEntityInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; @@ -136,10 +137,10 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues private string $note = ''; /** - * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="prcomment_") + * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_") * @Serializer\Groups({"read", "accompanying_period_work:edit", "docgen:read"}) */ - private CommentEmbeddable $privateComment; + private PrivateCommentEmbeddable $privateComment; /** * @ORM\ManyToMany(targetEntity=Person::class) @@ -209,7 +210,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues public function __construct() { $this->goals = new ArrayCollection(); - $this->privateComment = new CommentEmbeddable(); + $this->privateComment = new PrivateCommentEmbeddable(); $this->results = new ArrayCollection(); $this->thirdParties = new ArrayCollection(); $this->persons = new ArrayCollection(); @@ -331,7 +332,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues return $this->note; } - public function getPrivateComment(): CommentEmbeddable + public function getPrivateComment(): PrivateCommentEmbeddable { return $this->privateComment; } @@ -518,7 +519,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues return $this; } - public function setPrivateComment(CommentEmbeddable $privateComment): self + public function setPrivateComment(PrivateCommentEmbeddable $privateComment): self { $this->privateComment = $privateComment; From e8dcb45abbb4796ac3e8b2c7e6a0002d5e1f7cc2 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 27 Apr 2022 11:49:31 +0200 Subject: [PATCH 07/47] remove dump --- src/Bundle/ChillActivityBundle/Controller/ActivityController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 2840e3f27..481997355 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -366,7 +366,6 @@ final class ActivityController extends AbstractController if ($request->query->has('activityData')) { $activityData = $request->query->get('activityData'); - dump($activityData); if (array_key_exists('durationTime', $activityData)) { $durationTimeInMinutes = $activityData['durationTime']; $hours = floor($durationTimeInMinutes / 60); From 3ed2b36057c5c413bee7b3b90124a5a21431a465 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 27 Apr 2022 11:50:14 +0200 Subject: [PATCH 08/47] privateCommentType adjusted --- src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php b/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php index 174326d86..6ab166fe9 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php @@ -43,7 +43,9 @@ class PrivateCommentType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('comments', ChillTextareaType::class) + ->add('comments', ChillTextareaType::class, [ + 'label' => 'private comment' + ]) ->setDataMapper($this->dataMapper); } From 27ce146aa0bd695d8141bec390da0bea99b0251d Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 27 Apr 2022 11:50:32 +0200 Subject: [PATCH 09/47] Serializer made for privateComment --- .../PrivateCommentEmbeddableNormalizer.php | 56 +++++++++++++++++++ .../config/services/serializer.yaml | 3 + 2 files changed, 59 insertions(+) create mode 100644 src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php new file mode 100644 index 000000000..27e5b21f7 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php @@ -0,0 +1,56 @@ +security = $security; + } + + public function denormalize($data, string $type, ?string $format = null, array $context = []) + { + if (null === $data) { + return null; + } + + $comment = new PrivateCommentEmbeddable(); + + $comment->setCommentForUser($this->security->getUser(), $data['privateComment']); + } + + public function supportsDenormalization($data, string $type, ?string $format = null) + { + return $type === CommentEmbeddable::class; + } + + public function normalize($comment, $format = null, array $contect = []) + { + return $comment->getComment(); + } + + public function supportsNormalization($data, ?string $format = null) + { + return $data instanceof CommentEmbeddable; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/config/services/serializer.yaml b/src/Bundle/ChillMainBundle/config/services/serializer.yaml index 4d8aa9954..1084dab71 100644 --- a/src/Bundle/ChillMainBundle/config/services/serializer.yaml +++ b/src/Bundle/ChillMainBundle/config/services/serializer.yaml @@ -10,4 +10,7 @@ services: Chill\MainBundle\Serializer\Normalizer\DoctrineExistingEntityNormalizer: tags: - { name: 'serializer.normalizer', priority: 8 } + Chill\MainBundle\Serializer\Normalizer\PrivateCommentEmbeddableNormalizer: + autowire: true + autoconfigure: true From b2003c74a6488ea636dbc63623735940e7623223 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 27 Apr 2022 11:50:53 +0200 Subject: [PATCH 10/47] renderbox for private comments (not working yet) --- .../Entity/PrivateCommentRender.php | 72 +++++++++++++++++++ .../config/services/templating.yaml | 4 ++ 2 files changed, 76 insertions(+) create mode 100644 src/Bundle/ChillMainBundle/Templating/Entity/PrivateCommentRender.php diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/PrivateCommentRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/PrivateCommentRender.php new file mode 100644 index 000000000..d47cb2296 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Templating/Entity/PrivateCommentRender.php @@ -0,0 +1,72 @@ +engine = $engine; + $this->sercurity = $security; + } + + /** + * @param PrivateCommentEmbeddable $entity + */ + public function renderBox($entity, array $options): string + { + // default options + $options = array_merge([ + 'user' => [], + 'disable_markdown' => false, + 'limit_lines' => null, + 'metadata' => true, + ], $options); + + return $this->engine + ->render( + '@ChillMain/Entity/CommentEmbeddable.html.twig', + [ + 'opening_box' => $this->getDefaultOpeningBox('comment-embeddable'), + 'closing_box' => $this->getDefaultClosingBox(), + 'user' => $this->security->getUser() ?? null, + 'comment' => $entity->getCommentForUser($this->security->getUser()), + 'options' => $options, + ] + ); + } + + /** + * @param PrivateCommentEmbeddable $entity + */ + public function renderString($entity, array $options): string + { + return $entity->getCommentForUser($this->security->getUser()); + } + + public function supports($entity, array $options): bool + { + return $entity instanceof PrivateCommentEmbeddable; + } +} diff --git a/src/Bundle/ChillMainBundle/config/services/templating.yaml b/src/Bundle/ChillMainBundle/config/services/templating.yaml index e69700732..bd8d99786 100644 --- a/src/Bundle/ChillMainBundle/config/services/templating.yaml +++ b/src/Bundle/ChillMainBundle/config/services/templating.yaml @@ -41,6 +41,10 @@ services: tags: - { name: 'chill.render_entity' } + Chill\MainBundle\Templating\Entity\PrivateCommentRender: + tags: + - { name: 'chill.render_entity' } + Chill\MainBundle\Templating\ChillMarkdownRenderExtension: tags: - { name: twig.extension } From e878960da95720671bba6fc253d8e7cc07a5e56b Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 27 Apr 2022 11:51:18 +0200 Subject: [PATCH 11/47] Private comment adjusted for rendez-vous --- .../Resources/views/Calendar/new.html.twig | 34 +++++++++---------- .../translations/messages.fr.yml | 4 +-- .../translations/messages.fr.yml | 1 + 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/new.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/new.html.twig index 7841f5b46..41adb52cc 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/new.html.twig +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/new.html.twig @@ -54,22 +54,22 @@
{{ form_end(form) }} diff --git a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml index 1dbb00bb8..eeb12298f 100644 --- a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml @@ -17,7 +17,7 @@ status: Statut du rendez-vous calendar location: Localistion du rendez-vous calendar comment: Remarque sur le rendez-vous sendSMS: Envoi d'un SMS -Send s m s: Envoi d'un SMS ? +Send s m s: Envoi d'un SMS ? Cancel reason: Motif d'annulation Add a new calendar: Ajouter un nouveau rendez-vous "Success : calendar item updated!": "Rendez-vous mis à jour" @@ -26,4 +26,4 @@ The calendar item has been successfully removed.: Le rendez-vous a été supprim From the day: Du to the day: au Transform to activity: Transformer en échange -private comment: Commentaire privé \ No newline at end of file +private comment: Notes privé \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index 452ad306c..e9a5fce4d 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -65,6 +65,7 @@ Read more: Lire la suite # comment embeddable No comment associated: Aucun commentaire +private comment: Notes privé #pagination Previous: Précédent From 4dc56db018a1b7173fd567c3bc71f20d772b1f5a Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 27 Apr 2022 11:51:32 +0200 Subject: [PATCH 12/47] show of activity adjusted for private comment --- .../Resources/views/Activity/show.html.twig | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig index 512557491..b6d375933 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig @@ -146,19 +146,18 @@
{% endif %} - {% if t.privateCommentVisible and is_granted('CHILL_ACTIVITY_SEE_DETAILS', entity) and entity.privateComment.userId is same as(app.user.id) %} - {% if t.privateCommentLabel is not empty %} -
{{ t.privateCommentLabel }}
- {% else %} -
{{ 'activity.private comment'|trans }}
- {% endif %} -
- {%- if entity.privateComment.empty -%} - {{ 'No comment associated'|trans }} - {%- else -%} - {{ entity.privateComment|chill_entity_render_box }} - {%- endif -%} -
+ {% if t.privateCommentVisible and is_granted('CHILL_ACTIVITY_SEE_DETAILS', entity) %} + {% set userID = app.user.id %} + {% if userID in entity.privateComment.comments|keys %} + {% if t.privateCommentLabel is not empty %} +
{{ t.privateCommentLabel }}
+ {% else %} +
{{ 'activity.private comment'|trans }}
+ {% endif %} +
+ {{ entity.privateComment.comments[userID]|chill_entity_render_box }} +
+ {% endif %} {% endif %} {% if t.documentsVisible and is_granted('CHILL_ACTIVITY_SEE_DETAILS', entity) %} From c56a125a787aad92bd4b9107d65ed3bd041bac17 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 27 Apr 2022 11:52:01 +0200 Subject: [PATCH 13/47] privateComment for action (not working yet) --- .../vuejs/AccompanyingCourseWorkEdit/App.vue | 58 +++++++++++-------- .../vuejs/AccompanyingCourseWorkEdit/store.js | 7 +++ .../ChillPersonBundle/chill.api.specs.yaml | 2 + 3 files changed, 42 insertions(+), 25 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue index 19d253f41..6d0123dc6 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue @@ -150,12 +150,12 @@ @@ -283,18 +283,18 @@ -