From 8cf1cc7c347476c3959b536725f0fd519c067f65 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 14 Jun 2021 00:23:22 +0200 Subject: [PATCH] WIP refactoring --- app/scodoc/ImportScolars.py | 2 +- app/scodoc/html_sidebar.py | 6 +- app/scodoc/pe_jurype.py | 4 +- app/scodoc/sco_abs.py | 2 +- app/scodoc/sco_abs_notification.py | 12 +-- app/scodoc/sco_abs_views.py | 26 ++--- app/scodoc/sco_apogee_csv.py | 2 +- app/scodoc/sco_archives_etud.py | 11 +- app/scodoc/sco_bulletins.py | 93 +--------------- app/scodoc/sco_bulletins_json.py | 2 +- app/scodoc/sco_bulletins_pdf.py | 2 +- app/scodoc/sco_bulletins_xml.py | 2 +- app/scodoc/sco_compute_moy.py | 2 +- app/scodoc/sco_debouche.py | 2 +- app/scodoc/sco_etape_apogee_view.py | 8 +- app/scodoc/sco_export_results.py | 4 +- app/scodoc/sco_find_etud.py | 2 +- app/scodoc/sco_formsemestre_exterieurs.py | 6 +- app/scodoc/sco_formsemestre_inscriptions.py | 10 +- app/scodoc/sco_formsemestre_validation.py | 16 +-- app/scodoc/sco_groups.py | 6 +- app/scodoc/sco_groups_view.py | 4 +- app/scodoc/sco_inscr_passage.py | 6 +- app/scodoc/sco_liste_notes.py | 4 +- app/scodoc/sco_moduleimpl_inscriptions.py | 6 +- app/scodoc/sco_page_etud.py | 7 +- app/scodoc/sco_photos.py | 4 +- app/scodoc/sco_poursuite_dut.py | 2 +- app/scodoc/sco_prepajury.py | 2 +- app/scodoc/sco_pvjury.py | 6 +- app/scodoc/sco_pvpdf.py | 2 +- app/scodoc/sco_report.py | 8 +- app/scodoc/sco_saisie_notes.py | 2 +- app/scodoc/sco_synchro_etuds.py | 6 +- app/scodoc/sco_tag_module.py | 4 +- app/scodoc/sco_trombino.py | 2 +- app/scodoc/sco_ue_external.py | 5 +- app/scodoc/scolars.py | 21 +++- app/views/absences.py | 26 +++-- app/views/notes.py | 112 +++++++++++++++----- app/views/scolar.py | 27 ++--- 41 files changed, 235 insertions(+), 241 deletions(-) diff --git a/app/scodoc/ImportScolars.py b/app/scodoc/ImportScolars.py index 92a3d447a..908782a1b 100644 --- a/app/scodoc/ImportScolars.py +++ b/app/scodoc/ImportScolars.py @@ -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": diff --git a/app/scodoc/html_sidebar.py b/app/scodoc/html_sidebar.py index 67c1a3412..d3fe1224d 100644 --- a/app/scodoc/html_sidebar.py +++ b/app/scodoc/html_sidebar.py @@ -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(), diff --git a/app/scodoc/pe_jurype.py b/app/scodoc/pe_jurype.py index 62863b481..d0c5bae3a 100644 --- a/app/scodoc/pe_jurype.py +++ b/app/scodoc/pe_jurype.py @@ -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) diff --git a/app/scodoc/sco_abs.py b/app/scodoc/sco_abs.py index 415101eab..0bd38dff3 100644 --- a/app/scodoc/sco_abs.py +++ b/app/scodoc/sco_abs.py @@ -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"] diff --git a/app/scodoc/sco_abs_notification.py b/app/scodoc/sco_abs_notification.py index 5433d0bb6..e2a8afb1b 100644 --- a/app/scodoc/sco_abs_notification.py +++ b/app/scodoc/sco_abs_notification.py @@ -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) diff --git a/app/scodoc/sco_abs_views.py b/app/scodoc/sco_abs_views.py index cc38fc80b..3d9e7de2d 100644 --- a/app/scodoc/sco_abs_views.py +++ b/app/scodoc/sco_abs_views.py @@ -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 = """
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 %(nomprenom)s 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( diff --git a/app/scodoc/sco_apogee_csv.py b/app/scodoc/sco_apogee_csv.py index 619f64628..e8117e0cf 100644 --- a/app/scodoc/sco_apogee_csv.py +++ b/app/scodoc/sco_apogee_csv.py @@ -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 diff --git a/app/scodoc/sco_archives_etud.py b/app/scodoc/sco_archives_etud.py index 617153489..77cb6189e 100644 --- a/app/scodoc/sco_archives_etud.py +++ b/app/scodoc/sco_archives_etud.py @@ -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" ), """

Téléchargement de fichier associés aux étudiants

Les fichiers associés (dossiers d'admission, certificats, ...), de types quelconques (pdf, doc, images) diff --git a/app/scodoc/sco_bulletins.py b/app/scodoc/sco_bulletins.py index 43f8b89e4..cbad07543 100644 --- a/app/scodoc/sco_bulletins.py +++ b/app/scodoc/sco_bulletins.py @@ -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), - """ -

- - """ - % (REQUEST.URL0, formsemestre_id), - ] - H.append("""  """) - if choose_mail: - H.append( - """
Utiliser si possible les adresses personnelles
""" - ) - - H.append("""

""" + explanation + """

""") - - return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) - - -expl_bull = """Versions des bulletins:
  • courte: moyennes des modules
  • intermédiaire: moyennes des modules et notes des évaluations sélectionnées
  • complète: toutes les notes
    • """ - - -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.

      " - + 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) -""" diff --git a/app/scodoc/sco_bulletins_json.py b/app/scodoc/sco_bulletins_json.py index 157367eb2..3137cc2fe 100644 --- a/app/scodoc/sco_bulletins_json.py +++ b/app/scodoc/sco_bulletins_json.py @@ -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, diff --git a/app/scodoc/sco_bulletins_pdf.py b/app/scodoc/sco_bulletins_pdf.py index a3e05029f..41a802a64 100644 --- a/app/scodoc/sco_bulletins_pdf.py +++ b/app/scodoc/sco_bulletins_pdf.py @@ -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 = {} diff --git a/app/scodoc/sco_bulletins_xml.py b/app/scodoc/sco_bulletins_xml.py index 782ca98c8..95616c3a4 100644 --- a/app/scodoc/sco_bulletins_xml.py +++ b/app/scodoc/sco_bulletins_xml.py @@ -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, diff --git a/app/scodoc/sco_compute_moy.py b/app/scodoc/sco_compute_moy.py index 7dba22a57..89c9a9710 100644 --- a/app/scodoc/sco_compute_moy.py +++ b/app/scodoc/sco_compute_moy.py @@ -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 %s""" diff --git a/app/scodoc/sco_debouche.py b/app/scodoc/sco_debouche.py index 9262af3db..515397a36 100644 --- a/app/scodoc/sco_debouche.py +++ b/app/scodoc/sco_debouche.py @@ -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))] diff --git a/app/scodoc/sco_etape_apogee_view.py b/app/scodoc/sco_etape_apogee_view.py index d3d4aa1a8..128e1bcda 100644 --- a/app/scodoc/sco_etape_apogee_view.py +++ b/app/scodoc/sco_etape_apogee_view.py @@ -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: diff --git a/app/scodoc/sco_export_results.py b/app/scodoc/sco_export_results.py index 0afe3f81a..be1bf6da7 100644 --- a/app/scodoc/sco_export_results.py +++ b/app/scodoc/sco_export_results.py @@ -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' diff --git a/app/scodoc/sco_find_etud.py b/app/scodoc/sco_find_etud.py index 9e0e26cfb..d93be419c 100644 --- a/app/scodoc/sco_find_etud.py +++ b/app/scodoc/sco_find_etud.py @@ -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) diff --git a/app/scodoc/sco_formsemestre_exterieurs.py b/app/scodoc/sco_formsemestre_exterieurs.py index 42d68e04f..ab35431b3 100644 --- a/app/scodoc/sco_formsemestre_exterieurs.py +++ b/app/scodoc/sco_formsemestre_exterieurs.py @@ -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), """

      Enregistrement d'une inscription antérieure dans un autre établissement

      @@ -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": diff --git a/app/scodoc/sco_formsemestre_inscriptions.py b/app/scodoc/sco_formsemestre_inscriptions.py index 9bc0b0cb5..20bd19701 100644 --- a/app/scodoc/sco_formsemestre_inscriptions.py +++ b/app/scodoc/sco_formsemestre_inscriptions.py @@ -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), "

      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] ] diff --git a/app/scodoc/sco_formsemestre_validation.py b/app/scodoc/sco_formsemestre_validation.py index af2516030..fabbff05d 100644 --- a/app/scodoc/sco_formsemestre_validation.py +++ b/app/scodoc/sco_formsemestre_validation.py @@ -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 = ["

      "] # 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( 'Etud. précédent (%s)' % (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( 'Etud. suivant (%s)' % (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] diff --git a/app/scodoc/sco_groups.py b/app/scodoc/sco_groups.py index 6c2dbf452..d3669fec7 100644 --- a/app/scodoc/sco_groups.py +++ b/app/scodoc/sco_groups.py @@ -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] diff --git a/app/scodoc/sco_groups_view.py b/app/scodoc/sco_groups_view.py index 9bac0ee7d..20386e8c0 100644 --- a/app/scodoc/sco_groups_view.py +++ b/app/scodoc/sco_groups_view.py @@ -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"]: diff --git a/app/scodoc/sco_inscr_passage.py b/app/scodoc/sco_inscr_passage.py index 6d41edc65..948114cd2 100644 --- a/app/scodoc/sco_inscr_passage.py +++ b/app/scodoc/sco_inscr_passage.py @@ -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é!) diff --git a/app/scodoc/sco_liste_notes.py b/app/scodoc/sco_liste_notes.py index 71ff91352..0fab9d741 100644 --- a/app/scodoc/sco_liste_notes.py +++ b/app/scodoc/sco_liste_notes.py @@ -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("

    • aucun
    • ") for etudid in etudids: - etud = context.getEtudInfo(etudid=etudid, filled=True)[0] + etud = scolars.get_etud_info(etudid=etudid, filled=True)[0] H.append( '
    • %(nomprenom)s' % etud diff --git a/app/scodoc/sco_moduleimpl_inscriptions.py b/app/scodoc/sco_moduleimpl_inscriptions.py index 687b52729..30e2905fa 100644 --- a/app/scodoc/sco_moduleimpl_inscriptions.py +++ b/app/scodoc/sco_moduleimpl_inscriptions.py @@ -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("
        ") 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( '
      • %(nomprenom)s' % 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( [ diff --git a/app/scodoc/sco_page_etud.py b/app/scodoc/sco_page_etud.py index 090ed3d45..c39ca695b 100644 --- a/app/scodoc/sco_page_etud.py +++ b/app/scodoc/sco_page_etud.py @@ -482,7 +482,8 @@ def ficheEtud(context, etudid=None, REQUEST=None):
""" - 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 ) diff --git a/app/scodoc/sco_photos.py b/app/scodoc/sco_photos.py index 199ec7fc0..cf79103c6 100644 --- a/app/scodoc/sco_photos.py +++ b/app/scodoc/sco_photos.py @@ -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) diff --git a/app/scodoc/sco_poursuite_dut.py b/app/scodoc/sco_poursuite_dut.py index ac64a8e12..3fa466f6b 100644 --- a/app/scodoc/sco_poursuite_dut.py +++ b/app/scodoc/sco_poursuite_dut.py @@ -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 diff --git a/app/scodoc/sco_prepajury.py b/app/scodoc/sco_prepajury.py index c90ac0ef1..3fc41e6bd 100644 --- a/app/scodoc/sco_prepajury.py +++ b/app/scodoc/sco_prepajury.py @@ -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] diff --git a/app/scodoc/sco_pvjury.py b/app/scodoc/sco_pvjury.py index b266d9027..6f8e43671 100644 --- a/app/scodoc/sco_pvjury.py +++ b/app/scodoc/sco_pvjury.py @@ -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 = '%s' % ( etudid, etud["nomprenom"], diff --git a/app/scodoc/sco_pvpdf.py b/app/scodoc/sco_pvpdf.py index 2321b0039..eb20a2588 100644 --- a/app/scodoc/sco_pvpdf.py +++ b/app/scodoc/sco_pvpdf.py @@ -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( diff --git a/app/scodoc/sco_report.py b/app/scodoc/sco_report.py index 40aae5daa..e8fce7431 100644 --- a/app/scodoc/sco_report.py +++ b/app/scodoc/sco_report.py @@ -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 ( diff --git a/app/scodoc/sco_saisie_notes.py b/app/scodoc/sco_saisie_notes.py index 07bc64346..c3ceb6f77 100644 --- a/app/scodoc/sco_saisie_notes.py +++ b/app/scodoc/sco_saisie_notes.py @@ -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)) diff --git a/app/scodoc/sco_synchro_etuds.py b/app/scodoc/sco_synchro_etuds.py index 74a603a91..0c6fbba09 100644 --- a/app/scodoc/sco_synchro_etuds.py +++ b/app/scodoc/sco_synchro_etuds.py @@ -195,7 +195,7 @@ def formsemestre_synchro_etuds( if a_desinscrire or a_desinscrire_without_key: H.append("

Etudiants à désinscrire :

    ") 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('
  1. %(nomprenom)s
  2. ' % 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) diff --git a/app/scodoc/sco_tag_module.py b/app/scodoc/sco_tag_module.py index 81e1ad9a1..9718fcfd5 100644 --- a/app/scodoc/sco_tag_module.py +++ b/app/scodoc/sco_tag_module.py @@ -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') ] diff --git a/app/scodoc/sco_trombino.py b/app/scodoc/sco_trombino.py index 6d54834a9..d34c1f5ed 100644 --- a/app/scodoc/sco_trombino.py +++ b/app/scodoc/sco_trombino.py @@ -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) diff --git a/app/scodoc/sco_ue_external.py b/app/scodoc/sco_ue_external.py index f3d442729..51855dd66 100644 --- a/app/scodoc/sco_ue_external.py +++ b/app/scodoc/sco_ue_external.py @@ -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, diff --git a/app/scodoc/scolars.py b/app/scodoc/scolars.py index f63d981c6..84b0231ac 100644 --- a/app/scodoc/scolars.py +++ b/app/scodoc/scolars.py @@ -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". diff --git a/app/views/absences.py b/app/views/absences.py index 0bebf0ea1..e8db99b30 100644 --- a/app/views/absences.py +++ b/app/views/absences.py @@ -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) diff --git a/app/views/notes.py b/app/views/notes.py index 2d9ffbd79..767d8fac8 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -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 = """

    %s sera désinscrit de tous les modules du semestre %s (%s - %s).

    @@ -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,16 +2592,68 @@ 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, -) -sco_publish( - "/formsemestre_bulletins_mailetuds_choice", - sco_bulletins.formsemestre_bulletins_mailetuds_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, + ) + expl_bull = """Versions des bulletins: