From 9fcc20869bca3b5a62223325e4a0df7907b1e9df Mon Sep 17 00:00:00 2001
From: Vinciane <vinciane.bizet@maarch.org>
Date: Mon, 11 Mar 2019 10:56:46 +0100
Subject: [PATCH] FIX #9511 Fix alert editing message

---
 .../template/template-administration.component.ts         | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/frontend/app/administration/template/template-administration.component.ts b/src/frontend/app/administration/template/template-administration.component.ts
index b4b8c737587..502d2e00712 100755
--- a/src/frontend/app/administration/template/template-administration.component.ts
+++ b/src/frontend/app/administration/template/template-administration.component.ts
@@ -226,7 +226,7 @@ export class TemplateAdministrationComponent implements OnInit {
     }
 
     startJnlp() {
-        if (this.creationMode || (this.template.template_file_name == null  && this.template.template_path == null)) {
+        if (this.creationMode || (this.template.template_file_name == null && this.template.template_path == null)) {
             this.jnlpValue.objectType = 'templateCreation';
             for (let element of this.defaultTemplatesList) {
                 if (this.template.template_style == element.fileExt + ': ' + element.fileName) {
@@ -281,11 +281,13 @@ export class TemplateAdministrationComponent implements OnInit {
     }
 
     onSubmit() {
+        console.log(this.template);
         this.template.entities = $j('#jstree').jstree(true).get_checked();
         if (this.template.template_target != 'notifications') {
             this.template.template_datasource = 'letterbox_attachment';
         }
-        if (this.template.template_style != 'uploadFile' && !this.template.jnlpUniqueId && (this.template.template_type == 'OFFICE' || (this.template.template_type == 'OFFICE_HTML' && this.template.template_style))) {
+
+        if (this.template.template_style != 'uploadFile' && !this.template.jnlpUniqueId && !this.template.template_file_name && (this.template.template_type == 'OFFICE' || this.template.template_type == 'OFFICE_HTML')) {
             alert(this.lang.editModelFirst);
             return;
         }
@@ -383,7 +385,7 @@ export class TemplateAdministrationComponent implements OnInit {
         this.template.uploadedFile = null;
     }
 
-    loadTab (event:any) {
+    loadTab(event: any) {
         if (event.index === 0) {
             this.initMce('textarea#templateOfficeHtml');
         } else {
-- 
GitLab