Commit ac28febd authored by Guillaume Heurtier's avatar Guillaume Heurtier
Browse files

FEAT #10568 TIME 2:00 fix template subject name + refactor lang

parent 4cc3329d
......@@ -178,8 +178,8 @@ UPDATE groupbasket SET list_event_data = jsonb_set(list_event_data, '{canUpdateD
UPDATE groupbasket SET list_event_data = list_event_data - 'canUpdate';
/* TEMPLATES */
ALTER TABLE templates DROP COLUMN IF EXISTS template_subject;
ALTER TABLE templates ADD COLUMN template_subject character varying(255);
ALTER TABLE templates DROP COLUMN IF EXISTS subject;
ALTER TABLE templates ADD COLUMN subject character varying(255);
/* RE CREATE VIEWS */
CREATE OR REPLACE VIEW res_view_letterbox AS
......
......@@ -717,6 +717,7 @@ CREATE TABLE templates
template_datasource character varying(32),
template_target character varying(255),
template_attachment_type character varying(255) DEFAULT NULL::character varying,
subject character varying(255),
CONSTRAINT templates_pkey PRIMARY KEY (template_id)
)
WITH (OIDS=FALSE);
......
......@@ -32,6 +32,11 @@ use Template\models\TemplateModel;
class OnlyOfficeController
{
// List of format convertible by OnlyOffice https://api.onlyoffice.com/editors/conversionapi
const CONVERTIBLE_EXTENSIONS = ['doc', 'docm', 'docx', 'dot', 'dotm', 'dotx', 'epub', 'fodt', 'html', 'mht', 'odt', 'ott', 'rtf', 'txt', 'xps',
'csv', 'fods', 'ods', 'ots', 'xls', 'xlsm', 'xlsx', 'xlt', 'xltm', 'xltx',
'fodp', 'odp', 'otp', 'pot', 'potm', 'potx', 'pps', 'ppsm', 'ppsx', 'ppt', 'pptm', 'pptx'];
public function getConfiguration(Request $request, Response $response)
{
$loadedXml = CoreConfigModel::getXmlLoaded(['path' => 'apps/maarch_entreprise/xml/documentEditorsConfig.xml']);
......@@ -331,12 +336,7 @@ class OnlyOfficeController
$docInfo = pathinfo($args['fullFilename']);
// List of format convertible by OnlyOffice https://api.onlyoffice.com/editors/conversionapi
$convertibleExtensions = ['doc', 'docm', 'docx', 'dot', 'dotm', 'dotx', 'epub', 'fodt', 'html', 'mht', 'odt', 'ott', 'pdf', 'rtf', 'txt', 'xps',
'csv', 'fods', 'ods', 'ots', 'xls', 'xlsm', 'xlsx', 'xlt', 'xltm', 'xltx',
'fodp', 'odp', 'otp', 'pot', 'potm', 'potx', 'pps', 'ppsm', 'ppsx', 'ppt', 'pptm', 'pptx'];
if (!in_array($docInfo['extension'], $convertibleExtensions)) {
if (!in_array($docInfo['extension'], OnlyOfficeController::CONVERTIBLE_EXTENSIONS)) {
return false;
}
......
......@@ -751,8 +751,8 @@ class EmailController
return ['errors' => 'Data isHtml is not a boolean or empty', 'code' => 400];
}
if (!empty($args['data']['object']) && !Validator::stringType()->length(1, 256)->validate($args['data']['object'])) {
return ['errors' => 'Data object is not a string or is more than 256 characters', 'code' => 400];
if (!empty($args['data']['object']) && !Validator::stringType()->length(1, 255)->validate($args['data']['object'])) {
return ['errors' => 'Data object is not a string or is more than 255 characters', 'code' => 400];
}
if (!empty($args['data']['sender']['email'])) {
......
......@@ -163,7 +163,7 @@ class TemplateController
if (!Validator::stringType()->validate($body['subject']) && !Validator::length(1, 255)->validate($body['subject'])) {
return $response->withStatus(400)->withJson(['errors' => 'Body subject is too long or not a string']);
}
$template['template_subject'] = $body['subject'];
$template['subject'] = $body['subject'];
}
$id = TemplateModel::create($template);
......@@ -247,7 +247,7 @@ class TemplateController
if (!Validator::stringType()->validate($body['subject']) && !Validator::length(1, 255)->validate($body['subject'])) {
return $response->withStatus(400)->withJson(['errors' => 'Body subject is too long or not a string']);
}
$template['template_subject'] = $body['subject'];
$template['subject'] = $body['subject'];
}
TemplateAssociationModel::delete(['where' => ['template_id = ?'], 'data' => [$aArgs['id']]]);
......@@ -476,7 +476,7 @@ class TemplateController
$data = [$entities, 'HTML', 'sendmail'];
$templates = TemplateModel::getWithAssociation([
'select' => ['DISTINCT(templates.template_id)', 'templates.template_label', 'templates.template_subject'],
'select' => ['DISTINCT(templates.template_id)', 'templates.template_label', 'templates.subject'],
'where' => $where,
'data' => $data,
'orderBy' => ['templates.template_label']
......@@ -486,7 +486,7 @@ class TemplateController
$templates[$key] = [
'id' => $template['template_id'],
'label' => $template['template_label'],
'subject' => $template['template_subject']
'subject' => $template['subject']
];
}
......@@ -506,7 +506,7 @@ class TemplateController
}
$templates = TemplateModel::getWithAssociation([
'select' => ['DISTINCT(templates.template_id)', 'templates.template_content', 'templates.template_subject'],
'select' => ['DISTINCT(templates.template_id)', 'templates.template_content', 'templates.subject'],
'where' => ['(templates_association.value_field in (?) OR templates_association.template_id IS NULL)', 'templates.template_type = ?', 'templates.template_target = ?', 'templates.template_id = ?'],
'data' => [$entities, 'HTML', 'sendmail', $args['id']],
'orderBy' => ['templates.template_id']
......@@ -536,7 +536,7 @@ class TemplateController
]);
$mergedDocument = base64_decode($mergedDocument['encodedDocument']);
$mergedSubject = MergeController::mergeDocument([
'content' => $template['template_subject'],
'content' => $template['subject'],
'data' => $dataToMerge
]);
$mergedSubject = base64_decode($mergedSubject['encodedDocument']);
......
......@@ -96,18 +96,18 @@ abstract class TemplateModelAbstract
DatabaseModel::insert([
'table' => 'templates',
'columnsValues' => [
'template_id' => $nextSequenceId,
'template_label' => $args['template_label'],
'template_comment' => $args['template_comment'],
'template_content' => $args['template_content'],
'template_type' => $args['template_type'],
'template_style' => $args['template_style'],
'template_datasource' => $args['template_datasource'],
'template_target' => $args['template_target'],
'template_attachment_type' => $args['template_attachment_type'],
'template_path' => $args['template_path'],
'template_file_name' => $args['template_file_name'],
'template_subject' => $args['template_subject'],
'template_id' => $nextSequenceId,
'template_label' => $args['template_label'],
'template_comment' => $args['template_comment'],
'template_content' => $args['template_content'],
'template_type' => $args['template_type'],
'template_style' => $args['template_style'],
'template_datasource' => $args['template_datasource'],
'template_target' => $args['template_target'],
'template_attachment_type' => $args['template_attachment_type'],
'template_path' => $args['template_path'],
'template_file_name' => $args['template_file_name'],
'subject' => $args['subject']
]
]);
......
<div class="mat-dialog-content-container">
<h1 mat-dialog-title>{{lang.templateAssociateEntities}}</h1>
<h1 mat-dialog-title>{{'lang.templateAssociateEntities' | translate}}</h1>
<mat-dialog-content>
<div class="alert-message alert-message-info" role="alert">
<p>{{lang.templateCheckEntities}}<b>{{lang['AR'+data.template_attachment_type]}}</b></p>
<p>{{'lang.templateCheckEntities' | translate}}<b>{{lang['AR'+data.template_attachment_type]}}</b></p>
</div>
<mat-list>
<mat-list-item *ngFor="let entity of data.entitiesList">
......@@ -12,6 +12,6 @@
</mat-list>
</mat-dialog-content>
<mat-dialog-actions>
<button mat-raised-button color="primary" type="submit" (click)="dialogRef.close()">{{lang.close}}</button>
<button mat-raised-button color="primary" type="submit" (click)="dialogRef.close()">{{'lang.close' | translate}}</button>
</mat-dialog-actions>
</div>
\ No newline at end of file
</div>
<mat-sidenav-container autosize class="maarch-container">
<ng-template #adminMenuTemplate>
<mat-nav-list *ngIf="!creationMode && !loading">
<h3 mat-subheader>{{lang.actions}}</h3>
<h3 mat-subheader>{{'lang.actions' | translate}}</h3>
<a mat-list-item [disableRipple]="lockFound || template.target == 'acknowledgementReceipt'"
[class.disabled]="lockFound || template.target == 'acknowledgementReceipt'"
(click)="duplicateTemplate()">
<mat-icon color="primary" mat-list-icon class="fa fa-copy"></mat-icon>
<p mat-line>
{{lang.duplicate}}
{{'lang.duplicate' | translate}}
</p>
</a>
</mat-nav-list>
......@@ -36,8 +36,8 @@
<div class="form-group" *ngIf="!creationMode">
<div class="col-sm-12">
<mat-form-field>
<input matInput type="number" title="{{lang.technicalId}}"
value="{{template.id}}" placeholder="{{lang.technicalId}}" disabled>
<input matInput type="number" title="{{'lang.technicalId' | translate}}"
value="{{template.id}}" placeholder="{{'lang.technicalId' | translate}}" disabled>
</mat-form-field>
</div>
</div>
......@@ -45,8 +45,8 @@
<div class="col-sm-12">
<mat-form-field>
<input matInput name="label" [(ngModel)]="template.label"
title="{{lang.templateName}}" type="text"
placeholder="{{lang.templateName}}" maxlength="255" required>
title="{{'lang.templateName' | translate}}" type="text"
placeholder="{{'lang.templateName' | translate}}" maxlength="255" required>
</mat-form-field>
</div>
</div>
......@@ -54,8 +54,8 @@
<div class="col-sm-12">
<mat-form-field>
<textarea matInput name="description" [(ngModel)]="template.description"
name="template_comment" placeholder="{{lang.description}}"
title="{{lang.description}}" matTextareaAutosize matAutosizeMinRows="2"
name="template_comment" placeholder="{{'lang.description' | translate}}"
title="{{'lang.description' | translate}}" matTextareaAutosize matAutosizeMinRows="2"
matAutosizeMaxRows="5" required>
</textarea>
</mat-form-field>
......@@ -65,7 +65,7 @@
<div class="col-sm-12">
<mat-form-field>
<mat-select [disabled]="!creationMode" name="target" required
title="{{lang.templateTarget}}" placeholder="{{lang.templateTarget}}"
title="{{'lang.templateTarget' | translate}}" placeholder="{{'lang.templateTarget' | translate}}"
[(ngModel)]="template.target"
(selectionChange)="updateTemplateType()">
<mat-option *ngFor="let target of targetTypes" [value]="target">
......@@ -78,9 +78,9 @@
<div class="col-sm-12">
<mat-form-field>
<mat-select id="template_attachment_type" name="template_attachment_type"
title="{{lang.attachmentType}}" placeholder="{{lang.attachmentType}}"
title="{{'lang.attachmentType' | translate}}" placeholder="{{'lang.attachmentType' | translate}}"
[(ngModel)]="template.template_attachment_type">
<mat-option value="all">{{lang.allAttachments}}</mat-option>
<mat-option value="all">{{'lang.allAttachments' | translate}}</mat-option>
<mat-option *ngFor="let value of attachmentTypesList" [value]="value.id">
{{value.label}}
</mat-option>
......@@ -93,12 +93,12 @@
<div class="col-sm-12">
<mat-form-field>
<mat-select [disabled]="!creationMode" id="template_attachment_type"
name="template_attachment_type" title="{{lang.acknowledgementReceiptType}}"
placeholder="{{lang.acknowledgementReceiptType}}"
name="template_attachment_type" title="{{'lang.acknowledgementReceiptType' | translate}}"
placeholder="{{'lang.acknowledgementReceiptType' | translate}}"
[(ngModel)]="template.template_attachment_type" required>
<mat-option value="simple">{{lang.ARsimple}}</mat-option>
<mat-option value="sva">{{lang.ARsva}}</mat-option>
<mat-option value="svr">{{lang.ARsvr}}</mat-option>
<mat-option value="simple">{{'lang.ARsimple' | translate}}</mat-option>
<mat-option value="sva">{{'lang.ARsva' | translate}}</mat-option>
<mat-option value="svr">{{'lang.ARsvr' | translate}}</mat-option>
</mat-select>
</mat-form-field>
</div>
......@@ -108,8 +108,8 @@
<div class="col-sm-12">
<mat-form-field>
<input matInput name="subject" [(ngModel)]="template.subject"
title="{{lang.subject}}" type="text"
placeholder="{{lang.subject}}" maxlength="255" required>
title="{{'lang.subject' | translate}}" type="text"
placeholder="{{'lang.subject' | translate}}" maxlength="255" required>
</mat-form-field>
</div>
</div>
......@@ -138,10 +138,10 @@
<div class="col-sm-12">
<mat-form-field *ngIf="creationMode || template.file.name">
<mat-select id="template_style" [disabled]="!creationMode" name="template_style"
title="{{lang.defaultTemplate}}" placeholder="{{lang.chosenModel}}"
title="{{'lang.defaultTemplate' | translate}}" placeholder="{{'lang.chosenModel' | translate}}"
[(ngModel)]="selectedModelFile" (selectionChange)="changeModel()"
[required]="template.target!='acknowledgementReceipt'">
<mat-optgroup label="{{lang.loadedFile}} :">
<mat-optgroup label="{{'lang.loadedFile' | translate}} :">
<mat-option class="selectFile" (click)="uploadSignFileOffice.click()"
[value]="template.file.name">
<mat-icon class="fa fa-paperclip" color="primary"
......@@ -164,11 +164,11 @@
<button mat-raised-button color="default" type="button"
(click)="$event.stopPropagation();editFile()"
*ngIf="((creationMode && selectedModelFile) || (!creationMode))"
[disabled]="lockFound">{{lang.templateEdition}}</button>
[disabled]="lockFound">{{'lang.templateEdition' | translate}}</button>
<button mat-raised-button color="default" type="button"
(click)="$event.stopPropagation();uploadSignFileOffice.click()"
*ngIf="((creationMode && !selectedModelFile) || (!creationMode && !functionsService.empty(template.file.name)) && headerService.user.preferences.documentEdition !== 'java')"
[disabled]="lockFound">{{lang.importFile}}</button>
[disabled]="lockFound">{{'lang.importFile' | translate}}</button>
</div>
<iframe *ngIf="templateDocView !== null" [src]="templateDocView"
style="width:100%;height:800px;"></iframe>
......@@ -177,8 +177,8 @@
<div class="col-sm-12">
<mat-form-field>
<textarea matInput [(ngModel)]="template.file.content" name="templateTxt"
id="templateTxt" placeholder="{{lang.contentTxtTemplate}}"
title="{{lang.contentTxtTemplate}}" matTextareaAutosize
id="templateTxt" placeholder="{{'lang.contentTxtTemplate' | translate}}"
title="{{'lang.contentTxtTemplate' | translate}}" matTextareaAutosize
matAutosizeMinRows="5" matAutosizeMaxRows="5"
[required]="template.target!='acknowledgementReceipt'">
</textarea>
......@@ -198,9 +198,9 @@
<div class="col-sm-12">
<mat-form-field>
<mat-select id="datasource" name="datasource"
title="{{lang.templateDatasource}}"
placeholder="{{lang.templateDatasource}}" [(ngModel)]="template.datasource">
<mat-option value="">{{lang.noDatasource}}</mat-option>
title="{{'lang.templateDatasource' | translate}}"
placeholder="{{'lang.templateDatasource' | translate}}" [(ngModel)]="template.datasource">
<mat-option value="">{{'lang.noDatasource' | translate}}</mat-option>
<ng-container *ngFor="let datasource of datasourcesList">
<mat-option *ngIf="displayDatasources(datasource)"
[value]="datasource.id">{{datasource.label}}</mat-option>
......@@ -212,7 +212,7 @@
<div class="form-group" *ngIf="template.type=='OFFICE_HTML'">
<mat-tab-group (selectedTabChange)="loadTab($event);">
<mat-tab label="{{lang.electronicTemplate}}">
<mat-tab label="{{'lang.electronicTemplate' | translate}}">
<div class="col-sm-12">
<div id="html_mode" style="display: block; width:100%;">
<textarea [(ngModel)]="template.file.electronic.content"
......@@ -222,7 +222,7 @@
</div>
</div>
</mat-tab>
<mat-tab label="{{lang.paperTemplate}}">
<mat-tab label="{{'lang.paperTemplate' | translate}}">
<div class="col-md-12" style="display: none;">
<div class="form-inline hide">
<div class="form-group">
......@@ -236,10 +236,10 @@
<mat-form-field>
<mat-select id="template_style"
[disabled]="!creationMode && template.file.paper.name !== null"
name="template_style" title="{{lang.defaultTemplate}}"
placeholder="{{lang.chosenModel}}" [(ngModel)]="selectedModelFile"
name="template_style" title="{{'lang.defaultTemplate' | translate}}"
placeholder="{{'lang.chosenModel' | translate}}" [(ngModel)]="selectedModelFile"
[required]="template.target!='acknowledgementReceipt'">
<mat-optgroup label="{{lang.loadedFile}} :">
<mat-optgroup label="{{'lang.loadedFile' | translate}} :">
<mat-option (click)="uploadSignFileOfficeHtml.click()"
style="text-align: center;"
[value]="template.file.paper.name">
......@@ -263,11 +263,11 @@
<button mat-raised-button color="default" type="button"
(click)="$event.stopPropagation();editFile()"
*ngIf="((creationMode && selectedModelFile) || (!creationMode && !functionsService.empty(template.file.paper.name)))"
[disabled]="lockFound">{{lang.templateEdition}}</button>
[disabled]="lockFound">{{'lang.templateEdition' | translate}}</button>
<button mat-raised-button color="default" type="button"
(click)="$event.stopPropagation();uploadSignFileOfficeHtml.click()"
*ngIf="!selectedModelFile || (!creationMode && headerService.user.preferences.documentEdition !== 'java')"
[disabled]="lockFound">{{lang.importFile}}</button>
[disabled]="lockFound">{{'lang.importFile' | translate}}</button>
</div>
<iframe *ngIf="templateDocView !== null" [src]="templateDocView"
style="width:100%;height:800px;"></iframe>
......@@ -277,7 +277,7 @@
</div>
<div class="col-sm-12" style="background: white;position:sticky;bottom:0px; text-align:center;">
<button mat-raised-button color="primary" type="submit"
[disabled]="!templatesFormUp.form.valid || lockFound">{{lang.save}}</button>
[disabled]="!templatesFormUp.form.valid || lockFound">{{'lang.save' | translate}}</button>
</div>
</form>
</mat-card>
......@@ -288,11 +288,11 @@
<mat-sidenav #snav2 [mode]="appService.getViewMode() ? 'over' : 'side'" [fixedInViewport]="appService.getViewMode()"
fixedTopGap="56" position='end' [opened]="!appService.getViewMode()" style="overflow-x:hidden;width:400px;">
<mat-list>
<h3 mat-subheader>{{lang.chooseEntityAssociationModel}}</h3>
<h3 mat-subheader>{{'lang.chooseEntityAssociationModel' | translate}}</h3>
<div style="padding:10px;">
<mat-form-field>
<input matInput id="jstree_search" name="jstree_search" type="text"
placeholder="{{lang.searchEntities}}">
placeholder="{{'lang.searchEntities' | translate}}">
</mat-form-field>
<div id="jstree"></div>
</div>
......
......@@ -13,6 +13,7 @@ import { of } from 'rxjs/internal/observable/of';
import { TemplateFileEditorModalComponent } from './templateFileEditorModal/template-file-editor-modal.component';
import { DomSanitizer } from '@angular/platform-browser';
import { AlertComponent } from '../../../plugins/modal/alert.component';
import {TranslateService} from '@ngx-translate/core';
declare var tinymce: any;
......@@ -75,7 +76,7 @@ export class TemplateAdministrationComponent implements OnInit, OnDestroy {
datasourcesList: any;
jnlpValue: any = {};
extensionModels: any[] = [];
buttonFileName: any = this.lang.importFile;
buttonFileName: any = this.translate.instant('lang.importFile');
lockFound: boolean = false;
intervalLockFile: any;
......@@ -96,7 +97,8 @@ export class TemplateAdministrationComponent implements OnInit, OnDestroy {
public dialog: MatDialog,
public appService: AppService,
private viewContainerRef: ViewContainerRef,
public functionsService: FunctionsService
public functionsService: FunctionsService,
private translate: TranslateService
) { }
ngOnInit(): void {
......@@ -105,7 +107,7 @@ export class TemplateAdministrationComponent implements OnInit, OnDestroy {
this.route.params.subscribe(params => {
if (typeof params['id'] === 'undefined') {
this.headerService.setHeader(this.lang.templateCreation);
this.headerService.setHeader(this.translate.instant('lang.templateCreation'));
this.creationMode = true;
......@@ -128,7 +130,7 @@ export class TemplateAdministrationComponent implements OnInit, OnDestroy {
datasource: data.template.template_datasource,
target: data.template.template_target,
type: data.template.template_type,
subject: data.template.template_subject,
subject: data.template.subject,
file: {}
};
this.updateTemplateType();
......@@ -150,7 +152,7 @@ export class TemplateAdministrationComponent implements OnInit, OnDestroy {
this.getViewTemplateContent();
}
this.headerService.setHeader(this.lang.templateModification, this.template.template_label);
this.headerService.setHeader(this.translate.instant('lang.templateModification'), this.template.template_label);
this.loading = false;
});
}
......@@ -181,8 +183,8 @@ export class TemplateAdministrationComponent implements OnInit, OnDestroy {
tinymce.init({
selector: selectorId,
statusbar: false,
language: this.lang.langISO.replace('-', '_'),
language_url: `../node_modules/tinymce-i18n/langs/${this.lang.langISO.replace('-', '_')}.js`,
language: this.translate.instant('lang.langISO').replace('-', '_'),
language_url: `../node_modules/tinymce-i18n/langs/${this.translate.instant('lang.langISO').replace('-', '_')}.js`,
height: '200',
plugins: [
'autoresize',
......@@ -311,7 +313,10 @@ export class TemplateAdministrationComponent implements OnInit, OnDestroy {
const fileExtension = file.name.toLowerCase().split('.').pop();
if (this.allowedExtensions.filter(ext => ext.toLowerCase() === fileExtension.toLowerCase()).length === 0) {
this.dialog.open(AlertComponent, { panelClass: 'maarch-modal', autoFocus: false, disableClose: true, data: { title: this.lang.notAllowedExtension + ' !', msg: this.lang.file + ' : <b>' + file.name + '</b>, ' + this.lang.type + ' : <b>' + file.type + '</b><br/><br/><u>' + this.lang.allowedExtensions + '</u> : <br/>' + this.allowedExtensions.filter((elem: any, index: any, self: any) => index === self.indexOf(elem)).join(', ') } });
this.dialog.open(AlertComponent, { panelClass: 'maarch-modal', autoFocus: false, disableClose: true, data: {
title: this.translate.instant('lang.notAllowedExtension') + ' !',
msg: this.translate.instant('lang.file') + ' : <b>' + file.name + '</b>, ' + this.translate.instant('lang.type') + ' : <b>' + file.type + '</b><br/><br/><u>' + this.translate.instant('lang.allowedExtensions') + '</u> : <br/>' + this.allowedExtensions.filter((elem: any, index: any, self: any) => index === self.indexOf(elem)).join(', ')
} });
return false;
} else {
return true;
......@@ -386,7 +391,7 @@ export class TemplateAdministrationComponent implements OnInit, OnDestroy {
}
}
if (this.functionsService.empty(editorOptions.objectId)) {
alert(this.lang.canNotEditImportedDocumentWhenJava);
alert(this.translate.instant('lang.canNotEditImportedDocumentWhenJava'));
return false;
}
} else {
......@@ -495,12 +500,12 @@ export class TemplateAdministrationComponent implements OnInit, OnDestroy {
duplicateTemplate() {
if (!this.lockFound && this.template.target !== 'acknowledgementReceipt') {
const r = confirm(this.lang.confirmDuplicate);
const r = confirm(this.translate.instant('lang.confirmDuplicate'));
if (r) {
this.http.post('../rest/templates/' + this.template.id + '/duplicate', { 'id': this.template.id })
.subscribe((data: any) => {
this.notify.success(this.lang.templateDuplicated);
this.notify.success(this.translate.instant('lang.templateDuplicated'));
this.router.navigate(['/administration/templates/' + data.id]);
}, (err) => {
this.notify.error(err.error.errors);
......@@ -534,7 +539,7 @@ export class TemplateAdministrationComponent implements OnInit, OnDestroy {
this.dialog.open(TemplateAdministrationCheckEntitiesModalComponent, this.config);
} else {
this.router.navigate(['/administration/templates']);
this.notify.success(this.lang.templateAdded);
this.notify.success(this.translate.instant('lang.templateAdded'));
}
}),
catchError((err: any) => {
......@@ -556,7 +561,7 @@ export class TemplateAdministrationComponent implements OnInit, OnDestroy {
this.dialogRef = this.dialog.open(TemplateAdministrationCheckEntitiesModalComponent, this.config);
} else {
this.router.navigate(['/administration/templates']);
this.notify.success(this.lang.templateUpdated);
this.notify.success(this.translate.instant('lang.templateUpdated'));
}
}),
catchError((err: any) => {
......@@ -577,11 +582,11 @@ export class TemplateAdministrationComponent implements OnInit, OnDestroy {
isValidTemplate() {
if (this.template.target === 'acknowledgementReceipt' && this.functionsService.empty(this.template.file.paper.name) && this.functionsService.empty(this.template.file.electronic.content)) {
alert(this.lang.mustCompleteAR);
alert(this.translate.instant('lang.mustCompleteAR'));
return false;
} else if (this.template.target !== 'acknowledgementReceipt' && this.template.type === 'OFFICE' && this.functionsService.empty(this.template.file.name)) {
alert(this.lang.editModelFirst);
alert(this.translate.instant('lang.editModelFirst'));
return false;
} else {
return true;
......@@ -666,7 +671,7 @@ export class TemplateAdministrationComponent implements OnInit, OnDestroy {
} else {
tinymce.remove('textarea');
if (this.template.template_file_name == null && this.template.template_style == null) {
this.buttonFileName = this.lang.importFile;
this.buttonFileName = this.translate.instant('lang.importFile');
}
}
}
......
......@@ -18,6 +18,7 @@ import { SentNumericPackagePageComponent } from '../sentResource/sent-numeric-pa
import { ThesaurusModalComponent } from '../tag/indexing/thesaurus/thesaurus-modal.component';
import { SelectIndexingModelComponent } from '../indexation/select-indexing-model/select-indexing-model.component';
import { DocumentFormModule } from '../document-form.module';
import {TranslateModule} from '@ngx-translate/core';
@NgModule({
imports: [
......@@ -25,6 +26,7 @@ import { DocumentFormModule } from '../document-form.module';
ActionsModule,
ProcessRoutingModule,
DocumentFormModule,
TranslateModule,
],
declarations: [
ProcessComponent,
......
......@@ -11,7 +11,7 @@
<mat-spinner style="margin:auto;"></mat-spinner>
</div>
<mat-form-field>
<span matPrefix class="attachLabel">{{lang.senderShort}}&nbsp;:&nbsp;</span>
<span matPrefix class="attachLabel">{{'lang.senderShort' | translate}}&nbsp;:&nbsp;</span>
<input *ngIf="!canManageMail()" matInput [value]="currentSender.email" readonly>
<mat-select *ngIf="canManageMail()" [compareWith]="this.compareSenders" [(ngModel)]="currentSender">
<mat-option *ngFor="let email of availableSenders | sortBy: 'label'" [value]="email">
......@@ -19,13 +19,13 @@
</mat-option>
</mat-select>
<button mat-button color="primary" matSuffix [disabled]="!canManageMail()" [class.activeButton]="showCopies"
(click)="$event.stopPropagation();showCopies = !showCopies">{{lang.copieShort}}</button>
(click)="$event.stopPropagation();showCopies = !showCopies">{{'lang.copieShort' | translate}}</button>
<button mat-button color="primary" matSuffix [disabled]="!canManageMail()"
[class.activeButton]="showInvisibleCopies"
(click)="$event.stopPropagation();showInvisibleCopies = !showInvisibleCopies">{{lang.invisibleCopyShort}}</button>
(click)="$event.stopPropagation();showInvisibleCopies = !showInvisibleCopies">{{'lang.invisibleCopyShort' | translate}}</button>
</mat-form-field>
<mat-form-field>
<span matPrefix class="attachLabel">{{lang.recipientShort}}&nbsp;:&nbsp;</span>
<span matPrefix class="attachLabel">{{'lang.recipientShort' | translate}}&nbsp;:&nbsp;</span>
<mat-chip-list id="recipients-list" #recipientsList cdkDropList
[cdkDropListConnectedTo]="['copies-list','invcopies-list']" [cdkDropListData]="recipients"
(cdkDropListDropped)="drop($event)">
......@@ -50,7 +50,7 @@
</mat-autocomplete>
</mat-form-field>
<mat-form-field *ngIf="showCopies">
<span matPrefix class="attachLabel">{{lang.copieShort}}&nbsp;:&nbsp;</span>
<span matPrefix class="attachLabel">{{'lang.copieShort' | translate}}&nbsp;:&nbsp;</span>
<mat-chip-list id="copies-list" #copiesList cdkDropList
[cdkDropListConnectedTo]="['recipients-list','invcopies-list']" [cdkDropListData]="copies"
(cdkDropListDropped)="drop($event)">
......@@ -74,7 +74,7 @@
</mat-autocomplete>
</mat-form-field>
<mat-form-field *ngIf="showInvisibleCopies">
<span matPrefix class="attachLabel">{{lang.invisibleCopyShort}}&nbsp;:&nbsp;</span>
<span matPrefix class="attachLabel">{{'lang.invisibleCopyShort' | translate}}&nbsp;:&nbsp;</span>