From 739540af6438c754f99ae7121b7e51833896d0bc Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 11:13:22 +0100 Subject: [PATCH 01/93] created and updated traits added + template property added to Document entity --- .../ChillDocStoreBundle/Entity/Document.php | 31 +- .../migrations/Version20220131093117.php | 312 ++++++++++++++++++ .../AccompanyingPeriodContext.php | 3 +- 3 files changed, 342 insertions(+), 4 deletions(-) create mode 100644 src/Bundle/ChillDocStoreBundle/migrations/Version20220131093117.php diff --git a/src/Bundle/ChillDocStoreBundle/Entity/Document.php b/src/Bundle/ChillDocStoreBundle/Entity/Document.php index 874a60f0b..aa737e4b0 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/Document.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/Document.php @@ -11,7 +11,13 @@ declare(strict_types=1); namespace Chill\DocStoreBundle\Entity; +use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate; +use Chill\MainBundle\Doctrine\Model\TrackCreationInterface; +use Chill\MainBundle\Doctrine\Model\TrackCreationTrait; +use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface; +use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait; use Chill\MainBundle\Entity\HasScopeInterface; +use Chill\MainBundle\Entity\Scope; use Chill\MainBundle\Entity\User; use DateTimeInterface; use Doctrine\ORM\Mapping as ORM; @@ -20,8 +26,12 @@ use Symfony\Component\Validator\Constraints as Assert; /** * @ORM\MappedSuperclass */ -class Document implements HasScopeInterface +class Document implements HasScopeInterface, TrackCreationInterface, TrackUpdateInterface { + use TrackCreationTrait; + + use TrackUpdateTrait; + /** * @ORM\ManyToOne(targetEntity="Chill\DocStoreBundle\Entity\DocumentCategory") * @ORM\JoinColumns({ @@ -83,8 +93,11 @@ class Document implements HasScopeInterface private $user; /** - * @return DocumentCategory + * @ORM\ManyToOne(targetEntity="Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate") */ + private $template; + + public function getCategory(): ?DocumentCategory { return $this->category; @@ -115,7 +128,7 @@ class Document implements HasScopeInterface * * @return \Chill\MainBundle\Entity\Scope */ - public function getScope() + public function getScope(): ?Scope { return $this->scope; } @@ -130,6 +143,11 @@ class Document implements HasScopeInterface return $this->user; } + public function getTemplate(): ?DocGeneratorTemplate + { + return $this->template; + } + public function setCategory(DocumentCategory $category): self { $this->category = $category; @@ -178,4 +196,11 @@ class Document implements HasScopeInterface return $this; } + + public function setTemplate(?DocGeneratorTemplate $template): self + { + $this->template = $template; + return $this; + } + } diff --git a/src/Bundle/ChillDocStoreBundle/migrations/Version20220131093117.php b/src/Bundle/ChillDocStoreBundle/migrations/Version20220131093117.php new file mode 100644 index 000000000..c5aac740b --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/migrations/Version20220131093117.php @@ -0,0 +1,312 @@ +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 chill_doc.accompanyingcourse_document ADD template_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD createdAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD updatedAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD createdBy_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD updatedBy_id INT DEFAULT NULL'); + $this->addSql('COMMENT ON COLUMN chill_doc.accompanyingcourse_document.createdAt IS \'(DC2Type:datetime_immutable)\''); + $this->addSql('COMMENT ON COLUMN chill_doc.accompanyingcourse_document.updatedAt IS \'(DC2Type:datetime_immutable)\''); + $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD CONSTRAINT FK_A45098F65DA0FB8 FOREIGN KEY (template_id) REFERENCES chill_docgen_template (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD CONSTRAINT FK_A45098F63174800F FOREIGN KEY (createdBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD CONSTRAINT FK_A45098F665FF1AEC FOREIGN KEY (updatedBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('CREATE INDEX IDX_A45098F65DA0FB8 ON chill_doc.accompanyingcourse_document (template_id)'); + $this->addSql('CREATE INDEX IDX_A45098F63174800F ON chill_doc.accompanyingcourse_document (createdBy_id)'); + $this->addSql('CREATE INDEX IDX_A45098F665FF1AEC ON chill_doc.accompanyingcourse_document (updatedBy_id)'); + // $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 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 TABLE chill_main_workflow_entity_step ALTER transitionat SET NOT NULL'); + // $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('DROP INDEX participations_no_overlap'); + // $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_accompanying_period_work DROP CONSTRAINT fk_b694fb3616d9d9b'); + // $this->addSql('DROP INDEX idx_b694fb3616d9d9b'); + // $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 mobilenumber_trgm_idx'); + // $this->addSql('DROP INDEX fullnamecanonical_trgm_idx'); + // $this->addSql('DROP INDEX chill_custom_fullnamecanonical_only_trgm_idx_gin'); + // $this->addSql('DROP INDEX phonenumber_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 DROP DEFAULT'); + // $this->addSql('ALTER TABLE chill_person_person ALTER cfdata SET NOT NULL'); + // $this->addSql('ALTER TABLE chill_person_person ALTER mobilenumber DROP DEFAULT'); + // $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_relations ALTER isactive DROP NOT NULL'); + // $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('ALTER TABLE chill_doc.person_document ADD template_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_doc.person_document ADD createdAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_doc.person_document ADD updatedAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_doc.person_document ADD createdBy_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_doc.person_document ADD updatedBy_id INT DEFAULT NULL'); + $this->addSql('COMMENT ON COLUMN chill_doc.person_document.createdAt IS \'(DC2Type:datetime_immutable)\''); + $this->addSql('COMMENT ON COLUMN chill_doc.person_document.updatedAt IS \'(DC2Type:datetime_immutable)\''); + $this->addSql('ALTER TABLE chill_doc.person_document ADD CONSTRAINT FK_41DA53C5DA0FB8 FOREIGN KEY (template_id) REFERENCES chill_docgen_template (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_doc.person_document ADD CONSTRAINT FK_41DA53C3174800F FOREIGN KEY (createdBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_doc.person_document ADD CONSTRAINT FK_41DA53C65FF1AEC FOREIGN KEY (updatedBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('CREATE INDEX IDX_41DA53C5DA0FB8 ON chill_doc.person_document (template_id)'); + $this->addSql('CREATE INDEX IDX_41DA53C3174800F ON chill_doc.person_document (createdBy_id)'); + $this->addSql('CREATE INDEX IDX_41DA53C65FF1AEC ON chill_doc.person_document (updatedBy_id)'); + // $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('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 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 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 INDEX idx_589d51b4ef1a9d84 RENAME TO idx_154a075fef1a9d84'); + // $this->addSql('ALTER INDEX idx_589d51b4a76ed395 RENAME TO idx_154a075fa76ed395'); + // $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_main_workflow_entity_step ALTER transitionAt 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 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 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 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('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('CREATE INDEX participations_no_overlap ON chill_person_accompanying_period_participation (person_id, accompanyingperiod_id)'); + // $this->addSql('ALTER TABLE chill_main_location ALTER active SET DEFAULT \'true\''); + $this->addSql('ALTER TABLE chill_doc.person_document DROP CONSTRAINT FK_41DA53C5DA0FB8'); + $this->addSql('ALTER TABLE chill_doc.person_document DROP CONSTRAINT FK_41DA53C3174800F'); + $this->addSql('ALTER TABLE chill_doc.person_document DROP CONSTRAINT FK_41DA53C65FF1AEC'); + $this->addSql('DROP INDEX IDX_41DA53C5DA0FB8'); + $this->addSql('DROP INDEX IDX_41DA53C3174800F'); + $this->addSql('DROP INDEX IDX_41DA53C65FF1AEC'); + $this->addSql('ALTER TABLE chill_doc.person_document DROP template_id'); + $this->addSql('ALTER TABLE chill_doc.person_document DROP createdAt'); + $this->addSql('ALTER TABLE chill_doc.person_document DROP updatedAt'); + $this->addSql('ALTER TABLE chill_doc.person_document DROP createdBy_id'); + $this->addSql('ALTER TABLE chill_doc.person_document DROP updatedBy_id'); + // $this->addSql('ALTER INDEX idx_ac74095aa76ed395 RENAME TO idx_55026b0ca76ed395'); + // $this->addSql('ALTER INDEX idx_ac74095a682b5931 RENAME TO idx_55026b0c682b5931'); + // $this->addSql('ALTER INDEX idx_ac74095a217bbb47 RENAME TO idx_55026b0c217bbb47'); + // $this->addSql('ALTER INDEX idx_ac74095ac54c8c93 RENAME TO idx_55026b0cc54c8c93'); + // $this->addSql('ALTER INDEX idx_ac74095ad7fa8ef0 RENAME TO IDX_AC74095A550B0C53'); + // $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 SET DEFAULT \'\''); + // $this->addSql('ALTER TABLE chill_person_person ALTER phonenumber SET 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('CREATE INDEX mobilenumber_trgm_idx ON chill_person_person (mobilenumber)'); + // $this->addSql('CREATE INDEX fullnamecanonical_trgm_idx ON chill_person_person (center_id, fullnamecanonical)'); + // $this->addSql('CREATE INDEX chill_custom_fullnamecanonical_only_trgm_idx_gin ON chill_person_person (fullnamecanonical)'); + // $this->addSql('CREATE INDEX phonenumber_trgm_idx ON chill_person_person (phonenumber)'); + // $this->addSql('ALTER INDEX idx_bf210a141c9da55 RENAME TO idx_3370d4401c9da55'); + // $this->addSql('ALTER INDEX idx_bf210a143818da5 RENAME TO idx_3370d4403818da5'); + // $this->addSql('ALTER INDEX idx_bf210a145932f377 RENAME TO idx_person_center'); + // $this->addSql('ALTER INDEX idx_bf210a14d7d03ce3 RENAME TO IDX_BF210A145521BE40'); + // $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('CREATE INDEX idx_b694fb3616d9d9b ON chill_person_accompanying_period_work (handlingthierparty_id)'); + // $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)'); + // $this->addSql('ALTER TABLE chill_vendee.vendeeperson_entourage DROP CONSTRAINT FK_4D319FFEF57537C3'); + // $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 chill_vendee.idx_dd0a4c00eef79338 RENAME TO idx_1a4b602deef79338'); + // $this->addSql('CREATE INDEX chill_custom_canonicalized_trgm_idx_gist ON chill_3party.third_party (canonicalized) WHERE (active IS TRUE)'); + // $this->addSql('ALTER INDEX idx_a14d8f3d96df1f10 RENAME TO idx_a14d8f3d447bbb3b'); + // $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('ALTER INDEX idx_e260a868504cb38d RENAME TO idx_64a4a621504cb38d'); + // $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('ALTER TABLE chill_doc.accompanyingcourse_document DROP CONSTRAINT FK_A45098F65DA0FB8'); + $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP CONSTRAINT FK_A45098F63174800F'); + $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP CONSTRAINT FK_A45098F665FF1AEC'); + $this->addSql('DROP INDEX IDX_A45098F65DA0FB8'); + $this->addSql('DROP INDEX IDX_A45098F63174800F'); + $this->addSql('DROP INDEX IDX_A45098F665FF1AEC'); + $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP template_id'); + $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP createdAt'); + $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP updatedAt'); + $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP createdBy_id'); + $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP updatedBy_id'); + // $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('CREATE INDEX internal_center_geom_idx ON chill_vendee.center_polygon (geom)'); + // $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 permission_groups ALTER flags SET DEFAULT \'[]\''); + // $this->addSql('ALTER TABLE chill_person_marital_status ALTER id TYPE VARCHAR(10)'); + // $this->addSql('ALTER TABLE chill_person_relations ALTER isActive SET NOT NULL'); + // $this->addSql('ALTER TABLE custom_field_long_choice_options ALTER internal_key SET DEFAULT \'\''); + // $this->addSql('ALTER INDEX idx_7a48df7f5df53b66 RENAME TO idx_286dc95df53b66'); + // $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 customfieldsgroup ALTER options SET DEFAULT \'{}\''); + // $this->addSql('ALTER TABLE customfieldsgroup ALTER options 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 TABLE activityreasoncategory ALTER name DROP NOT NULL'); + } +} diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php index fc19b6590..02cedaad8 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php @@ -241,7 +241,8 @@ class AccompanyingPeriodContext implements public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void { $doc = new AccompanyingCourseDocument(); - $doc->setTitle($this->translatableStringHelper->localize($template->getName())) + $doc->setTemplate($template) + ->setTitle($this->translatableStringHelper->localize($template->getName())) ->setDate(new DateTime()) ->setDescription($this->translatableStringHelper->localize($template->getName())) ->setCourse($entity) From 46337ef25ded6384a943a665a76742424bead76d Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Feb 2022 15:09:42 +0100 Subject: [PATCH 02/93] in process... need to be sure which address to display exactly --- .../views/Person/household_history.html.twig | 14 +++++++++++++- .../translations/messages+intl-icu.fr.yaml | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/household_history.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/household_history.html.twig index d56fa30b1..6a8f0ee15 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/household_history.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/household_history.html.twig @@ -32,9 +32,21 @@
+ {% if p.household is same as p.person.getCurrentHousehold %} +
+
+

{{ 'Address'|trans }}

+
+
+ {% for h in p.person.getHouseholdParticipationsNotShareHousehold %} +

{{ h.address }}

+ {% endfor %} +
+
+ {% endif %}
-

En tant que

+

{{ 'As member'|trans }}

{{ p.position.label|localize_translatable_string }} diff --git a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml index ecafb367e..aded38b4a 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml +++ b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml @@ -98,6 +98,7 @@ household: from: Depuis to: Jusqu'au person history: Ménages + As member: En tant que household_composition: Since: >- From 97d2e3d5b5231906aa4ebf61f11f7ecc62125702 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Feb 2022 17:21:49 +0100 Subject: [PATCH 03/93] counter created for workflows for which user is a destuser and that are not finalized --- .../Workflow/EntityWorkflowStepRepository.php | 82 +++++++++++++++++++ .../Routing/MenuBuilder/UserMenuBuilder.php | 9 +- .../Counter/WorkflowByUserCounter.php | 41 ++++++++++ .../translations/messages+intl-icu.fr.yaml | 9 ++ 4 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php create mode 100644 src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php diff --git a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php new file mode 100644 index 000000000..bf45d3888 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php @@ -0,0 +1,82 @@ +repository = $entityManager->getRepository(EntityWorkflowStep::class); + } + + public function countUnreadByUser(User $user, ?array $orderBy = null, $limit = null, $offset = null): int + { + $qb = $this->buildQueryByUser($user)->select('count(e)'); + + return (int) $qb->getQuery()->getSingleScalarResult(); + } + + private function buildQueryByUser(User $user): QueryBuilder + { + $qb = $this->repository->createQueryBuilder('e'); + + $qb->where( + $qb->expr()->andX( + $qb->expr()->isMemberOf(':user', 'e.destUser'), + $qb->expr()->isNull('e.transitionAt'), + $qb->expr()->eq('e.isFinal', ':bool'), + ) + ); + + $qb->setParameter('user', $user); + $qb->setParameter('bool', false); + + dump($qb->getQuery()); + + return $qb; + } + + public function find($id): ?EntityWorkflowStep + { + return $this->repository->find($id); + } + + public function findAll(): array + { + return $this->repository->findAll(); + } + + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array + { + return $this->repository->findBy($criteria, $orderBy, $limit, $offset); + } + + public function findOneBy(array $criteria): ?EntityWorkflowStep + { + return $this->repository->findOneBy($criteria); + } + + public function getClassName() + { + return EntityWorkflow::class; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php index 9b6d89e83..b2fd5180e 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php @@ -14,6 +14,7 @@ namespace Chill\MainBundle\Routing\MenuBuilder; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Notification\Counter\NotificationByUserCounter; use Chill\MainBundle\Routing\LocalMenuBuilderInterface; +use Chill\MainBundle\Workflow\Counter\WorkflowByUserCounter; use Symfony\Component\Security\Core\Security; use Symfony\Contracts\Translation\TranslatorInterface; @@ -25,12 +26,16 @@ class UserMenuBuilder implements LocalMenuBuilderInterface private TranslatorInterface $translator; + private WorkflowByUserCounter $workflowByUserCounter; + public function __construct( NotificationByUserCounter $notificationByUserCounter, + WorkflowByUserCounter $workflowByUserCounter, Security $security, TranslatorInterface $translator ) { $this->notificationByUserCounter = $notificationByUserCounter; + $this->workflowByUserCounter = $workflowByUserCounter; $this->security = $security; $this->translator = $translator; } @@ -69,9 +74,11 @@ class UserMenuBuilder implements LocalMenuBuilderInterface 'counter' => $nbNotifications, ]); + $workflowCount = $this->workflowByUserCounter->getCountUnreadByUser($user); + $menu ->addChild( - $this->translator->trans('workflow.My workflows'), + $this->translator->trans('workflow.My workflows with counter', ['wc' => $workflowCount]), ['route' => 'chill_main_workflow_list_dest'] ) ->setExtras([ diff --git a/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php b/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php new file mode 100644 index 000000000..7c1717d52 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php @@ -0,0 +1,41 @@ +workflowStepRepository = $workflowStepRepository; + } + + public function addNotification(UserInterface $u): int + { + if (!$u instanceof User) { + return 0; + } + + return $this->getCountUnreadByUser($u); + } + + public function getCountUnreadByUser(User $user): int + { + return $this->workflowStepRepository->countUnreadByUser($user); + } +} diff --git a/src/Bundle/ChillMainBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillMainBundle/translations/messages+intl-icu.fr.yaml index 7a5b328f4..9ec3644ef 100644 --- a/src/Bundle/ChillMainBundle/translations/messages+intl-icu.fr.yaml +++ b/src/Bundle/ChillMainBundle/translations/messages+intl-icu.fr.yaml @@ -29,3 +29,12 @@ notification: few {# non-lues} other {# non-lues} } + +workflow: + My workflows with counter: >- + {wc, plural, + =0 {Mes workflows} + one {Une workflow} + few {# workflows} + other {# workflows} + } From 76932e6e8cecfc9f6bc194a0f2ce243c1dc9e03e Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Feb 2022 17:23:12 +0100 Subject: [PATCH 04/93] bugfix in notificationhandler. Not sure about the fix in the template --- .../views/Workflow/_notification_include.html.twig | 2 +- .../Workflow/Notification/WorkflowNotificationHandler.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_notification_include.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_notification_include.html.twig index c20f51193..221ddf4b4 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_notification_include.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_notification_include.html.twig @@ -2,7 +2,7 @@

{{ 'workflow_'|trans }}

- {% include handler.templateTitle(l.entity_workflow) with handler.templateTitleData(entity_workflow)|merge({ + {% include handler.templateTitle(entity_workflow) with handler.templateTitleData(entity_workflow)|merge({ 'description': true, 'breadcrumb': true, 'add_classes': 'ms-3 h3' diff --git a/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php b/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php index 756d79fbf..2f29afc56 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php +++ b/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php @@ -23,6 +23,12 @@ class WorkflowNotificationHandler implements NotificationHandlerInterface private EntityWorkflowRepository $entityWorkflowRepository; + public function __construct(EntityWorkflowRepository $entityWorkflowRepository, EntityWorkflowManager $entityWorkflowManager) + { + $this->entityWorkflowRepository = $entityWorkflowRepository; + $this->entityWorkflowManager = $entityWorkflowManager; + } + public function getTemplate(Notification $notification, array $options = []): string { return '@ChillMain/Workflow/_notification_include.html.twig'; From 99efa51794ee1cdd168abb49786193b7eec9fdbe Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Feb 2022 17:23:45 +0100 Subject: [PATCH 05/93] csfixes --- .../Workflow/EntityWorkflowStepRepository.php | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php index bf45d3888..a6bece129 100644 --- a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php @@ -13,9 +13,9 @@ namespace Chill\MainBundle\Repository\Workflow; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\Workflow\EntityWorkflowStep; -use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ObjectRepository; class EntityWorkflowStepRepository implements ObjectRepository @@ -34,26 +34,6 @@ class EntityWorkflowStepRepository implements ObjectRepository return (int) $qb->getQuery()->getSingleScalarResult(); } - private function buildQueryByUser(User $user): QueryBuilder - { - $qb = $this->repository->createQueryBuilder('e'); - - $qb->where( - $qb->expr()->andX( - $qb->expr()->isMemberOf(':user', 'e.destUser'), - $qb->expr()->isNull('e.transitionAt'), - $qb->expr()->eq('e.isFinal', ':bool'), - ) - ); - - $qb->setParameter('user', $user); - $qb->setParameter('bool', false); - - dump($qb->getQuery()); - - return $qb; - } - public function find($id): ?EntityWorkflowStep { return $this->repository->find($id); @@ -79,4 +59,23 @@ class EntityWorkflowStepRepository implements ObjectRepository return EntityWorkflow::class; } -} \ No newline at end of file + private function buildQueryByUser(User $user): QueryBuilder + { + $qb = $this->repository->createQueryBuilder('e'); + + $qb->where( + $qb->expr()->andX( + $qb->expr()->isMemberOf(':user', 'e.destUser'), + $qb->expr()->isNull('e.transitionAt'), + $qb->expr()->eq('e.isFinal', ':bool'), + ) + ); + + $qb->setParameter('user', $user); + $qb->setParameter('bool', false); + + dump($qb->getQuery()); + + return $qb; + } +} From a78f29cffc1e940caeeab6a294d48b752d84e292 Mon Sep 17 00:00:00 2001 From: nobohan Date: Tue, 1 Feb 2022 17:44:55 +0100 Subject: [PATCH 06/93] on the fly component: add returnPath when viewing --- .../public/vuejs/OnTheFly/components/OnTheFly.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue index 116ed86c1..c3522863c 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue @@ -160,7 +160,10 @@ export default { }, badgeType() { return 'entity-' + this.type + ' badge-' + this.type; - } + }, + getReturnPath() { + return `?returnPath=${window.location.pathname}${window.location.search}${window.location.hash}`; + }, }, watch: { canCloseModal: { @@ -217,9 +220,9 @@ export default { buildLocation(id, type) { if (type === 'person') { // TODO i18n - return `/fr/person/${id}/general`; + return encodeURI(`/fr/person/${id}/general${this.getReturnPath}`); } else if (type === 'thirdparty') { - return `/fr/3party/3party/${id}/view`; + return encodeURI(`/fr/3party/3party/${id}/view${this.getReturnPath}`); } } } From a83b0326d762d71142bdeb37b9f701a2f8d9a7a7 Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 2 Feb 2022 07:04:14 +0100 Subject: [PATCH 07/93] upd CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a198c0929..e7ca8f3ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to ## Unreleased +* [person] add a returnPath when clicking on some Person or ThirdParty badge (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/427) * renommer "dossier numéro" en "parcours numéro" dans les résultats de recherche * renomme date de début en date d'ouverture dans le formulaire parcours From 8bafa37fe1702c09a67f3b63b482a695e5819ce4 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 2 Feb 2022 10:32:46 +0100 Subject: [PATCH 08/93] dump removed --- .../Repository/Workflow/EntityWorkflowStepRepository.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php index a6bece129..ad1b21c79 100644 --- a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php @@ -74,8 +74,6 @@ class EntityWorkflowStepRepository implements ObjectRepository $qb->setParameter('user', $user); $qb->setParameter('bool', false); - dump($qb->getQuery()); - return $qb; } } From 6cc4fa582ea9aaa2f2513f884de80c5eae28e3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 2 Feb 2022 22:15:53 +0100 Subject: [PATCH 09/93] fix validation error with startDate --- src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index dbc3ba182..593cdfc83 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -217,8 +217,8 @@ class AccompanyingPeriod implements * * @ORM\Column(type="date") * @Groups({"read", "write", "docgen:read"}) - * @Assert\LessThan(value="today", groups={AccompanyingPeriod::STEP_CONFIRMED}) - * @Assert\LessThan(propertyPath="closingDate", groups={AccompanyingPeriod::STEP_CONFIRMED}) + * @Assert\LessThan(value="tomorrow", groups={AccompanyingPeriod::STEP_CONFIRMED}) + * @Assert\LessThanOrEqual(propertyPath="closingDate", groups={AccompanyingPeriod::STEP_CONFIRMED}) */ private ?DateTime $openingDate = null; From 02d9a713de91b28b421509e37889e43168213954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 2 Feb 2022 22:16:15 +0100 Subject: [PATCH 10/93] set requestor before acdtions --- .../views/Person/list_with_period.html.twig | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig index 86459337d..e705ab499 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig @@ -179,14 +179,6 @@
{% endif %} - {% if acp.requestoranonymous == false %} {% if (acp.requestorPerson is not null and acp.requestorPerson.id != person.id) or acp.requestorThirdParty is not null %}
@@ -220,6 +212,16 @@
{% endif %} {% endif %} + + +
{% endfor %} From 9553e18d832208daf09726be6a67bcab5cb5f70a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 2 Feb 2022 22:17:24 +0100 Subject: [PATCH 11/93] do not uppercase/lowercase ref in activity list --- .../Resources/views/Activity/_list_item.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/_list_item.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/_list_item.html.twig index fadf7ff14..3a4749f3c 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/_list_item.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/_list_item.html.twig @@ -68,7 +68,7 @@

{{ 'Referrer'|trans }}

- {{ activity.user|chill_entity_render_string|capitalize }} + {{ activity.user|chill_entity_render_box }}

From 211ecf1c3e100be6f14c8add52850d8e0a367f32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 2 Feb 2022 23:19:59 +0100 Subject: [PATCH 12/93] add cache to workflow counter --- .../Workflow/EntityWorkflowRepository.php | 3 +- .../Counter/WorkflowByUserCounter.php | 69 +++++++++++++++++-- 2 files changed, 66 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php index cac5c9996..63e27c7ba 100644 --- a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php @@ -110,7 +110,8 @@ class EntityWorkflowRepository implements ObjectRepository $qb->where( $qb->expr()->andX( $qb->expr()->isMemberOf(':user', 'step.destUser'), - $qb->expr()->isNull('step.transitionAfter') + $qb->expr()->isNull('step.transitionAfter'), + $qb->expr()->eq('step.isFinal', "'FALSE'") ) ); diff --git a/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php b/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php index 7c1717d52..6a61e7de4 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php +++ b/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php @@ -12,30 +12,89 @@ declare(strict_types=1); namespace Chill\MainBundle\Workflow\Counter; use Chill\MainBundle\Entity\User; +use Chill\MainBundle\Entity\Workflow\EntityWorkflow; use Chill\MainBundle\Repository\Workflow\EntityWorkflowStepRepository; use Chill\MainBundle\Templating\UI\NotificationCounterInterface; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Workflow\Event\Event; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; -final class WorkflowByUserCounter implements NotificationCounterInterface +final class WorkflowByUserCounter implements NotificationCounterInterface, EventSubscriberInterface { private EntityWorkflowStepRepository $workflowStepRepository; - public function __construct(EntityWorkflowStepRepository $workflowStepRepository) + private CacheItemPoolInterface $cacheItemPool; + + public function __construct(EntityWorkflowStepRepository $workflowStepRepository, CacheItemPoolInterface $cacheItemPool) { $this->workflowStepRepository = $workflowStepRepository; + $this->cacheItemPool = $cacheItemPool; } - public function addNotification(UserInterface $u): int + public function addNotification(UserInterface $user): int { - if (!$u instanceof User) { + if (!$user instanceof User) { return 0; } - return $this->getCountUnreadByUser($u); + $key = self::generateCacheKeyWorkflowByUser($user); + $item = $this->cacheItemPool->getItem($key); + + if ($item->isHit()) { + return $item->get(); + } + + $nb = $this->getCountUnreadByUser($user); + + $item->set($nb) + ->expiresAfter(60 * 15); + $this->cacheItemPool->save($item); + + return $nb; } public function getCountUnreadByUser(User $user): int { return $this->workflowStepRepository->countUnreadByUser($user); } + + public static function generateCacheKeyWorkflowByUser(User $user): string + { + return 'chill_main_workflow_by_u_'.$user->getId(); + } + + public function resetWorkflowCache(Event $event): void + { + if (!$event->getSubject() instanceof EntityWorkflow) { + return; + } + + /** @var EntityWorkflow $entityWorkflow */ + $entityWorkflow = $event->getSubject(); + $step = $entityWorkflow->getCurrentStep(); + + if ($step === null) { + return; + } + + $keys = []; + foreach ($step->getDestUser() as $user) { + $keys[] = self::generateCacheKeyWorkflowByUser($user); + } + + if ([] !== $keys) { + $this->cacheItemPool->deleteItems($keys); + } + + } + + public static function getSubscribedEvents() + { + return [ + 'workflow.leave' => 'resetWorkflowCache', + ]; + } + + } From 3d5723facbe07f15a8ff8e2fe75e4a2bd53406d3 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 3 Feb 2022 08:59:56 +0100 Subject: [PATCH 13/93] AddPerson: correct thirdparty PATCH url + add email and altnames in AddPerson and serializer --- .../components/PersonsAssociated/ParticipationItem.vue | 4 +++- .../vuejs/AccompanyingCourse/components/Requestor.vue | 4 +++- .../components/Resources/ResourceItem.vue | 4 +++- .../Serializer/Normalizer/PersonJsonNormalizer.php | 7 +++++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue index 2ed08ffc0..dbc7b47ac 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue @@ -120,6 +120,8 @@ export default { if (payload.data.birthdate !== null) { body.birthdate = payload.data.birthdate; } body.phonenumber = payload.data.phonenumber; body.mobilenumber = payload.data.mobilenumber; + body.email = payload.data.email; + body.altNames = payload.data.altNames; body.gender = payload.data.gender; makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body) @@ -143,7 +145,7 @@ export default { body.telephone = payload.data.phonenumber; body.address = { id: payload.data.address.address_id }; - makeFetch('PATCH', `/api/1.0/third-party/third-party/${payload.data.id}.json`, body) + makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body) .then(response => { this.$store.dispatch('addThirdparty', { target: payload.target, body: response }) this.canCloseOnTheFlyModal = true; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue index 8f29f4771..809348d20 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue @@ -261,6 +261,8 @@ export default { if (payload.data.birthdate !== null) { body.birthdate = payload.data.birthdate; } body.phonenumber = payload.data.phonenumber; body.mobilenumber = payload.data.mobilenumber; + body.email = payload.data.email; + body.altNames = payload.data.altNames; body.gender = payload.data.gender; makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body) @@ -284,7 +286,7 @@ export default { body.telephone = payload.data.phonenumber; body.address = { id: payload.data.address.address_id }; - makeFetch('PATCH', `/api/1.0/third-party/third-party/${payload.data.id}.json`, body) + makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body) .then(response => { this.$store.dispatch('addThirdparty', { target: payload.target, body: response }) this.canCloseOnTheFlyModal = true; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue index 102dcf741..c9b66a8e5 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue @@ -152,6 +152,8 @@ export default { if (payload.data.birthdate !== null) { body.birthdate = payload.data.birthdate; } body.phonenumber = payload.data.phonenumber; body.mobilenumber = payload.data.mobilenumber; + body.email = payload.data.email; + body.altNames = payload.data.altNames; body.gender = payload.data.gender; makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body) @@ -175,7 +177,7 @@ export default { body.telephone = payload.data.phonenumber; body.address = { id: payload.data.address.address_id }; - makeFetch('PATCH', `/api/1.0/third-party/third-party/${payload.data.id}.json`, body) + makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body) .then(response => { this.$store.dispatch('addThirdparty', { target: payload.target, body: response }) this.canCloseOnTheFlyModal = true; diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php index 6288663e2..bfac5f936 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php @@ -91,6 +91,7 @@ class PersonJsonNormalizer implements 'deathdate', 'center', 'altNames', + 'email' ]; $fields = array_filter( @@ -161,6 +162,11 @@ class PersonJsonNormalizer implements } } + break; + + case 'email': + $person->setEmail($data[$item]); + break; } } @@ -189,6 +195,7 @@ class PersonJsonNormalizer implements 'centers' => $this->normalizer->normalize($this->centerResolverManager->resolveCenters($person), $format, $context), 'phonenumber' => $person->getPhonenumber(), 'mobilenumber' => $person->getMobilenumber(), + 'email' => $person->getEmail(), 'altNames' => $this->normalizeAltNames($person->getAltNames()), 'gender' => $person->getGender(), 'current_household_address' => $this->normalizer->normalize($person->getCurrentHouseholdAddress(), $format, $context), From 4afea55465b46d3f04ba8b8d7d2a2dc865445937 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 3 Feb 2022 09:17:45 +0100 Subject: [PATCH 14/93] addperson: repair altname: add altname if known --- .../Resources/public/vuejs/_components/OnTheFly/Person.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue index 9543da3bb..0e511ce5e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue @@ -43,10 +43,11 @@ -
+
@@ -199,6 +200,9 @@ export default { }, feminized() { return (this.person.gender === 'woman')? 'e' : ''; + }, + personAltNamesLabels() { + return this.person.altNames.map(a => a ? a.label : ''); } }, mounted() { From 1f0ef6e1872b28f49266688d8f2cce21600e67e0 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 3 Feb 2022 11:07:32 +0100 Subject: [PATCH 15/93] on-the-fly: close modal only after validation --- .../public/vuejs/OnTheFly/components/OnTheFly.vue | 12 +----------- .../PersonsAssociated/ParticipationItem.vue | 9 ++++----- .../AccompanyingCourse/components/Requestor.vue | 13 ++++++------- .../components/Resources/ResourceItem.vue | 13 ++++--------- .../public/vuejs/_components/AddPersons.vue | 8 +++----- 5 files changed, 18 insertions(+), 37 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue index 116ed86c1..21f7a9c55 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue @@ -90,7 +90,7 @@ export default { OnTheFlyThirdparty, OnTheFlyCreate }, - props: ['type', 'id', 'action', 'buttonText', 'displayBadge', 'isDead', 'parent', 'canCloseModal'], + props: ['type', 'id', 'action', 'buttonText', 'displayBadge', 'isDead', 'parent'], emits: ['saveFormOnTheFly'], data() { return { @@ -162,16 +162,6 @@ export default { return 'entity-' + this.type + ' badge-' + this.type; } }, - watch: { - canCloseModal: { - handler: function(val, oldVal) { - if (val) { - this.closeModal(); - } - }, - deep: true - } - }, methods: { closeModal() { this.modal.showModal = false; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue index dbc7b47ac..c9c7136c5 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue @@ -28,7 +28,7 @@
  • -
  • +
  • @@ -82,7 +82,7 @@ :id="resource.resource.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly" - :canCloseModal="canCloseOnTheFlyModal"> + ref="onTheFly">
  • @@ -116,11 +116,6 @@ export default { }, props: ['resource'], emits: ['remove'], - data() { - return { - canCloseOnTheFlyModal: false - } - }, computed: { parent() { return { @@ -159,7 +154,7 @@ export default { makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body) .then(response => { this.$store.dispatch('addPerson', { target: payload.target, body: response }) - this.canCloseOnTheFlyModal = true; + this.$refs.onTheFly.closeModal(); }) .catch((error) => { if (error.name === 'ValidationException') { @@ -180,7 +175,7 @@ export default { makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body) .then(response => { this.$store.dispatch('addThirdparty', { target: payload.target, body: response }) - this.canCloseOnTheFlyModal = true; + this.$refs.onTheFly.closeModal(); }) .catch((error) => { if (error.name === 'ValidationException') { diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue index 9e318ff96..1f017d28d 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue @@ -69,7 +69,7 @@ :buttonText="$t('onthefly.create.button', {q: query})" action="create" @saveFormOnTheFly="saveFormOnTheFly" - :canCloseModal="canCloseOnTheFlyModal"> + ref="onTheFly">
  • @@ -121,7 +121,6 @@ export default { selected: [], priorSuggestion: {} }, - canCloseOnTheFlyModal: false } }, computed: { @@ -271,7 +270,7 @@ export default { makeFetch('POST', '/api/1.0/person/person.json', data) .then(response => { this.newPriorSuggestion(response); - this.canCloseOnTheFlyModal = true; + this.$refs.onTheFly.closeModal(); }) .catch((error) => { if (error.name === 'ValidationException') { @@ -287,7 +286,7 @@ export default { makeFetch('POST', '/api/1.0/thirdparty/thirdparty.json', data) .then(response => { this.newPriorSuggestion(response); - this.canCloseOnTheFlyModal = true; + this.$refs.onTheFly.closeModal(); }) .catch((error) => { if (error.name === 'ValidationException') { @@ -299,7 +298,6 @@ export default { } }) } - this.canCloseOnTheFlyModal = false; } }, } From f139af8b6f33c823a550dd0a588ad1dd1d8de442 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 3 Feb 2022 11:26:31 +0100 Subject: [PATCH 16/93] accompanying course work: fix on-the-fly update of thirdParty --- .../vuejs/AccompanyingCourseWorkEdit/App.vue | 30 ++++++++++++++----- .../vuejs/AccompanyingCourseWorkEdit/index.js | 10 ++++++- .../vuejs/AccompanyingCourseWorkEdit/store.js | 12 ++++++++ 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue index f9d1a747c..34c0794fb 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue @@ -211,7 +211,7 @@