From 349db2142defe9cc6845e8ca7e7244997740da37 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 3 Mar 2022 14:39:00 +0100 Subject: [PATCH 1/5] person: add url field to SocialWork Evaluation entity + populate with http title values --- .../Entity/SocialWork/Evaluation.php | 18 +++++++++ .../migrations/Version20220303113855.php | 38 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/migrations/Version20220303113855.php diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php index 1350ae6d8..9349c335e 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php @@ -62,6 +62,12 @@ class Evaluation */ private array $title = []; + /** + * @ORM\Column(type="text", nullable=true) + * @Serializer\Groups({"read", "docgen:read"}) + */ + private ?string $url = null; + public function __construct() { $this->socialActions = new ArrayCollection(); @@ -101,6 +107,11 @@ class Evaluation return $this->title; } + public function getUrl(): ?string + { + return $this->url; + } + public function removeSocialAction(SocialAction $socialAction): self { if ($this->socialActions->contains($socialAction)) { @@ -130,4 +141,11 @@ class Evaluation return $this; } + + public function setUrl(?string $url): self + { + $this->url = $url; + + return $this; + } } diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20220303113855.php b/src/Bundle/ChillPersonBundle/migrations/Version20220303113855.php new file mode 100644 index 000000000..9991d2eca --- /dev/null +++ b/src/Bundle/ChillPersonBundle/migrations/Version20220303113855.php @@ -0,0 +1,38 @@ +addSql('ALTER TABLE chill_person_social_work_evaluation ADD url TEXT DEFAULT NULL'); + $this->addSql("UPDATE chill_person_social_work_evaluation SET url = CASE WHEN title->>'fr' LIKE 'http%' THEN title->>'fr' ELSE null END;"); + } + + public function down(Schema $schema): void + { + + $this->addSql('ALTER TABLE chill_person_social_work_evaluation DROP url'); + } +} From 568a1d95f46544fff7040710359b5fd7ea91a634 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 3 Mar 2022 15:10:05 +0100 Subject: [PATCH 2/5] AccompanyingCourseWorkEdit: add url to vuejs form --- .../components/AddEvaluation.vue | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue index 579d0b306..d2b8c5b46 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue @@ -5,6 +5,11 @@ {{ evaluation.evaluation.title.fr }} + +
@@ -128,4 +133,11 @@ export default { } } } + div.item-url { + i { + color: unset!important; + margin-left: 1rem; + margin-right: 0.5rem; + } + } From a88e052eb64f06c4195f9a3b20f319ac291505d3 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 3 Mar 2022 15:12:47 +0100 Subject: [PATCH 3/5] upd CHANGELOG --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bd743078..7de2c188a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ and this project adheres to ## Unreleased +* [person] Add url in accompanying period work evaluations entity and form (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/476) + + * [parcours] Toggle emergency/intensity only by referrer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/442) * [docstore] Add an API entrypoint for StoredObject (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/466) * [person] Add the possibility of uploading existing documents to AccPeriodWorkEvaluationDocument (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/466) From c5eac09478e1b9bed3369182ce351f64420a0366 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 3 Mar 2022 15:17:05 +0100 Subject: [PATCH 4/5] php cs fix on migration --- .../migrations/Version20220303113855.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20220303113855.php b/src/Bundle/ChillPersonBundle/migrations/Version20220303113855.php index 9991d2eca..7840cdfce 100644 --- a/src/Bundle/ChillPersonBundle/migrations/Version20220303113855.php +++ b/src/Bundle/ChillPersonBundle/migrations/Version20220303113855.php @@ -15,10 +15,15 @@ use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; /** - * Add url to SocialWork Evaluation + * Add url to SocialWork Evaluation. */ final class Version20220303113855 extends AbstractMigration { + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_person_social_work_evaluation DROP url'); + } + public function getDescription(): string { return 'Add url to SocialWork Evaluation'; @@ -29,10 +34,4 @@ final class Version20220303113855 extends AbstractMigration $this->addSql('ALTER TABLE chill_person_social_work_evaluation ADD url TEXT DEFAULT NULL'); $this->addSql("UPDATE chill_person_social_work_evaluation SET url = CASE WHEN title->>'fr' LIKE 'http%' THEN title->>'fr' ELSE null END;"); } - - public function down(Schema $schema): void - { - - $this->addSql('ALTER TABLE chill_person_social_work_evaluation DROP url'); - } } From 7afada5dad29d34a981baf5c60ff8955e6b3a2ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Sun, 6 Mar 2022 22:36:38 +0100 Subject: [PATCH 5/5] fix cs --- src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php | 2 ++ src/Bundle/ChillPersonBundle/Entity/PersonPhone.php | 2 +- src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php | 1 - 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php b/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php index 8fdaf2596..22f580d78 100644 --- a/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php +++ b/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php @@ -92,9 +92,11 @@ final class PhonenumberHelper implements PhoneNumberHelperInterface switch ($this->phoneNumberUtil->getNumberType($phonenumber)) { case PhoneNumberType::MOBILE: return 'mobile'; + case PhoneNumberType::FIXED_LINE: case PhoneNumberType::VOIP: return 'landline'; + default: return 'landline'; } diff --git a/src/Bundle/ChillPersonBundle/Entity/PersonPhone.php b/src/Bundle/ChillPersonBundle/Entity/PersonPhone.php index 7d0bce1ff..7f0e28ddb 100644 --- a/src/Bundle/ChillPersonBundle/Entity/PersonPhone.php +++ b/src/Bundle/ChillPersonBundle/Entity/PersonPhone.php @@ -98,7 +98,7 @@ class PersonPhone public function isEmpty(): bool { - return ("" === $this->getDescription() || null === $this->getDescription()) + return ('' === $this->getDescription() || null === $this->getDescription()) && null === $this->getPhonenumber(); } diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php b/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php index 1910d4605..3b1de28c7 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php @@ -16,7 +16,6 @@ use Chill\MainBundle\Phonenumber\PhonenumberHelper; use Chill\PersonBundle\Entity\PersonPhone; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\TelType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormEvent;