From fe7fb101cab22a98cb48fb620e952020b9cf291f Mon Sep 17 00:00:00 2001
From: "mathias.chouet" <mathias.chouet@irstea.fr>
Date: Mon, 16 Sep 2019 10:15:00 +0200
Subject: [PATCH] Fix bug in Cloisons related method allParamsAreFixed()

---
 .../generic-calculator/calculator.component.ts           | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/app/components/generic-calculator/calculator.component.ts b/src/app/components/generic-calculator/calculator.component.ts
index c68de58db..84f141806 100644
--- a/src/app/components/generic-calculator/calculator.component.ts
+++ b/src/app/components/generic-calculator/calculator.component.ts
@@ -515,7 +515,14 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe
     private allParamsAreFixed() {
         let ret = true;
         for (const p of this._formulaire.currentNub.parameterIterator) {
-            ret = ret && (! p.hasMultipleValues);
+            if (p.valueMode === ParamValueMode.LINK) {
+                ret = ret && (! p.hasMultipleValues);
+            } else {
+                // avoid calling hasMultipleValues here, because changing parameter mode in GUI
+                // switches valueMode before setting min/max/step or valuesList, and iterator
+                // checker fails to count values that do not exist yet
+                ret = ret && (! [ ParamValueMode.LISTE, ParamValueMode.MINMAX ].includes(p.valueMode));
+            }
         }
         return ret;
     }
-- 
GitLab