Fix regression: cancel button in old forms

This commit is contained in:
Emmanuel Viennet 2024-10-24 11:22:48 +02:00
parent b5d5bb3b91
commit a9bc28a49e
2 changed files with 7 additions and 5 deletions

View File

@ -442,8 +442,9 @@ class TF(object):
self.formid}_submit" id="{self.formid}_submit" value="{self.submitlabel self.formid}_submit" id="{self.formid}_submit" value="{self.submitlabel
}" {' '.join(self.submitbuttonattributes)}/>""" }" {' '.join(self.submitbuttonattributes)}/>"""
if self.cancelbutton: if self.cancelbutton:
buttons_markup += f""" <input class="btn btn-default" type="submit" name="cancel" id="{ buttons_markup += f""" <input class="btn btn-default" type="submit"
self.formid}_cancel" value="{self.cancelbutton}">""" name="{self.formid}_cancel" id="{self.formid}_cancel"
value="{self.cancelbutton}">"""
buttons_markup += "</div>" buttons_markup += "</div>"
R = [] R = []

View File

@ -706,7 +706,6 @@ def do_formsemestre_createwithmodules(edit=False, formsemestre: FormSemestre = N
def opt_selected(gid): def opt_selected(gid):
if gid == vals.get(select_name): if gid == vals.get(select_name):
return "selected" return "selected"
else:
return "" return ""
if mod.id in module_ids_set: if mod.id in module_ids_set:
@ -866,7 +865,7 @@ def do_formsemestre_createwithmodules(edit=False, formsemestre: FormSemestre = N
{msg} {msg}
{tf[1]} {tf[1]}
""" """
elif tf[0] == -1: if tf[0] == -1: # Annulation
if formsemestre: if formsemestre:
return redirect( return redirect(
url_for( url_for(
@ -876,6 +875,7 @@ def do_formsemestre_createwithmodules(edit=False, formsemestre: FormSemestre = N
) )
) )
return redirect(url_for("notes.index_html", scodoc_dept=g.scodoc_dept)) return redirect(url_for("notes.index_html", scodoc_dept=g.scodoc_dept))
# Edition ou modification du semestre # Edition ou modification du semestre
tf[2]["gestion_compensation"] = bool(tf[2]["gestion_compensation_lst"]) tf[2]["gestion_compensation"] = bool(tf[2]["gestion_compensation_lst"])
tf[2]["gestion_semestrielle"] = bool(tf[2]["gestion_semestrielle_lst"]) tf[2]["gestion_semestrielle"] = bool(tf[2]["gestion_semestrielle_lst"])
@ -890,6 +890,7 @@ def do_formsemestre_createwithmodules(edit=False, formsemestre: FormSemestre = N
# (retire le "MI" du début du nom de champs) # (retire le "MI" du début du nom de champs)
module_ids_checked = [int(x[2:]) for x in tf[2]["tf-checked"]] module_ids_checked = [int(x[2:]) for x in tf[2]["tf-checked"]]
_formsemestre_check_ue_bonus_unicity(module_ids_checked) _formsemestre_check_ue_bonus_unicity(module_ids_checked)
ok = False
if not edit: if not edit:
if is_apc: if is_apc:
_formsemestre_check_module_list(module_ids_checked, tf[2]["semestre_id"]) _formsemestre_check_module_list(module_ids_checked, tf[2]["semestre_id"])