From 2da65f42d06c06334fca80d8841907f12a0bd1a1 Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Tue, 13 Oct 2020 16:51:19 +0200
Subject: [PATCH] FEAT #15049 TIME 0:10 fix msg

---
 .../send-to-record-management.component.html               | 2 +-
 .../send-to-record-management.component.ts                 | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/frontend/app/actions/send-to-record-management-action/send-to-record-management.component.html b/src/frontend/app/actions/send-to-record-management-action/send-to-record-management.component.html
index 67f5401f4d1..8f3f1f42f9d 100644
--- a/src/frontend/app/actions/send-to-record-management-action/send-to-record-management.component.html
+++ b/src/frontend/app/actions/send-to-record-management-action/send-to-record-management.component.html
@@ -127,7 +127,7 @@
             </mat-tab-group>
         </ng-container>
         <div *ngIf="resourcesErrors.length > 0" class="alert-message alert-message-danger">
-            {{'lang.' + resourcesErrors[0].lang | translate}}
+            {{resourcesErrors[0]}}
         </div>
     </div>
     <span class="divider-modal"></span>
diff --git a/src/frontend/app/actions/send-to-record-management-action/send-to-record-management.component.ts b/src/frontend/app/actions/send-to-record-management-action/send-to-record-management.component.ts
index 7c8efbbca47..869ab34f24c 100644
--- a/src/frontend/app/actions/send-to-record-management-action/send-to-record-management.component.ts
+++ b/src/frontend/app/actions/send-to-record-management-action/send-to-record-management.component.ts
@@ -5,6 +5,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
 import { TranslateService } from '@ngx-translate/core';
 import { FunctionsService } from '@service/functions.service';
 import { NotificationService } from '@service/notification/notification.service';
+import { error } from 'jquery';
 import { of } from 'rxjs';
 import { catchError, finalize, tap } from 'rxjs/operators';
 
@@ -129,7 +130,11 @@ export class SendToRecordManagementComponent implements OnInit {
             }),
             finalize(() => this.checking = false),
             catchError((err: any) => {
-                this.resourcesErrors.push(err.error);
+                if (!this.functions.empty(err.error.lang)) {
+                    this.resourcesErrors.push(this.translate.instant('lang.' + err.error.lang));
+                } else {
+                    this.resourcesErrors.push(err.error.errors);
+                }
                 // this.notify.handleErrors(err);
                 return of(false);
             })
-- 
GitLab