From c9eb6bce973f2f95ad319c9bbde720dd11534300 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Mon, 20 Mar 2023 11:16:52 +0100
Subject: [PATCH] refactor: MacroRugoRemous: add an error message when no PAM
 exists in the session

refs #609
---
 src/app/formulaire/elements/select/select-field-target-pam.ts | 1 +
 src/locale/messages.en.json                                   | 1 +
 src/locale/messages.fr.json                                   | 1 +
 3 files changed, 3 insertions(+)

diff --git a/src/app/formulaire/elements/select/select-field-target-pam.ts b/src/app/formulaire/elements/select/select-field-target-pam.ts
index 177166a82..0e699ac25 100644
--- a/src/app/formulaire/elements/select/select-field-target-pam.ts
+++ b/src/app/formulaire/elements/select/select-field-target-pam.ts
@@ -9,6 +9,7 @@ export class SelectFieldTargetPam extends SelectField {
     constructor(parent: FormulaireNode) {
         super(parent);
         this._associatedProperty = MacroRugoRemous.NubMacroRugoProp;
+        this._messageWhenEmpty = "INFO_MACRORUGOREMOUS_CREATE_PAM_FIRST";
     }
 
     protected populate() {
diff --git a/src/locale/messages.en.json b/src/locale/messages.en.json
index 9c3886fed..db4e3e018 100755
--- a/src/locale/messages.en.json
+++ b/src/locale/messages.en.json
@@ -507,6 +507,7 @@
     "INFO_MACRORUGOREMOUS_TITRE_COURT": "Rock R. Backw. curve",
     "INFO_MACRORUGOREMOUS_TITRE": "Rock-ramp backwater curve",
     "INFO_MACRORUGOREMOUS_DESCRIPTION": "Backwater curve in rock-ramp fishpass",
+    "INFO_MACRORUGOREMOUS_CREATE_PAM_FIRST": "Create first a rock-ramp fishpass",
     "INFO_PARALLELSTRUCTURE_DESCRIPTION": "orifice gate weir threshold free flow submerged discharge stage-discharge",
     "INFO_PARALLELSTRUCTURE_TITRE_COURT": "// structures",
     "INFO_PARALLELSTRUCTURE_TITRE": "Parallel structures",
diff --git a/src/locale/messages.fr.json b/src/locale/messages.fr.json
index de269e339..e3f2fb207 100755
--- a/src/locale/messages.fr.json
+++ b/src/locale/messages.fr.json
@@ -508,6 +508,7 @@
     "INFO_MACRORUGOREMOUS_TITRE_COURT": "C. remous de PAM",
     "INFO_MACRORUGOREMOUS_TITRE": "Courbe de remous de passe à m. rugo.",
     "INFO_MACRORUGOREMOUS_DESCRIPTION": "Courbe de remous d'une passe à macro-rugosités simple",
+    "INFO_MACRORUGOREMOUS_CREATE_PAM_FIRST": "Créer d'abord une passe à macrorugosités simple",
     "INFO_PARALLELSTRUCTURE_DESCRIPTION": "orifice vanne seuil déversoir noyé dénoyé débit",
     "INFO_PARALLELSTRUCTURE_TITRE_COURT": "Ouvrages",
     "INFO_PARALLELSTRUCTURE_TITRE": "Lois d'ouvrages",
-- 
GitLab