1
0
forked from ScoDoc/ScoDoc

Fix: ignore obsolete preferences when cloning a formsemestre

This commit is contained in:
viennet 2020-12-16 01:34:08 +01:00
parent 7194dee09f
commit 99d5d2efd7

View File

@ -101,8 +101,7 @@ def formsemestre_editwithmodules(context, REQUEST, formsemestre_id):
def can_edit_sem(context, REQUEST, formsemestre_id="", sem=None): def can_edit_sem(context, REQUEST, formsemestre_id="", sem=None):
"""Return sem if user can edit it, False otherwise """Return sem if user can edit it, False otherwise"""
"""
sem = sem or sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sem or sco_formsemestre.get_formsemestre(context, formsemestre_id)
authuser = REQUEST.AUTHENTICATED_USER authuser = REQUEST.AUTHENTICATED_USER
if not authuser.has_permission(ScoImplement, context): # pas chef if not authuser.has_permission(ScoImplement, context): # pas chef
@ -643,7 +642,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
[tf[2]["etape_apo" + str(n)] for n in range(0, EDIT_NB_ETAPES + 1)] [tf[2]["etape_apo" + str(n)] for n in range(0, EDIT_NB_ETAPES + 1)]
): ):
msg = '<ul class="tf-msg"><li class="tf-msg">Code étape Apogée manquant</li></ul>' msg = '<ul class="tf-msg"><li class="tf-msg">Code étape Apogée manquant</li></ul>'
if tf[0] == 0 or msg: if tf[0] == 0 or msg:
return ( return (
'<p>Formation <a class="discretelink" href="ue_list?formation_id=%(formation_id)s"><em>%(titre)s</em> (%(acronyme)s), version %(version)d, code %(formation_code)s</a></p>' '<p>Formation <a class="discretelink" href="ue_list?formation_id=%(formation_id)s"><em>%(titre)s</em> (%(acronyme)s), version %(version)d, code %(formation_code)s</a></p>'
@ -808,9 +807,9 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
def formsemestre_delete_moduleimpls(context, formsemestre_id, module_ids_to_del): def formsemestre_delete_moduleimpls(context, formsemestre_id, module_ids_to_del):
"""Delete moduleimpls """Delete moduleimpls
module_ids_to_del: list of module_id (warning: not moduleimpl) module_ids_to_del: list of module_id (warning: not moduleimpl)
Moduleimpls must have no associated evaluations. Moduleimpls must have no associated evaluations.
""" """
ok = True ok = True
msg = [] msg = []
for module_id in module_ids_to_del: for module_id in module_ids_to_del:
@ -970,7 +969,7 @@ def do_formsemestre_clone(
REQUEST=None, REQUEST=None,
): ):
"""Clone a semestre: make copy, same modules, same options, same resps, same partitions. """Clone a semestre: make copy, same modules, same options, same resps, same partitions.
New dates, responsable_id New dates, responsable_id
""" """
log("cloning %s" % orig_formsemestre_id) log("cloning %s" % orig_formsemestre_id)
orig_sem = sco_formsemestre.get_formsemestre(context, orig_formsemestre_id) orig_sem = sco_formsemestre.get_formsemestre(context, orig_formsemestre_id)
@ -1023,7 +1022,10 @@ def do_formsemestre_clone(
for pname in prefs.base_prefs.prefs[orig_formsemestre_id]: for pname in prefs.base_prefs.prefs[orig_formsemestre_id]:
if not prefs.is_global(pname): if not prefs.is_global(pname):
pvalue = prefs[pname] pvalue = prefs[pname]
prefs.base_prefs.set(formsemestre_id, pname, pvalue) try:
prefs.base_prefs.set(formsemestre_id, pname, pvalue)
except:
log("do_formsemestre_clone: ignoring old preference %s" % pname)
# 5- Copy formules utilisateur # 5- Copy formules utilisateur
objs = sco_compute_moy.formsemestre_ue_computation_expr_list( objs = sco_compute_moy.formsemestre_ue_computation_expr_list(
@ -1136,7 +1138,7 @@ def formsemestre_associate_new_version(
def do_formsemestres_associate_new_version(context, formsemestre_ids, REQUEST=None): def do_formsemestres_associate_new_version(context, formsemestre_ids, REQUEST=None):
"""Cree une nouvelle version de la formation du semestre, et y rattache les semestres. """Cree une nouvelle version de la formation du semestre, et y rattache les semestres.
Tous les moduleimpl sont -associés à la nouvelle formation, ainsi que les decisions de jury Tous les moduleimpl sont -associés à la nouvelle formation, ainsi que les decisions de jury
si elles existent (codes d'UE validées). si elles existent (codes d'UE validées).
Les semestre doivent tous appartenir à la meme version de la formation Les semestre doivent tous appartenir à la meme version de la formation
""" """
@ -1426,8 +1428,7 @@ def formsemestre_change_lock(
def formsemestre_change_publication_bul( def formsemestre_change_publication_bul(
context, formsemestre_id, REQUEST=None, dialog_confirmed=False context, formsemestre_id, REQUEST=None, dialog_confirmed=False
): ):
"""Change etat publication bulletins sur portail """Change etat publication bulletins sur portail"""
"""
ok, err = context._check_access_diretud(formsemestre_id, REQUEST) ok, err = context._check_access_diretud(formsemestre_id, REQUEST)
if not ok: if not ok:
return err return err
@ -1479,8 +1480,7 @@ formsemestre_uecoef_delete = _formsemestre_uecoef_editor.delete
def formsemestre_edit_uecoefs(context, formsemestre_id, err_ue_id=None, REQUEST=None): def formsemestre_edit_uecoefs(context, formsemestre_id, err_ue_id=None, REQUEST=None):
"""Changement manuel des coefficients des UE capitalisées. """Changement manuel des coefficients des UE capitalisées."""
"""
context = context.Notes # si appele d'en haut, eg par exception ScoValueError context = context.Notes # si appele d'en haut, eg par exception ScoValueError
ok, err = context._check_access_diretud(formsemestre_id, REQUEST) ok, err = context._check_access_diretud(formsemestre_id, REQUEST)
if not ok: if not ok:
@ -1669,14 +1669,14 @@ def get_formsemestre_session_id(context, sem, F, parcours):
Exemple: RT-DUT-FI-S1-ANNEE Exemple: RT-DUT-FI-S1-ANNEE
DEPT-TYPE-MODALITE+-S?|SPECIALITE DEPT-TYPE-MODALITE+-S?|SPECIALITE
TYPE=DUT|LP*|M* TYPE=DUT|LP*|M*
MODALITE=FC|FI|FA (si plusieurs, en inverse alpha) MODALITE=FC|FI|FA (si plusieurs, en inverse alpha)
SPECIALITE=[A-Z]+ EON,ASSUR, ... (si pas Sn ou SnD) SPECIALITE=[A-Z]+ EON,ASSUR, ... (si pas Sn ou SnD)
ANNEE=annee universitaire de debut (exemple: un S2 de 2013-2014 sera S2-2013) ANNEE=annee universitaire de debut (exemple: un S2 de 2013-2014 sera S2-2013)
""" """
# sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) # sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
# F = context.formation_list( args={ 'formation_id' : sem['formation_id'] } )[0] # F = context.formation_list( args={ 'formation_id' : sem['formation_id'] } )[0]