From bd6738b156f12f753a5de8bdca8cebe6b9da326d Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Tue, 26 Jun 2018 10:03:54 +0200
Subject: [PATCH] =?UTF-8?q?=20#48=20FormComputeFixedVar=20:=20modif=20de?=
 =?UTF-8?q?=20getVariatedParameter()=20pour=20tenir=20compte=20des=20param?=
 =?UTF-8?q?=C3=A8tres=20li=C3=A9s=20=C3=A0=20un=20param=C3=A8tre=20variabl?=
 =?UTF-8?q?e?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../definition/form-compute-fixedvar.ts           | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/app/formulaire/definition/form-compute-fixedvar.ts b/src/app/formulaire/definition/form-compute-fixedvar.ts
index 1955e9350..110235960 100644
--- a/src/app/formulaire/definition/form-compute-fixedvar.ts
+++ b/src/app/formulaire/definition/form-compute-fixedvar.ts
@@ -15,7 +15,20 @@ export class FormComputeFixedVar extends FormCompute {
     }
 
     private getVariatedParameter(): NgParameter {
-        return this._formBase.getDisplayedParamFromState(ParamRadioConfig.VAR);
+        let res = this._formBase.getDisplayedParamFromState(ParamRadioConfig.VAR);
+        if (res !== undefined)
+            return res;
+
+        const pms = this._formBase.getDisplayedParamListFromState(ParamRadioConfig.LINK);
+        for (const p of pms)
+            if (p.valueMode === ParamValueMode.LINK)
+                switch (p.paramDefinition.referencedParamValues.valueMode) {
+                    case ParamValueMode.LISTE:
+                    case ParamValueMode.MINMAX:
+                        return p;
+                }
+
+        return undefined;
     }
 
     private getComputedParameter(): NgParameter {
-- 
GitLab