forked from ScoDoc/ScoDoc
Merge pull request 'de 1 à 4 (co-)directeur d'études' (#484) from jmplace/ScoDoc-Lille:plusieurs_DE into master
Reviewed-on: https://scodoc.org/git/ScoDoc/ScoDoc/pulls/484
This commit is contained in:
commit
eab7894f4f
@ -142,6 +142,14 @@ def can_edit_sem(formsemestre_id="", sem=None):
|
||||
return sem
|
||||
|
||||
|
||||
resp_fields = [
|
||||
"responsable_id",
|
||||
"responsable_id2",
|
||||
"responsable_id3",
|
||||
"responsable_id4",
|
||||
]
|
||||
|
||||
|
||||
def do_formsemestre_createwithmodules(edit=False):
|
||||
"Form choix modules / responsables et creation formsemestre"
|
||||
# Fonction accessible à tous, controle acces à la main:
|
||||
@ -192,14 +200,8 @@ def do_formsemestre_createwithmodules(edit=False):
|
||||
modimpl.responsable_id,
|
||||
f"inconnu numéro {modimpl.responsable_id} resp. de {modimpl.id} !",
|
||||
)
|
||||
if sem["responsables"]:
|
||||
initvalues["responsable_id"] = uid2display.get(
|
||||
sem["responsables"][0], sem["responsables"][0]
|
||||
)
|
||||
if len(sem["responsables"]) > 1:
|
||||
initvalues["responsable_id2"] = uid2display.get(
|
||||
sem["responsables"][1], sem["responsables"][1]
|
||||
)
|
||||
for index, resp in enumerate(sem["responsables"]):
|
||||
initvalues[resp_fields[index]] = uid2display.get(resp)
|
||||
|
||||
# Liste des ID de semestres
|
||||
if formation.type_parcours is not None:
|
||||
@ -274,15 +276,16 @@ def do_formsemestre_createwithmodules(edit=False):
|
||||
"allow_null": False,
|
||||
},
|
||||
),
|
||||
*[
|
||||
(
|
||||
"responsable_id",
|
||||
field,
|
||||
{
|
||||
"input_type": "text_suggest",
|
||||
"size": 50,
|
||||
"title": "Directeur des études",
|
||||
"title": "(Co-)Directeur(s) des études",
|
||||
"explanation": "taper le début du nom et choisir dans le menu",
|
||||
"allowed_values": allowed_user_names,
|
||||
"allow_null": False, # il faut au moins un responsable de semestre
|
||||
"allow_null": index, # > 0, # il faut au moins un responsable de semestre
|
||||
"text_suggest_options": {
|
||||
"script": url_for(
|
||||
"users.get_user_list_xml", scodoc_dept=g.scodoc_dept
|
||||
@ -294,28 +297,9 @@ def do_formsemestre_createwithmodules(edit=False):
|
||||
"timeout": 60000,
|
||||
},
|
||||
},
|
||||
),
|
||||
(
|
||||
"responsable_id2",
|
||||
{
|
||||
"input_type": "text_suggest",
|
||||
"size": 50,
|
||||
"title": "Co-directeur des études",
|
||||
"explanation": "",
|
||||
"allowed_values": allowed_user_names,
|
||||
"allow_null": True, # optionnel
|
||||
"text_suggest_options": {
|
||||
"script": url_for(
|
||||
"users.get_user_list_xml", scodoc_dept=g.scodoc_dept
|
||||
)
|
||||
+ "?",
|
||||
"varname": "start",
|
||||
"json": False,
|
||||
"noresults": "Valeur invalide !",
|
||||
"timeout": 60000,
|
||||
},
|
||||
},
|
||||
),
|
||||
for index, field in enumerate(resp_fields)
|
||||
],
|
||||
(
|
||||
"titre",
|
||||
{
|
||||
@ -781,16 +765,12 @@ def do_formsemestre_createwithmodules(edit=False):
|
||||
else:
|
||||
tf[2]["bul_hide_xml"] = True
|
||||
# remap les identifiants de responsables:
|
||||
tf[2]["responsable_id"] = User.get_user_id_from_nomplogin(
|
||||
tf[2]["responsable_id"]
|
||||
)
|
||||
tf[2]["responsable_id2"] = User.get_user_id_from_nomplogin(
|
||||
tf[2]["responsable_id2"]
|
||||
)
|
||||
tf[2]["responsables"] = [tf[2]["responsable_id"]]
|
||||
if tf[2]["responsable_id2"]:
|
||||
tf[2]["responsables"].append(tf[2]["responsable_id2"])
|
||||
|
||||
for field in resp_fields:
|
||||
tf[2][field] = User.get_user_id_from_nomplogin(tf[2][field])
|
||||
tf[2]["responsables"] = []
|
||||
for field in resp_fields:
|
||||
if tf[2][field]:
|
||||
tf[2]["responsables"].append(tf[2][field])
|
||||
for module_id in tf[2]["tf-checked"]:
|
||||
mod_resp_id = User.get_user_id_from_nomplogin(tf[2][module_id])
|
||||
if mod_resp_id is None:
|
||||
|
Loading…
Reference in New Issue
Block a user