WIP refactoring

This commit is contained in:
Emmanuel Viennet 2021-06-14 00:23:22 +02:00
parent 23477faa3b
commit 8cf1cc7c34
41 changed files with 235 additions and 241 deletions

View File

@ -198,7 +198,7 @@ def sco_import_generate_excel_sample(
# rempli table avec données actuelles
lines = []
for i in members:
etud = context.getEtudInfo(etudid=i["etudid"], filled=True)[0]
etud = scolars.get_etud_info(etudid=i["etudid"], filled=True)[0]
l = []
for field in titles:
if field == "groupes":

View File

@ -97,7 +97,7 @@ def sidebar(context, REQUEST=None):
# ---- s'il y a un etudiant selectionné:
if REQUEST.form.has_key("etudid"):
etudid = REQUEST.form["etudid"]
etud = context.getEtudInfo(filled=1, etudid=etudid)[0]
etud = scolars.get_etud_info(filled=1, etudid=etudid)[0]
params.update(etud)
# compte les absences du semestre en cours
H.append(
@ -166,7 +166,9 @@ def sidebar_dept(context, REQUEST=None):
"""Partie supérieure de la marge de gauche"""
infos = {
"BASE0": REQUEST.BASE0,
"DeptIntranetTitle": sco_preferences.get_preference(context, "DeptIntranetTitle"),
"DeptIntranetTitle": sco_preferences.get_preference(
context, "DeptIntranetTitle"
),
"DeptIntranetURL": sco_preferences.get_preference(context, "DeptIntranetURL"),
"DeptName": sco_preferences.get_preference(context, "DeptName"),
"ScoURL": context.ScoURL(),

View File

@ -1117,7 +1117,7 @@ class JuryPE:
ETUDINFO_DICT si mémorisée soit en les chargeant et en les mémorisant
"""
if etudid not in self.ETUDINFO_DICT:
self.ETUDINFO_DICT[etudid] = context.getEtudInfo(
self.ETUDINFO_DICT[etudid] = scolars.get_etud_info(
etudid=etudid, filled=True
)[0]
return self.ETUDINFO_DICT[etudid]
@ -1139,7 +1139,7 @@ class JuryPE:
def get_semestresDUT_d_un_etudiant(self, etudid, semestre_id=None):
"""Renvoie la liste des semestres DUT d'un étudiant
pour un semestre_id (parmi 1,2,3,4) donné
en fonction de ses infos d'etud (cf. context.getEtudInfo(etudid=etudid, filled=True)[0]),
en fonction de ses infos d'etud (cf. scolars.get_etud_info( etudid=etudid, filled=True)[0]),
les semestres étant triés par ordre décroissant.
Si semestre_id == None renvoie tous les semestres"""
etud = self.get_cache_etudInfo_d_un_etudiant(self.context, etudid)

View File

@ -604,7 +604,7 @@ def invalidateAbsEtudDate(context, etudid, date):
date: date au format ISO
"""
# Semestres a cette date:
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
sems = [
sem
for sem in etud["sems"]

View File

@ -152,7 +152,7 @@ def abs_notify_get_destinations(context, sem, prefs, etudid, date, nbabs, nbabsj
if prefs["abs_notify_email"]:
destinations.append(prefs["abs_notify_email"])
if prefs["abs_notify_etud"]:
etud = context.getEtudInfo(etudid=etudid, filled=1)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1)[0]
if etud["email_default"]:
destinations.append(etud["email_default"])
@ -181,11 +181,11 @@ def abs_notify_is_above_threshold(context, etudid, nbabs, nbabsjust, formsemestr
(nbabs > abs_notify_abs_threshold)
(nbabs - nbabs_last_notified) > abs_notify_abs_increment
"""
abs_notify_abs_threshold = sco_preferences.get_preference(context,
"abs_notify_abs_threshold", formsemestre_id
abs_notify_abs_threshold = sco_preferences.get_preference(
context, "abs_notify_abs_threshold", formsemestre_id
)
abs_notify_abs_increment = sco_preferences.get_preference(context,
"abs_notify_abs_increment", formsemestre_id
abs_notify_abs_increment = sco_preferences.get_preference(
context, "abs_notify_abs_increment", formsemestre_id
)
nbabs_last_notified = etud_nbabs_last_notified(context, etudid, formsemestre_id)
@ -236,7 +236,7 @@ def abs_notification_message(context, sem, prefs, etudid, nbabs, nbabsjust):
"""Mime notification message based on template.
returns None if sending should be canceled (emplty template).
"""
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
# Variables accessibles dans les balises du template: %(nom_variable)s :
values = sco_bulletins.make_context_dict(context, sem, etud)

View File

@ -70,7 +70,7 @@ def doSignaleAbsence(
description: str
etudid: etudiant concerné. Si non spécifié, cherche dans REQUEST.form
"""
etud = context.getEtudInfo(filled=1, etudid=etudid, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(filled=1, etudid=etudid, REQUEST=REQUEST)[0]
etudid = etud["etudid"]
description_abs = description
@ -149,12 +149,12 @@ def doSignaleAbsence(
def SignaleAbsenceEtud(context, REQUEST=None): # etudid implied
"""Formulaire individuel simple de signalement d'une absence"""
# brute-force portage from very old dtml code ...
etud = context.getEtudInfo(filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(filled=1, REQUEST=REQUEST)[0]
etudid = etud["etudid"]
disabled = False
if not etud["cursem"]:
require_module = sco_preferences.get_preference(context,
"abs_require_module"
require_module = sco_preferences.get_preference(
context, "abs_require_module"
) # on utilise la pref globale car pas de sem courant
if require_module:
menu_module = """<div class="ue_warning">Pas inscrit dans un semestre courant,
@ -164,7 +164,9 @@ def SignaleAbsenceEtud(context, REQUEST=None): # etudid implied
menu_module = ""
else:
formsemestre_id = etud["cursem"]["formsemestre_id"]
require_module = sco_preferences.get_preference(context, "abs_require_module", formsemestre_id)
require_module = sco_preferences.get_preference(
context, "abs_require_module", formsemestre_id
)
nt = context.Notes._getNotesCache().get_NotesTable(
context.Notes, formsemestre_id
)
@ -286,7 +288,7 @@ def doJustifAbsence(
description: str
etudid: etudiant concerné. Si non spécifié, cherche dans REQUEST.form
"""
etud = context.getEtudInfo(filled=1, etudid=etudid, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(filled=1, etudid=etudid, REQUEST=REQUEST)[0]
etudid = etud["etudid"]
description_abs = description
dates = sco_abs.DateRangeISO(context, datedebut, datefin)
@ -355,7 +357,7 @@ def doJustifAbsence(
def JustifAbsenceEtud(context, REQUEST=None): # etudid implied
"""Formulaire individuel simple de justification d'une absence"""
# brute-force portage from very old dtml code ...
etud = context.getEtudInfo(filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(filled=1, REQUEST=REQUEST)[0]
etudid = etud["etudid"]
H = [
html_sco_header.sco_header(
@ -413,7 +415,7 @@ def doAnnuleAbsence(
context, datedebut, datefin, demijournee, etudid=False, REQUEST=None
): # etudid implied
"""Annulation des absences pour une demi journée"""
etud = context.getEtudInfo(filled=1, etudid=etudid, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(filled=1, etudid=etudid, REQUEST=REQUEST)[0]
etudid = etud["etudid"]
dates = sco_abs.DateRangeISO(context, datedebut, datefin)
@ -464,7 +466,7 @@ autre absence pour <b>%(nomprenom)s</b></a></li>
def AnnuleAbsenceEtud(context, REQUEST=None): # etudid implied
"""Formulaire individuel simple d'annulation d'une absence"""
# brute-force portage from very old dtml code ...
etud = context.getEtudInfo(filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(filled=1, REQUEST=REQUEST)[0]
etudid = etud["etudid"]
H = [
@ -553,7 +555,7 @@ def doAnnuleJustif(
context, datedebut0, datefin0, demijournee, REQUEST=None
): # etudid implied
"""Annulation d'une justification"""
etud = context.getEtudInfo(filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(filled=1, REQUEST=REQUEST)[0]
etudid = etud["etudid"]
dates = sco_abs.DateRangeISO(context, datedebut0, datefin0)
nbadded = 0
@ -658,7 +660,7 @@ def formChoixSemestreGroupe(context, all=False):
def CalAbs(context, REQUEST=None): # etud implied
"""Calendrier des absences d un etudiant"""
# crude portage from 1999 DTML
etud = context.getEtudInfo(filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(filled=1, REQUEST=REQUEST)[0]
etudid = etud["etudid"]
anneescolaire = int(scu.AnneeScolaire(REQUEST))
datedebut = str(anneescolaire) + "-08-31"
@ -746,7 +748,7 @@ def ListeAbsEtud(
absjust_only = int(absjust_only) # si vrai, table absjust seule (export xls ou pdf)
datedebut = "%s-08-31" % scu.AnneeScolaire(REQUEST)
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
# Liste des absences et titres colonnes tables:
titles, columns_ids, absnonjust, absjust = context.Absences._TablesAbsEtud(

View File

@ -285,7 +285,7 @@ class ApoEtud(dict):
return "ApoEtud( nom='%s', nip='%s' )" % (self["nom"], self["nip"])
def lookup_scodoc(self, context, etape_formsemestre_ids):
etuds = context.getEtudInfo(code_nip=self["nip"], filled=True)
etuds = scolars.get_etud_info(code_nip=self["nip"], filled=True)
if not etuds:
# pas dans ScoDoc
self.etud = None

View File

@ -129,9 +129,10 @@ def etud_upload_file_form(context, REQUEST, etudid):
raise AccessDenied(
"opération non autorisée pour %s" % str(REQUEST.AUTHENTICATED_USER)
)
etud = context.getEtudInfo(filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(filled=1, REQUEST=REQUEST)[0]
H = [
html_sco_header.sco_header(context,
html_sco_header.sco_header(
context,
REQUEST,
page_title="Chargement d'un document associé à %(nomprenom)s" % etud,
),
@ -197,7 +198,7 @@ def etud_delete_archive(context, REQUEST, etudid, archive_name, dialog_confirmed
raise AccessDenied(
"opération non autorisée pour %s" % str(REQUEST.AUTHENTICATED_USER)
)
etud = context.getEtudInfo(filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(filled=1, REQUEST=REQUEST)[0]
archive_id = EtudsArchive.get_id_from_name(context, etudid, archive_name)
dest_url = "ficheEtud?etudid=%s" % etudid
if not dialog_confirmed:
@ -252,8 +253,8 @@ def etudarchive_generate_excel_sample(context, group_id=None, REQUEST=None):
def etudarchive_import_files_form(context, group_id, REQUEST=None):
"""Formualaire pour importation fichiers d'un groupe"""
H = [
html_sco_header.sco_header(context,
REQUEST, page_title="Import de fichiers associés aux étudiants"
html_sco_header.sco_header(
context, REQUEST, page_title="Import de fichiers associés aux étudiants"
),
"""<h2 class="formsemestre">Téléchargement de fichier associés aux étudiants</h2>
<p>Les fichiers associés (dossiers d'admission, certificats, ...), de types quelconques (pdf, doc, images)

View File

@ -138,7 +138,7 @@ def formsemestre_bulletinetud_dict(
I["formation"]["type_parcours"]
)
# Infos sur l'etudiant
I["etud"] = context.getEtudInfo(etudid=etudid, filled=1)[0]
I["etud"] = scolars.get_etud_info(etudid=etudid, filled=1)[0]
I["descr_situation"] = I["etud"]["inscriptionstr"]
if I["etud"]["inscription_formsemestre_id"]:
I[
@ -780,7 +780,7 @@ def formsemestre_bulletinetud(
):
"page bulletin de notes"
try:
etud = context.getEtudInfo(filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(filled=1, REQUEST=REQUEST)[0]
etudid = etud["etudid"]
except:
return scu.log_unknown_etud(context, REQUEST, format=format)
@ -1210,92 +1210,3 @@ def _formsemestre_bulletinetud_header_html(
)
return "".join(H)
def formsemestre_bulletins_choice(
context, REQUEST, formsemestre_id, title="", explanation="", choose_mail=False
):
"""Choix d'une version de bulletin"""
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
H = [
html_sco_header.html_sem_header(context, REQUEST, title, sem),
"""
<form name="f" method="GET" action="%s">
<input type="hidden" name="formsemestre_id" value="%s"></input>
"""
% (REQUEST.URL0, formsemestre_id),
]
H.append("""<select name="version" class="noprint">""")
for (v, e) in (
("short", "Version courte"),
("selectedevals", "Version intermédiaire"),
("long", "Version complète"),
):
H.append('<option value="%s">%s</option>' % (v, e))
H.append("""</select>&nbsp;&nbsp;<input type="submit" value="Générer"/>""")
if choose_mail:
H.append(
"""<div><input type="checkbox" name="prefer_mail_perso" value="1">Utiliser si possible les adresses personnelles</div>"""
)
H.append("""<p class="help">""" + explanation + """</p>""")
return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST)
expl_bull = """Versions des bulletins:<ul><li><bf>courte</bf>: moyennes des modules</li><li><bf>intermédiaire</bf>: moyennes des modules et notes des évaluations sélectionnées</li><li><bf>complète</bf>: toutes les notes</li><ul>"""
def formsemestre_bulletins_pdf_choice(context, REQUEST, formsemestre_id, version=None):
"""Choix version puis envois classeur bulletins pdf"""
if version:
return context.formsemestre_bulletins_pdf(
formsemestre_id, REQUEST, version=version
)
return formsemestre_bulletins_choice(
context,
REQUEST,
formsemestre_id,
title="Choisir la version des bulletins à générer",
explanation=expl_bull,
)
def formsemestre_bulletins_mailetuds_choice(
context,
REQUEST,
formsemestre_id,
version=None,
dialog_confirmed=False,
prefer_mail_perso=0,
):
"""Choix version puis envois classeur bulletins pdf"""
if version:
return context.formsemestre_bulletins_mailetuds(
formsemestre_id,
REQUEST,
version=version,
dialog_confirmed=dialog_confirmed,
prefer_mail_perso=prefer_mail_perso,
)
return formsemestre_bulletins_choice(
context,
REQUEST,
formsemestre_id,
title="Choisir la version des bulletins à envoyer par mail",
explanation="Chaque étudiant ayant une adresse mail connue de ScoDoc recevra une copie PDF de son bulletin de notes, dans la version choisie.</p><p>"
+ expl_bull,
choose_mail=True,
)
"""
from debug import *
from sco_bulletins import *
context = go_dept(app, 'RT')
etudid='EID25013'
etudid='EID27760' # bonh
formsemestre_id = 'SEM27425'
I = formsemestre_bulletinetud_dict(context.Notes, formsemestre_id, etudid, REQUEST=REQUEST)
"""

View File

@ -116,7 +116,7 @@ def formsemestre_bulletinetud_published_dict(
d.update(**el)
# Infos sur l'etudiant
etudinfo = context.getEtudInfo(etudid=etudid, filled=1)[0]
etudinfo = scolars.get_etud_info(etudid=etudid, filled=1)[0]
d["etudiant"] = dict(
etudid=etudid,

View File

@ -227,7 +227,7 @@ def get_formsemestre_bulletins_pdf(
def get_etud_bulletins_pdf(context, etudid, REQUEST, version="selectedevals"):
"Bulletins pdf de tous les semestres de l'étudiant, et filename"
etud = context.getEtudInfo(etudid=etudid, filled=1)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1)[0]
fragments = []
bookmarks = {}
filigrannes = {}

View File

@ -99,7 +99,7 @@ def make_xml_formsemestre_bulletinetud(
doc.bulletinetud(**el)
# Infos sur l'etudiant
etudinfo = context.getEtudInfo(etudid=etudid, filled=1)[0]
etudinfo = scolars.get_etud_info(etudid=etudid, filled=1)[0]
doc._push()
doc.etudiant(
etudid=etudid,

View File

@ -166,7 +166,7 @@ def compute_user_formula(
if user_moy != "NA0" and user_moy != "NA":
user_moy = float(user_moy)
if (user_moy > 20) or (user_moy < 0):
etud = context.getEtudInfo(etudid=etudid, filled=1)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1)[0]
raise ScoException(
"""valeur moyenne %s hors limite pour <a href="formsemestre_bulletinetud?formsemestre_id=%s&etudid=%s">%s</a>"""

View File

@ -104,7 +104,7 @@ def table_debouche_etudids(context, etudids, keep_numeric=True):
"""Rapport pour ces etudiants"""
L = []
for etudid in etudids:
etud = context.getEtudInfo(filled=1, etudid=etudid)[0]
etud = scolars.get_etud_info(filled=1, etudid=etudid)[0]
# retrouve le "dernier" semestre (au sens de la date de fin)
sems = etud["sems"]
es = [(sems[i]["date_fin_iso"], i) for i in range(len(sems))]

View File

@ -498,7 +498,7 @@ def view_apo_etuds(context, semset_id, title="", nips=[], format="html", REQUEST
etuds = sco_etape_apogee.apo_csv_retreive_etuds_by_nip(context, semset, nips)
# Ils sont parfois dans ScoDoc même si pas dans le semestre: essaie de les retrouver
for etud in etuds.values():
etud_sco = context.getEtudInfo(code_nip=etud["nip"], filled=True)
etud_sco = scolars.get_etud_info(code_nip=etud["nip"], filled=True)
if etud_sco:
e = etud_sco[0]
etud["inscriptions_scodoc"] = ", ".join(
@ -529,12 +529,12 @@ def view_scodoc_etuds(
if type(etudids) != type([]):
etudids = [etudids]
etuds = [
context.getEtudInfo(etudid=etudid, filled=True)[0] for etudid in etudids
scolars.get_etud_info(etudid=etudid, filled=True)[0] for etudid in etudids
]
elif nips is not None:
if type(nips) != type([]):
nips = [nips]
etuds = [context.getEtudInfo(code_nip=nip, filled=True)[0] for nip in nips]
etuds = [scolars.get_etud_info(code_nip=nip, filled=True)[0] for nip in nips]
else:
raise ValueError("etudid or NIP must be specified")
@ -752,7 +752,7 @@ def view_apo_csv(context, etape_apo="", semset_id="", format="html", REQUEST=Non
e["in_scodoc_str"] = {True: "oui", False: "non"}[e["in_scodoc"]]
if e["in_scodoc"]:
e["_in_scodoc_str_target"] = "ficheEtud?code_nip=" + e["nip"]
e.update(context.getEtudInfo(code_nip=e["nip"], filled=True)[0])
e.update(scolars.get_etud_info(code_nip=e["nip"], filled=True)[0])
e["_nom_td_attrs"] = 'id="%s" class="etudinfo"' % (e["etudid"],)
e["_prenom_td_attrs"] = 'id="pre-%s" class="etudinfo"' % (e["etudid"],)
else:

View File

@ -83,7 +83,7 @@ def _build_results_table(context, start_date=None, end_date=None, types_parcours
etudids = nt.get_etudids()
for etudid in etudids:
if etudid not in etuds_infos: # pas encore traité ?
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
for sem in etud["sems"]: # le plus récent d'abord
if sem["formsemestre_id"] in formsemestre_ids_parcours:
etuds_infos[etudid] = {
@ -340,7 +340,7 @@ from debug import *
from sco_export_results import *
context = go_dept(app, 'RT').Notes
etudid = 'EID27764'
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info( etudid=etudid, filled=True)[0]
start_date='2015-08-15'
end_date='2017-08-31'

View File

@ -110,7 +110,7 @@ def search_etud_in_dept(context, expnom="", REQUEST=None):
"""
dest_url = "ficheEtud"
if len(expnom) > 1:
etuds = context.getEtudInfo(filled=1, etudid=expnom, REQUEST=REQUEST)
etuds = scolars.get_etud_info(filled=1, etudid=expnom, REQUEST=REQUEST)
if len(etuds) != 1:
if scu.is_valid_code_nip(expnom):
etuds = search_etuds_infos(context, code_nip=expnom, REQUEST=REQUEST)

View File

@ -53,7 +53,7 @@ def formsemestre_ext_create(context, etudid, sem_params, REQUEST=None):
args={"formation_id": sem_params["formation_id"]}
)[0]
if etudid:
_etud = context.getEtudInfo(etudid=etudid, filled=1)[0]
_etud = scolars.get_etud_info(etudid=etudid, filled=1)[0]
# Create formsemestre
sem_params["modalite"] = "EXT"
@ -75,7 +75,7 @@ def formsemestre_ext_create(context, etudid, sem_params, REQUEST=None):
def formsemestre_ext_create_form(context, etudid, formsemestre_id, REQUEST=None):
"""Formulaire creation/inscription à un semestre extérieur"""
etud = context.getEtudInfo(etudid=etudid, filled=1)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1)[0]
H = [
html_sco_header.sco_header(context, REQUEST),
"""<h2>Enregistrement d'une inscription antérieure dans un autre établissement</h2>
@ -214,7 +214,7 @@ def formsemestre_ext_edit_ue_validations(
mais pas enregistrée.
"""
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
ue_list = _list_ue_with_coef_and_validations(context, sem, etudid)
descr = _ue_form_description(context, ue_list, REQUEST.form)
if REQUEST and REQUEST.method == "GET":

View File

@ -119,7 +119,7 @@ def formsemestre_inscription_with_modules_form(
"""Formulaire inscription de l'etud dans l'un des semestres existants.
Si only_ext, ne montre que les semestre extérieurs.
"""
etud = context.getEtudInfo(etudid=etudid, filled=1)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1)[0]
H = [
html_sco_header.sco_header(context, REQUEST),
"<h2>Inscription de %s" % etud["nomprenom"],
@ -178,7 +178,7 @@ def formsemestre_inscription_with_modules(
if multiple_ok:
multiple_ok = int(multiple_ok)
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
etud = context.getEtudInfo(etudid=etudid, filled=1)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1)[0]
H = [
html_sco_header.html_sem_header(
context,
@ -278,7 +278,7 @@ def formsemestre_inscription_option(context, etudid, formsemestre_id, REQUEST=No
if sem["etat"] != "1":
raise ScoValueError("Modification impossible: semestre verrouille")
etud = context.getEtudInfo(etudid=etudid, filled=1)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1)[0]
nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id
) # > get_etud_ue_status
@ -571,7 +571,7 @@ def est_inscrit_ailleurs(context, etudid, formsemestre_id):
temps que celui indiqué (par formsemestre_id).
Retourne la liste des semestres concernés (ou liste vide).
"""
etud = context.getEtudInfo(etudid=etudid, filled=1)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1)[0]
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
debut_s = sem["dateord"]
fin_s = DateDMYtoISO(sem["date_fin"])
@ -616,7 +616,7 @@ def formsemestre_inscrits_ailleurs(context, formsemestre_id, REQUEST=None):
insd = list_inscrits_ailleurs(context, formsemestre_id)
# liste ordonnée par nom
etudlist = [
context.getEtudInfo(etudid=etudid, filled=1)[0]
scolars.get_etud_info(etudid=etudid, filled=1)[0]
for etudid in insd.keys()
if insd[etudid]
]

View File

@ -91,7 +91,7 @@ def formsemestre_validation_etud_form(
if readonly:
check = True
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
Se = sco_parcours_dut.SituationEtudParcours(context, etud, formsemestre_id)
if Se.sem["etat"] != "1":
raise ScoValueError("validation: semestre verrouille")
@ -108,13 +108,13 @@ def formsemestre_validation_etud_form(
Footer = ["<p>"]
# Navigation suivant/precedent
if etud_index_prev != None:
etud_p = context.getEtudInfo(etudid=T[etud_index_prev][-1], filled=True)[0]
etud_p = scolars.get_etud_info(etudid=T[etud_index_prev][-1], filled=True)[0]
Footer.append(
'<span><a href="formsemestre_validation_etud_form?formsemestre_id=%s&etud_index=%s">Etud. précédent (%s)</a></span>'
% (formsemestre_id, etud_index_prev, etud_p["nomprenom"])
)
if etud_index_next != None:
etud_n = context.getEtudInfo(etudid=T[etud_index_next][-1], filled=True)[0]
etud_n = scolars.get_etud_info(etudid=T[etud_index_next][-1], filled=True)[0]
Footer.append(
'<span style="padding-left: 50px;"><a href="formsemestre_validation_etud_form?formsemestre_id=%s&etud_index=%s">Etud. suivant (%s)</a></span>'
% (formsemestre_id, etud_index_next, etud_n["nomprenom"])
@ -333,7 +333,7 @@ def formsemestre_validation_etud(
REQUEST=None,
):
"""Enregistre validation"""
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
Se = sco_parcours_dut.SituationEtudParcours(context, etud, formsemestre_id)
# retrouve la decision correspondant au code:
choices = Se.get_possible_choices(assiduite=True)
@ -368,7 +368,7 @@ def formsemestre_validation_etud_manu(
"""Enregistre validation"""
if assidu:
assidu = 1
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
Se = sco_parcours_dut.SituationEtudParcours(context, etud, formsemestre_id)
if code_etat in Se.parcours.UNUSED_CODES:
raise ScoValueError("code decision invalide dans ce parcours")
@ -862,7 +862,7 @@ def do_formsemestre_validation_auto(context, formsemestre_id, REQUEST):
nb_valid = 0
conflicts = [] # liste des etudiants avec decision differente déjà saisie
for etudid in etudids:
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
Se = sco_parcours_dut.SituationEtudParcours(context, etud, formsemestre_id)
ins = context.do_formsemestre_inscription_list(
{"etudid": etudid, "formsemestre_id": formsemestre_id}
@ -964,7 +964,7 @@ def formsemestre_fix_validation_ues(context, formsemestre_id, REQUEST=None):
modifs = [] # liste d'étudiants modifiés
cnx = context.GetDBConnexion(autocommit=False)
for etudid in etudids:
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
Se = sco_parcours_dut.SituationEtudParcours(context, etud, formsemestre_id)
ins = context.do_formsemestre_inscription_list(
{"etudid": etudid, "formsemestre_id": formsemestre_id}
@ -1071,7 +1071,7 @@ def formsemestre_validate_previous_ue(context, formsemestre_id, etudid, REQUEST=
"""Form. saisie UE validée hors ScoDoc
(pour étudiants arrivant avec un UE antérieurement validée).
"""
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
Fo = context.formation_list(args={"formation_id": sem["formation_id"]})[0]

View File

@ -469,7 +469,7 @@ def XMLgetGroupsInPartition(context, partition_id, REQUEST=None): # was XMLgetG
group_name=group["group_name"],
)
for e in get_group_members(context, group["group_id"]):
etud = context.getEtudInfo(etudid=e["etudid"], filled=1)[0]
etud = scolars.get_etud_info(etudid=e["etudid"], filled=1)[0]
doc._push()
doc.etud(
etudid=e["etudid"],
@ -494,7 +494,7 @@ def XMLgetGroupsInPartition(context, partition_id, REQUEST=None): # was XMLgetG
group_name="",
)
for etudid in etuds_set:
etud = context.getEtudInfo(etudid=etudid, filled=1)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1)[0]
doc._push()
doc.etud(
etudid=etud["etudid"],
@ -1299,7 +1299,7 @@ def get_prev_moy(context, etudid, formsemestre_id):
"""
import sco_parcours_dut
info = context.getEtudInfo(etudid=etudid, filled=True)
info = scolars.get_etud_info(etudid=etudid, filled=True)
if not info:
raise ScoValueError("etudiant invalide: etudid=%s" % etudid)
etud = info[0]

View File

@ -785,7 +785,7 @@ def groups_table(
# remplis infos lycee si on a que le code lycée
# et ajoute infos inscription
for m in groups_infos.members:
etud = context.getEtudInfo(m["etudid"], filled=True)[0]
etud = scolars.get_etud_info(m["etudid"], filled=True)[0]
m.update(etud)
scolars.etud_add_lycee_infos(etud)
# et ajoute le parcours
@ -974,7 +974,7 @@ def export_groups_as_moodle_csv(context, formsemestre_id=None, REQUEST=None):
partition = sco_groups.get_partition(context, partition_id)
members = partitions_etud_groups[partition_id]
for etudid in members:
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
group_name = members[etudid]["group_name"]
elts = [moodle_sem_name]
if partition["partition_name"]:

View File

@ -59,7 +59,7 @@ def list_authorized_etuds_by_sem(context, sem, delai=274):
for e in liste:
# Filtre ceux qui se sont déjà inscrit dans un semestre APRES le semestre src
auth_used = False # autorisation deja utilisée ?
etud = context.getEtudInfo(etudid=e["etudid"], filled=True)[0]
etud = scolars.get_etud_info(etudid=e["etudid"], filled=True)[0]
for isem in etud["sems"]:
if ndb.DateDMYtoISO(isem["date_debut"]) >= ndb.DateDMYtoISO(
src["date_fin"]
@ -114,7 +114,7 @@ def list_inscrits(context, formsemestre_id, with_dems=False):
inscr = {}
for i in ins:
etudid = i["etudid"]
inscr[etudid] = context.getEtudInfo(etudid=etudid, filled=True)[0]
inscr[etudid] = scolars.get_etud_info(etudid=etudid, filled=True)[0]
return inscr
@ -172,7 +172,7 @@ def do_inscrit(context, sem, etudids, REQUEST=None, inscrit_groupes=False):
# (mise en correspondance à partir du nom du groupe, sans tenir compte
# du nom de la partition: évidemment, cela ne marche pas si on a les
# même noms de groupes dans des partitions différentes)
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
log("cherche groupes de %(nom)s" % etud)
# recherche le semestre origine (il serait plus propre de l'avoir conservé!)

View File

@ -284,7 +284,7 @@ def _make_table_notes(
for etudid in etudids:
css_row_class = None
# infos identite etudiant
etud = context.getEtudInfo(etudid=etudid, filled=1)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1)[0]
# infos inscription
inscr = context.do_formsemestre_inscription_list(
{"etudid": etudid, "formsemestre_id": M["formsemestre_id"]}
@ -803,7 +803,7 @@ def evaluation_check_absences_html(
if not etudids and show_ok:
H.append("<li>aucun</li>")
for etudid in etudids:
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
H.append(
'<li><a class="discretelink" href="ficheEtud?etudid=%(etudid)s">%(nomprenom)s</a>'
% etud

View File

@ -87,7 +87,7 @@ def moduleimpl_inscriptions_edit(
# Liste des inscrits à ce semestre
inscrits = context.Notes.do_formsemestre_inscription_listinscrits(formsemestre_id)
for ins in inscrits:
etuds_info = context.getEtudInfo(etudid=ins["etudid"], filled=1)
etuds_info = scolars.get_etud_info(etudid=ins["etudid"], filled=1)
if not etuds_info:
log(
"moduleimpl_inscriptions_edit: incoherency for etudid=%s !"
@ -343,7 +343,7 @@ def moduleimpl_inscriptions_stats(context, formsemestre_id, REQUEST=None):
)
H.append("<ul>")
for info in UECaps[ue["ue_id"]]:
etud = context.getEtudInfo(etudid=info["etudid"], filled=True)[0]
etud = scolars.get_etud_info(etudid=info["etudid"], filled=True)[0]
H.append(
'<li class="etud"><a class="discretelink" href="ficheEtud?etudid=%(etudid)s">%(nomprenom)s</a>'
% etud
@ -447,7 +447,7 @@ def _fmt_etud_set(context, ins, max_list_size=7):
return "%d étudiants" % len(ins)
etuds = []
for etudid in ins:
etuds.append(context.getEtudInfo(etudid=etudid, filled=True)[0])
etuds.append(scolars.get_etud_info(etudid=etudid, filled=True)[0])
etuds.sort(lambda x, y: cmp(x["nom"], y["nom"]))
return ", ".join(
[

View File

@ -482,7 +482,8 @@ def ficheEtud(context, etudid=None, REQUEST=None):
</div>
"""
header = html_sco_header.sco_header(context,
header = html_sco_header.sco_header(
context,
REQUEST,
page_title="Fiche étudiant %(prenom)s %(nom)s" % info,
cssstyles=["libjs/jQuery-tagEditor/jquery.tag-editor.css"],
@ -504,7 +505,7 @@ def menus_etud(context, REQUEST=None):
return ""
authuser = REQUEST.AUTHENTICATED_USER
etud = context.getEtudInfo(filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(filled=1, REQUEST=REQUEST)[0]
menuEtud = [
{
@ -555,7 +556,7 @@ def etud_info_html(context, etudid, with_photo="1", REQUEST=None, debug=False):
# log('etud_info_html: formsemestre_id=%s' % formsemestre_id)
with_photo = int(with_photo)
etud = context.getEtudInfo(filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(filled=1, REQUEST=REQUEST)[0]
photo_html = sco_photos.etud_photo_html(
context, etud, title="fiche de " + etud["nom"], REQUEST=REQUEST
)

View File

@ -117,7 +117,7 @@ def get_photo_image(context, etudid=None, size="small", REQUEST=None):
if not etudid:
filename = UNKNOWN_IMAGE_PATH
else:
etud = context.getEtudInfo(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
filename = photo_pathname(context, etud, size=size)
if not filename:
filename = UNKNOWN_IMAGE_PATH
@ -172,7 +172,7 @@ def etud_photo_html(
"""
if not etud:
if etudid:
etud = context.getEtudInfo(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
else:
raise ValueError("etud_photo_html: either etud or etudid must be specified")
photo_url = etud_photo_url(context, etud, size=size, REQUEST=REQUEST)

View File

@ -158,7 +158,7 @@ def _getEtudInfoGroupes(context, group_ids, etat=None):
for group_id in group_ids:
members = sco_groups.get_group_members(context, group_id, etat=etat)
for m in members:
etud = context.getEtudInfo(etudid=m["etudid"], filled=True)[0]
etud = scolars.get_etud_info(etudid=m["etudid"], filled=True)[0]
etuds.append(etud)
return etuds

View File

@ -71,7 +71,7 @@ def feuille_preparation_jury(context, formsemestre_id, REQUEST):
nbabs = {}
nbabsjust = {}
for etudid in etudids:
info = context.getEtudInfo(etudid=etudid, filled=True)
info = scolars.get_etud_info(etudid=etudid, filled=True)
if not info:
continue # should not occur...
etud = info[0]

View File

@ -226,7 +226,7 @@ def dict_pvjury(
L = []
D = {} # même chose que L, mais { etudid : dec }
for etudid in etudids:
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
Se = sco_parcours_dut.SituationEtudParcours(context, etud, formsemestre_id)
semestre_non_terminal = semestre_non_terminal or Se.semestre_non_terminal
d = {}
@ -327,7 +327,7 @@ def dict_pvjury(
max_date = date
# Code semestre precedent
if with_prev: # optionnel car un peu long...
info = context.getEtudInfo(etudid=etudid, filled=True)
info = scolars.get_etud_info(etudid=etudid, filled=True)
if not info:
continue # should not occur
etud = info[0]
@ -614,7 +614,7 @@ def formsemestre_pvjury_pdf(
groups_infos = None
if etudid:
# PV pour ce seul étudiant:
etud = context.getEtudInfo(etudid=etudid, filled=1)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1)[0]
etuddescr = '<a class="discretelink" href="ficheEtud?etudid=%s">%s</a>' % (
etudid,
etud["nomprenom"],

View File

@ -367,7 +367,7 @@ def pdf_lettres_individuelles(
npages = 0
for e in dpv["decisions"]:
if e["decision_sem"]: # decision prise
etud = context.getEtudInfo(e["identite"]["etudid"], filled=True)[0]
etud = scolars.get_etud_info(e["identite"]["etudid"], filled=True)[0]
params["nomEtud"] = etud["nomprenom"]
bookmarks[npages + 1] = scu.suppress_accents(etud["nomprenom"])
objects += pdf_lettre_individuelle(

View File

@ -63,7 +63,7 @@ def formsemestre_etuds_stats(context, sem, only_primo=False):
etuds = []
for t in T:
etudid = t[-1]
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
decision = nt.get_etud_decision_sem(etudid)
if decision:
etud["codedecision"] = decision["code"]
@ -418,7 +418,7 @@ def table_suivi_cohorte(
civilites = set()
statuts = set()
for etudid in etudids:
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
bacspe = etud["bac"] + " / " + etud["specialite"]
# sélection sur bac:
if (
@ -900,7 +900,7 @@ def _descr_etud_set(context, etudids):
"textual html description of a set of etudids"
etuds = []
for etudid in etudids:
etuds.append(context.getEtudInfo(etudid=etudid, filled=True)[0])
etuds.append(scolars.get_etud_info(etudid=etudid, filled=True)[0])
# sort by name
etuds.sort(lambda x, y: cmp(x["nom"], y["nom"]))
return ", ".join([e["nomprenom"] for e in etuds])
@ -1032,7 +1032,7 @@ def tsp_etud_list(
civilites = set()
statuts = set()
for etudid in etudids:
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
bacspe = etud["bac"] + " / " + etud["specialite"]
# sélection sur bac, primo, ...:
if (

View File

@ -265,7 +265,7 @@ def do_evaluation_upload_xls(context, REQUEST):
)
if len(invalids) < 25:
etudsnames = [
context.getEtudInfo(etudid=etudid, filled=True)[0]["nomprenom"]
scolars.get_etud_info(etudid=etudid, filled=True)[0]["nomprenom"]
for etudid in invalids
]
diag.append("Notes invalides pour: " + ", ".join(etudsnames))

View File

@ -195,7 +195,7 @@ def formsemestre_synchro_etuds(
if a_desinscrire or a_desinscrire_without_key:
H.append("<h3>Etudiants à désinscrire :</h3><ol>")
for key in a_desinscrire:
etud = context.getEtudInfo(filled=1, code_nip=key)[0]
etud = scolars.get_etud_info(filled=1, code_nip=key)[0]
H.append('<li class="desinscription">%(nomprenom)s</li>' % etud)
for etudid in a_desinscrire_without_key:
etud = inscrits_without_key_all[etudid]
@ -229,7 +229,7 @@ def formsemestre_synchro_etuds(
# Conversions des listes de codes NIP en listes de codes etudid
def nip2etudid(code_nip):
etud = context.getEtudInfo(code_nip=code_nip)[0]
etud = scolars.get_etud_info(code_nip=code_nip)[0]
return etud["etudid"]
etudids_a_inscrire = [nip2etudid(x) for x in a_inscrire]
@ -807,7 +807,7 @@ def formsemestre_import_etud_admission(
for i in ins:
etudid = i["etudid"]
info = context.getEtudInfo(etudid=etudid, filled=1)[0]
info = scolars.get_etud_info(etudid=etudid, filled=1)[0]
code_nip = info["code_nip"]
if not code_nip:
no_nip.append(etudid)

View File

@ -270,7 +270,7 @@ def get_etud_tagged_modules(context, etudid, tagname):
Cherche dans tous les semestres dans lesquel l'étudiant est ou a été inscrit.
Construit la liste des modules avec le tag donné par tagname
"""
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
R = []
for sem in etud["sems"]:
nt = sco_core.get_notes_cache(
@ -337,7 +337,7 @@ from sco_tag_module import *
context = go_dept(app, 'GEA').Notes
etudid='GEAEID80687'
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info( etudid=etudid, filled=True)[0]
sem = etud['sems'][0]
[ tm['moy'] for tm in get_etud_tagged_modules(context, etudid, 'allo') ]

View File

@ -621,7 +621,7 @@ def zip_excel_import_files(
etudid = Filename2Etud[normname]
# ok, store photo
try:
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
del Filename2Etud[normname]
except:
raise ScoValueError("ID étudiant invalide: %s" % etudid)

View File

@ -214,12 +214,13 @@ def external_ue_create_form(context, formsemestre_id, etudid, REQUEST=None):
if not sem["resp_can_edit"] or str(authuser) not in sem["responsables"]:
raise AccessDenied("vous n'avez pas le droit d'effectuer cette opération")
etud = context.getEtudInfo(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
formation_id = sem["formation_id"]
existing_external_ue = get_existing_external_ue(context, formation_id)
H = [
html_sco_header.html_sem_header(context,
html_sco_header.html_sem_header(
context,
REQUEST,
"Ajout d'une UE externe pour %(nomprenom)s" % etud,
sem,

View File

@ -399,7 +399,7 @@ def identite_edit(cnx, args, context=None, REQUEST=None):
# Notification du changement par e-mail:
if notify_to:
etud = context.getEtudInfo(etudid=args["etudid"], filled=True)[0]
etud = getEtudInfo(context, etudid=args["etudid"], filled=True)[0]
after = identite_list(cnx, {"etudid": args["etudid"]})[0]
notify_etud_change(
context,
@ -513,7 +513,7 @@ def adresse_edit(cnx, args, context=None):
# Notification du changement par e-mail:
if notify_to:
etud = context.getEtudInfo(etudid=args["etudid"], filled=True)[0]
etud = getEtudInfo(context, etudid=args["etudid"], filled=True)[0]
after = adresse_list(cnx, {"etudid": args["etudid"]})[0]
notify_etud_change(
context,
@ -652,6 +652,23 @@ def make_etud_args(etudid=None, code_nip=None, REQUEST=None, raise_exc=True):
return args
def get_etud_info(etudid=False, code_nip=False, filled=False, REQUEST=None):
"""infos sur un etudiant (API)
On peut specifier etudid ou conde_nip
ou bien cherche dans REQUEST.form: etudid, code_nip, code_ine
(dans cet ordre).
"""
if etudid is None:
return []
cnx = context.GetDBConnexion()
args = make_etud_args(etudid=etudid, code_nip=code_nip, REQUEST=REQUEST)
etud = scolars.etudident_list(cnx, args=args)
if filled:
fillEtudsInfo(context, etud)
return etud
def create_etud(context, cnx, args={}, REQUEST=None):
"""Creation d'un étudiant. génère aussi évenement et "news".

View File

@ -718,9 +718,11 @@ def SignaleAbsenceGrHebdo(
)
formsemestre_id = groups_infos.formsemestre_id
require_module = sco_preferences.get_preference(context, "abs_require_module", formsemestre_id)
require_module = sco_preferences.get_preference(
context, "abs_require_module", formsemestre_id
)
etuds = [
context.getEtudInfo(etudid=m["etudid"], filled=True)[0]
scolars.get_etud_info(etudid=m["etudid"], filled=True)[0]
for m in groups_infos.members
]
# Restreint aux inscrits au module sélectionné
@ -880,9 +882,11 @@ def SignaleAbsenceGrSemestre(
+ context.sco_footer(REQUEST)
)
formsemestre_id = groups_infos.formsemestre_id
require_module = sco_preferences.get_preference(context, "abs_require_module", formsemestre_id)
require_module = sco_preferences.get_preference(
context, "abs_require_module", formsemestre_id
)
etuds = [
context.getEtudInfo(etudid=m["etudid"], filled=True)[0]
scolars.get_etud_info(etudid=m["etudid"], filled=True)[0]
for m in groups_infos.members
]
# Restreint aux inscrits au module sélectionné
@ -1380,7 +1384,7 @@ def EtatAbsencesGr(
# Construit tableau (etudid, statut, nomprenom, nbJust, nbNonJust, NbTotal)
T = []
for m in groups_infos.members:
etud = context.getEtudInfo(etudid=m["etudid"], filled=True)[0]
etud = scolars.get_etud_info(etudid=m["etudid"], filled=True)[0]
nbabs = context.CountAbs(etudid=etud["etudid"], debut=datedebut, fin=datefin)
nbabsjust = context.CountAbsJust(
etudid=etud["etudid"], debut=datedebut, fin=datefin
@ -1604,7 +1608,7 @@ def AddBilletAbsence(
"""
t0 = time.time()
# check etudid
etuds = context.getEtudInfo(
etuds = scolars.get_etud_info(
etudid=etudid, code_nip=code_nip, REQUEST=REQUEST, filled=True
)
if not etuds:
@ -1650,7 +1654,7 @@ def AddBilletAbsenceForm(context, etudid, REQUEST=None):
"""Formulaire ajout billet (pour tests seulement, le vrai formulaire accessible aux etudiants
étant sur le portail étudiant).
"""
etud = context.getEtudInfo(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
H = [
html_sco_header.sco_header(
context, REQUEST, page_title="Billet d'absence de %s" % etud["nomprenom"]
@ -1719,7 +1723,7 @@ def _tableBillets(context, billets, etud=None, title=""):
b["etat_str"] = "ok"
if not etud:
# ajoute info etudiant
e = context.getEtudInfo(etudid=b["etudid"], filled=1)
e = scolars.get_etud_info(etudid=b["etudid"], filled=1)
if not e:
b["nomprenom"] = "???" # should not occur
else:
@ -1759,7 +1763,7 @@ def _tableBillets(context, billets, etud=None, title=""):
@scodoc7func(context)
def listeBilletsEtud(context, etudid=False, REQUEST=None, format="html"):
"""Liste billets pour un etudiant"""
etuds = context.getEtudInfo(etudid=etudid, filled=1, REQUEST=REQUEST)
etuds = scolars.get_etud_info(etudid=etudid, filled=1, REQUEST=REQUEST)
if not etuds:
return scu.log_unknown_etud(context, format=format, REQUEST=REQUEST)
@ -1902,7 +1906,7 @@ def ProcessBilletAbsenceForm(context, billet_id, REQUEST=None):
)
billet = billets[0]
etudid = billet["etudid"]
etud = context.getEtudInfo(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
H = [
html_sco_header.sco_header(
@ -1983,7 +1987,7 @@ def ProcessBilletAbsenceForm(context, billet_id, REQUEST=None):
def XMLgetAbsEtud(context, beg_date="", end_date="", REQUEST=None):
"""returns list of absences in date interval"""
t0 = time.time()
etud = context.getEtudInfo(REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(REQUEST=REQUEST)[0]
exp = re.compile(r"^(\d{4})\D?(0[1-9]|1[0-2])\D?([12]\d|0[1-9]|3[01])$")
if not exp.match(beg_date):
raise ScoValueError("invalid date: %s" % beg_date)

View File

@ -1499,7 +1499,7 @@ def view_module_abs(context, REQUEST, moduleimpl_id, format="html"):
fin=fin_sem,
moduleimpl_id=moduleimpl_id,
)
etud = context.getEtudInfo(etudid=etudid, filled=True)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=True)[0]
T.append(
{
"nomprenom": etud["nomprenom"],
@ -1811,7 +1811,7 @@ def do_formsemestre_inscription_listinscrits(
context, formsemestre_id, format=None, REQUEST=None
):
"""Liste les inscrits (état I) à ce semestre et cache le résultat"""
cache = sco_core.get_formsemestre_inscription_cache(context, )
cache = context.get_formsemestre_inscription_cache()
r = cache.get(formsemestre_id)
if r is None:
# retreive list
@ -1834,17 +1834,6 @@ def do_formsemestre_inscription_edit(context, args=None, formsemestre_id=None):
) # > modif inscription semestre (demission ?)
# Cache inscriptions semestres
def get_formsemestre_inscription_cache(context, format=None):
u = context.GetDBConnexionString()
if CACHE_formsemestre_inscription.has_key(u):
return CACHE_formsemestre_inscription[u]
else:
log("get_formsemestre_inscription_cache: new simpleCache")
CACHE_formsemestre_inscription[u] = sco_cache.simpleCache()
return CACHE_formsemestre_inscription[u]
@bp.route("/formsemestre_desinscription")
@permission_required(Permission.ScoImplement)
@scodoc7func(context)
@ -1874,7 +1863,7 @@ def formsemestre_desinscription(
% (etudid, formsemestre_id)
)
if not dialog_confirmed:
etud = context.getEtudInfo(etudid=etudid, filled=1)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1)[0]
if sem["modalite"] != "EXT":
msg_ext = """
<p>%s sera désinscrit de tous les modules du semestre %s (%s - %s).</p>
@ -2573,6 +2562,25 @@ def formsemestre_bulletins_pdf(
return scu.sendPDFFile(REQUEST, pdfdoc, filename)
@bp.route("/formsemestre_bulletins_pdf_choice")
@permission_required(Permission.ScoView)
@scodoc7func(context)
def formsemestre_bulletins_pdf_choice(context, REQUEST, formsemestre_id, version=None):
"""Choix version puis envois classeur bulletins pdf"""
if version:
pdfdoc, filename = sco_bulletins_pdf.get_formsemestre_bulletins_pdf(
context, formsemestre_id, REQUEST, version=version
)
return scu.sendPDFFile(REQUEST, pdfdoc, filename)
return formsemestre_bulletins_choice(
context,
REQUEST,
formsemestre_id,
title="Choisir la version des bulletins à générer",
explanation=expl_bull,
)
@bp.route("/etud_bulletins_pdf")
@permission_required(Permission.ScoView)
@scodoc7func(context)
@ -2584,18 +2592,70 @@ def etud_bulletins_pdf(context, etudid, REQUEST, version="selectedevals"):
return scu.sendPDFFile(REQUEST, pdfdoc, filename)
sco_publish(
"/formsemestre_bulletins_pdf_choice",
sco_bulletins.formsemestre_bulletins_pdf_choice,
Permission.ScoView,
@bp.route("/formsemestre_bulletins_mailetuds_choice")
@permission_required(Permission.ScoView)
@scodoc7func(context)
def formsemestre_bulletins_mailetuds_choice(
context,
REQUEST,
formsemestre_id,
version=None,
dialog_confirmed=False,
prefer_mail_perso=0,
):
"""Choix version puis envois classeur bulletins pdf"""
if version:
return context.formsemestre_bulletins_mailetuds(
formsemestre_id,
REQUEST,
version=version,
dialog_confirmed=dialog_confirmed,
prefer_mail_perso=prefer_mail_perso,
)
sco_publish(
"/formsemestre_bulletins_mailetuds_choice",
sco_bulletins.formsemestre_bulletins_mailetuds_choice,
Permission.ScoView,
expl_bull = """Versions des bulletins:<ul><li><bf>courte</bf>: moyennes des modules</li><li><bf>intermédiaire</bf>: moyennes des modules et notes des évaluations sélectionnées</li><li><bf>complète</bf>: toutes les notes</li><ul>"""
return formsemestre_bulletins_choice(
context,
REQUEST,
formsemestre_id,
title="Choisir la version des bulletins à envoyer par mail",
explanation="Chaque étudiant ayant une adresse mail connue de ScoDoc recevra une copie PDF de son bulletin de notes, dans la version choisie.</p><p>"
+ expl_bull,
choose_mail=True,
)
def formsemestre_bulletins_choice(
context, REQUEST, formsemestre_id, title="", explanation="", choose_mail=False
):
"""Choix d'une version de bulletin"""
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
H = [
html_sco_header.html_sem_header(context, REQUEST, title, sem),
"""
<form name="f" method="GET" action="%s">
<input type="hidden" name="formsemestre_id" value="%s"></input>
"""
% (REQUEST.URL0, formsemestre_id),
]
H.append("""<select name="version" class="noprint">""")
for (v, e) in (
("short", "Version courte"),
("selectedevals", "Version intermédiaire"),
("long", "Version complète"),
):
H.append('<option value="%s">%s</option>' % (v, e))
H.append("""</select>&nbsp;&nbsp;<input type="submit" value="Générer"/>""")
if choose_mail:
H.append(
"""<div><input type="checkbox" name="prefer_mail_perso" value="1">Utiliser si possible les adresses personnelles</div>"""
)
H.append("""<p class="help">""" + explanation + """</p>""")
return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST)
@bp.route("/formsemestre_bulletins_mailetuds")
@permission_required(Permission.ScoView)
@scodoc7func(context)
@ -2706,7 +2766,7 @@ def appreciation_add_form(
logdb(REQUEST, cnx, method="appreciation_suppress", etudid=etudid, msg="")
return REQUEST.RESPONSE.redirect(bull_url)
#
etud = context.getEtudInfo(etudid=etudid, filled=1)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1)[0]
if id:
a = "Edition"
else:
@ -3052,7 +3112,7 @@ def formsemestre_validation_suppress_etud(
)
if not dialog_confirmed:
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
etud = context.getEtudInfo(etudid=etudid, filled=1)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1)[0]
nt = sco_core.get_notes_cache(context).get_NotesTable(
context, formsemestre_id
) # > get_etud_decision_sem

View File

@ -256,7 +256,7 @@ def doc_preferences(context, REQUEST):
@scodoc7func(context)
def showEtudLog(context, etudid, format="html", REQUEST=None):
"""Display log of operations on this student"""
etud = context.getEtudInfo(filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(filled=1, REQUEST=REQUEST)[0]
ops = scolars.list_scolog(context, etudid)
@ -336,18 +336,13 @@ def getEtudInfo(
context, etudid=False, code_nip=False, filled=False, REQUEST=None, format=None
):
"""infos sur un etudiant (API)
On peut specifier etudid
On peut specifier etudid ou code_nip
ou bien cherche dans REQUEST.form: etudid, code_nip, code_ine
(dans cet ordre).
"""
if etudid is None:
return []
cnx = context.GetDBConnexion()
args = make_etud_args(etudid=etudid, code_nip=code_nip, REQUEST=REQUEST)
etud = scolars.etudident_list(cnx, args=args)
if filled:
fillEtudsInfo(context, etud)
etud = scolars.get_etud_info(
etudid=etudid, code_nip=code_nip, filled=filled, REQUEST=REQUEST
)
if format is None:
return etud
else:
@ -598,7 +593,7 @@ def doSuppressAnnotation(context, etudid, annotation_id, REQUEST):
def formChangeCoordonnees(context, etudid, REQUEST):
"edit coordonnees etudiant"
cnx = context.GetDBConnexion()
etud = context.getEtudInfo(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
adrs = scolars.adresse_list(cnx, {"etudid": etudid})
if adrs:
adr = adrs[0]
@ -716,7 +711,7 @@ sco_publish("/etud_photo_html", sco_photos.etud_photo_html, Permission.ScoView)
@scodoc7func(context)
def etud_photo_orig_page(context, etudid=None, REQUEST=None):
"Page with photo in orig. size"
etud = context.getEtudInfo(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
H = [
html_sco_header.sco_header(context, REQUEST, page_title=etud["nomprenom"]),
"<h2>%s</h2>" % etud["nomprenom"],
@ -733,7 +728,7 @@ def etud_photo_orig_page(context, etudid=None, REQUEST=None):
@scodoc7func(context)
def formChangePhoto(context, etudid=None, REQUEST=None):
"""Formulaire changement photo étudiant"""
etud = context.getEtudInfo(filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(filled=1, REQUEST=REQUEST)[0]
if sco_photos.etud_photo_is_local(context, etud):
etud["photoloc"] = "dans ScoDoc"
else:
@ -790,7 +785,7 @@ def formChangePhoto(context, etudid=None, REQUEST=None):
@scodoc7func(context)
def formSuppressPhoto(context, etudid=None, REQUEST=None, dialog_confirmed=False):
"""Formulaire suppression photo étudiant"""
etud = context.getEtudInfo(filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(filled=1, REQUEST=REQUEST)[0]
if not dialog_confirmed:
return scu.confirm_dialog(
context,
@ -846,7 +841,7 @@ def _formDem_of_Def(
operation_method="",
):
"Formulaire démission ou défaillance Etudiant"
etud = context.getEtudInfo(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
etud = scolars.get_etud_info(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
if sem["etat"] != "1":
raise ScoValueError("Modification impossible: semestre verrouille")
@ -1020,7 +1015,7 @@ def _doCancelDem_or_Def(
if sem["etat"] != "1":
raise ScoValueError("Modification impossible: semestre verrouille")
# verif
info = context.getEtudInfo(etudid, filled=True)[0]
info = scolars.get_etud_info(etudid, filled=True)[0]
ok = False
for i in info["ins"]:
if i["formsemestre_id"] == formsemestre_id: