From b52711aae2065c5288a68bd9574f23da411962f4 Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Thu, 3 Sep 2020 16:39:26 +0200
Subject: [PATCH] FIX #13998 TIME 0:30 fix load address

---
 .../issuing-site/indexing/issuing-site-input.component.ts   | 6 ++++--
 .../app/indexation/indexing-form/indexing-form.component.ts | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/frontend/app/administration/registered-mail/issuing-site/indexing/issuing-site-input.component.ts b/src/frontend/app/administration/registered-mail/issuing-site/indexing/issuing-site-input.component.ts
index 276e031981d..7cc3e09076a 100644
--- a/src/frontend/app/administration/registered-mail/issuing-site/indexing/issuing-site-input.component.ts
+++ b/src/frontend/app/administration/registered-mail/issuing-site/indexing/issuing-site-input.component.ts
@@ -49,7 +49,9 @@ export class IssuingSiteInputComponent implements OnInit {
             this.getIssuingSites(this.registedMailType);
         }
         if (!this.functions.empty(this.control.value)) {
-            this.setAddress(this.control.value);
+            setTimeout(() => {
+                this.setAddress(this.control.value);
+            }, 0);
         }
     }
 
@@ -62,7 +64,7 @@ export class IssuingSiteInputComponent implements OnInit {
                 this.issuingSiteList = data['ranges'].filter((item: any) => item.registeredMailType === registeredMailType && item.status === 'OK' && item.entities.indexOf(this.headerService.user.entities[0].id) > -1).map((item: any) => {
                     return {
                         ...item,
-                        id : item.siteId,
+                        id: item.siteId,
                         label: `${item.label} (${item.customerAccountNumber})`,
                         disabled: item.fullness === 100,
                     };
diff --git a/src/frontend/app/indexation/indexing-form/indexing-form.component.ts b/src/frontend/app/indexation/indexing-form/indexing-form.component.ts
index 650e21b031e..4929a651b96 100755
--- a/src/frontend/app/indexation/indexing-form/indexing-form.component.ts
+++ b/src/frontend/app/indexation/indexing-form/indexing-form.component.ts
@@ -449,7 +449,7 @@ export class IndexingFormComponent implements OnInit {
                             this.http.put(`../rest/registeredMails/${this.resId}`, {
                                     type: formatdatas.registeredMail_type,
                                     warranty: formatdatas.registeredMail_warranty,
-                                    issuingSiteId: formatdatas.registeredMail_issuingSite.split('#').slice(-1)[0],
+                                    issuingSiteId: formatdatas.registeredMail_issuingSite,
                                     letter: formatdatas.registeredMail_letter,
                                     recipient: formatdatas.registeredMail_recipient,
                                     reference: formatdatas.registeredMail_reference
-- 
GitLab