From e32b8b09429f792b8d1f547b0daef27815e93cb7 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 4 Mar 2022 16:27:53 +0100 Subject: [PATCH] Fix phonenumber -> telephone for thirdparty --- .../public/vuejs/OnTheFly/components/OnTheFly.vue | 10 ++++++---- .../Normalizer/PhonenumberNormalizer.php | 4 ++++ .../components/Resources/ResourceItem.vue | 2 +- .../_components/Entity/ThirdPartyRenderBox.vue | 8 ++++---- .../vuejs/_components/OnTheFly/ThirdParty.vue | 14 +++++++------- .../Serializer/Normalizer/ThirdPartyNormalizer.php | 2 +- 6 files changed, 23 insertions(+), 17 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 5528d563e..494a081e1 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue @@ -93,7 +93,6 @@ import Modal from 'ChillMainAssets/vuejs/_components/Modal.vue'; import OnTheFlyCreate from './Create.vue'; import OnTheFlyPerson from 'ChillPersonAssets/vuejs/_components/OnTheFly/Person.vue'; import OnTheFlyThirdparty from 'ChillThirdPartyAssets/vuejs/_components/OnTheFly/ThirdParty.vue'; -import { postThirdparty } from "ChillThirdPartyAssets/vuejs/_api/OnTheFly"; export default { name: 'OnTheFly', @@ -218,21 +217,24 @@ export default { case 'thirdparty': data = this.$refs.castThirdparty.$data.thirdparty; - /* never executed ? */ + /* never executed ? Yes, when editing thirdparty... */ break; default: if (typeof this.type === 'undefined') { // action=create or addContact - console.log('will rewrite data'); + console.log('will rewrite data'); if (this.action === 'addContact') { type = 'thirdparty' data = this.$refs.castThirdparty.$data.thirdparty; console.log('data original', data); data.parent = {type: "thirdparty", id: this.parent.id}; + // data.civility = {type: 'chill_main_civility', id: civility.id }; + // data.profession = {type: 'third_party_profession', id: profession.id }; } else { + console.log('im here') type = this.$refs.castNew.radioType; data = this.$refs.castNew.castDataByType(); - console.log(data) + console.log('saveAction', data) } } else { throw 'error with object type'; diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php index cb59e6421..aee5a263b 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php @@ -40,6 +40,10 @@ class PhonenumberNormalizer implements NormalizerInterface, DenormalizerInterfac */ public function denormalize($data, $type, $format = null, array $context = []) { + if ("" == trim($data)) { + return null; + } + try { return $this->phoneNumberUtil->parse($data, $this->defaultCarrierCode); } catch (NumberParseException $e) { 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 8d897da13..6f3f2a8fa 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 @@ -170,7 +170,7 @@ export default { console.log('data', payload.data) body.name = payload.data.name; body.email = payload.data.email; - body.telephone = payload.data.phonenumber; + body.telephone = payload.data.telephone; body.address = payload.data.address ? { id: payload.data.address.address_id } : null; makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body) diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue index 1555ec66a..bcdbf5e55 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue @@ -61,9 +61,9 @@ -
  • +
  • - {{ thirdparty.phonenumber }} + {{ thirdparty.telephone }}
  • @@ -78,9 +78,9 @@
  • -
  • +
  • - {{ thirdparty.phonenumber }} + {{ thirdparty.telephone }}
  • diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue index 40efa9bfb..f0d48b9d6 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue @@ -116,12 +116,12 @@
    - + + aria-describedby="telephone" />
    @@ -266,10 +266,10 @@ export default { this.thirdparty.name = query; }, }, - mounted() { - let dependencies = []; - dependencies.push(this.loadProfessions()); - dependencies.push(this.loadCivilities()); + mounted() { + let dependencies = []; + dependencies.push(this.loadProfessions()); + dependencies.push(this.loadCivilities()); if (this.action !== 'create') { if (this.id) { dependencies.push(this.loadData()); diff --git a/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php b/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php index 65bc15ba0..8e4775aad 100644 --- a/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php +++ b/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php @@ -62,7 +62,7 @@ class ThirdPartyNormalizer implements NormalizerAwareInterface, NormalizerInterf }, $thirdParty->getTypesAndCategories()), 'profession' => $this->normalizer->normalize($thirdParty->getProfession(), $format, $context), 'address' => $this->normalizer->normalize($thirdParty->getAddress(), $format, ['address_rendering' => 'short']), - 'phonenumber' => $this->normalizer->normalize($thirdParty->getTelephone()), + 'telephone' => $this->normalizer->normalize($thirdParty->getTelephone()), 'email' => $thirdParty->getEmail(), 'isChild' => $thirdParty->isChild(), 'parent' => $this->normalizer->normalize($thirdParty->getParent(), $format, $context),