From f5a565708e2875ae4d27f35a9d41715cac3cb4c1 Mon Sep 17 00:00:00 2001 From: Marc Rufener Date: Wed, 14 Jun 2023 14:14:48 +0200 Subject: [PATCH] fix bug hannening when openning a new cadastration --- .../Affaires/NewAffaire/NewAffaire.vue | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/front/src/components/Affaires/NewAffaire/NewAffaire.vue b/front/src/components/Affaires/NewAffaire/NewAffaire.vue index bb0fd1b9..fcae1836 100644 --- a/front/src/components/Affaires/NewAffaire/NewAffaire.vue +++ b/front/src/components/Affaires/NewAffaire/NewAffaire.vue @@ -760,9 +760,13 @@ export default { // test validation of clients which are in a different component let test = true; - test = test && this.$refs.ref_client_commande.validator(); - test = test && this.$refs.ref_client_envoi.validator(); - if (this.affaireTypeRequirements && this.affaireTypeRequirements.section_facture) { + if (this.$refs.ref_client_commande) { + test = test && this.$refs.ref_client_commande.validator(); + } + if (this.$refs.ref_client_envoi) { + test = test && this.$refs.ref_client_envoi.validator(); + } + if (this.affaireTypeRequirements && this.affaireTypeRequirements.section_facture && this.$refs.ref_client_facture) { test = test && this.$refs.ref_client_facture.validator(); } @@ -910,7 +914,7 @@ export default { this.form.client_commande_id = process.env.VUE_APP_CLIENT_CADASTRATION_ID; this.form.client_envoi_id = process.env.VUE_APP_CLIENT_CADASTRATION_ID; this.form.client_envoi_complement = null; - this.client_facture_id = null; + this.client_facture_id = process.env.VUE_APP_CLIENT_CADASTRATION_ID; this.client_facture_premiere_ligne = null; this.form.nom = "Cadastration sur "; } else if (this.form.type.id === this.typesAffaires_conf.mpd) { @@ -1005,8 +1009,12 @@ export default { _this.setModificationAffaireNuméros(); // fill clients from old affaire - this.$refs.ref_client_commande.getClientById(_this.selectedModificationAffaire.client_commande_id); - this.$refs.ref_client_envoi.getClientById(_this.selectedModificationAffaire.client_envoi_id); + if (this.$refs.ref_client_commande) { + this.$refs.ref_client_commande.getClientById(_this.selectedModificationAffaire.client_commande_id); + } + if (this.$refs.ref_client_envoi) { + this.$refs.ref_client_envoi.getClientById(_this.selectedModificationAffaire.client_envoi_id); + } this.getParentAffaireFactureClients(this.form.affaire_base_id).then(() => { this.$refs.ref_client_facture.getClientById(this.client_facture_id); });