From 49e66bc8369cd5a01b0367d892d8194a0bacdf2b Mon Sep 17 00:00:00 2001 From: "francois.grand" <francois.grand@irstea.fr> Date: Tue, 9 Jan 2018 12:24:12 +0100 Subject: [PATCH] =?UTF-8?q?Correction=20bug=20d'affichage=20des=20titres?= =?UTF-8?q?=20de=20saisie=20de=20param=C3=A8tre=20(section=20param/parabol?= =?UTF-8?q?ique)=20d=C3=BB=20=C3=A0=20un=20pb=20de=20MAJ=20de=20l'internat?= =?UTF-8?q?ionalisation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/formulaire/formulaire-definition.ts | 15 ++++++++++++++- src/app/formulaire/formulaire-element.ts | 8 ++++++-- src/app/services/formulaire/formulaire.service.ts | 10 +++++----- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/app/formulaire/formulaire-definition.ts b/src/app/formulaire/formulaire-definition.ts index 82771cde8..0b0177788 100644 --- a/src/app/formulaire/formulaire-definition.ts +++ b/src/app/formulaire/formulaire-definition.ts @@ -2,7 +2,6 @@ import { ComputeNodeType, ParamsEquation, Nub, acSection, RegimeUniforme, Method import { ParamsSectionRectang, cSnRectang, ParamsSectionCirc, cSnCirc, ParamsSectionPuiss, cSnPuiss, Result } from "jalhyd"; import { ConduiteDistrib, ConduiteDistribParams, LechaptCalmon, LechaptCalmonParams, ParamsSectionTrapez, cSnTrapez } from "jalhyd"; - import { ParamService } from "../services/param/param.service"; import { InternationalisationService } from "../services/internationalisation/internationalisation.service"; import { Field } from "./field"; @@ -21,6 +20,7 @@ import { ExistenceDependency } from "./existence-dependency"; import { FixedVarResults } from "../results/fixed-var-results"; import { SectionResults } from "../results/section-results"; import { RemousResults } from "../results/remous-results"; +import { StringMap } from "../stringmap"; export enum CalculatorType { @@ -1089,4 +1089,17 @@ export class FormulaireDefinition { public hasRemousResults(): boolean { return this._remousResults.hasResults(); } + + public updateLocalisation(localisation: StringMap) { + for (let loc_id in localisation) { + for (let fs of this._fieldSets) { + if (fs.id == loc_id) + fs.updateLocalisation(localisation); + + for (let p of fs.fields) + if (p.id === loc_id) + p.updateLocalisation(localisation); + } + } + } } diff --git a/src/app/formulaire/formulaire-element.ts b/src/app/formulaire/formulaire-element.ts index 69df8ebbb..bc1ee5f95 100644 --- a/src/app/formulaire/formulaire-element.ts +++ b/src/app/formulaire/formulaire-element.ts @@ -10,7 +10,7 @@ export abstract class FormulaireElement { private _id: string; private _formId: number; public isDisplayed: boolean; - public label: string; + private _label: string; constructor(nodeType: ComputeNodeType, id: string, formId: number) { this._nodeType = nodeType; @@ -31,6 +31,10 @@ export abstract class FormulaireElement { return this._formId; } + get label(): string { + return this._label; + } + protected abstract verifyDependency(d: Dependency): boolean; public verifiesDependency(d: Dependency): boolean { @@ -41,7 +45,7 @@ export abstract class FormulaireElement { } public updateLocalisation(loc: StringMap) { - this.label = loc[this.id]; + this._label = loc[this.id]; } public toString() { diff --git a/src/app/services/formulaire/formulaire.service.ts b/src/app/services/formulaire/formulaire.service.ts index 1b833bc14..8933a6066 100644 --- a/src/app/services/formulaire/formulaire.service.ts +++ b/src/app/services/formulaire/formulaire.service.ts @@ -50,11 +50,11 @@ export class FormulaireService extends Observable { * @param localisation ensemble id-message traduit */ private updateFormulaireLocalisation(formId: number, localisation: StringMap) { - for (let loc_id in localisation) { - let fe = this.getFormulaireElementById(formId, loc_id); - if (fe != undefined) - fe.updateLocalisation(localisation); - } + for (let f of this._formulaires) + if (f.uid == formId) { + f.updateLocalisation(localisation); + break; + } } /** -- GitLab