From dd4d463c42fd3431cf32b4dd48d92276f00a7f09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 24 Mar 2022 19:32:53 +0100 Subject: [PATCH] fix bug when setting civility to null in on the fly --- .../public/vuejs/OnTheFly/components/OnTheFly.vue | 12 ++++-------- 1 file changed, 4 insertions(+), 8 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 66a30c296..979f53d74 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue @@ -229,18 +229,14 @@ export default { 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: data.civility.id}; - data.profession = {type: 'third_party_profession', id: data.profession.id}; + data.civility = data.civility !== null ? {type: 'chill_main_civility', id: data.civility.id} : null; + data.profession = data.profession !== null ? {type: 'third_party_profession', id: data.profession.id} : null; } else { type = this.$refs.castNew.radioType; data = this.$refs.castNew.castDataByType(); // console.log('type', type); - if (null !== data.civility) { - data.civility = {type: 'chill_main_civility', id: data.civility.id}; - } - if (null !== data.profession) { - data.profession = {type: 'third_party_profession', id: data.profession.id}; - } + data.civility = data.civility !== null ? {type: 'chill_main_civility', id: data.civility.id} : null; + data.profession = data.profession !== null ? {type: 'third_party_profession', id: data.profession.id} : null; // console.log('onthefly data', data); } } else {