From 089c3d96b4bd2a451ae3212105828e98440b102c Mon Sep 17 00:00:00 2001
From: Emmanuel Viennet <emmanuel.viennet@gmail.com>
Date: Sat, 21 Aug 2021 23:09:08 +0200
Subject: [PATCH] =?UTF-8?q?Fix:=203=20bugs=20li=C3=A9s=20aux=20moduleimpl?=
 =?UTF-8?q?=5Fid?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/views/notes.py | 51 +++++++++++++++++++++++++++++++++++++---------
 1 file changed, 41 insertions(+), 10 deletions(-)

diff --git a/app/views/notes.py b/app/views/notes.py
index 694b04ab..7c520999 100644
--- a/app/views/notes.py
+++ b/app/views/notes.py
@@ -749,7 +749,13 @@ def edit_enseignants_form(REQUEST, moduleimpl_id):
     if tf[0] == 0:
         return header + "\n".join(H) + tf[1] + F + footer
     elif tf[0] == -1:
-        return flask.redirect("moduleimpl_status?moduleimpl_id=" + moduleimpl_id)
+        return flask.redirect(
+            url_for(
+                "notes.moduleimpl_status",
+                scodoc_dept=g.scodoc_dept,
+                moduleimpl_id=moduleimpl_id,
+            )
+        )
     else:
         ens_id = User.get_user_id_from_nomplogin(tf[2]["ens_id"])
         if not ens_id:
@@ -841,21 +847,37 @@ def edit_moduleimpl_resp(REQUEST, moduleimpl_id):
     if tf[0] == 0:
         return "\n".join(H) + tf[1] + help_str + html_sco_header.sco_footer()
     elif tf[0] == -1:
-        return flask.redirect("moduleimpl_status?moduleimpl_id=" + moduleimpl_id)
+        return flask.redirect(
+            url_for(
+                "notes.moduleimpl_status",
+                scodoc_dept=g.scodoc_dept,
+                moduleimpl_id=moduleimpl_id,
+            )
+        )
     else:
         responsable_id = User.get_user_id_from_nomplogin(tf[2]["responsable_id"])
         if (
             not responsable_id
         ):  # presque impossible: tf verifie les valeurs (mais qui peuvent changer entre temps)
-            return flask.redirect("moduleimpl_status?moduleimpl_id=" + moduleimpl_id)
+            return flask.redirect(
+                url_for(
+                    "notes.moduleimpl_status",
+                    scodoc_dept=g.scodoc_dept,
+                    moduleimpl_id=moduleimpl_id,
+                )
+            )
+
         sco_moduleimpl.do_moduleimpl_edit(
             {"moduleimpl_id": moduleimpl_id, "responsable_id": responsable_id},
             formsemestre_id=sem["formsemestre_id"],
         )
         return flask.redirect(
-            "moduleimpl_status?moduleimpl_id="
-            + moduleimpl_id
-            + "&head_message=responsable%20modifié"
+            url_for(
+                "notes.moduleimpl_status",
+                scodoc_dept=g.scodoc_dept,
+                moduleimpl_id=moduleimpl_id,
+                head_message="responsable%20modifié",
+            )
         )
 
 
@@ -929,7 +951,13 @@ def edit_moduleimpl_expr(REQUEST, moduleimpl_id):
     if tf[0] == 0:
         return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
     elif tf[0] == -1:
-        return flask.redirect("moduleimpl_status?moduleimpl_id=" + moduleimpl_id)
+        return flask.redirect(
+            url_for(
+                "notes.moduleimpl_status",
+                scodoc_dept=g.scodoc_dept,
+                moduleimpl_id=moduleimpl_id,
+            )
+        )
     else:
         sco_moduleimpl.do_moduleimpl_edit(
             {
@@ -942,9 +970,12 @@ def edit_moduleimpl_expr(REQUEST, moduleimpl_id):
             formsemestre_id=sem["formsemestre_id"]
         )  # > modif regle calcul
         return flask.redirect(
-            "moduleimpl_status?moduleimpl_id="
-            + moduleimpl_id
-            + "&head_message=règle%20de%20calcul%20modifiée"
+            url_for(
+                "notes.moduleimpl_status",
+                scodoc_dept=g.scodoc_dept,
+                moduleimpl_id=moduleimpl_id,
+                head_message="règle%20de%20calcul%20modifiée",
+            )
         )